diff options
author | yenatch <yenatch@gmail.com> | 2014-07-12 09:02:49 -0400 |
---|---|---|
committer | yenatch <yenatch@gmail.com> | 2014-07-12 09:02:49 -0400 |
commit | fb11ff7e55be56cef9234c8443614f04f2157a1e (patch) | |
tree | a6aa8d0745bd07d0b80090491b5e4b6652de4420 /engine/oam_dma.asm | |
parent | 15427f532085846ab6b51719be687951a094cb6c (diff) | |
parent | 9f29f21d9d43baa7124991dcf3b093fc6c615706 (diff) |
Merge pull request #48 from yenatch/master
Clean up post-split main.asm. Get rid of static wram addresses. Lay out a foundation for Yellow.
Diffstat (limited to 'engine/oam_dma.asm')
-rw-r--r-- | engine/oam_dma.asm | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/engine/oam_dma.asm b/engine/oam_dma.asm new file mode 100644 index 00000000..3de4d773 --- /dev/null +++ b/engine/oam_dma.asm @@ -0,0 +1,25 @@ +WriteDMACodeToHRAM: +; Since no other memory is available during OAM DMA, +; DMARoutine is copied to HRAM and executed there. + ld c, $ff80 % $100 + ld b, DMARoutineEnd - DMARoutine + ld hl, DMARoutine +.copy + ld a, [hli] + ld [$ff00+c], a + inc c + dec b + jr nz, .copy + ret + +DMARoutine: + ; initiate DMA + ld a, wOAMBuffer / $100 + ld [$ff46], a + + ; wait for DMA to finish + ld a, $28 +.wait dec a + jr nz, .wait + ret +DMARoutineEnd: |