Use HIGH() and LOW()

This commit is contained in:
Rangi 2020-07-07 11:10:29 -04:00
parent bbc257476f
commit 45ed05decf
22 changed files with 89 additions and 87 deletions

View file

@ -236,7 +236,7 @@ WriteMonPartySpriteOAM:
; make a copy at wMonPartySpritesSavedOAM.
push af
ld c, $10
ld h, wOAMBuffer / $100
ld h, HIGH(wOAMBuffer)
ldh a, [hPartyMonIndex]
swap a
ld l, a

View file

@ -1,7 +1,7 @@
WriteDMACodeToHRAM::
; Since no other memory is available during OAM DMA,
; DMARoutine is copied to HRAM and executed there.
ld c, hDMARoutine % $100
ld c, LOW(hDMARoutine)
ld b, DMARoutineEnd - DMARoutine
ld hl, DMARoutine
.copy
@ -14,7 +14,7 @@ WriteDMACodeToHRAM::
DMARoutine:
; initiate DMA
ld a, wOAMBuffer / $100
ld a, HIGH(wOAMBuffer)
ldh [rDMA], a
; wait for DMA to finish

View file

@ -18,7 +18,7 @@ PrepareOAMData::
.spriteLoop
ldh [hSpriteOffset2], a
ld d, wSpriteStateData1 / $100
ld d, HIGH(wSpriteStateData1)
ldh a, [hSpriteOffset2]
ld e, a
ld a, [de] ; c1x0
@ -79,7 +79,7 @@ PrepareOAMData::
ldh a, [hOAMBufferOffset]
ld e, a
ld d, wOAMBuffer / $100
ld d, HIGH(wOAMBuffer)
.tileLoop
ldh a, [hSpriteScreenY] ; temp for sprite Y position
@ -141,13 +141,13 @@ PrepareOAMData::
.nextSprite
ldh a, [hSpriteOffset2]
add $10
cp $100 % $100
cp LOW($100)
jp nz, .spriteLoop
; Clear unused OAM.
ldh a, [hOAMBufferOffset]
ld l, a
ld h, wOAMBuffer / $100
ld h, HIGH(wOAMBuffer)
ld de, $4
ld b, $a0
ld a, [wd736]