pokecrystal-board/engine/gfx/load_push_oam.asm

29 lines
462 B
NASM
Raw Normal View History

2018-06-24 16:09:41 +02:00
WriteOAMDMACodeToHRAM::
2018-08-25 14:34:25 -04:00
ld c, LOW(hTransferVirtualOAM)
ld b, OAMDMACodeEnd - OAMDMACode
ld hl, OAMDMACode
.copy
ld a, [hli]
2019-02-16 12:17:55 -05:00
ldh [c], a
inc c
dec b
jr nz, .copy
ret
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
2018-01-10 13:47:57 -05:00
ld a, NUM_SPRITE_OAM_STRUCTS
.wait
dec a
jr nz, .wait
ret
ENDL
OAMDMACodeEnd: