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.

38 lines
566 B

  1. INCLUDE "hardware.inc"
  2. SECTION "OAM Mirror", WRAM0, ALIGN[8]
  3. _OAM:: ds 40 * 4
  4. _OAM_end:
  5. SECTION "OAM DMA routine", ROM0
  6. ; Initialize OAM
  7. OAM_Init::
  8. ; Clear internal OAM
  9. ld hl, _OAM
  10. xor a
  11. ld c, _OAM_end - _OAM
  12. call memset
  13. ; Copy DMA transfer routine to HRAM
  14. ld hl, waitForDMA
  15. ld bc, DMA_Start
  16. ld d, waitForDMA_end - waitForDMA
  17. call memcpy
  18. ret
  19. waitForDMA:
  20. ld [rDMA], a
  21. ld a, 40
  22. .wait:
  23. dec a
  24. jr nz, .wait
  25. ret
  26. waitForDMA_end:
  27. SECTION "OAM DMA", HRAM
  28. DMA_Start::
  29. ds waitForDMA_end - waitForDMA