2018-06-24 14:09:41 +00:00
|
|
|
WriteOAMDMACodeToHRAM::
|
2018-08-25 18:34:25 +00:00
|
|
|
ld c, LOW(hTransferVirtualOAM)
|
2020-07-21 23:43:56 +00:00
|
|
|
ld b, OAMDMACodeEnd - OAMDMACode
|
|
|
|
ld hl, OAMDMACode
|
|
|
|
.copy
|
2017-12-25 00:35:35 +00:00
|
|
|
ld a, [hli]
|
2019-02-16 17:17:55 +00:00
|
|
|
ldh [c], a
|
2017-12-25 00:35:35 +00:00
|
|
|
inc c
|
|
|
|
dec b
|
2020-07-21 23:43:56 +00:00
|
|
|
jr nz, .copy
|
2017-12-25 00:35:35 +00:00
|
|
|
ret
|
|
|
|
|
2020-07-21 23:43:56 +00:00
|
|
|
OAMDMACode:
|
|
|
|
; This code is defined in ROM, but
|
|
|
|
; copied to and called from HRAM.
|
|
|
|
LOAD "OAM DMA", HRAM
|
|
|
|
hTransferVirtualOAM::
|
|
|
|
; initiate DMA
|
2018-01-23 21:45:34 +00:00
|
|
|
ld a, HIGH(wVirtualOAM)
|
2018-08-25 18:28:22 +00:00
|
|
|
ldh [rDMA], a
|
2020-07-21 23:43:56 +00:00
|
|
|
; wait for DMA to finish
|
2018-01-10 18:47:57 +00:00
|
|
|
ld a, NUM_SPRITE_OAM_STRUCTS
|
2020-07-21 23:43:56 +00:00
|
|
|
.wait
|
2017-12-25 00:35:35 +00:00
|
|
|
dec a
|
2020-07-21 23:43:56 +00:00
|
|
|
jr nz, .wait
|
2017-12-25 00:35:35 +00:00
|
|
|
ret
|
2020-07-21 23:43:56 +00:00
|
|
|
ENDL
|
|
|
|
OAMDMACodeEnd:
|