mirror of https://github.com/pret/pokecrystal.git
Format all CopyTilemapAtOnce variations the same way
This commit is contained in:
parent
abf3858fc4
commit
395ebd8386
|
@ -3,33 +3,37 @@ SaveMenu_CopyTilemapAtOnce:
|
||||||
and a
|
and a
|
||||||
jp z, WaitBGMap
|
jp z, WaitBGMap
|
||||||
|
|
||||||
; The following is a modified version of CopyTilemapAtOnce.
|
; The following is a modified version of _CopyTilemapAtOnce
|
||||||
|
; that waits for [rLY] to be $60 instead of $80 - 1.
|
||||||
ldh a, [hBGMapMode]
|
ldh a, [hBGMapMode]
|
||||||
push af
|
push af
|
||||||
xor a
|
xor a
|
||||||
ldh [hBGMapMode], a
|
ldh [hBGMapMode], a
|
||||||
|
|
||||||
ldh a, [hMapAnims]
|
ldh a, [hMapAnims]
|
||||||
push af
|
push af
|
||||||
xor a
|
xor a
|
||||||
ldh [hMapAnims], a
|
ldh [hMapAnims], a
|
||||||
.WaitLY:
|
|
||||||
|
.wait
|
||||||
ldh a, [rLY]
|
ldh a, [rLY]
|
||||||
cp $60
|
cp $60
|
||||||
jr c, .WaitLY
|
jr c, .wait
|
||||||
|
|
||||||
di
|
di
|
||||||
ld a, BANK(vBGMap2)
|
ld a, BANK(vBGMap2)
|
||||||
ldh [rVBK], a
|
ldh [rVBK], a
|
||||||
hlcoord 0, 0, wAttrmap
|
hlcoord 0, 0, wAttrmap
|
||||||
call .CopyTilemapAtOnce
|
call .CopyBGMapViaStack
|
||||||
ld a, BANK(vBGMap0)
|
ld a, BANK(vBGMap0)
|
||||||
ldh [rVBK], a
|
ldh [rVBK], a
|
||||||
hlcoord 0, 0
|
hlcoord 0, 0
|
||||||
call .CopyTilemapAtOnce
|
call .CopyBGMapViaStack
|
||||||
.WaitLY2:
|
|
||||||
|
.wait2
|
||||||
ldh a, [rLY]
|
ldh a, [rLY]
|
||||||
cp $60
|
cp $60
|
||||||
jr c, .WaitLY2
|
jr c, .wait2
|
||||||
ei
|
ei
|
||||||
|
|
||||||
pop af
|
pop af
|
||||||
|
@ -38,7 +42,8 @@ SaveMenu_CopyTilemapAtOnce:
|
||||||
ldh [hBGMapMode], a
|
ldh [hBGMapMode], a
|
||||||
ret
|
ret
|
||||||
|
|
||||||
.CopyTilemapAtOnce:
|
.CopyBGMapViaStack:
|
||||||
|
; Copy all tiles to vBGMap
|
||||||
ld [hSPBuffer], sp
|
ld [hSPBuffer], sp
|
||||||
ld sp, hl
|
ld sp, hl
|
||||||
ldh a, [hBGMapAddress + 1]
|
ldh a, [hBGMapAddress + 1]
|
||||||
|
@ -46,16 +51,18 @@ SaveMenu_CopyTilemapAtOnce:
|
||||||
ld l, 0
|
ld l, 0
|
||||||
ld a, SCREEN_HEIGHT
|
ld a, SCREEN_HEIGHT
|
||||||
ldh [hTilesPerCycle], a
|
ldh [hTilesPerCycle], a
|
||||||
ld b, 1 << 1
|
ld b, 1 << 1 ; not in v/hblank
|
||||||
ld c, LOW(rSTAT)
|
ld c, LOW(rSTAT)
|
||||||
|
|
||||||
.loop
|
.loop
|
||||||
rept SCREEN_WIDTH / 2
|
rept SCREEN_WIDTH / 2
|
||||||
pop de
|
pop de
|
||||||
|
; if in v/hblank, wait until not in v/hblank
|
||||||
.loop\@
|
.loop\@
|
||||||
ldh a, [c]
|
ldh a, [c]
|
||||||
and b
|
and b
|
||||||
jr nz, .loop\@
|
jr nz, .loop\@
|
||||||
|
; load vBGMap
|
||||||
ld [hl], e
|
ld [hl], e
|
||||||
inc l
|
inc l
|
||||||
ld [hl], d
|
ld [hl], d
|
||||||
|
|
|
@ -6,15 +6,18 @@ PhoneRing_CopyTilemapAtOnce:
|
||||||
cp $0
|
cp $0
|
||||||
jp z, WaitBGMap
|
jp z, WaitBGMap
|
||||||
|
|
||||||
; What follows is a modified version of CopyTilemapAtOnce.
|
; The following is a modified version of _CopyTilemapAtOnce
|
||||||
|
; that waits for [rLY] to be LY_VBLANK - 1 instead of $80 - 1.
|
||||||
ldh a, [hBGMapMode]
|
ldh a, [hBGMapMode]
|
||||||
push af
|
push af
|
||||||
xor a
|
xor a
|
||||||
ldh [hBGMapMode], a
|
ldh [hBGMapMode], a
|
||||||
|
|
||||||
ldh a, [hMapAnims]
|
ldh a, [hMapAnims]
|
||||||
push af
|
push af
|
||||||
xor a
|
xor a
|
||||||
ldh [hMapAnims], a
|
ldh [hMapAnims], a
|
||||||
|
|
||||||
.wait
|
.wait
|
||||||
ldh a, [rLY]
|
ldh a, [rLY]
|
||||||
cp LY_VBLANK - 1
|
cp LY_VBLANK - 1
|
||||||
|
@ -24,11 +27,12 @@ PhoneRing_CopyTilemapAtOnce:
|
||||||
ld a, BANK(vBGMap2)
|
ld a, BANK(vBGMap2)
|
||||||
ldh [rVBK], a
|
ldh [rVBK], a
|
||||||
hlcoord 0, 0, wAttrmap
|
hlcoord 0, 0, wAttrmap
|
||||||
call .CopyTilemapAtOnce
|
call .CopyBGMapViaStack
|
||||||
ld a, BANK(vBGMap0)
|
ld a, BANK(vBGMap0)
|
||||||
ldh [rVBK], a
|
ldh [rVBK], a
|
||||||
hlcoord 0, 0
|
hlcoord 0, 0
|
||||||
call .CopyTilemapAtOnce
|
call .CopyBGMapViaStack
|
||||||
|
|
||||||
.wait2
|
.wait2
|
||||||
ldh a, [rLY]
|
ldh a, [rLY]
|
||||||
cp LY_VBLANK - 1
|
cp LY_VBLANK - 1
|
||||||
|
@ -41,7 +45,8 @@ PhoneRing_CopyTilemapAtOnce:
|
||||||
ldh [hBGMapMode], a
|
ldh [hBGMapMode], a
|
||||||
ret
|
ret
|
||||||
|
|
||||||
.CopyTilemapAtOnce:
|
.CopyBGMapViaStack:
|
||||||
|
; Copy all tiles to vBGMap
|
||||||
ld [hSPBuffer], sp
|
ld [hSPBuffer], sp
|
||||||
ld sp, hl
|
ld sp, hl
|
||||||
ldh a, [hBGMapAddress + 1]
|
ldh a, [hBGMapAddress + 1]
|
||||||
|
@ -55,10 +60,12 @@ PhoneRing_CopyTilemapAtOnce:
|
||||||
.loop
|
.loop
|
||||||
rept SCREEN_WIDTH / 2
|
rept SCREEN_WIDTH / 2
|
||||||
pop de
|
pop de
|
||||||
|
; if in v/hblank, wait until not in v/hblank
|
||||||
.loop\@
|
.loop\@
|
||||||
ldh a, [c]
|
ldh a, [c]
|
||||||
and b
|
and b
|
||||||
jr nz, .loop\@
|
jr nz, .loop\@
|
||||||
|
; load vBGMap
|
||||||
ld [hl], e
|
ld [hl], e
|
||||||
inc l
|
inc l
|
||||||
ld [hl], d
|
ld [hl], d
|
||||||
|
|
|
@ -58,13 +58,13 @@ CGBOnly_CopyTilemapAtOnce::
|
||||||
jr z, WaitBGMap
|
jr z, WaitBGMap
|
||||||
|
|
||||||
CopyTilemapAtOnce::
|
CopyTilemapAtOnce::
|
||||||
jr .CopyTilemapAtOnce
|
jr _CopyTilemapAtOnce
|
||||||
|
|
||||||
; unused
|
; unused
|
||||||
farcall HDMATransferAttrmapAndTilemapToWRAMBank3
|
farcall HDMATransferAttrmapAndTilemapToWRAMBank3
|
||||||
ret
|
ret
|
||||||
|
|
||||||
.CopyTilemapAtOnce:
|
_CopyTilemapAtOnce:
|
||||||
ldh a, [hBGMapMode]
|
ldh a, [hBGMapMode]
|
||||||
push af
|
push af
|
||||||
xor a
|
xor a
|
||||||
|
@ -77,22 +77,22 @@ CopyTilemapAtOnce::
|
||||||
|
|
||||||
.wait
|
.wait
|
||||||
ldh a, [rLY]
|
ldh a, [rLY]
|
||||||
cp $7f
|
cp $80 - 1
|
||||||
jr c, .wait
|
jr c, .wait
|
||||||
|
|
||||||
di
|
di
|
||||||
ld a, BANK(vTiles3)
|
ld a, BANK(vBGMap2)
|
||||||
ldh [rVBK], a
|
ldh [rVBK], a
|
||||||
hlcoord 0, 0, wAttrmap
|
hlcoord 0, 0, wAttrmap
|
||||||
call .StackPointerMagic
|
call .CopyBGMapViaStack
|
||||||
ld a, BANK(vTiles0)
|
ld a, BANK(vBGMap0)
|
||||||
ldh [rVBK], a
|
ldh [rVBK], a
|
||||||
hlcoord 0, 0
|
hlcoord 0, 0
|
||||||
call .StackPointerMagic
|
call .CopyBGMapViaStack
|
||||||
|
|
||||||
.wait2
|
.wait2
|
||||||
ldh a, [rLY]
|
ldh a, [rLY]
|
||||||
cp $7f
|
cp $80 - 1
|
||||||
jr c, .wait2
|
jr c, .wait2
|
||||||
ei
|
ei
|
||||||
|
|
||||||
|
@ -102,7 +102,7 @@ CopyTilemapAtOnce::
|
||||||
ldh [hBGMapMode], a
|
ldh [hBGMapMode], a
|
||||||
ret
|
ret
|
||||||
|
|
||||||
.StackPointerMagic:
|
.CopyBGMapViaStack:
|
||||||
; Copy all tiles to vBGMap
|
; Copy all tiles to vBGMap
|
||||||
ld [hSPBuffer], sp
|
ld [hSPBuffer], sp
|
||||||
ld sp, hl
|
ld sp, hl
|
||||||
|
@ -122,7 +122,7 @@ rept SCREEN_WIDTH / 2
|
||||||
ldh a, [c]
|
ldh a, [c]
|
||||||
and b
|
and b
|
||||||
jr nz, .loop\@
|
jr nz, .loop\@
|
||||||
; load BGMap0
|
; load vBGMap
|
||||||
ld [hl], e
|
ld [hl], e
|
||||||
inc l
|
inc l
|
||||||
ld [hl], d
|
ld [hl], d
|
||||||
|
|
Loading…
Reference in New Issue