You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

40 lines
657 B

INCLUDE "hardware.inc"
SECTION "OAM Mirror", WRAM0, ALIGN[8]
_OAM:: ds OAM_COUNT * sizeof_OAM_ATTRS
_OAM_end:
SECTION "OAM Code", ROM0
; Initialize OAM
OAM_Init::
; Clear internal OAM
ld hl, _OAM
xor a
ld c, _OAM_end - _OAM
call memset
; Copy DMA transfer routine to HRAM
ld hl, waitForDMA
ld bc, DMA_Start
ld d, waitForDMA_end - waitForDMA
call memcpy
ret
; Wait for DMA transfer from $XX00 to complete (~160 cycles)
; @param a $XX
waitForDMA:
ld [rDMA], a
ld a, 40
.wait:
dec a
jr nz, .wait
ret
waitForDMA_end:
SECTION "OAM DMA", HRAM
DMA_Start::
ds waitForDMA_end - waitForDMA