Remove all code from main.asm (some labeled INCBINs, like out-of-context graphics, are still present)
engine/routines/ stores isolated out-of-context routines as individual files. It might be preferable later to append them to their related engine/ files in unique little SECTIONs, relying on the linkerscript to place them appropriately; or some other organization method. In the meantime, they're now easily findable apart from main.asm's other content.
This commit is contained in:
80
engine/routines/phonering_copytilemapatonce.asm
Normal file
80
engine/routines/phonering_copytilemapatonce.asm
Normal file
@@ -0,0 +1,80 @@
|
||||
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]
|
||||
cp $8f
|
||||
jr c, .wait
|
||||
|
||||
di
|
||||
ld a, BANK(VBGMap2)
|
||||
ld [rVBK], a
|
||||
hlcoord 0, 0, AttrMap
|
||||
call .CopyTilemapAtOnce
|
||||
ld a, BANK(VBGMap0)
|
||||
ld [rVBK], a
|
||||
hlcoord 0, 0
|
||||
call .CopyTilemapAtOnce
|
||||
.wait2
|
||||
ld a, [rLY]
|
||||
cp $8f
|
||||
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
|
||||
ld c, rSTAT % $100
|
||||
|
||||
.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
|
Reference in New Issue
Block a user