pokecrystal/engine/gfx/dma_transfer.asm

605 lines
9.4 KiB
NASM
Raw Normal View History

HDMATransferAttrmapAndTilemapToWRAMBank3::
2015-12-23 03:19:33 +00:00
ld hl, .Function
2015-12-09 23:25:44 +00:00
jp CallInSafeGFXMode
2015-11-30 16:04:14 +00:00
.Function:
decoord 0, 0, wAttrmap
ld hl, wScratchAttrmap
call PadAttrmapForHDMATransfer
2015-11-30 16:04:14 +00:00
decoord 0, 0
ld hl, wScratchTilemap
call PadTilemapForHDMATransfer
2015-11-30 16:04:14 +00:00
ld a, $0
ldh [rVBK], a
ld hl, wScratchTilemap
2016-05-05 02:34:09 +00:00
call HDMATransferToWRAMBank3
2015-11-30 16:04:14 +00:00
ld a, $1
ldh [rVBK], a
ld hl, wScratchAttrmap
2016-05-05 02:34:09 +00:00
call HDMATransferToWRAMBank3
2015-11-30 16:04:14 +00:00
ret
HDMATransferTilemapToWRAMBank3::
2015-12-23 03:19:33 +00:00
ld hl, .Function
2015-12-09 23:25:44 +00:00
jp CallInSafeGFXMode
2015-11-30 16:04:14 +00:00
.Function:
2015-11-30 16:04:14 +00:00
decoord 0, 0
ld hl, wScratchTilemap
call PadTilemapForHDMATransfer
2015-11-30 16:04:14 +00:00
ld a, $0
ldh [rVBK], a
ld hl, wScratchTilemap
2016-05-05 02:34:09 +00:00
call HDMATransferToWRAMBank3
2015-11-30 16:04:14 +00:00
ret
HDMATransferAttrmapToWRAMBank3:
2015-12-23 03:19:33 +00:00
ld hl, .Function
2015-12-09 23:25:44 +00:00
jp CallInSafeGFXMode
2015-11-30 16:04:14 +00:00
.Function:
decoord 0, 0, wAttrmap
ld hl, wScratchAttrmap
call PadAttrmapForHDMATransfer
2015-11-30 16:04:14 +00:00
ld a, $1
ldh [rVBK], a
ld hl, wScratchAttrmap
2016-05-05 02:34:09 +00:00
call HDMATransferToWRAMBank3
2015-11-30 16:04:14 +00:00
ret
2018-06-24 14:09:41 +00:00
ReloadMapPart::
2015-12-23 03:19:33 +00:00
ld hl, .Function
2015-12-09 23:25:44 +00:00
jp CallInSafeGFXMode
2015-11-30 16:04:14 +00:00
.Function:
decoord 0, 0, wAttrmap
ld hl, wScratchAttrmap
call PadAttrmapForHDMATransfer
2015-11-30 16:04:14 +00:00
decoord 0, 0
ld hl, wScratchTilemap
call PadTilemapForHDMATransfer
2015-11-30 16:04:14 +00:00
call DelayFrame
2016-05-05 02:34:09 +00:00
2015-11-30 16:04:14 +00:00
di
ldh a, [rVBK]
2015-11-30 16:04:14 +00:00
push af
ld a, $1
ldh [rVBK], a
ld hl, wScratchAttrmap
2016-05-05 02:34:09 +00:00
call HDMATransfer_Wait127Scanlines_toBGMap
2015-11-30 16:04:14 +00:00
ld a, $0
ldh [rVBK], a
ld hl, wScratchTilemap
2016-05-05 02:34:09 +00:00
call HDMATransfer_Wait127Scanlines_toBGMap
2015-11-30 16:04:14 +00:00
pop af
ldh [rVBK], a
2015-11-30 16:04:14 +00:00
ei
2016-05-05 02:34:09 +00:00
2015-11-30 16:04:14 +00:00
ret
2018-06-24 14:09:41 +00:00
Mobile_ReloadMapPart:
2015-11-30 16:04:14 +00:00
ld hl, ReloadMapPart ; useless
2015-12-23 03:19:33 +00:00
ld hl, .Function
2015-12-09 23:25:44 +00:00
jp CallInSafeGFXMode
2015-11-30 16:04:14 +00:00
.Function:
decoord 0, 0, wAttrmap
ld hl, wScratchAttrmap
call PadAttrmapForHDMATransfer
2015-11-30 16:04:14 +00:00
decoord 0, 0
ld hl, wScratchTilemap
call PadTilemapForHDMATransfer
2015-11-30 16:04:14 +00:00
call DelayFrame
2016-05-05 02:34:09 +00:00
2015-11-30 16:04:14 +00:00
di
ldh a, [rVBK]
2015-11-30 16:04:14 +00:00
push af
ld a, $1
ldh [rVBK], a
ld hl, wScratchAttrmap
2016-05-05 02:34:09 +00:00
call HDMATransfer_NoDI
2015-11-30 16:04:14 +00:00
ld a, $0
ldh [rVBK], a
ld hl, wScratchTilemap
2016-05-05 02:34:09 +00:00
call HDMATransfer_NoDI
2015-11-30 16:04:14 +00:00
pop af
ldh [rVBK], a
2015-11-30 16:04:14 +00:00
ei
2016-05-05 02:34:09 +00:00
2015-11-30 16:04:14 +00:00
ret
Function1040d4: ; unreferenced
ld hl, .Function
2015-12-09 23:25:44 +00:00
jp CallInSafeGFXMode
2015-11-30 16:04:14 +00:00
.Function
2015-11-30 16:04:14 +00:00
ld a, $1
ldh [rVBK], a
2018-01-04 20:06:11 +00:00
ld a, BANK(w3_d800)
ldh [rSVBK], a
2015-11-30 16:04:14 +00:00
ld de, w3_d800
ldh a, [hBGMapAddress + 1]
ldh [rHDMA1], a
ldh a, [hBGMapAddress]
ldh [rHDMA2], a
2015-11-30 16:04:14 +00:00
ld a, d
ldh [rHDMA3], a
2015-11-30 16:04:14 +00:00
ld a, e
ldh [rHDMA4], a
2015-11-30 16:04:14 +00:00
ld a, $23
ldh [hDMATransfer], a
2015-12-23 03:19:33 +00:00
call WaitDMATransfer
2015-11-30 16:04:14 +00:00
ret
Function1040fb: ; unreferenced
ld hl, .Function
2015-12-09 23:25:44 +00:00
jp CallInSafeGFXMode
2015-11-30 16:04:14 +00:00
.Function
2015-11-30 16:04:14 +00:00
ld a, $1
ldh [rVBK], a
ld a, BANK(w3_d800)
ldh [rSVBK], a
2015-11-30 16:04:14 +00:00
ld hl, w3_d800
2016-05-05 02:34:09 +00:00
call HDMATransferToWRAMBank3
2015-11-30 16:04:14 +00:00
ret
OpenAndCloseMenu_HDMATransferTilemapAndAttrmap::
2015-12-09 23:25:44 +00:00
; OpenText
2015-12-23 03:19:33 +00:00
ld hl, .Function
2015-12-09 23:25:44 +00:00
jp CallInSafeGFXMode
2015-11-30 16:04:14 +00:00
.Function:
; Transfer wAttrmap and Tilemap to BGMap
2016-05-05 02:34:09 +00:00
; Fill vBGAttrs with $00
; Fill vBGTiles with " "
decoord 0, 0, wAttrmap
ld hl, wScratchAttrmap
call PadAttrmapForHDMATransfer
2015-11-30 16:04:14 +00:00
decoord 0, 0
ld hl, wScratchTilemap
call PadTilemapForHDMATransfer
2015-11-30 16:04:14 +00:00
call DelayFrame
2015-12-09 23:25:44 +00:00
2015-11-30 16:04:14 +00:00
di
ldh a, [rVBK]
2015-11-30 16:04:14 +00:00
push af
ld a, $1
ldh [rVBK], a
ld hl, wScratchAttrmap
2016-05-05 02:34:09 +00:00
call HDMATransfer_Wait123Scanlines_toBGMap
2015-11-30 16:04:14 +00:00
ld a, $0
ldh [rVBK], a
ld hl, wScratchTilemap
2016-05-05 02:34:09 +00:00
call HDMATransfer_Wait123Scanlines_toBGMap
2015-11-30 16:04:14 +00:00
pop af
ldh [rVBK], a
2015-11-30 16:04:14 +00:00
ei
ret
Mobile_OpenAndCloseMenu_HDMATransferTilemapAndAttrmap:
2015-12-23 03:19:33 +00:00
ld hl, .Function
2015-12-09 23:25:44 +00:00
jp CallInSafeGFXMode
2015-11-30 16:04:14 +00:00
.Function:
; Transfer wAttrmap and Tilemap to BGMap
2016-05-05 02:34:09 +00:00
; Fill vBGAttrs with $00
; Fill vBGTiles with $ff
decoord 0, 0, wAttrmap
ld hl, wScratchAttrmap
call PadAttrmapForHDMATransfer
2015-11-30 16:04:14 +00:00
ld c, $ff
decoord 0, 0
ld hl, wScratchTilemap
call PadMapForHDMATransfer
2016-05-05 02:34:09 +00:00
2015-11-30 16:04:14 +00:00
ld a, $1
ldh [rVBK], a
ld hl, wScratchAttrmap
2016-05-05 02:34:09 +00:00
call HDMATransfer_Wait127Scanlines_toBGMap
2015-11-30 16:04:14 +00:00
ld a, $0
ldh [rVBK], a
ld hl, wScratchTilemap
2016-05-05 02:34:09 +00:00
call HDMATransfer_Wait127Scanlines_toBGMap
2015-11-30 16:04:14 +00:00
ret
2018-06-24 14:09:41 +00:00
CallInSafeGFXMode:
ldh a, [hBGMapMode]
2015-11-30 16:04:14 +00:00
push af
ldh a, [hMapAnims]
2015-11-30 16:04:14 +00:00
push af
xor a
ldh [hBGMapMode], a
ldh [hMapAnims], a
ldh a, [rSVBK]
2015-11-30 16:04:14 +00:00
push af
ld a, BANK(wScratchTilemap)
ldh [rSVBK], a
ldh a, [rVBK]
2015-11-30 16:04:14 +00:00
push af
2015-12-09 23:25:44 +00:00
2015-11-30 16:04:14 +00:00
call ._hl_
2015-12-09 23:25:44 +00:00
2015-11-30 16:04:14 +00:00
pop af
ldh [rVBK], a
2015-11-30 16:04:14 +00:00
pop af
ldh [rSVBK], a
2015-11-30 16:04:14 +00:00
pop af
ldh [hMapAnims], a
2015-11-30 16:04:14 +00:00
pop af
ldh [hBGMapMode], a
2015-11-30 16:04:14 +00:00
ret
2018-06-24 14:09:41 +00:00
._hl_
jp hl
2015-11-30 16:04:14 +00:00
2018-06-24 14:09:41 +00:00
HDMATransferToWRAMBank3:
2016-05-05 02:34:09 +00:00
call _LoadHDMAParameters
2015-11-30 16:04:14 +00:00
ld a, $23
ldh [hDMATransfer], a
2015-11-30 16:04:14 +00:00
2018-06-24 14:09:41 +00:00
WaitDMATransfer:
2015-12-23 03:19:33 +00:00
.loop
2015-11-30 16:04:14 +00:00
call DelayFrame
ldh a, [hDMATransfer]
2015-11-30 16:04:14 +00:00
and a
2015-12-23 03:19:33 +00:00
jr nz, .loop
2015-11-30 16:04:14 +00:00
ret
2018-06-24 14:09:41 +00:00
HDMATransfer_Wait127Scanlines_toBGMap:
2016-05-05 02:34:09 +00:00
; HDMA transfer from hl to [hBGMapAddress]
; hBGMapAddress -> de
; 2 * SCREEN_HEIGHT -> c
ldh a, [hBGMapAddress + 1]
2015-11-30 16:04:14 +00:00
ld d, a
ldh a, [hBGMapAddress]
2015-11-30 16:04:14 +00:00
ld e, a
2016-05-05 02:34:09 +00:00
ld c, 2 * SCREEN_HEIGHT
jr HDMATransfer_Wait127Scanlines
2015-11-30 16:04:14 +00:00
2018-06-24 14:09:41 +00:00
HDMATransfer_Wait123Scanlines_toBGMap:
2016-05-05 02:34:09 +00:00
; HDMA transfer from hl to [hBGMapAddress]
2015-12-09 23:25:44 +00:00
; hBGMapAddress -> de
2016-05-05 02:34:09 +00:00
; 2 * SCREEN_HEIGHT -> c
2015-12-09 23:25:44 +00:00
; $7b --> b
ldh a, [hBGMapAddress + 1]
2015-11-30 16:04:14 +00:00
ld d, a
ldh a, [hBGMapAddress]
2015-11-30 16:04:14 +00:00
ld e, a
2016-05-05 02:34:09 +00:00
ld c, 2 * SCREEN_HEIGHT
jr HDMATransfer_Wait123Scanlines
2015-11-30 16:04:14 +00:00
2018-06-24 14:09:41 +00:00
HDMATransfer_NoDI:
2016-05-05 02:34:09 +00:00
; HDMA transfer from hl to [hBGMapAddress]
; [hBGMapAddress] --> de
; 2 * SCREEN_HEIGHT --> c
ldh a, [hBGMapAddress + 1]
2015-11-30 16:04:14 +00:00
ld d, a
ldh a, [hBGMapAddress]
2015-11-30 16:04:14 +00:00
ld e, a
2016-05-05 02:34:09 +00:00
ld c, 2 * SCREEN_HEIGHT
; [rHDMA1, rHDMA2] = hl & $fff0
2015-11-30 16:04:14 +00:00
ld a, h
ldh [rHDMA1], a
2015-11-30 16:04:14 +00:00
ld a, l
and $f0
ldh [rHDMA2], a
2016-05-05 02:34:09 +00:00
; [rHDMA3, rHDMA4] = de & $1ff0
2015-11-30 16:04:14 +00:00
ld a, d
and $1f
ldh [rHDMA3], a
2015-11-30 16:04:14 +00:00
ld a, e
and $f0
ldh [rHDMA4], a
2016-05-05 02:34:09 +00:00
; b = c | %10000000
2015-11-30 16:04:14 +00:00
ld a, c
dec c
or $80
ld b, a
2016-05-05 02:34:09 +00:00
; d = $7f - c + 1
2015-11-30 16:04:14 +00:00
ld a, $7f
sub c
ld d, a
2016-05-05 02:34:09 +00:00
; while [rLY] >= d: pass
2015-11-30 16:04:14 +00:00
.loop1
ldh a, [rLY]
2015-11-30 16:04:14 +00:00
cp d
jr nc, .loop1
2016-05-05 02:34:09 +00:00
; while not [rSTAT] & 3: pass
2015-11-30 16:04:14 +00:00
.loop2
ldh a, [rSTAT]
2015-11-30 16:04:14 +00:00
and $3
jr z, .loop2
2016-05-05 02:34:09 +00:00
; load the 5th byte of HDMA
2015-11-30 16:04:14 +00:00
ld a, b
ldh [rHDMA5], a
2016-05-05 02:34:09 +00:00
; wait until rLY advances (c + 1) times
ldh a, [rLY]
2015-11-30 16:04:14 +00:00
inc c
ld hl, rLY
.loop3
cp [hl]
jr z, .loop3
ld a, [hl]
dec c
jr nz, .loop3
ld hl, rHDMA5
res 7, [hl]
ret
2016-05-05 02:34:09 +00:00
HDMATransfer_Wait123Scanlines:
2015-11-30 16:04:14 +00:00
ld b, $7b
2016-05-05 02:34:09 +00:00
jr _continue_HDMATransfer
2015-11-30 16:04:14 +00:00
2016-05-05 02:34:09 +00:00
HDMATransfer_Wait127Scanlines:
2015-11-30 16:04:14 +00:00
ld b, $7f
2016-05-05 02:34:09 +00:00
_continue_HDMATransfer:
; a lot of waiting around for hardware registers
; [rHDMA1, rHDMA2] = hl & $fff0
2015-11-30 16:04:14 +00:00
ld a, h
ldh [rHDMA1], a
2015-11-30 16:04:14 +00:00
ld a, l
and $f0 ; high nybble
ldh [rHDMA2], a
2016-05-05 02:34:09 +00:00
; [rHDMA3, rHDMA4] = de & $1ff0
2015-11-30 16:04:14 +00:00
ld a, d
and $1f ; lower 5 bits
ldh [rHDMA3], a
2015-11-30 16:04:14 +00:00
ld a, e
and $f0 ; high nybble
ldh [rHDMA4], a
2016-05-05 02:34:09 +00:00
; e = c | %10000000
2015-11-30 16:04:14 +00:00
ld a, c
dec c
2016-05-05 02:34:09 +00:00
or $80
2015-11-30 16:04:14 +00:00
ld e, a
2016-05-05 02:34:09 +00:00
; d = b - c + 1
2015-11-30 16:04:14 +00:00
ld a, b
sub c
ld d, a
2016-05-05 02:34:09 +00:00
; while [rLY] >= d: pass
2015-11-30 16:04:14 +00:00
.ly_loop
ldh a, [rLY]
2015-11-30 16:04:14 +00:00
cp d
jr nc, .ly_loop
di
2016-05-05 02:34:09 +00:00
; while [rSTAT] & 3: pass
2015-11-30 16:04:14 +00:00
.rstat_loop_1
ldh a, [rSTAT]
2015-11-30 16:04:14 +00:00
and $3
jr nz, .rstat_loop_1
2016-05-05 02:34:09 +00:00
; while not [rSTAT] & 3: pass
2015-11-30 16:04:14 +00:00
.rstat_loop_2
ldh a, [rSTAT]
2015-11-30 16:04:14 +00:00
and $3
jr z, .rstat_loop_2
2016-05-05 02:34:09 +00:00
; load the 5th byte of HDMA
2015-11-30 16:04:14 +00:00
ld a, e
ldh [rHDMA5], a
2016-05-05 02:34:09 +00:00
; wait until rLY advances (c + 1) times
ldh a, [rLY]
2015-11-30 16:04:14 +00:00
inc c
ld hl, rLY
.final_ly_loop
cp [hl]
jr z, .final_ly_loop
ld a, [hl]
dec c
jr nz, .final_ly_loop
ld hl, rHDMA5
res 7, [hl]
ei
ret
2018-06-24 14:09:41 +00:00
_LoadHDMAParameters:
2015-11-30 16:04:14 +00:00
ld a, h
ldh [rHDMA1], a
2015-11-30 16:04:14 +00:00
ld a, l
ldh [rHDMA2], a
ldh a, [hBGMapAddress + 1]
2015-11-30 16:04:14 +00:00
and $1f
ldh [rHDMA3], a
ldh a, [hBGMapAddress]
ldh [rHDMA4], a
2015-11-30 16:04:14 +00:00
ret
2018-06-24 14:09:41 +00:00
PadTilemapForHDMATransfer:
2015-11-30 16:04:14 +00:00
ld c, " "
jr PadMapForHDMATransfer
2015-11-30 16:04:14 +00:00
PadAttrmapForHDMATransfer:
2015-11-30 16:04:14 +00:00
ld c, $0
2018-06-24 14:09:41 +00:00
PadMapForHDMATransfer:
; pad a 20x18 map to 32x18 for HDMA transfer
; back up the padding value in c to hMapObjectIndex
ldh a, [hMapObjectIndex]
2015-11-30 16:04:14 +00:00
push af
ld a, c
ldh [hMapObjectIndex], a
2015-11-30 16:04:14 +00:00
; for each row on the screen
ld c, SCREEN_HEIGHT
.loop1
; for each tile in the row
ld b, SCREEN_WIDTH
.loop2
; copy from de to hl
ld a, [de]
inc de
ld [hli], a
dec b
jr nz, .loop2
; load the original padding value of c into hl for 32 - 20 = 12 rows
ldh a, [hMapObjectIndex]
2016-05-05 02:34:09 +00:00
ld b, BG_MAP_WIDTH - SCREEN_WIDTH
2015-11-30 16:04:14 +00:00
.loop3
ld [hli], a
dec b
jr nz, .loop3
dec c
jr nz, .loop1
; restore the original value of hMapObjectIndex
2015-11-30 16:04:14 +00:00
pop af
ldh [hMapObjectIndex], a
2015-11-30 16:04:14 +00:00
ret
2020-05-18 00:59:15 +00:00
HDMATransfer2bpp::
2015-11-30 16:04:14 +00:00
; 2bpp when [rLCDC] & $80
; switch to WRAM bank 6
ldh a, [rSVBK]
2015-11-30 16:04:14 +00:00
push af
ld a, BANK(wScratchTilemap)
ldh [rSVBK], a
2015-11-30 16:04:14 +00:00
push bc
push hl
; Copy c tiles of the 2bpp from b:de to wScratchTilemap
2015-11-30 16:04:14 +00:00
ld a, b ; bank
ld l, c ; number of tiles
ld h, $0
; multiply by 16 (16 bytes of a 2bpp = 8 x 8 tile)
add hl, hl
add hl, hl
add hl, hl
add hl, hl
2015-11-30 16:04:14 +00:00
ld b, h
ld c, l
ld h, d ; address
ld l, e
ld de, wScratchTilemap
2015-11-30 16:04:14 +00:00
call FarCopyBytes
2015-11-30 16:04:14 +00:00
pop hl
pop bc
push bc
call DelayFrame
pop bc
ld d, h
ld e, l
ld hl, wScratchTilemap
2016-05-05 02:34:09 +00:00
call HDMATransfer_Wait127Scanlines
2015-11-30 16:04:14 +00:00
; restore the previous bank
pop af
ldh [rSVBK], a
2015-11-30 16:04:14 +00:00
ret
2020-05-18 00:59:15 +00:00
HDMATransfer1bpp::
2015-11-30 16:04:14 +00:00
; 1bpp when [rLCDC] & $80
.loop
ld a, c
cp $10
jp c, .bankswitch
jp z, .bankswitch
push bc
push hl
push de
ld c, $10
call .bankswitch
pop de
ld hl, $80
add hl, de
ld d, h
ld e, l
pop hl
lb bc, 1, 0
add hl, bc
pop bc
ld a, c
sub $10
ld c, a
jr .loop
2018-06-24 14:09:41 +00:00
.bankswitch
ldh a, [rSVBK]
2015-11-30 16:04:14 +00:00
push af
ld a, BANK(wScratchTilemap)
ldh [rSVBK], a
2015-11-30 16:04:14 +00:00
push bc
push hl
ld a, b
ld l, c
ld h, $0
add hl, hl ; multiply by 8
add hl, hl ; multiply by 8
add hl, hl ; multiply by 8
2015-11-30 16:04:14 +00:00
ld c, l
ld b, h
ld h, d
ld l, e
ld de, wScratchTilemap
2015-11-30 16:04:14 +00:00
call FarCopyBytesDouble_DoubleBankSwitch
pop hl
pop bc
push bc
call DelayFrame
pop bc
ld d, h
ld e, l
ld hl, wScratchTilemap
2016-05-05 02:34:09 +00:00
call HDMATransfer_Wait127Scanlines
2015-11-30 16:04:14 +00:00
pop af
ldh [rSVBK], a
2015-11-30 16:04:14 +00:00
ret
2018-06-24 14:09:41 +00:00
HDMATransfer_OnlyTopFourRows:
2016-05-05 02:34:09 +00:00
ld hl, .Function
2015-12-09 23:25:44 +00:00
jp CallInSafeGFXMode
2015-11-30 16:04:14 +00:00
2016-05-05 02:34:09 +00:00
.Function:
ld hl, wScratchTilemap
2015-11-30 16:04:14 +00:00
decoord 0, 0
2016-05-05 02:34:09 +00:00
call .Copy
ld hl, wScratchTilemap + $80
decoord 0, 0, wAttrmap
2016-05-05 02:34:09 +00:00
call .Copy
2015-11-30 16:04:14 +00:00
ld a, $1
ldh [rVBK], a
2015-11-30 16:04:14 +00:00
ld c, $8
ld hl, wScratchTilemap + $80
2017-12-28 12:32:33 +00:00
debgcoord 0, 0, vBGMap1
2016-05-05 02:34:09 +00:00
call HDMATransfer_Wait127Scanlines
2015-11-30 16:04:14 +00:00
ld a, $0
ldh [rVBK], a
2015-11-30 16:04:14 +00:00
ld c, $8
ld hl, wScratchTilemap
2017-12-28 12:32:33 +00:00
debgcoord 0, 0, vBGMap1
2016-05-05 02:34:09 +00:00
call HDMATransfer_Wait127Scanlines
2015-11-30 16:04:14 +00:00
ret
2018-06-24 14:09:41 +00:00
.Copy:
2015-11-30 16:04:14 +00:00
ld b, 4
.outer_loop
ld c, SCREEN_WIDTH
.inner_loop
ld a, [de]
ld [hli], a
inc de
dec c
jr nz, .inner_loop
ld a, l
2016-05-05 02:34:09 +00:00
add BG_MAP_WIDTH - SCREEN_WIDTH
2015-11-30 16:04:14 +00:00
ld l, a
ld a, h
2018-02-04 18:16:40 +00:00
adc 0
2015-11-30 16:04:14 +00:00
ld h, a
dec b
jr nz, .outer_loop
ret