INCLUDE "hardware.inc" SECTION "OAM Mirror", WRAM0, ALIGN[8] _OAM:: ds 40 * 4 _OAM_end: SECTION "OAM DMA routine", 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 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