Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
pret
GitHub Repository: pret/pokered
Path: blob/master/engine/gfx/oam_dma.asm
1271 views
1
WriteDMACodeToHRAM::
2
; Since no other memory is available during OAM DMA,
3
; DMARoutine is copied to HRAM and executed there.
4
ld c, LOW(hDMARoutine)
5
ld b, DMARoutine.End - DMARoutine
6
ld hl, DMARoutine
7
.copy
8
ld a, [hli]
9
ldh [c], a
10
inc c
11
dec b
12
jr nz, .copy
13
ret
14
15
DMARoutine:
16
LOAD "OAM DMA", HRAM
17
hDMARoutine::
18
; initiate DMA
19
ld a, HIGH(wShadowOAM)
20
ldh [rDMA], a
21
; wait for DMA to finish
22
ld a, $28
23
.wait
24
dec a
25
jr nz, .wait
26
ret
27
ENDL
28
.End:
29
30