2018-06-24 14:09:41 +00:00
|
|
|
WriteOAMDMACodeToHRAM::
|
2022-07-09 21:18:22 +00:00
|
|
|
ld c, LOW(hTransferShadowOAM)
|
2024-01-03 15:58:53 +00:00
|
|
|
ld b, OAMDMACode.End - OAMDMACode
|
2020-07-21 23:43:56 +00:00
|
|
|
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
|
2022-07-09 21:18:22 +00:00
|
|
|
hTransferShadowOAM::
|
2020-07-21 23:43:56 +00:00
|
|
|
; initiate DMA
|
2022-07-09 21:18:22 +00:00
|
|
|
ld a, HIGH(wShadowOAM)
|
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
|
2024-01-03 15:58:53 +00:00
|
|
|
.End:
|