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