summaryrefslogtreecommitdiff
path: root/engine/gfx
diff options
context:
space:
mode:
Diffstat (limited to 'engine/gfx')
-rwxr-xr-xengine/gfx/hp_bar.asm14
-rwxr-xr-xengine/gfx/mon_icons.asm6
-rw-r--r--engine/gfx/oam_dma.asm2
-rwxr-xr-xengine/gfx/palettes.asm62
-rwxr-xr-xengine/gfx/screen_effects.asm26
-rw-r--r--engine/gfx/sprite_oam.asm30
6 files changed, 70 insertions, 70 deletions
diff --git a/engine/gfx/hp_bar.asm b/engine/gfx/hp_bar.asm
index 4b91da58..b7bd97f2 100755
--- a/engine/gfx/hp_bar.asm
+++ b/engine/gfx/hp_bar.asm
@@ -21,22 +21,22 @@ GetHPBarLength:
rr e
srl d
rr e
- ld a, [hMultiplicand+1]
+ ldh a, [hMultiplicand+1]
ld b, a
- ld a, [hMultiplicand+2]
+ ldh a, [hMultiplicand+2]
srl b ; divide multiplication result as well
rr a
srl b
rr a
- ld [hMultiplicand+2], a
+ ldh [hMultiplicand+2], a
ld a, b
- ld [hMultiplicand+1], a
+ ldh [hMultiplicand+1], a
.maxHPSmaller256
ld a, e
- ld [hDivisor], a
+ ldh [hDivisor], a
ld b, $4
call Divide
- ld a, [hMultiplicand+2]
+ ldh a, [hMultiplicand+2]
ld e, a ; e = bc * 48 / de (num of pixels of HP bar)
pop hl
and a
@@ -213,7 +213,7 @@ UpdateHPBar_PrintHPNumber:
ld a, [wHPBarOldHP + 1]
ld [wHPBarTempHP], a
push hl
- ld a, [hFlagsFFF6]
+ ldh a, [hFlagsFFF6]
bit 0, a
jr z, .asm_fb15
ld de, $9
diff --git a/engine/gfx/mon_icons.asm b/engine/gfx/mon_icons.asm
index 7a96b36c..19008c05 100755
--- a/engine/gfx/mon_icons.asm
+++ b/engine/gfx/mon_icons.asm
@@ -169,7 +169,7 @@ WriteMonPartySpriteOAMByPartyIndex:
push hl
push de
push bc
- ld a, [hPartyMonIndex]
+ ldh a, [hPartyMonIndex]
ld hl, wPartySpecies
ld e, a
ld d, 0
@@ -187,7 +187,7 @@ WriteMonPartySpriteOAMBySpecies:
; Write OAM blocks for the party sprite of the species in
; [wMonPartySpriteSpecies].
xor a
- ld [hPartyMonIndex], a
+ ldh [hPartyMonIndex], a
ld a, [wMonPartySpriteSpecies]
call GetPartyMonSpriteID
ld [wOAMBaseTile], a
@@ -237,7 +237,7 @@ WriteMonPartySpriteOAM:
push af
ld c, $10
ld h, wOAMBuffer / $100
- ld a, [hPartyMonIndex]
+ ldh a, [hPartyMonIndex]
swap a
ld l, a
add $10
diff --git a/engine/gfx/oam_dma.asm b/engine/gfx/oam_dma.asm
index aeea4c01..d8d8839a 100644
--- a/engine/gfx/oam_dma.asm
+++ b/engine/gfx/oam_dma.asm
@@ -15,7 +15,7 @@ WriteDMACodeToHRAM::
DMARoutine:
; initiate DMA
ld a, wOAMBuffer / $100
- ld [rDMA], a
+ ldh [rDMA], a
; wait for DMA to finish
ld a, $28
diff --git a/engine/gfx/palettes.asm b/engine/gfx/palettes.asm
index 58e08e86..23203374 100755
--- a/engine/gfx/palettes.asm
+++ b/engine/gfx/palettes.asm
@@ -335,13 +335,13 @@ SendSGBPacket:
push bc
; disable ReadJoypad to prevent it from interfering with sending the packet
ld a, 1
- ld [hDisableJoypadPolling], a
+ ldh [hDisableJoypadPolling], a
; send RESET signal (P14=LOW, P15=LOW)
xor a
- ld [rJOYP], a
+ ldh [rJOYP], a
; set P14=HIGH, P15=HIGH
ld a, $30
- ld [rJOYP], a
+ ldh [rJOYP], a
;load length of packets (16 bytes)
ld b, $10
.nextByte
@@ -358,10 +358,10 @@ SendSGBPacket:
; else (if 0th bit is zero) set P14=LOW,P15=HIGH (send bit 0)
ld a, $20
.next0
- ld [rJOYP], a
+ ldh [rJOYP], a
; must set P14=HIGH,P15=HIGH between each "pulse"
ld a, $30
- ld [rJOYP], a
+ ldh [rJOYP], a
; rotation will put next bit in 0th position (so we can always use command
; "bit 0,d" to fetch the bit that has to be sent)
rr d
@@ -372,12 +372,12 @@ SendSGBPacket:
jr nz, .nextByte
; send bit 1 as a "stop bit" (end of parameter data)
ld a, $20
- ld [rJOYP], a
+ ldh [rJOYP], a
; set P14=HIGH,P15=HIGH
ld a, $30
- ld [rJOYP], a
+ ldh [rJOYP], a
xor a
- ld [hDisableJoypadPolling], a
+ ldh [hDisableJoypadPolling], a
; wait for about 70000 cycles
call Wait7000
; restore (previously pushed) number of packets
@@ -457,41 +457,41 @@ CheckSGB:
di
call SendSGBPacket
ld a, 1
- ld [hDisableJoypadPolling], a
+ ldh [hDisableJoypadPolling], a
ei
call Wait7000
- ld a, [rJOYP]
+ ldh a, [rJOYP]
and $3
cp $3
jr nz, .isSGB
ld a, $20
- ld [rJOYP], a
- ld a, [rJOYP]
- ld a, [rJOYP]
+ ldh [rJOYP], a
+ ldh a, [rJOYP]
+ ldh a, [rJOYP]
call Wait7000
call Wait7000
ld a, $30
- ld [rJOYP], a
+ ldh [rJOYP], a
call Wait7000
call Wait7000
ld a, $10
- ld [rJOYP], a
- ld a, [rJOYP]
- ld a, [rJOYP]
- ld a, [rJOYP]
- ld a, [rJOYP]
- ld a, [rJOYP]
- ld a, [rJOYP]
+ ldh [rJOYP], a
+ ldh a, [rJOYP]
+ ldh a, [rJOYP]
+ ldh a, [rJOYP]
+ ldh a, [rJOYP]
+ ldh a, [rJOYP]
+ ldh a, [rJOYP]
call Wait7000
call Wait7000
ld a, $30
- ld [rJOYP], a
- ld a, [rJOYP]
- ld a, [rJOYP]
- ld a, [rJOYP]
+ ldh [rJOYP], a
+ ldh a, [rJOYP]
+ ldh a, [rJOYP]
+ ldh a, [rJOYP]
call Wait7000
call Wait7000
- ld a, [rJOYP]
+ ldh a, [rJOYP]
and $3
cp $3
jr nz, .isSGB
@@ -513,7 +513,7 @@ CopyGfxToSuperNintendoVRAM:
push de
call DisableLCD
ld a, $e4
- ld [rBGP], a
+ ldh [rBGP], a
ld de, vChars1
ld a, [wCopyingSGBTileData]
and a
@@ -539,11 +539,11 @@ CopyGfxToSuperNintendoVRAM:
dec c
jr nz, .loop
ld a, $e3
- ld [rLCDC], a
+ ldh [rLCDC], a
pop hl
call SendSGBPacket
xor a
- ld [rBGP], a
+ ldh [rBGP], a
ei
ret
@@ -577,7 +577,7 @@ SendSGBPackets:
InitGBCPalettes:
ld a, $80 ; index 0 with auto-increment
- ld [rBGPI], a
+ ldh [rBGPI], a
inc hl
ld c, $20
.loop
@@ -592,7 +592,7 @@ InitGBCPalettes:
inc d
.noCarry
ld a, [de]
- ld [rBGPD], a
+ ldh [rBGPD], a
dec c
jr nz, .loop
ret
diff --git a/engine/gfx/screen_effects.asm b/engine/gfx/screen_effects.asm
index 0d3806c1..e8648901 100755
--- a/engine/gfx/screen_effects.asm
+++ b/engine/gfx/screen_effects.asm
@@ -1,14 +1,14 @@
; b = new colour for BG colour 0 (usually white) for 4 frames
ChangeBGPalColor0_4Frames:
call GetPredefRegisters
- ld a, [rBGP]
+ ldh a, [rBGP]
or b
- ld [rBGP], a
+ ldh [rBGP], a
ld c, 4
call DelayFrames
- ld a, [rBGP]
+ ldh a, [rBGP]
and %11111100
- ld [rBGP], a
+ ldh [rBGP], a
ret
PredefShakeScreenVertically:
@@ -19,7 +19,7 @@ PredefShakeScreenVertically:
ld [wDisableVBlankWYUpdate], a
xor a
.loop
- ld [hMutateWY], a
+ ldh [hMutateWY], a
call .MutateWY
call .MutateWY
dec b
@@ -30,10 +30,10 @@ PredefShakeScreenVertically:
ret
.MutateWY
- ld a, [hMutateWY]
+ ldh a, [hMutateWY]
xor b
- ld [hMutateWY], a
- ld [rWY], a
+ ldh [hMutateWY], a
+ ldh [rWY], a
ld c, 3
jp DelayFrames
@@ -43,7 +43,7 @@ PredefShakeScreenHorizontally:
call GetPredefRegisters
xor a
.loop
- ld [hMutateWX], a
+ ldh [hMutateWX], a
call .MutateWX
ld c, 1
call DelayFrames
@@ -54,18 +54,18 @@ PredefShakeScreenHorizontally:
; restore normal WX
ld a, 7
- ld [rWX], a
+ ldh [rWX], a
ret
.MutateWX
- ld a, [hMutateWX]
+ ldh a, [hMutateWX]
xor b
- ld [hMutateWX], a
+ ldh [hMutateWX], a
bit 7, a
jr z, .skipZeroing
xor a ; zero a if it's negative
.skipZeroing
add 7
- ld [rWX], a
+ ldh [rWX], a
ld c, 4
jp DelayFrames
diff --git a/engine/gfx/sprite_oam.asm b/engine/gfx/sprite_oam.asm
index 68128413..1a96286d 100644
--- a/engine/gfx/sprite_oam.asm
+++ b/engine/gfx/sprite_oam.asm
@@ -13,13 +13,13 @@ PrepareOAMData::
.updateEnabled
xor a
- ld [hOAMBufferOffset], a
+ ldh [hOAMBufferOffset], a
.spriteLoop
- ld [hSpriteOffset2], a
+ ldh [hSpriteOffset2], a
ld d, wSpriteStateData1 / $100
- ld a, [hSpriteOffset2]
+ ldh a, [hSpriteOffset2]
ld e, a
ld a, [de] ; c1x0
and a
@@ -58,7 +58,7 @@ PrepareOAMData::
ld e, a
ld a, [de] ; c2x7
and $80
- ld [hSpritePriority], a ; temp store sprite priority
+ ldh [hSpritePriority], a ; temp store sprite priority
pop de
; read the entry from the table
@@ -77,17 +77,17 @@ PrepareOAMData::
call GetSpriteScreenXY
- ld a, [hOAMBufferOffset]
+ ldh a, [hOAMBufferOffset]
ld e, a
ld d, wOAMBuffer / $100
.tileLoop
- ld a, [hSpriteScreenY] ; temp for sprite Y position
+ ldh a, [hSpriteScreenY] ; temp for sprite Y position
add $10 ; Y=16 is top of screen (Y=0 is invisible)
add [hl] ; add Y offset from table
ld [de], a ; write new sprite OAM Y position
inc hl
- ld a, [hSpriteScreenX] ; temp for sprite X position
+ ldh a, [hSpriteScreenX] ; temp for sprite X position
add $8 ; X=8 is left of screen (X=0 is invisible)
add [hl] ; add X offset from table
inc e
@@ -126,7 +126,7 @@ PrepareOAMData::
ld a, [hl]
bit 1, a ; is the tile allowed to set the sprite priority bit?
jr z, .skipPriority
- ld a, [hSpritePriority]
+ ldh a, [hSpritePriority]
or [hl]
.skipPriority
inc hl
@@ -136,16 +136,16 @@ PrepareOAMData::
jr z, .tileLoop
ld a, e
- ld [hOAMBufferOffset], a
+ ldh [hOAMBufferOffset], a
.nextSprite
- ld a, [hSpriteOffset2]
+ ldh a, [hSpriteOffset2]
add $10
cp $100 % $100
jp nz, .spriteLoop
; Clear unused OAM.
- ld a, [hOAMBufferOffset]
+ ldh a, [hOAMBufferOffset]
ld l, a
ld h, wOAMBuffer / $100
ld de, $4
@@ -170,20 +170,20 @@ GetSpriteScreenXY:
inc e
inc e
ld a, [de] ; c1x4
- ld [hSpriteScreenY], a
+ ldh [hSpriteScreenY], a
inc e
inc e
ld a, [de] ; c1x6
- ld [hSpriteScreenX], a
+ ldh [hSpriteScreenX], a
ld a, 4
add e
ld e, a
- ld a, [hSpriteScreenY]
+ ldh a, [hSpriteScreenY]
add 4
and $f0
ld [de], a ; c1xa (y)
inc e
- ld a, [hSpriteScreenX]
+ ldh a, [hSpriteScreenX]
and $f0
ld [de], a ; c1xb (x)
ret