pokecrystal-board/engine/gfx/load_push_oam.asm

29 lines
459 B
NASM
Raw Normal View History

2018-06-24 07:09:41 -07:00
WriteOAMDMACodeToHRAM::
ld c, LOW(hTransferShadowOAM)
ld b, OAMDMACodeEnd - OAMDMACode
ld hl, OAMDMACode
.copy
ld a, [hli]
2019-02-16 09:17:55 -08: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
hTransferShadowOAM::
; initiate DMA
ld a, HIGH(wShadowOAM)
ldh [rDMA], a
; wait for DMA to finish
2018-01-10 10:47:57 -08:00
ld a, NUM_SPRITE_OAM_STRUCTS
.wait
dec a
jr nz, .wait
ret
ENDL
OAMDMACodeEnd: