You've already forked pokecrystal-board
mirror of
https://gitlab.com/xCrystal/pokecrystal-board.git
synced 2025-04-09 05:44:44 -07:00
Use LOAD/ENDL for OAM DMA code in HRAM (requires rgbds 0.4.1)
This commit is contained in:
@@ -1,21 +1,28 @@
|
||||
WriteOAMDMACodeToHRAM::
|
||||
ld c, LOW(hTransferVirtualOAM)
|
||||
ld b, .PushOAMEnd - .PushOAM
|
||||
ld hl, .PushOAM
|
||||
.loop
|
||||
ld b, OAMDMACodeEnd - OAMDMACode
|
||||
ld hl, OAMDMACode
|
||||
.copy
|
||||
ld a, [hli]
|
||||
ldh [c], a
|
||||
inc c
|
||||
dec b
|
||||
jr nz, .loop
|
||||
jr nz, .copy
|
||||
ret
|
||||
|
||||
.PushOAM:
|
||||
OAMDMACode:
|
||||
; This code is defined in ROM, but
|
||||
; copied to and called from HRAM.
|
||||
LOAD "OAM DMA", HRAM
|
||||
hTransferVirtualOAM::
|
||||
; initiate DMA
|
||||
ld a, HIGH(wVirtualOAM)
|
||||
ldh [rDMA], a
|
||||
; wait for DMA to finish
|
||||
ld a, NUM_SPRITE_OAM_STRUCTS
|
||||
.pushoam_loop
|
||||
.wait
|
||||
dec a
|
||||
jr nz, .pushoam_loop
|
||||
jr nz, .wait
|
||||
ret
|
||||
.PushOAMEnd
|
||||
ENDL
|
||||
OAMDMACodeEnd:
|
||||
|
Reference in New Issue
Block a user