2018-06-24 07:09:41 -07:00
|
|
|
SaveMenu_CopyTilemapAtOnce:
|
2018-08-25 11:28:22 -07:00
|
|
|
ldh a, [hCGB]
|
2017-12-24 16:35:35 -08:00
|
|
|
and a
|
|
|
|
jp z, WaitBGMap
|
|
|
|
|
|
|
|
; The following is a modified version of CopyTilemapAtOnce.
|
2018-08-25 11:28:22 -07:00
|
|
|
ldh a, [hBGMapMode]
|
2017-12-24 16:35:35 -08:00
|
|
|
push af
|
|
|
|
xor a
|
2018-08-25 11:28:22 -07:00
|
|
|
ldh [hBGMapMode], a
|
|
|
|
ldh a, [hMapAnims]
|
2017-12-24 16:35:35 -08:00
|
|
|
push af
|
|
|
|
xor a
|
2018-08-25 11:28:22 -07:00
|
|
|
ldh [hMapAnims], a
|
2017-12-24 16:35:35 -08:00
|
|
|
.WaitLY:
|
2018-08-25 11:28:22 -07:00
|
|
|
ldh a, [rLY]
|
2017-12-24 16:35:35 -08:00
|
|
|
cp $60
|
|
|
|
jr c, .WaitLY
|
|
|
|
|
|
|
|
di
|
2017-12-28 04:32:33 -08:00
|
|
|
ld a, BANK(vBGMap2)
|
2018-08-25 11:28:22 -07:00
|
|
|
ldh [rVBK], a
|
2020-02-13 09:30:13 -08:00
|
|
|
hlcoord 0, 0, wAttrmap
|
2017-12-24 16:35:35 -08:00
|
|
|
call .CopyTilemapAtOnce
|
2017-12-28 04:32:33 -08:00
|
|
|
ld a, BANK(vBGMap0)
|
2018-08-25 11:28:22 -07:00
|
|
|
ldh [rVBK], a
|
2017-12-24 16:35:35 -08:00
|
|
|
hlcoord 0, 0
|
|
|
|
call .CopyTilemapAtOnce
|
|
|
|
.WaitLY2:
|
2018-08-25 11:28:22 -07:00
|
|
|
ldh a, [rLY]
|
2017-12-24 16:35:35 -08:00
|
|
|
cp $60
|
|
|
|
jr c, .WaitLY2
|
|
|
|
ei
|
|
|
|
|
|
|
|
pop af
|
2018-08-25 11:28:22 -07:00
|
|
|
ldh [hMapAnims], a
|
2017-12-24 16:35:35 -08:00
|
|
|
pop af
|
2018-08-25 11:28:22 -07:00
|
|
|
ldh [hBGMapMode], a
|
2017-12-24 16:35:35 -08:00
|
|
|
ret
|
|
|
|
|
2018-06-24 07:09:41 -07:00
|
|
|
.CopyTilemapAtOnce:
|
2018-08-25 11:39:24 -07:00
|
|
|
ld [hSPBuffer], sp
|
2017-12-24 16:35:35 -08:00
|
|
|
ld sp, hl
|
2018-08-25 11:28:22 -07:00
|
|
|
ldh a, [hBGMapAddress + 1]
|
2017-12-24 16:35:35 -08:00
|
|
|
ld h, a
|
|
|
|
ld l, 0
|
|
|
|
ld a, SCREEN_HEIGHT
|
2018-08-25 11:28:22 -07:00
|
|
|
ldh [hTilesPerCycle], a
|
2017-12-24 16:35:35 -08:00
|
|
|
ld b, 1 << 1
|
2017-12-25 10:40:10 -08:00
|
|
|
ld c, LOW(rSTAT)
|
2017-12-24 16:35:35 -08:00
|
|
|
|
|
|
|
.loop
|
|
|
|
rept SCREEN_WIDTH / 2
|
|
|
|
pop de
|
|
|
|
.loop\@
|
2019-02-16 09:17:55 -08:00
|
|
|
ldh a, [c]
|
2017-12-24 16:35:35 -08:00
|
|
|
and b
|
|
|
|
jr nz, .loop\@
|
|
|
|
ld [hl], e
|
|
|
|
inc l
|
|
|
|
ld [hl], d
|
|
|
|
inc l
|
|
|
|
endr
|
|
|
|
|
|
|
|
ld de, BG_MAP_WIDTH - SCREEN_WIDTH
|
|
|
|
add hl, de
|
2018-08-25 11:28:22 -07:00
|
|
|
ldh a, [hTilesPerCycle]
|
2017-12-24 16:35:35 -08:00
|
|
|
dec a
|
2018-08-25 11:28:22 -07:00
|
|
|
ldh [hTilesPerCycle], a
|
2017-12-24 16:35:35 -08:00
|
|
|
jr nz, .loop
|
|
|
|
|
2018-08-25 11:28:22 -07:00
|
|
|
ldh a, [hSPBuffer]
|
2017-12-24 16:35:35 -08:00
|
|
|
ld l, a
|
2018-08-25 11:28:22 -07:00
|
|
|
ldh a, [hSPBuffer + 1]
|
2017-12-24 16:35:35 -08:00
|
|
|
ld h, a
|
|
|
|
ld sp, hl
|
|
|
|
ret
|