2017-12-25 00:35:35 +00:00
|
|
|
PhoneRing_CopyTilemapAtOnce: ; 4d188
|
|
|
|
ld a, [hCGB]
|
|
|
|
and a
|
|
|
|
jp z, WaitBGMap
|
|
|
|
ld a, [wSpriteUpdatesEnabled]
|
|
|
|
cp $0
|
|
|
|
jp z, WaitBGMap
|
|
|
|
|
|
|
|
; What follows is a modified version of CopyTilemapAtOnce.
|
|
|
|
ld a, [hBGMapMode]
|
|
|
|
push af
|
|
|
|
xor a
|
|
|
|
ld [hBGMapMode], a
|
|
|
|
ld a, [hMapAnims]
|
|
|
|
push af
|
|
|
|
xor a
|
|
|
|
ld [hMapAnims], a
|
|
|
|
.wait
|
|
|
|
ld a, [rLY]
|
2017-12-29 17:53:21 +00:00
|
|
|
cp LY_VBLANK - 1
|
2017-12-25 00:35:35 +00:00
|
|
|
jr c, .wait
|
|
|
|
|
|
|
|
di
|
2017-12-28 12:32:33 +00:00
|
|
|
ld a, BANK(vBGMap2)
|
2017-12-25 00:35:35 +00:00
|
|
|
ld [rVBK], a
|
|
|
|
hlcoord 0, 0, AttrMap
|
|
|
|
call .CopyTilemapAtOnce
|
2017-12-28 12:32:33 +00:00
|
|
|
ld a, BANK(vBGMap0)
|
2017-12-25 00:35:35 +00:00
|
|
|
ld [rVBK], a
|
|
|
|
hlcoord 0, 0
|
|
|
|
call .CopyTilemapAtOnce
|
|
|
|
.wait2
|
|
|
|
ld a, [rLY]
|
2017-12-29 17:53:21 +00:00
|
|
|
cp LY_VBLANK - 1
|
2017-12-25 00:35:35 +00:00
|
|
|
jr c, .wait2
|
|
|
|
ei
|
|
|
|
|
|
|
|
pop af
|
|
|
|
ld [hMapAnims], a
|
|
|
|
pop af
|
|
|
|
ld [hBGMapMode], a
|
|
|
|
ret
|
|
|
|
|
|
|
|
.CopyTilemapAtOnce: ; 4d1cb
|
|
|
|
ld [hSPBuffer], sp
|
|
|
|
ld sp, hl
|
|
|
|
ld a, [hBGMapAddress + 1]
|
|
|
|
ld h, a
|
|
|
|
ld l, 0
|
|
|
|
ld a, SCREEN_HEIGHT
|
|
|
|
ld [hTilesPerCycle], a
|
|
|
|
ld b, 1 << 1 ; not in v/hblank
|
2017-12-25 18:40:10 +00:00
|
|
|
ld c, LOW(rSTAT)
|
2017-12-25 00:35:35 +00:00
|
|
|
|
|
|
|
.loop
|
|
|
|
rept SCREEN_WIDTH / 2
|
|
|
|
pop de
|
|
|
|
.loop\@
|
|
|
|
ld a, [$ff00+c]
|
|
|
|
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
|
|
|
|
ld a, [hTilesPerCycle]
|
|
|
|
dec a
|
|
|
|
ld [hTilesPerCycle], a
|
|
|
|
jr nz, .loop
|
|
|
|
|
|
|
|
ld a, [hSPBuffer]
|
|
|
|
ld l, a
|
|
|
|
ld a, [hSPBuffer + 1]
|
|
|
|
ld h, a
|
|
|
|
ld sp, hl
|
|
|
|
ret
|