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