ref: 772fcc7588a4e1fbe146a02b429cf64282c81dcb
parent: c480632d5494d04f7f5f0298a31877a2293b564e
author: Rangi <remy.oukaour+rangi42@gmail.com>
date: Mon Jul 6 15:03:05 EDT 2020
Specify the ldh instruction, don't turn ld into ldh
--- a/Makefile
+++ b/Makefile
@@ -58,7 +58,7 @@
$(MAKE) -C tools/
-RGBASMFLAGS = -h -Weverything
+RGBASMFLAGS = -h -L -Weverything
# Create a sym/map for debug purposes if `make` run with `DEBUG=1`
ifeq ($(DEBUG),1)
RGBASMFLAGS += -E
--- a/audio/engine_1.asm
+++ b/audio/engine_1.asm
@@ -20,10 +20,10 @@
set 7, a
ld [wMuteAudioAndPauseMusic], a
xor a ; disable all channels' output
- ld [rNR51], a
- ld [rNR30], a
+ ldh [rNR51], a
+ ldh [rNR30], a
ld a, $80
- ld [rNR30], a
+ ldh [rNR30], a
jr .nextChannel
.applyAffects
call Audio1_ApplyMusicAffects
@@ -183,9 +183,9 @@
jr nz, .skipSfxChannel3
; restart hardware channel 3 (wave channel) output
ld a, $0
- ld [rNR30], a
+ ldh [rNR30], a
ld a, $80
- ld [rNR30], a
+ ldh [rNR30], a
.skipSfxChannel3
jr nz, .dontDisable
ld a, [wDisableChannelOutputWhenSfxEnds]
@@ -219,9 +219,9 @@
.disableChannelOutput
ld hl, Audio1_HWChannelDisableMasks
add hl, bc
- ld a, [rNR51]
+ ldh a, [rNR51]
and [hl]
- ld [rNR51], a
+ ldh [rNR51], a
.afterDisable
ld a, [wChannelSoundIDs + Ch5]
cp CRY_SFX_START
@@ -241,7 +241,7 @@
ret c
.skipRewind
ld a, [wSavedVolume]
- ld [rNR50], a
+ ldh [rNR50], a
xor a
ld [wSavedVolume], a
.skipCry
@@ -548,7 +548,7 @@
cp $f0 ; is this command a volume?
jr nz, Audio1_execute_music ; no
call Audio1_GetNextMusicByte
- ld [rNR50], a ; store volume
+ ldh [rNR50], a ; store volume
jp Audio1_sound_ret
Audio1_execute_music:
@@ -638,7 +638,7 @@
bit BIT_EXECUTE_MUSIC, [hl]
jr nz, Audio1_note ; no
call Audio1_GetNextMusicByte
- ld [rNR10], a
+ ldh [rNR10], a
jp Audio1_sound_ret
Audio1_note:
@@ -770,9 +770,9 @@
ld b, 0
ld hl, Audio1_HWChannelDisableMasks
add hl, bc
- ld a, [rNR51]
+ ldh a, [rNR51]
and [hl]
- ld [rNR51], a ; disable hardware channel 3's output
+ ldh [rNR51], a ; disable hardware channel 3's output
jr .done
.notChannel3
ld b, REG_VOLUME_ENVELOPE
@@ -844,7 +844,7 @@
ld b, 0
ld hl, Audio1_HWChannelEnableMasks
add hl, bc
- ld a, [rNR51]
+ ldh a, [rNR51]
or [hl] ; set this channel's bits
ld d, a
ld a, c
@@ -866,7 +866,7 @@
add hl, bc
and [hl]
ld d, a
- ld a, [rNR51]
+ ldh a, [rNR51]
ld hl, Audio1_HWChannelDisableMasks
add hl, bc
and [hl] ; reset this channel's output bits
@@ -874,7 +874,7 @@
ld d, a
.skip
ld a, d
- ld [rNR51], a
+ ldh [rNR51], a
ret
Audio1_ApplyDutyCycleAndSoundLength:
@@ -928,7 +928,7 @@
ld hl, rWave_0
ld b, $f
ld a, $0 ; stop hardware channel 3
- ld [rNR30], a
+ ldh [rNR30], a
.loop
ld a, [de]
inc de
@@ -938,7 +938,7 @@
and a
jr nz, .loop
ld a, $80 ; start hardware channel 3
- ld [rNR30], a
+ ldh [rNR30], a
pop de
.notChannel3
ld a, d
@@ -1399,17 +1399,17 @@
ld a, $ff
ld [wStereoPanning], a
xor a
- ld [rNR50], a
+ ldh [rNR50], a
ld a, $8
- ld [rNR10], a
+ ldh [rNR10], a
ld a, 0
- ld [rNR51], a
+ ldh [rNR51], a
xor a
- ld [rNR30], a
+ ldh [rNR30], a
ld a, $80
- ld [rNR30], a
+ ldh [rNR30], a
ld a, $77
- ld [rNR50], a
+ ldh [rNR50], a
jp .playSoundCommon
.playSfx
@@ -1555,7 +1555,7 @@
cp Ch5
jr nz, .skipSweepDisable
ld a, $8
- ld [rNR10], a ; sweep off
+ ldh [rNR10], a ; sweep off
.skipSweepDisable
ld a, c
and a
@@ -1565,22 +1565,22 @@
.stopAllAudio
ld a, $80
- ld [rNR52], a ; sound hardware on
- ld [rNR30], a ; wave playback on
+ ldh [rNR52], a ; sound hardware on
+ ldh [rNR30], a ; wave playback on
xor a
- ld [rNR51], a ; no sound output
- ld [rNR32], a ; mute channel 3 (wave channel)
+ ldh [rNR51], a ; no sound output
+ ldh [rNR32], a ; mute channel 3 (wave channel)
ld a, $8
- ld [rNR10], a ; sweep off
- ld [rNR12], a ; mute channel 1 (pulse channel 1)
- ld [rNR22], a ; mute channel 2 (pulse channel 2)
- ld [rNR42], a ; mute channel 4 (noise channel)
+ ldh [rNR10], a ; sweep off
+ ldh [rNR12], a ; mute channel 1 (pulse channel 1)
+ ldh [rNR22], a ; mute channel 2 (pulse channel 2)
+ ldh [rNR42], a ; mute channel 4 (noise channel)
ld a, $40
- ld [rNR14], a ; counter mode
- ld [rNR24], a
- ld [rNR44], a
+ ldh [rNR14], a ; counter mode
+ ldh [rNR24], a
+ ldh [rNR44], a
ld a, $77
- ld [rNR50], a ; full volume
+ ldh [rNR50], a ; full volume
xor a
ld [wUnusedC000], a
ld [wDisableChannelOutputWhenSfxEnds], a
@@ -1699,10 +1699,10 @@
ld a, [wSavedVolume]
and a
jr nz, .done
- ld a, [rNR50]
+ ldh a, [rNR50]
ld [wSavedVolume], a
ld a, $77
- ld [rNR50], a ; full volume
+ ldh [rNR50], a ; full volume
.done
ret
--- a/audio/engine_2.asm
+++ b/audio/engine_2.asm
@@ -22,10 +22,10 @@
set 7, a
ld [wMuteAudioAndPauseMusic], a
xor a ; disable all channels' output
- ld [rNR51], a
- ld [rNR30], a
+ ldh [rNR51], a
+ ldh [rNR30], a
ld a, $80
- ld [rNR30], a
+ ldh [rNR30], a
jr .nextChannel
.applyAffects
call Audio2_ApplyMusicAffects
@@ -194,9 +194,9 @@
jr nz, .skipSfxChannel3
; restart hardware channel 3 (wave channel) output
ld a, $0
- ld [rNR30], a
+ ldh [rNR30], a
ld a, $80
- ld [rNR30], a
+ ldh [rNR30], a
.skipSfxChannel3
jr nz, .dontDisable
ld a, [wDisableChannelOutputWhenSfxEnds]
@@ -230,9 +230,9 @@
.disableChannelOutput
ld hl, Audio2_HWChannelDisableMasks
add hl, bc
- ld a, [rNR51]
+ ldh a, [rNR51]
and [hl]
- ld [rNR51], a
+ ldh [rNR51], a
.afterDisable
ld a, [wChannelSoundIDs + Ch5]
cp CRY_SFX_START
@@ -252,7 +252,7 @@
ret c
.skipRewind
ld a, [wSavedVolume]
- ld [rNR50], a
+ ldh [rNR50], a
xor a
ld [wSavedVolume], a
.skipCry
@@ -559,7 +559,7 @@
cp $f0 ; is this command a volume?
jr nz, Audio2_execute_music ; no
call Audio2_GetNextMusicByte
- ld [rNR50], a ; store volume
+ ldh [rNR50], a ; store volume
jp Audio2_sound_ret
Audio2_execute_music:
@@ -649,7 +649,7 @@
bit BIT_EXECUTE_MUSIC, [hl]
jr nz, Audio2_note ; no
call Audio2_GetNextMusicByte
- ld [rNR10], a
+ ldh [rNR10], a
jp Audio2_sound_ret
Audio2_note:
@@ -781,9 +781,9 @@
ld b, 0
ld hl, Audio2_HWChannelDisableMasks
add hl, bc
- ld a, [rNR51]
+ ldh a, [rNR51]
and [hl]
- ld [rNR51], a ; disable hardware channel 3's output
+ ldh [rNR51], a ; disable hardware channel 3's output
jr .done
.notChannel3
ld b, REG_VOLUME_ENVELOPE
@@ -855,7 +855,7 @@
ld b, 0
ld hl, Audio2_HWChannelEnableMasks
add hl, bc
- ld a, [rNR51]
+ ldh a, [rNR51]
or [hl] ; set this channel's bits
ld d, a
ld a, c
@@ -877,7 +877,7 @@
add hl, bc
and [hl]
ld d, a
- ld a, [rNR51]
+ ldh a, [rNR51]
ld hl, Audio2_HWChannelDisableMasks
add hl, bc
and [hl] ; reset this channel's output bits
@@ -885,7 +885,7 @@
ld d, a
.skip
ld a, d
- ld [rNR51], a
+ ldh [rNR51], a
ret
Audio2_ApplyDutyCycleAndSoundLength:
@@ -939,7 +939,7 @@
ld hl, rWave_0
ld b, $f
ld a, $0 ; stop hardware channel 3
- ld [rNR30], a
+ ldh [rNR30], a
.loop
ld a, [de]
inc de
@@ -949,7 +949,7 @@
and a
jr nz, .loop
ld a, $80 ; start hardware channel 3
- ld [rNR30], a
+ ldh [rNR30], a
pop de
.notChannel3
ld a, d
@@ -1462,17 +1462,17 @@
ld a, $ff
ld [wStereoPanning], a
xor a
- ld [rNR50], a
+ ldh [rNR50], a
ld a, $8
- ld [rNR10], a
+ ldh [rNR10], a
ld a, 0
- ld [rNR51], a
+ ldh [rNR51], a
xor a
- ld [rNR30], a
+ ldh [rNR30], a
ld a, $80
- ld [rNR30], a
+ ldh [rNR30], a
ld a, $77
- ld [rNR50], a
+ ldh [rNR50], a
jp .playSoundCommon
.playSfx
@@ -1618,7 +1618,7 @@
cp Ch5
jr nz, .skipSweepDisable
ld a, $8
- ld [rNR10], a ; sweep off
+ ldh [rNR10], a ; sweep off
.skipSweepDisable
ld a, c
and a
@@ -1628,22 +1628,22 @@
.stopAllAudio
ld a, $80
- ld [rNR52], a ; sound hardware on
- ld [rNR30], a ; wave playback on
+ ldh [rNR52], a ; sound hardware on
+ ldh [rNR30], a ; wave playback on
xor a
- ld [rNR51], a ; no sound output
- ld [rNR32], a ; mute channel 3 (wave channel)
+ ldh [rNR51], a ; no sound output
+ ldh [rNR32], a ; mute channel 3 (wave channel)
ld a, $8
- ld [rNR10], a ; sweep off
- ld [rNR12], a ; mute channel 1 (pulse channel 1)
- ld [rNR22], a ; mute channel 2 (pulse channel 2)
- ld [rNR42], a ; mute channel 4 (noise channel)
+ ldh [rNR10], a ; sweep off
+ ldh [rNR12], a ; mute channel 1 (pulse channel 1)
+ ldh [rNR22], a ; mute channel 2 (pulse channel 2)
+ ldh [rNR42], a ; mute channel 4 (noise channel)
ld a, $40
- ld [rNR14], a ; counter mode
- ld [rNR24], a
- ld [rNR44], a
+ ldh [rNR14], a ; counter mode
+ ldh [rNR24], a
+ ldh [rNR44], a
ld a, $77
- ld [rNR50], a ; full volume
+ ldh [rNR50], a ; full volume
xor a
ld [wUnusedC000], a
ld [wDisableChannelOutputWhenSfxEnds], a
@@ -1762,10 +1762,10 @@
ld a, [wSavedVolume]
and a
jr nz, .done
- ld a, [rNR50]
+ ldh a, [rNR50]
ld [wSavedVolume], a
ld a, $77
- ld [rNR50], a ; full volume
+ ldh [rNR50], a ; full volume
.done
ret
--- a/audio/engine_3.asm
+++ b/audio/engine_3.asm
@@ -20,10 +20,10 @@
set 7, a
ld [wMuteAudioAndPauseMusic], a
xor a ; disable all channels' output
- ld [rNR51], a
- ld [rNR30], a
+ ldh [rNR51], a
+ ldh [rNR30], a
ld a, $80
- ld [rNR30], a
+ ldh [rNR30], a
jr .nextChannel
.applyAffects
call Audio3_ApplyMusicAffects
@@ -183,9 +183,9 @@
jr nz, .skipSfxChannel3
; restart hardware channel 3 (wave channel) output
ld a, $0
- ld [rNR30], a
+ ldh [rNR30], a
ld a, $80
- ld [rNR30], a
+ ldh [rNR30], a
.skipSfxChannel3
jr nz, .dontDisable
ld a, [wDisableChannelOutputWhenSfxEnds]
@@ -219,9 +219,9 @@
.disableChannelOutput
ld hl, Audio3_HWChannelDisableMasks
add hl, bc
- ld a, [rNR51]
+ ldh a, [rNR51]
and [hl]
- ld [rNR51], a
+ ldh [rNR51], a
.afterDisable
ld a, [wChannelSoundIDs + Ch5]
cp CRY_SFX_START
@@ -241,7 +241,7 @@
ret c
.skipRewind
ld a, [wSavedVolume]
- ld [rNR50], a
+ ldh [rNR50], a
xor a
ld [wSavedVolume], a
.skipCry
@@ -548,7 +548,7 @@
cp $f0 ; is this command a volume?
jr nz, Audio3_execute_music ; no
call Audio3_GetNextMusicByte
- ld [rNR50], a ; store volume
+ ldh [rNR50], a ; store volume
jp Audio3_sound_ret
Audio3_execute_music:
@@ -638,7 +638,7 @@
bit BIT_EXECUTE_MUSIC, [hl]
jr nz, Audio3_note ; no
call Audio3_GetNextMusicByte
- ld [rNR10], a
+ ldh [rNR10], a
jp Audio3_sound_ret
Audio3_note:
@@ -770,9 +770,9 @@
ld b, 0
ld hl, Audio3_HWChannelDisableMasks
add hl, bc
- ld a, [rNR51]
+ ldh a, [rNR51]
and [hl]
- ld [rNR51], a ; disable hardware channel 3's output
+ ldh [rNR51], a ; disable hardware channel 3's output
jr .done
.notChannel3
ld b, REG_VOLUME_ENVELOPE
@@ -844,7 +844,7 @@
ld b, 0
ld hl, Audio3_HWChannelEnableMasks
add hl, bc
- ld a, [rNR51]
+ ldh a, [rNR51]
or [hl] ; set this channel's bits
ld d, a
ld a, c
@@ -866,7 +866,7 @@
add hl, bc
and [hl]
ld d, a
- ld a, [rNR51]
+ ldh a, [rNR51]
ld hl, Audio3_HWChannelDisableMasks
add hl, bc
and [hl] ; reset this channel's output bits
@@ -874,7 +874,7 @@
ld d, a
.skip
ld a, d
- ld [rNR51], a
+ ldh [rNR51], a
ret
Audio3_ApplyDutyCycleAndSoundLength:
@@ -928,7 +928,7 @@
ld hl, rWave_0
ld b, $f
ld a, $0 ; stop hardware channel 3
- ld [rNR30], a
+ ldh [rNR30], a
.loop
ld a, [de]
inc de
@@ -938,7 +938,7 @@
and a
jr nz, .loop
ld a, $80 ; start hardware channel 3
- ld [rNR30], a
+ ldh [rNR30], a
pop de
.notChannel3
ld a, d
@@ -1399,17 +1399,17 @@
ld a, $ff
ld [wStereoPanning], a
xor a
- ld [rNR50], a
+ ldh [rNR50], a
ld a, $8
- ld [rNR10], a
+ ldh [rNR10], a
ld a, 0
- ld [rNR51], a
+ ldh [rNR51], a
xor a
- ld [rNR30], a
+ ldh [rNR30], a
ld a, $80
- ld [rNR30], a
+ ldh [rNR30], a
ld a, $77
- ld [rNR50], a
+ ldh [rNR50], a
jp .playSoundCommon
.playSfx
@@ -1555,7 +1555,7 @@
cp Ch5
jr nz, .skipSweepDisable
ld a, $8
- ld [rNR10], a ; sweep off
+ ldh [rNR10], a ; sweep off
.skipSweepDisable
ld a, c
and a
@@ -1565,22 +1565,22 @@
.stopAllAudio
ld a, $80
- ld [rNR52], a ; sound hardware on
- ld [rNR30], a ; wave playback on
+ ldh [rNR52], a ; sound hardware on
+ ldh [rNR30], a ; wave playback on
xor a
- ld [rNR51], a ; no sound output
- ld [rNR32], a ; mute channel 3 (wave channel)
+ ldh [rNR51], a ; no sound output
+ ldh [rNR32], a ; mute channel 3 (wave channel)
ld a, $8
- ld [rNR10], a ; sweep off
- ld [rNR12], a ; mute channel 1 (pulse channel 1)
- ld [rNR22], a ; mute channel 2 (pulse channel 2)
- ld [rNR42], a ; mute channel 4 (noise channel)
+ ldh [rNR10], a ; sweep off
+ ldh [rNR12], a ; mute channel 1 (pulse channel 1)
+ ldh [rNR22], a ; mute channel 2 (pulse channel 2)
+ ldh [rNR42], a ; mute channel 4 (noise channel)
ld a, $40
- ld [rNR14], a ; counter mode
- ld [rNR24], a
- ld [rNR44], a
+ ldh [rNR14], a ; counter mode
+ ldh [rNR24], a
+ ldh [rNR44], a
ld a, $77
- ld [rNR50], a ; full volume
+ ldh [rNR50], a ; full volume
xor a
ld [wUnusedC000], a
ld [wDisableChannelOutputWhenSfxEnds], a
@@ -1699,10 +1699,10 @@
ld a, [wSavedVolume]
and a
jr nz, .done
- ld a, [rNR50]
+ ldh a, [rNR50]
ld [wSavedVolume], a
ld a, $77
- ld [rNR50], a ; full volume
+ ldh [rNR50], a ; full volume
.done
ret
--- a/audio/pokedex_rating_sfx.asm
+++ b/audio/pokedex_rating_sfx.asm
@@ -1,5 +1,5 @@
PlayPokedexRatingSfx::
- ld a, [hDexRatingNumMonsOwned]
+ ldh a, [hDexRatingNumMonsOwned]
ld c, $0
ld hl, OwnedMonValues
.getSfxPointer
--- a/engine/battle/animations.asm
+++ b/engine/battle/animations.asm
@@ -163,7 +163,7 @@
PlayAnimation:
xor a
- ld [hROMBankTemp], a ; it looks like nothing reads this
+ ldh [hROMBankTemp], a ; it looks like nothing reads this
ld [wSubAnimTransform], a
ld a, [wAnimationID] ; get animation number
dec a
@@ -241,15 +241,15 @@
ld l, c
ld h, b
push hl
- ld a, [rOBP0]
+ ldh a, [rOBP0]
push af
ld a, [wAnimPalette]
- ld [rOBP0], a
+ ldh [rOBP0], a
call LoadAnimationTileset
call LoadSubanimation
call PlaySubanimation
pop af
- ld [rOBP0], a
+ ldh [rOBP0], a
.nextAnimationCommand
pop hl
jr .animationLoop
@@ -308,7 +308,7 @@
; sets the transform to the subanimation type if it's the enemy's turn
GetSubanimationTransform1:
ld b, a
- ld a, [hWhoseTurn]
+ ldh a, [hWhoseTurn]
and a
ld a, b
ret nz
@@ -319,7 +319,7 @@
; sets the transform to 2 (i.e. horizontal and vertical flip) if it's the player's turn
; sets the transform to 0 (i.e. no transform) if it's the enemy's turn
GetSubanimationTransform2:
- ld a, [hWhoseTurn]
+ ldh a, [hWhoseTurn]
and a
ld a, 2 << 5
ret z
@@ -421,7 +421,7 @@
ShareMoveAnimations:
; some moves just reuse animations from status conditions
- ld a, [hWhoseTurn]
+ ldh a, [hWhoseTurn]
and a
ret z
@@ -497,9 +497,9 @@
push bc
push bc
.loop1
- ld a, [rWX]
+ ldh a, [rWX]
inc a
- ld [rWX], a
+ ldh [rWX], a
ld c, 2
call DelayFrames
dec b
@@ -506,9 +506,9 @@
jr nz, .loop1
pop bc
.loop2
- ld a, [rWX]
+ ldh a, [rWX]
dec a
- ld [rWX], a
+ ldh [rWX], a
ld c, 2
call DelayFrames
dec b
@@ -534,16 +534,16 @@
ld b, $f0
.next
ld a, b
- ld [rOBP0], a
+ ldh [rOBP0], a
ld a, $6c
- ld [rOBP1], a
+ ldh [rOBP1], a
ret
.notSGB
ld a, $e4
ld [wAnimPalette], a
- ld [rOBP0], a
+ ldh [rOBP0], a
ld a, $6c
- ld [rOBP1], a
+ ldh [rOBP1], a
ret
PlaySubanimation:
@@ -656,9 +656,9 @@
cp 3 ; is it a Master Ball or Ultra Ball?
jr nc, .skipFlashingEffect
.flashingEffect ; do a flashing effect if it's Master Ball or Ultra Ball
- ld a, [rOBP0]
+ ldh a, [rOBP0]
xor %00111100 ; complement colors 1 and 2
- ld [rOBP0], a
+ ldh [rOBP0], a
.skipFlashingEffect
ld a, [wSubAnimCounter]
cp 11 ; is it the beginning of the subanimation?
@@ -695,7 +695,7 @@
dec b
jr nz, .loop
ld a, %00001000
- ld [rNR10], a ; Channel 1 sweep register
+ ldh [rNR10], a ; Channel 1 sweep register
ret
.isTrainerBattle ; if it's a trainer battle, shorten the animation by one frame
ld a, [wSubAnimCounter]
@@ -882,9 +882,9 @@
ld c, 5
call DelayFrames
pop bc
- ld a, [hSCX] ; background scroll X
+ ldh a, [hSCX] ; background scroll X
sub 8 ; scroll to the left
- ld [hSCX], a
+ ldh [hSCX], a
pop de
jr .loop
@@ -920,16 +920,16 @@
; calls a function with the turn flipped from player to enemy or vice versa
; input - hl - address of function to call
CallWithTurnFlipped:
- ld a, [hWhoseTurn]
+ ldh a, [hWhoseTurn]
push af
xor 1
- ld [hWhoseTurn], a
+ ldh [hWhoseTurn], a
ld de, .returnAddress
push de
jp hl
.returnAddress
pop af
- ld [hWhoseTurn], a
+ ldh [hWhoseTurn], a
ret
; flashes the screen for an extended period (48 frames)
@@ -947,7 +947,7 @@
ld a, [hli]
cp $01 ; is it the end of the palettes?
jr z, .endOfPalettes
- ld [rBGP], a
+ ldh [rBGP], a
call FlashScreenLongDelay
jr .innerLoop
.endOfPalettes
@@ -1006,18 +1006,18 @@
jp DelayFrames
AnimationFlashScreen:
- ld a, [rBGP]
+ ldh a, [rBGP]
push af ; save initial palette
ld a, %00011011 ; 0, 1, 2, 3 (inverted colors)
- ld [rBGP], a
+ ldh [rBGP], a
ld c, 2
call DelayFrames
xor a ; white out background
- ld [rBGP], a
+ ldh [rBGP], a
ld c, 2
call DelayFrames
pop af
- ld [rBGP], a ; restore initial palette
+ ldh [rBGP], a ; restore initial palette
ret
AnimationDarkScreenPalette:
@@ -1062,7 +1062,7 @@
jr z, .next
ld a, c
.next
- ld [rBGP], a
+ ldh [rBGP], a
ret
ld b, $5
@@ -1133,7 +1133,7 @@
AnimationSlideMonUp:
; Slides the mon's sprite upwards.
ld c, 7
- ld a, [hWhoseTurn]
+ ldh a, [hWhoseTurn]
and a
coord hl, 1, 6
coord de, 1, 5
@@ -1201,7 +1201,7 @@
jr nz, .slideLoop
; Fill in the bottom row of the mon pic with the next row's tile IDs.
- ld a, [hWhoseTurn]
+ ldh a, [hWhoseTurn]
and a
coord hl, 1, 11
jr z, .next
@@ -1370,7 +1370,7 @@
AnimationShakeBackAndForth:
; Shakes the mon's sprite back and forth rapidly. This is used in Double Team.
; The mon's sprite disappears after this animation.
- ld a, [hWhoseTurn]
+ ldh a, [hWhoseTurn]
and a
coord hl, 0, 5
coord de, 2, 5
@@ -1418,7 +1418,7 @@
; Shifts the mon's sprite horizontally to a fixed location. Used by lots of
; animations like Tackle/Body Slam.
call AnimationHideMonPic
- ld a, [hWhoseTurn]
+ ldh a, [hWhoseTurn]
and a
coord hl, 2, 5
jr z, .next
@@ -1434,7 +1434,7 @@
AnimationResetMonPosition:
; Resets the mon's sprites to be located at the normal coordinates.
- ld a, [hWhoseTurn]
+ ldh a, [hWhoseTurn]
and a
ld a, 5 * SCREEN_WIDTH + 2
jr z, .next
@@ -1446,7 +1446,7 @@
AnimationSpiralBallsInward:
; Creates an effect that looks like energy balls spiralling into the
; player mon's sprite. Used in Focus Energy, for example.
- ld a, [hWhoseTurn]
+ ldh a, [hWhoseTurn]
and a
jr z, .playerTurn
ld a, -40
@@ -1530,7 +1530,7 @@
ld c, 4
.loop
push bc
- ld a, [hWhoseTurn]
+ ldh a, [hWhoseTurn]
and a
jr z, .playerTurn
coord hl, 16, 0
@@ -1583,7 +1583,7 @@
AnimationShootBallsUpward:
; Shoots one pillar of "energy" balls upwards. Used in Teleport/Sky Attack
; animations.
- ld a, [hWhoseTurn]
+ ldh a, [hWhoseTurn]
and a
jr z, .playerTurn
lb bc, 0, 16 * 8
@@ -1651,7 +1651,7 @@
AnimationShootManyBallsUpward:
; Shoots several pillars of "energy" balls upward.
- ld a, [hWhoseTurn]
+ ldh a, [hWhoseTurn]
and a
ld hl, UpwardBallsAnimXCoordinatesPlayerTurn
ld a, $50 ; y coordinate for "energy" ball pillar
@@ -1743,7 +1743,7 @@
_AnimationSlideMonOff:
; Slides the mon's sprite off the screen horizontally by e tiles and waits
; [wSlideMonDelay] V-blanks each time the pic is slid by one tile.
- ld a, [hWhoseTurn]
+ ldh a, [hWhoseTurn]
and a
jr z, .playerTurn
coord hl, 12, 0
@@ -1758,7 +1758,7 @@
.rowLoop ; iterates once for each row
ld c, 8
.tileLoop ; iterates once for each tile in the row
- ld a, [hWhoseTurn]
+ ldh a, [hWhoseTurn]
and a
jr z, .playerTurn2
call .EnemyNextTile
@@ -1821,7 +1821,7 @@
jp Delay3
CopyTempPicToMonPic:
- ld a, [hWhoseTurn]
+ ldh a, [hWhoseTurn]
and a
ld hl, vBackPic ; player turn
jr z, .next
@@ -1837,9 +1837,9 @@
call BattleAnimCopyTileMapToVRAM
call Delay3
xor a
- ld [hAutoBGTransferEnabled], a
+ ldh [hAutoBGTransferEnabled], a
ld a, SCREEN_HEIGHT_PX
- ld [hWY], a
+ ldh [hWY], a
ld d, $80 ; terminator
ld e, SCREEN_HEIGHT_PX - 1
ld c, $ff
@@ -1848,7 +1848,7 @@
push hl
.innerLoop
call WavyScreen_SetSCX
- ld a, [rLY]
+ ldh a, [rLY]
cp e ; is it the last visible line in the frame?
jr nz, .innerLoop ; keep going if not
pop hl
@@ -1861,11 +1861,11 @@
dec c
jr nz, .loop
xor a
- ld [hWY], a
+ ldh [hWY], a
call SaveScreenTilesToBuffer2
call ClearScreen
ld a, 1
- ld [hAutoBGTransferEnabled], a
+ ldh [hAutoBGTransferEnabled], a
call Delay3
call LoadScreenTilesFromBuffer2
ld hl, vBGMap1
@@ -1873,11 +1873,11 @@
ret
WavyScreen_SetSCX:
- ld a, [rSTAT]
+ ldh a, [rSTAT]
and $3 ; is it H-blank?
jr nz, WavyScreen_SetSCX ; wait until it's H-blank
ld a, [hl]
- ld [rSCX], a
+ ldh [rSCX], a
inc hl
ld a, [hl]
cp d ; have we reached the end?
@@ -1898,7 +1898,7 @@
xor a
ld bc, $310
call FillMemory
- ld a, [hWhoseTurn]
+ ldh a, [hWhoseTurn]
and a
jr z, .playerTurn
ld hl, SlowbroSprite ; facing down sprite
@@ -1937,7 +1937,7 @@
jp FarCopyData2
HideSubstituteShowMonAnim:
- ld a, [hWhoseTurn]
+ ldh a, [hWhoseTurn]
and a
ld hl, wPlayerMonMinimized
ld a, [wPlayerBattleStatus2]
@@ -1987,7 +1987,7 @@
ld [wChangeMonPicEnemyTurnSpecies], a
ChangeMonPic:
- ld a, [hWhoseTurn]
+ ldh a, [hWhoseTurn]
and a
jr z, .playerTurn
ld a, [wChangeMonPicEnemyTurnSpecies]
@@ -2020,11 +2020,11 @@
AnimationHideEnemyMonPic:
; Hides the enemy mon's sprite
xor a
- ld [hAutoBGTransferEnabled], a
+ ldh [hAutoBGTransferEnabled], a
ld hl, AnimationHideMonPic
call CallWithTurnFlipped
ld a, $1
- ld [hAutoBGTransferEnabled], a
+ ldh [hAutoBGTransferEnabled], a
jp Delay3
InitMultipleObjectsOAM:
@@ -2050,7 +2050,7 @@
AnimationHideMonPic:
; Hides the mon's sprite.
- ld a, [hWhoseTurn]
+ ldh a, [hWhoseTurn]
and a
jr z, .playerTurn
ld a, 12
@@ -2078,7 +2078,7 @@
; in order to show only a portion of the mon sprite.
GetMonSpriteTileMapPointerFromRowCount:
push de
- ld a, [hWhoseTurn]
+ ldh a, [hWhoseTurn]
and a
jr nz, .enemyTurn
ld a, 20 * 5 + 1
@@ -2166,7 +2166,7 @@
ld b, a
call IsCryMove
jr nc, .NotCryMove
- ld a, [hWhoseTurn]
+ ldh a, [hWhoseTurn]
and a
jr nz, .next
ld a, [wBattleMonSpecies] ; get number of current monster
@@ -2211,7 +2211,7 @@
INCLUDE "data/moves/sfx.asm"
CopyPicTiles:
- ld a, [hWhoseTurn]
+ ldh a, [hWhoseTurn]
and a
ld a, $31 ; base tile ID of player mon sprite
jr z, .next
@@ -2218,7 +2218,7 @@
; enemy turn
xor a ; base tile ID of enemy mon sprite
.next
- ld [hBaseTileID], a
+ ldh [hBaseTileID], a
jr CopyTileIDs_NoBGTransfer
; copy the tiles used when a mon is being sent out of or into a pokeball
@@ -2235,7 +2235,7 @@
CopyTileIDs_NoBGTransfer:
xor a
- ld [hAutoBGTransferEnabled], a
+ ldh [hAutoBGTransferEnabled], a
; fall through
; b = number of rows
@@ -2245,7 +2245,7 @@
.rowLoop
push bc
push hl
- ld a, [hBaseTileID]
+ ldh a, [hBaseTileID]
ld b, a
.columnLoop
ld a, [de]
@@ -2261,7 +2261,7 @@
dec b
jr nz, .rowLoop
ld a, $1
- ld [hAutoBGTransferEnabled], a
+ ldh [hAutoBGTransferEnabled], a
pop hl
ret
@@ -2361,16 +2361,16 @@
AnimationLeavesFalling:
; Makes leaves float down from the top of the screen. This is used
; in Razor Leaf's animation.
- ld a, [rOBP0]
+ ldh a, [rOBP0]
push af
ld a, [wAnimPalette]
- ld [rOBP0], a
+ ldh [rOBP0], a
ld d, $37 ; leaf tile
ld a, 3 ; number of leaves
ld [wNumFallingObjects], a
call AnimationFallingObjects
pop af
- ld [rOBP0], a
+ ldh [rOBP0], a
ret
AnimationPetalsFalling:
@@ -2529,7 +2529,7 @@
call CopyVideoData
xor a
- ld [hSCX], a
+ ldh [hSCX], a
; Copy wTileMap to BG map 0. The regular BG (not the window) is set to use
; map 0 and can be scrolled with SCX, which allows a shaking effect.
@@ -2539,7 +2539,7 @@
; Now that the regular BG is showing the same thing the window was, move the
; window off the screen so that we can modify its contents below.
ld a, SCREEN_HEIGHT_PX
- ld [hWY], a
+ ldh [hWY], a
; Copy wTileMap to VRAM such that the row below the enemy HUD (in wTileMap) is
; lined up with row 0 of the window.
@@ -2551,7 +2551,7 @@
; covers everything below the enemy HD with a copy that looks just like what
; was there before.
ld a, 7 * 8
- ld [hWY], a
+ ldh [hWY], a
; Write OAM entries so that the copy of the back pic from the top of this
; function shows up on screen. We need this because the back pic's Y coordinates
@@ -2576,11 +2576,11 @@
call AnimationShowMonPic
call ClearSprites
ld a, SCREEN_HEIGHT_PX
- ld [hWY], a
+ ldh [hWY], a
ld hl, vBGMap1
call BattleAnimCopyTileMapToVRAM
xor a
- ld [hWY], a
+ ldh [hWY], a
call SaveScreenTilesToBuffer1
ld hl, vBGMap0
call BattleAnimCopyTileMapToVRAM
@@ -2595,7 +2595,7 @@
CopyTileIDsFromList:
call GetPredefRegisters
ld a, c
- ld [hBaseTileID], a
+ ldh [hBaseTileID], a
ld a, b
push hl
call GetTileIDList
@@ -2603,30 +2603,30 @@
jp CopyTileIDs
ShakeEnemyHUD_ShakeBG:
- ld a, [hSCX]
+ ldh a, [hSCX]
ld [wTempSCX], a
.loop
ld a, [wTempSCX]
add d
- ld [hSCX], a
+ ldh [hSCX], a
ld c, 2
call DelayFrames
ld a, [wTempSCX]
sub d
- ld [hSCX], a
+ ldh [hSCX], a
ld c, 2
call DelayFrames
dec e
jr nz, .loop
ld a, [wTempSCX]
- ld [hSCX], a
+ ldh [hSCX], a
ret
BattleAnimCopyTileMapToVRAM:
ld a, h
- ld [hAutoBGTransferDest + 1], a
+ ldh [hAutoBGTransferDest + 1], a
ld a, l
- ld [hAutoBGTransferDest], a
+ ldh [hAutoBGTransferDest], a
jp Delay3
TossBallAnimation:
--- a/engine/battle/battle_transitions.asm
+++ b/engine/battle/battle_transitions.asm
@@ -1,9 +1,9 @@
BattleTransition:
ld a, 1
- ld [hAutoBGTransferEnabled], a
+ ldh [hAutoBGTransferEnabled], a
call Delay3
xor a
- ld [hWY], a
+ ldh [hWY], a
dec a
ld [wUpdateSpritesEnabled], a
call DelayFrame
@@ -11,7 +11,7 @@
; Determine which OAM block is being used by the enemy trainer sprite (if there
; is one).
ld hl, wSpritePlayerStateData1ImageIndex
- ld a, [hSpriteIndexOrTextID] ; enemy trainer sprite index (0 if wild battle)
+ ldh a, [hSpriteIndexOrTextID] ; enemy trainer sprite index (0 if wild battle)
ld c, a
ld b, 0
ld de, $10
@@ -165,9 +165,9 @@
BattleTransition_BlackScreen:
ld a, $ff
- ld [rBGP], a
- ld [rOBP0], a
- ld [rOBP1], a
+ ldh [rBGP], a
+ ldh [rOBP0], a
+ ldh [rOBP1], a
ret
; for non-dungeon trainer battles
@@ -330,7 +330,7 @@
ld a, [hli]
cp $1
jr z, .done
- ld [rBGP], a
+ ldh [rBGP], a
ld c, 2
call DelayFrames
jr .loop
@@ -349,7 +349,7 @@
.loop
push bc
xor a
- ld [hAutoBGTransferEnabled], a
+ ldh [hAutoBGTransferEnabled], a
coord hl, 0, 7
coord de, 0, 8
ld bc, -SCREEN_WIDTH * 2
@@ -367,7 +367,7 @@
ld bc, 2
call BattleTransition_CopyTiles2
ld a, $1
- ld [hAutoBGTransferEnabled], a
+ ldh [hAutoBGTransferEnabled], a
ld c, 6
call DelayFrames
pop bc
@@ -381,7 +381,7 @@
BattleTransition_Split:
ld c, SCREEN_HEIGHT / 2
xor a
- ld [hAutoBGTransferEnabled], a
+ ldh [hAutoBGTransferEnabled], a
.loop
push bc
coord hl, 0, 16
@@ -496,7 +496,7 @@
coord hl, 0, 0
coord de, 1, 17
xor a
- ld [hAutoBGTransferEnabled], a
+ ldh [hAutoBGTransferEnabled], a
.loop
push bc
push hl
@@ -535,7 +535,7 @@
coord hl, 0, 0
coord de, 19, 1
xor a
- ld [hAutoBGTransferEnabled], a
+ ldh [hAutoBGTransferEnabled], a
.loop
push bc
push hl
@@ -582,7 +582,7 @@
ld b, $3
call BattleTransition_FlashScreen_
xor a
- ld [hAutoBGTransferEnabled], a
+ ldh [hAutoBGTransferEnabled], a
ret
BattleTransition_Circle_Sub1:
@@ -601,10 +601,10 @@
BattleTransition_TransferDelay3:
ld a, 1
- ld [hAutoBGTransferEnabled], a
+ ldh [hAutoBGTransferEnabled], a
call Delay3
xor a
- ld [hAutoBGTransferEnabled], a
+ ldh [hAutoBGTransferEnabled], a
ret
; used for low level wild non-dungeon battles
--- a/engine/battle/common_text.asm
+++ b/engine/battle/common_text.asm
@@ -101,16 +101,16 @@
ld hl, GoText
jr z, .printText
xor a
- ld [hMultiplicand], a
+ ldh [hMultiplicand], a
ld hl, wEnemyMonHP
ld a, [hli]
ld [wLastSwitchInEnemyMonHP], a
- ld [hMultiplicand + 1], a
+ ldh [hMultiplicand + 1], a
ld a, [hl]
ld [wLastSwitchInEnemyMonHP + 1], a
- ld [hMultiplicand + 2], a
+ ldh [hMultiplicand + 2], a
ld a, 25
- ld [hMultiplier], a
+ ldh [hMultiplier], a
call Multiply
ld hl, wEnemyMonMaxHP
ld a, [hli]
@@ -121,9 +121,9 @@
rr b
ld a, b
ld b, 4
- ld [hDivisor], a ; enemy mon max HP divided by 4
+ ldh [hDivisor], a ; enemy mon max HP divided by 4
call Divide
- ld a, [hQuotient + 3] ; a = (enemy mon current HP * 25) / (enemy max HP / 4); this approximates the current percentage of max HP
+ ldh a, [hQuotient + 3] ; a = (enemy mon current HP * 25) / (enemy max HP / 4); this approximates the current percentage of max HP
ld hl, GoText ; 70% or greater
cp 70
jr nc, .printText
@@ -179,14 +179,14 @@
dec hl
ld a, [de]
sub b
- ld [hMultiplicand + 2], a
+ ldh [hMultiplicand + 2], a
dec de
ld b, [hl]
ld a, [de]
sbc b
- ld [hMultiplicand + 1], a
+ ldh [hMultiplicand + 1], a
ld a, 25
- ld [hMultiplier], a
+ ldh [hMultiplier], a
call Multiply
ld hl, wEnemyMonMaxHP
ld a, [hli]
@@ -197,11 +197,11 @@
rr b
ld a, b
ld b, 4
- ld [hDivisor], a
+ ldh [hDivisor], a
call Divide
pop bc
pop de
- ld a, [hQuotient + 3] ; a = ((LastSwitchInEnemyMonHP - CurrentEnemyMonHP) / 25) / (EnemyMonMaxHP / 4)
+ ldh a, [hQuotient + 3] ; a = ((LastSwitchInEnemyMonHP - CurrentEnemyMonHP) / 25) / (EnemyMonMaxHP / 4)
; Assuming that the enemy mon hasn't gained HP since the last switch in,
; a approximates the percentage that the enemy mon's total HP has decreased
; since the last switch in.
--- a/engine/battle/core.asm
+++ b/engine/battle/core.asm
@@ -48,25 +48,25 @@
jr nz, .copyRowLoop
call EnableLCD
ld a, $90
- ld [hWY], a
- ld [rWY], a
+ ldh [hWY], a
+ ldh [rWY], a
xor a
- ld [hTilesetType], a
- ld [hSCY], a
+ ldh [hTilesetType], a
+ ldh [hSCY], a
dec a
ld [wUpdateSpritesEnabled], a
call Delay3
xor a
- ld [hAutoBGTransferEnabled], a
+ ldh [hAutoBGTransferEnabled], a
ld b, $70
ld c, $90
ld a, c
- ld [hSCX], a
+ ldh [hSCX], a
call DelayFrame
ld a, %11100100 ; inverted palette for silhouette effect
- ld [rBGP], a
- ld [rOBP0], a
- ld [rOBP1], a
+ ldh [rBGP], a
+ ldh [rOBP0], a
+ ldh [rOBP1], a
.slideSilhouettesLoop ; slide silhouettes of the player's pic and the enemy's pic onto the screen
ld h, b
ld l, $40
@@ -78,21 +78,21 @@
call SetScrollXForSlidingPlayerBodyLeft ; end background scrolling on line $60
call SlidePlayerHeadLeft
ld a, c
- ld [hSCX], a
+ ldh [hSCX], a
dec c
dec c
jr nz, .slideSilhouettesLoop
ld a, $1
- ld [hAutoBGTransferEnabled], a
+ ldh [hAutoBGTransferEnabled], a
ld a, $31
- ld [hStartTileID], a
+ ldh [hStartTileID], a
coord hl, 1, 5
predef CopyUncompressedPicToTilemap
xor a
- ld [hWY], a
- ld [rWY], a
+ ldh [hWY], a
+ ldh [rWY], a
inc a
- ld [hAutoBGTransferEnabled], a
+ ldh [hAutoBGTransferEnabled], a
call Delay3
ld b, SET_PAL_BATTLE
call RunPaletteCommand
@@ -118,13 +118,13 @@
ret
SetScrollXForSlidingPlayerBodyLeft:
- ld a, [rLY]
+ ldh a, [rLY]
cp l
jr nz, SetScrollXForSlidingPlayerBodyLeft
ld a, h
- ld [rSCX], a
+ ldh [rSCX], a
.loop
- ld a, [rLY]
+ ldh a, [rLY]
cp h
jr z, .loop
ret
@@ -266,7 +266,7 @@
ld a, SFX_RUN
call PlaySoundWaitForCurrent
xor a
- ld [hWhoseTurn], a
+ ldh [hWhoseTurn], a
jpab AnimationSlideEnemyMonOff
WildRanText:
@@ -398,7 +398,7 @@
jr nc, .playerMovesFirst ; if player is faster
jr .enemyMovesFirst ; if enemy is faster
.speedEqual ; 50/50 chance for both players
- ld a, [hSerialConnectionStatus]
+ ldh a, [hSerialConnectionStatus]
cp USING_INTERNAL_CLOCK
jr z, .invertOutcome
call BattleRandom
@@ -412,7 +412,7 @@
jr .playerMovesFirst
.enemyMovesFirst
ld a, $1
- ld [hWhoseTurn], a
+ ldh [hWhoseTurn], a
callab TrainerAI
jr c, .AIActionUsedEnemyFirst
call ExecuteEnemyMove
@@ -450,7 +450,7 @@
jp z, HandlePlayerMonFainted
call DrawHUDsAndHPBars
ld a, $1
- ld [hWhoseTurn], a
+ ldh [hWhoseTurn], a
callab TrainerAI
jr c, .AIActionUsedPlayerFirst
call ExecuteEnemyMove
@@ -470,7 +470,7 @@
HandlePoisonBurnLeechSeed:
ld hl, wBattleMonHP
ld de, wBattleMonStatus
- ld a, [hWhoseTurn]
+ ldh a, [hWhoseTurn]
and a
jr z, .playersTurn
ld hl, wEnemyMonHP
@@ -495,7 +495,7 @@
call HandlePoisonBurnLeechSeed_DecreaseOwnHP
.notBurnedOrPoisoned
ld de, wPlayerBattleStatus2
- ld a, [hWhoseTurn]
+ ldh a, [hWhoseTurn]
and a
jr z, .playersTurn2
ld de, wEnemyBattleStatus2
@@ -504,16 +504,16 @@
add a
jr nc, .notLeechSeeded
push hl
- ld a, [hWhoseTurn]
+ ldh a, [hWhoseTurn]
push af
xor $1
- ld [hWhoseTurn], a
+ ldh [hWhoseTurn], a
xor a
ld [wAnimationType], a
ld a, ABSORB
call PlayMoveAnimation ; play leech seed animation (from opposing mon)
pop af
- ld [hWhoseTurn], a
+ ldh [hWhoseTurn], a
pop hl
call HandlePoisonBurnLeechSeed_DecreaseOwnHP
call HandlePoisonBurnLeechSeed_IncreaseEnemyHP
@@ -571,7 +571,7 @@
.nonZeroDamage
ld hl, wPlayerBattleStatus3
ld de, wPlayerToxicCounter
- ld a, [hWhoseTurn]
+ ldh a, [hWhoseTurn]
and a
jr z, .playersTurn
ld hl, wEnemyBattleStatus3
@@ -618,7 +618,7 @@
HandlePoisonBurnLeechSeed_IncreaseEnemyHP:
push hl
ld hl, wEnemyMonMaxHP
- ld a, [hWhoseTurn]
+ ldh a, [hWhoseTurn]
and a
jr z, .playersTurn
ld hl, wBattleMonMaxHP
@@ -655,19 +655,19 @@
ld [hl], a
ld [wHPBarNewHP], a
.noOverfullHeal
- ld a, [hWhoseTurn]
+ ldh a, [hWhoseTurn]
xor $1
- ld [hWhoseTurn], a
+ ldh [hWhoseTurn], a
call UpdateCurMonHPBar
- ld a, [hWhoseTurn]
+ ldh a, [hWhoseTurn]
xor $1
- ld [hWhoseTurn], a
+ ldh [hWhoseTurn], a
pop hl
ret
UpdateCurMonHPBar:
coord hl, 10, 9 ; tile pointer to player HP bar
- ld a, [hWhoseTurn]
+ ldh a, [hWhoseTurn]
and a
ld a, $1
jr z, .playersTurn
@@ -1232,7 +1232,7 @@
; if a is 8, the slide is to the right, else it is to the left
; bug: when this is called, [hAutoBGTransferEnabled] is non-zero, so there is screen tearing
SlideTrainerPicOffScreen:
- ld [hSlideAmount], a
+ ldh [hSlideAmount], a
ld c, a
.slideStepLoop ; each iteration, the trainer pic is slid one tile left/right
push bc
@@ -1240,10 +1240,10 @@
ld b, 7 ; number of rows
.rowLoop
push hl
- ld a, [hSlideAmount]
+ ldh a, [hSlideAmount]
ld c, a
.columnLoop
- ld a, [hSlideAmount]
+ ldh a, [hSlideAmount]
cp 8
jr z, .slideRight
.slideLeft ; slide player sprite off screen
@@ -1426,7 +1426,7 @@
ld de, vFrontPic
call LoadMonFrontSprite
ld a, -$31
- ld [hStartTileID], a
+ ldh [hStartTileID], a
coord hl, 15, 6
predef AnimateSendingOutMon
ld a, [wEnemyMonSpecies2]
@@ -1508,14 +1508,14 @@
inc a
ld [wNumRunAttempts], a
ld a, [hli]
- ld [hMultiplicand + 1], a
+ ldh [hMultiplicand + 1], a
ld a, [hl]
- ld [hMultiplicand + 2], a
+ ldh [hMultiplicand + 2], a
ld a, [de]
- ld [hEnemySpeed], a
+ ldh [hEnemySpeed], a
inc de
ld a, [de]
- ld [hEnemySpeed + 1], a
+ ldh [hEnemySpeed + 1], a
call LoadScreenTilesFromBuffer1
ld de, hMultiplicand + 1
ld hl, hEnemySpeed
@@ -1523,17 +1523,17 @@
call StringCmp
jr nc, .canEscape ; jump if player speed greater than enemy speed
xor a
- ld [hMultiplicand], a
+ ldh [hMultiplicand], a
ld a, 32
- ld [hMultiplier], a
+ ldh [hMultiplier], a
call Multiply ; multiply player speed by 32
- ld a, [hProduct + 2]
- ld [hDividend], a
- ld a, [hProduct + 3]
- ld [hDividend + 1], a
- ld a, [hEnemySpeed]
+ ldh a, [hProduct + 2]
+ ldh [hDividend], a
+ ldh a, [hProduct + 3]
+ ldh [hDividend + 1], a
+ ldh a, [hEnemySpeed]
ld b, a
- ld a, [hEnemySpeed + 1]
+ ldh a, [hEnemySpeed + 1]
; divide enemy speed by 4
srl b
rr a
@@ -1541,10 +1541,10 @@
rr a
and a
jr z, .canEscape ; jump if enemy speed divided by 4, mod 256 is 0
- ld [hDivisor], a ; ((enemy speed / 4) % 256)
+ ldh [hDivisor], a ; ((enemy speed / 4) % 256)
ld b, $2
call Divide ; divide (player speed * 32) by ((enemy speed / 4) % 256)
- ld a, [hQuotient + 2]
+ ldh a, [hQuotient + 2]
and a ; is the quotient greater than 256?
jr nz, .canEscape ; if so, the player can escape
ld a, [wNumRunAttempts]
@@ -1554,15 +1554,15 @@
dec c
jr z, .compareWithRandomValue
ld b, 30
- ld a, [hQuotient + 3]
+ ldh a, [hQuotient + 3]
add b
- ld [hQuotient + 3], a
+ ldh [hQuotient + 3], a
jr c, .canEscape
jr .loop
.compareWithRandomValue
call BattleRandom
ld b, a
- ld a, [hQuotient + 3]
+ ldh a, [hQuotient + 3]
cp b
jr nc, .canEscape ; if the random value was less than or equal to the quotient
; plus 30 times the number of attempts, the player can escape
@@ -1730,7 +1730,7 @@
call DrawPlayerHUDAndHPBar
predef LoadMonBackPic
xor a
- ld [hStartTileID], a
+ ldh [hStartTileID], a
ld hl, wBattleAndStartSavedMenuItem
ld [hli], a
ld [hl], a
@@ -1754,7 +1754,7 @@
ld hl, wEnemyBattleStatus1
res USING_TRAPPING_MOVE, [hl]
ld a, $1
- ld [hWhoseTurn], a
+ ldh [hWhoseTurn], a
ld a, POOF_ANIM
call PlayMoveAnimation
coord hl, 4, 11
@@ -1773,7 +1773,7 @@
lb bc, 5, 5
xor a
ld [wDownscaledMonSize], a
- ld [hBaseTileID], a
+ ldh [hBaseTileID], a
predef CopyDownscaledMonTiles
ld c, 4
call DelayFrames
@@ -1783,7 +1783,7 @@
ld a, 1
ld [wDownscaledMonSize], a
xor a
- ld [hBaseTileID], a
+ ldh [hBaseTileID], a
predef CopyDownscaledMonTiles
call Delay3
call .clearScreenArea
@@ -1812,7 +1812,7 @@
DrawPlayerHUDAndHPBar:
xor a
- ld [hAutoBGTransferEnabled], a
+ ldh [hAutoBGTransferEnabled], a
coord hl, 9, 7
lb bc, 5, 11
call ClearScreenArea
@@ -1845,7 +1845,7 @@
coord hl, 10, 9
predef DrawHP
ld a, $1
- ld [hAutoBGTransferEnabled], a
+ ldh [hAutoBGTransferEnabled], a
ld hl, wPlayerHPBarColor
call GetBattleHealthBarColor
ld hl, wBattleMonHP
@@ -1873,7 +1873,7 @@
DrawEnemyHUDAndHPBar:
xor a
- ld [hAutoBGTransferEnabled], a
+ ldh [hAutoBGTransferEnabled], a
coord hl, 0, 0
lb bc, 4, 12
call ClearScreenArea
@@ -1895,9 +1895,9 @@
.skipPrintLevel
ld hl, wEnemyMonHP
ld a, [hli]
- ld [hMultiplicand + 1], a
+ ldh [hMultiplicand + 1], a
ld a, [hld]
- ld [hMultiplicand + 2], a
+ ldh [hMultiplicand + 2], a
or [hl] ; is current HP zero?
jr nz, .hpNonzero
; current HP is 0
@@ -1908,45 +1908,45 @@
jp .drawHPBar
.hpNonzero
xor a
- ld [hMultiplicand], a
+ ldh [hMultiplicand], a
ld a, 48
- ld [hMultiplier], a
+ ldh [hMultiplier], a
call Multiply ; multiply current HP by 48
ld hl, wEnemyMonMaxHP
ld a, [hli]
ld b, a
ld a, [hl]
- ld [hDivisor], a
+ ldh [hDivisor], a
ld a, b
and a ; is max HP > 255?
jr z, .doDivide
; if max HP > 255, scale both (current HP * 48) and max HP by dividing by 4 so that max HP fits in one byte
; (it needs to be one byte so it can be used as the divisor for the Divide function)
- ld a, [hDivisor]
+ ldh a, [hDivisor]
srl b
rr a
srl b
rr a
- ld [hDivisor], a
- ld a, [hProduct + 2]
+ ldh [hDivisor], a
+ ldh a, [hProduct + 2]
ld b, a
srl b
- ld a, [hProduct + 3]
+ ldh a, [hProduct + 3]
rr a
srl b
rr a
- ld [hProduct + 3], a
+ ldh [hProduct + 3], a
ld a, b
- ld [hProduct + 2], a
+ ldh [hProduct + 2], a
.doDivide
- ld a, [hProduct + 2]
- ld [hDividend], a
- ld a, [hProduct + 3]
- ld [hDividend + 1], a
+ ldh a, [hProduct + 2]
+ ldh [hDividend], a
+ ldh a, [hProduct + 3]
+ ldh [hDividend + 1], a
ld a, $2
ld b, a
call Divide ; divide (current HP * 48) by max HP
- ld a, [hQuotient + 3]
+ ldh a, [hQuotient + 3]
; set variables for DrawHPBar
ld e, a
ld a, $6
@@ -1958,7 +1958,7 @@
coord hl, 2, 2
call DrawHPBar
ld a, $1
- ld [hAutoBGTransferEnabled], a
+ ldh [hAutoBGTransferEnabled], a
ld hl, wEnemyHPBarColor
GetBattleHealthBarColor:
@@ -2469,13 +2469,13 @@
.writemoves
ld de, wMovesString
- ld a, [hFlagsFFF6]
+ ldh a, [hFlagsFFF6]
set 2, a
- ld [hFlagsFFF6], a
+ ldh [hFlagsFFF6], a
call PlaceString
- ld a, [hFlagsFFF6]
+ ldh a, [hFlagsFFF6]
res 2, a
- ld [hFlagsFFF6], a
+ ldh [hFlagsFFF6], a
ret
.regularmenu
@@ -2825,7 +2825,7 @@
PrintMenuItem:
xor a
- ld [hAutoBGTransferEnabled], a
+ ldh [hAutoBGTransferEnabled], a
coord hl, 0, 8
ld b, 3
ld c, 9
@@ -2847,7 +2847,7 @@
ld hl, wCurrentMenuItem
dec [hl]
xor a
- ld [hWhoseTurn], a
+ ldh [hWhoseTurn], a
ld hl, wBattleMonMoves
ld a, [wCurrentMenuItem]
ld c, a
@@ -2891,7 +2891,7 @@
predef PrintMoveType
.moveDisabled
ld a, $1
- ld [hAutoBGTransferEnabled], a
+ ldh [hAutoBGTransferEnabled], a
jp Delay3
DisabledText:
@@ -3043,7 +3043,7 @@
ExecutePlayerMove:
xor a
- ld [hWhoseTurn], a ; set player's turn
+ ldh [hWhoseTurn], a ; set player's turn
ld a, [wPlayerSelectedMove]
inc a
jp z, ExecutePlayerMoveDone ; for selected move = FF, skip most of player's turn
@@ -3252,7 +3252,7 @@
; print the ghost battle messages
call IsGhostBattle
ret nz
- ld a, [hWhoseTurn]
+ ldh a, [hWhoseTurn]
and a
jr nz, .Ghost
ld a, [wBattleMonStatus] ; player’s turn
@@ -3619,7 +3619,7 @@
PrintMoveIsDisabledText:
ld hl, wPlayerSelectedMove
ld de, wPlayerBattleStatus1
- ld a, [hWhoseTurn]
+ ldh a, [hWhoseTurn]
and a
jr z, .removeChargingUp
inc hl
@@ -3675,11 +3675,11 @@
xor a
ld [wAnimationType], a
inc a
- ld [hWhoseTurn], a
+ ldh [hWhoseTurn], a
call PlayMoveAnimation
call DrawPlayerHUDAndHPBar
xor a
- ld [hWhoseTurn], a
+ ldh [hWhoseTurn], a
jp ApplyDamageToPlayerPokemon
PrintMonName1Text:
@@ -3694,7 +3694,7 @@
MonName1Text:
text_far _MonName1Text
text_asm
- ld a, [hWhoseTurn]
+ ldh a, [hWhoseTurn]
and a
ld a, [wPlayerMoveNum]
ld hl, wPlayerUsedMove
@@ -3818,7 +3818,7 @@
PrintMoveFailureText:
ld de, wPlayerMoveEffect
- ld a, [hWhoseTurn]
+ ldh a, [hWhoseTurn]
and a
jr z, .playersTurn
ld de, wEnemyMoveEffect
@@ -3866,7 +3866,7 @@
call PrintText
ld b, $4
predef PredefShakeScreenHorizontally
- ld a, [hWhoseTurn]
+ ldh a, [hWhoseTurn]
and a
jr nz, .enemyTurn
jp ApplyDamageToPlayerPokemon
@@ -4160,9 +4160,9 @@
; in the case of a critical hit, reset the player's attack and the enemy's defense to their base values
ld c, 3 ; defense stat
call GetEnemyMonStat
- ld a, [hProduct + 2]
+ ldh a, [hProduct + 2]
ld b, a
- ld a, [hProduct + 3]
+ ldh a, [hProduct + 3]
ld c, a
push bc
ld hl, wPartyMon1Attack
@@ -4192,9 +4192,9 @@
; in the case of a critical hit, reset the player's and enemy's specials to their base values
ld c, 5 ; special stat
call GetEnemyMonStat
- ld a, [hProduct + 2]
+ ldh a, [hProduct + 2]
ld b, a
- ld a, [hProduct + 3]
+ ldh a, [hProduct + 3]
ld c, a
push bc
ld hl, wPartyMon1Special
@@ -4371,9 +4371,9 @@
ld bc, wEnemyMon2 - wEnemyMon1
call AddNTimes
ld a, [hli]
- ld [hMultiplicand + 1], a
+ ldh [hMultiplicand + 1], a
ld a, [hl]
- ld [hMultiplicand + 2], a
+ ldh [hMultiplicand + 2], a
pop bc
pop de
ret
@@ -4404,7 +4404,7 @@
; d: base power
; e: level
- ld a, [hWhoseTurn] ; whose turn?
+ ldh a, [hWhoseTurn] ; whose turn?
and a
ld a, [wPlayerMoveEffect]
jr z, .effect
@@ -4489,25 +4489,25 @@
; Capped at MAX_NEUTRAL_DAMAGE - MIN_NEUTRAL_DAMAGE: 999 - 2 = 997.
ld hl, wDamage
ld b, [hl]
- ld a, [hQuotient + 3]
+ ldh a, [hQuotient + 3]
add b
- ld [hQuotient + 3], a
+ ldh [hQuotient + 3], a
jr nc, .dont_cap_1
- ld a, [hQuotient + 2]
+ ldh a, [hQuotient + 2]
inc a
- ld [hQuotient + 2], a
+ ldh [hQuotient + 2], a
and a
jr z, .cap
.dont_cap_1
- ld a, [hQuotient]
+ ldh a, [hQuotient]
ld b, a
- ld a, [hQuotient + 1]
+ ldh a, [hQuotient + 1]
or a
jr nz, .cap
- ld a, [hQuotient + 2]
+ ldh a, [hQuotient + 2]
cp (MAX_NEUTRAL_DAMAGE - MIN_NEUTRAL_DAMAGE + 1) / $100
jr c, .dont_cap_2
@@ -4514,7 +4514,7 @@
cp (MAX_NEUTRAL_DAMAGE - MIN_NEUTRAL_DAMAGE + 1) / $100 + 1
jr nc, .cap
- ld a, [hQuotient + 3]
+ ldh a, [hQuotient + 3]
cp (MAX_NEUTRAL_DAMAGE - MIN_NEUTRAL_DAMAGE + 1) % $100
jr nc, .cap
@@ -4521,12 +4521,12 @@
.dont_cap_2
inc hl
- ld a, [hQuotient + 3]
+ ldh a, [hQuotient + 3]
ld b, [hl]
add b
ld [hld], a
- ld a, [hQuotient + 2]
+ ldh a, [hQuotient + 2]
ld b, [hl]
adc b
ld [hl], a
@@ -4579,7 +4579,7 @@
CriticalHitTest:
xor a
ld [wCriticalHitOrOHKO], a
- ld a, [hWhoseTurn]
+ ldh a, [hWhoseTurn]
and a
ld a, [wEnemyMonSpecies]
jr nz, .handleEnemy
@@ -4590,7 +4590,7 @@
ld a, [wMonHBaseSpeed]
ld b, a
srl b ; (effective (base speed/2))
- ld a, [hWhoseTurn]
+ ldh a, [hWhoseTurn]
and a
ld hl, wPlayerMovePower
ld de, wPlayerBattleStatus2
@@ -4652,7 +4652,7 @@
; the outcome may be affected by the player's actions in the move selection menu prior to switching the Pokemon.
; This might also lead to desync glitches in link battles.
- ld a, [hWhoseTurn] ; whose turn
+ ldh a, [hWhoseTurn] ; whose turn
and a
; player's turn
ld hl, wEnemySelectedMove
@@ -4960,7 +4960,7 @@
; values for player turn
ld de, wEnemySubstituteHP
ld bc, wEnemyBattleStatus2
- ld a, [hWhoseTurn]
+ ldh a, [hWhoseTurn]
and a
jr z, .applyDamageToSubstitute
; values for enemy turn
@@ -4985,14 +4985,14 @@
ld hl, SubstituteBrokeText
call PrintText
; flip whose turn it is for the next function call
- ld a, [hWhoseTurn]
+ ldh a, [hWhoseTurn]
xor $01
- ld [hWhoseTurn], a
+ ldh [hWhoseTurn], a
callab HideSubstituteShowMonAnim ; animate the substitute breaking
; flip the turn back to the way it was
- ld a, [hWhoseTurn]
+ ldh a, [hWhoseTurn]
xor $01
- ld [hWhoseTurn], a
+ ldh [hWhoseTurn], a
ld hl, wPlayerMoveEffect ; value for player's turn
and a
jr z, .nullifyEffect
@@ -5016,7 +5016,7 @@
ld hl, wEnemyBattleStatus2
ld de, wEnemyMonStatMods
ld bc, wEnemyMoveNum
- ld a, [hWhoseTurn]
+ ldh a, [hWhoseTurn]
and a
jr z, .next
; values for the enemy turn
@@ -5029,9 +5029,9 @@
ld a, [de]
cp $0d ; maximum stat modifier value
ret z ; return if attack modifier is already maxed
- ld a, [hWhoseTurn]
+ ldh a, [hWhoseTurn]
xor $01 ; flip turn for the stat modifier raising function
- ld [hWhoseTurn], a
+ ldh [hWhoseTurn], a
; temporarily change the target pokemon's move to $00 and the effect to the one
; that causes the attack modifier to go up one stage
ld h, b
@@ -5048,9 +5048,9 @@
ldd [hl], a ; null move effect
ld a, RAGE
ld [hl], a ; restore the target pokemon's move number to Rage
- ld a, [hWhoseTurn]
+ ldh a, [hWhoseTurn]
xor $01 ; flip turn back to the way it was
- ld [hWhoseTurn], a
+ ldh [hWhoseTurn], a
ret
BuildingRageText:
@@ -5066,7 +5066,7 @@
; wPlayerUsedMove is also set to 0 whenever the player is fast asleep or frozen solid.
; wEnemyUsedMove is also set to 0 whenever the enemy is fast asleep or frozen solid.
- ld a, [hWhoseTurn]
+ ldh a, [hWhoseTurn]
and a
; values for player turn
ld a, [wEnemyUsedMove]
@@ -5119,7 +5119,7 @@
; values for player turn
ld de, wPlayerMoveNum
ld hl, wPlayerSelectedMove
- ld a, [hWhoseTurn]
+ ldh a, [hWhoseTurn]
and a
jr z, .pickMoveLoop
; values for enemy turn
@@ -5141,7 +5141,7 @@
; it's used to prevent moves that run another move within the same turn
; (like Mirror Move and Metronome) from losing 2 PP
IncrementMovePP:
- ld a, [hWhoseTurn]
+ ldh a, [hWhoseTurn]
and a
; values for player turn
ld hl, wBattleMonPP
@@ -5160,7 +5160,7 @@
ld h, d
ld l, e
add hl, bc
- ld a, [hWhoseTurn]
+ ldh a, [hWhoseTurn]
and a
ld a, [wPlayerMonNumber] ; value for player turn
jr z, .updatePP
@@ -5184,7 +5184,7 @@
ld e, [hl] ; e = type 2 of defender
ld a, [wPlayerMoveType]
ld [wMoveType], a
- ld a, [hWhoseTurn]
+ ldh a, [hWhoseTurn]
and a
jr z, .next
; values for enemy turn
@@ -5248,25 +5248,25 @@
and $80
ld b, a
ld a, [hl] ; a = damage multiplier
- ld [hMultiplier], a
+ ldh [hMultiplier], a
add b
ld [wDamageMultipliers], a
xor a
- ld [hMultiplicand], a
+ ldh [hMultiplicand], a
ld hl, wDamage
ld a, [hli]
- ld [hMultiplicand + 1], a
+ ldh [hMultiplicand + 1], a
ld a, [hld]
- ld [hMultiplicand + 2], a
+ ldh [hMultiplicand + 2], a
call Multiply
ld a, 10
- ld [hDivisor], a
+ ldh [hDivisor], a
ld b, $04
call Divide
- ld a, [hQuotient + 2]
+ ldh a, [hQuotient + 2]
ld [hli], a
ld b, a
- ld a, [hQuotient + 3]
+ ldh a, [hQuotient + 3]
ld [hl], a
or b ; is damage 0?
jr nz, .skipTypeImmunity
@@ -5331,7 +5331,7 @@
ld hl, wEnemyBattleStatus1
ld de, wPlayerMoveEffect
ld bc, wEnemyMonStatus
- ld a, [hWhoseTurn]
+ ldh a, [hWhoseTurn]
and a
jr z, .dreamEaterCheck
; enemy's turn
@@ -5360,7 +5360,7 @@
.checkForDigOrFlyStatus
bit INVULNERABLE, [hl]
jp nz, .moveMissed
- ld a, [hWhoseTurn]
+ ldh a, [hWhoseTurn]
and a
jr nz, .enemyTurn
.playerTurn
@@ -5414,7 +5414,7 @@
call CalcHitChance ; scale the move accuracy according to attacker's accuracy and target's evasion
ld a, [wPlayerMoveAccuracy]
ld b, a
- ld a, [hWhoseTurn]
+ ldh a, [hWhoseTurn]
and a
jr z, .doAccuracyCheck
ld a, [wEnemyMoveAccuracy]
@@ -5433,7 +5433,7 @@
ld [hl], a
inc a
ld [wMoveMissed], a
- ld a, [hWhoseTurn]
+ ldh a, [hWhoseTurn]
and a
jr z, .playerTurn2
.enemyTurn2
@@ -5448,7 +5448,7 @@
; values for player turn
CalcHitChance:
ld hl, wPlayerMoveAccuracy
- ld a, [hWhoseTurn]
+ ldh a, [hWhoseTurn]
and a
ld a, [wPlayerMonAccuracyMod]
ld b, a
@@ -5468,10 +5468,10 @@
; decreases the hit chance instead of increasing the hit chance)
; zero the high bytes of the multiplicand
xor a
- ld [hMultiplicand], a
- ld [hMultiplicand + 1], a
+ ldh [hMultiplicand], a
+ ldh [hMultiplicand + 1], a
ld a, [hl]
- ld [hMultiplicand + 2], a ; set multiplicand to move accuracy
+ ldh [hMultiplicand + 2], a ; set multiplicand to move accuracy
push hl
ld d, $02 ; loop has two iterations
; loop to do the calculations, the first iteration multiplies by the accuracy ratio and
@@ -5486,29 +5486,29 @@
add hl, bc ; hl = address of stat modifier ratio
pop bc
ld a, [hli]
- ld [hMultiplier], a ; set multiplier to the numerator of the ratio
+ ldh [hMultiplier], a ; set multiplier to the numerator of the ratio
call Multiply
ld a, [hl]
- ld [hDivisor], a ; set divisor to the the denominator of the ratio
+ ldh [hDivisor], a ; set divisor to the the denominator of the ratio
; (the dividend is the product of the previous multiplication)
ld b, $04 ; number of bytes in the dividend
call Divide
- ld a, [hQuotient + 3]
+ ldh a, [hQuotient + 3]
ld b, a
- ld a, [hQuotient + 2]
+ ldh a, [hQuotient + 2]
or b
jp nz, .nextCalculation
; make sure the result is always at least one
- ld [hQuotient + 2], a
+ ldh [hQuotient + 2], a
ld a, $01
- ld [hQuotient + 3], a
+ ldh [hQuotient + 3], a
.nextCalculation
ld b, c
dec d
jr nz, .loop
- ld a, [hQuotient + 2]
+ ldh a, [hQuotient + 2]
and a ; is the calculated hit chance over 0xFF?
- ld a, [hQuotient + 3]
+ ldh a, [hQuotient + 3]
jr z, .storeAccuracy
; if calculated hit chance over 0xFF
ld a, $ff ; set the hit chance to 0xFF
@@ -5528,12 +5528,12 @@
ret c ; return if damage is equal to 0 or 1
.DamageGreaterThanOne
xor a
- ld [hMultiplicand], a
+ ldh [hMultiplicand], a
dec hl
ld a, [hli]
- ld [hMultiplicand + 1], a
+ ldh [hMultiplicand + 1], a
ld a, [hl]
- ld [hMultiplicand + 2], a
+ ldh [hMultiplicand + 2], a
; loop until a random number greater than or equal to 217 is generated
.loop
call BattleRandom
@@ -5540,17 +5540,17 @@
rrca
cp 217
jr c, .loop
- ld [hMultiplier], a
+ ldh [hMultiplier], a
call Multiply ; multiply damage by the random number, which is in the range [217, 255]
ld a, 255
- ld [hDivisor], a
+ ldh [hDivisor], a
ld b, $4
call Divide ; divide the result by 255
; store the modified damage
- ld a, [hQuotient + 2]
+ ldh a, [hQuotient + 2]
ld hl, wDamage
ld [hli], a
- ld a, [hQuotient + 3]
+ ldh a, [hQuotient + 3]
ld [hl], a
ret
@@ -5906,11 +5906,11 @@
ld [hl], a
xor a
ld [wAnimationType], a
- ld [hWhoseTurn], a
+ ldh [hWhoseTurn], a
ld a, POUND
call PlayMoveAnimation
ld a, $1
- ld [hWhoseTurn], a
+ ldh [hWhoseTurn], a
call ApplyDamageToEnemyPokemon
jr .monHurtItselfOrFullyParalysed
.checkIfTriedToUseDisabledMove
@@ -6057,7 +6057,7 @@
ret
GetCurrentMove:
- ld a, [hWhoseTurn]
+ ldh a, [hWhoseTurn]
and a
jp z, .player
ld de, wEnemyMoveNum
@@ -6263,16 +6263,16 @@
predef BattleTransition
callab LoadHudAndHpBarAndStatusTilePatterns
ld a, $1
- ld [hAutoBGTransferEnabled], a
+ ldh [hAutoBGTransferEnabled], a
ld a, $ff
ld [wUpdateSpritesEnabled], a
call ClearSprites
call ClearScreen
xor a
- ld [hAutoBGTransferEnabled], a
- ld [hWY], a
- ld [rWY], a
- ld [hTilesetType], a
+ ldh [hAutoBGTransferEnabled], a
+ ldh [hWY], a
+ ldh [rWY], a
+ ldh [hTilesetType], a
ld hl, wPlayerStatsToDouble
ld [hli], a
ld [hli], a
@@ -6309,7 +6309,7 @@
predef ScaleSpriteByTwo
ld hl, wOAMBuffer
xor a
- ld [hOAMTile], a ; initial tile number
+ ldh [hOAMTile], a ; initial tile number
ld b, $7 ; 7 columns
ld e, $a0 ; X for the left-most column
.loop ; each loop iteration writes 3 OAM entries in a vertical column
@@ -6323,16 +6323,16 @@
add d ; increase Y by height of tile
ld d, a
inc hl
- ld a, [hOAMTile]
+ ldh a, [hOAMTile]
ld [hli], a ; OAM tile number
inc a ; increment tile number
- ld [hOAMTile], a
+ ldh [hOAMTile], a
inc hl
dec c
jr nz, .innerLoop
- ld a, [hOAMTile]
+ ldh a, [hOAMTile]
add $4 ; increase tile number by 4
- ld [hOAMTile], a
+ ldh [hOAMTile], a
ld a, $8 ; width of tile
add e ; increase X by width of tile
ld e, a
@@ -6346,7 +6346,7 @@
ld [MBC1SRamBank], a
ld hl, vSprites
ld de, sSpriteBuffer1
- ld a, [hLoadedROMBank]
+ ldh a, [hLoadedROMBank]
ld b, a
ld c, 7 * 7
call CopyVideoData
@@ -6353,7 +6353,7 @@
xor a
ld [MBC1SRamEnable], a
ld a, $31
- ld [hStartTileID], a
+ ldh [hStartTileID], a
coord hl, 1, 5
predef_jump CopyUncompressedPicToTilemap
@@ -6373,12 +6373,12 @@
xor a
ApplyBurnAndParalysisPenalties:
- ld [hWhoseTurn], a
+ ldh [hWhoseTurn], a
call QuarterSpeedDueToParalysis
jp HalveAttackDueToBurn
QuarterSpeedDueToParalysis:
- ld a, [hWhoseTurn]
+ ldh a, [hWhoseTurn]
and a
jr z, .playerTurn
.enemyTurn ; quarter the player's speed
@@ -6421,7 +6421,7 @@
ret
HalveAttackDueToBurn:
- ld a, [hWhoseTurn]
+ ldh a, [hWhoseTurn]
and a
jr z, .playerTurn
.enemyTurn ; halve the player's attack
@@ -6511,35 +6511,35 @@
ld b, 0
add hl, bc
xor a
- ld [hMultiplicand], a
+ ldh [hMultiplicand], a
ld a, [de]
- ld [hMultiplicand + 1], a
+ ldh [hMultiplicand + 1], a
inc de
ld a, [de]
- ld [hMultiplicand + 2], a
+ ldh [hMultiplicand + 2], a
ld a, [hli]
- ld [hMultiplier], a
+ ldh [hMultiplier], a
call Multiply
ld a, [hl]
- ld [hDivisor], a
+ ldh [hDivisor], a
ld b, $4
call Divide
pop hl
- ld a, [hDividend + 3]
+ ldh a, [hDividend + 3]
sub 999 % $100
- ld a, [hDividend + 2]
+ ldh a, [hDividend + 2]
sbc 999 / $100
jp c, .storeNewStatValue
; cap the stat at 999
ld a, 999 / $100
- ld [hDividend + 2], a
+ ldh [hDividend + 2], a
ld a, 999 % $100
- ld [hDividend + 3], a
+ ldh [hDividend + 3], a
.storeNewStatValue
- ld a, [hDividend + 2]
+ ldh a, [hDividend + 2]
ld [hli], a
ld b, a
- ld a, [hDividend + 3]
+ ldh a, [hDividend + 3]
ld [hl], a
or b
jr nz, .done
@@ -6605,7 +6605,7 @@
call LoadHpBarAndStatusTilePatterns
LoadHudTilePatterns:
- ld a, [rLCDC]
+ ldh a, [rLCDC]
add a ; is LCD disabled?
jr c, .lcdEnabled
.lcdDisabled
@@ -6690,7 +6690,7 @@
HandleExplodingAnimation:
- ld a, [hWhoseTurn]
+ ldh a, [hWhoseTurn]
and a
ld hl, wEnemyMonType1
ld de, wEnemyBattleStatus1
@@ -6740,7 +6740,7 @@
ld a, [wd732]
bit 1, a
jr z, .asm_3ef2f
- ld a, [hJoyHeld]
+ ldh a, [hJoyHeld]
bit 1, a ; B button pressed?
ret nz
.asm_3ef2f
@@ -6767,7 +6767,7 @@
call _LoadTrainerPic
xor a
ld [wEnemyMonSpecies2], a
- ld [hStartTileID], a
+ ldh [hStartTileID], a
dec a
ld [wAICount], a
coord hl, 12, 0
@@ -6823,7 +6823,7 @@
.spriteLoaded
xor a
ld [wTrainerClass], a
- ld [hStartTileID], a
+ ldh [hStartTileID], a
coord hl, 12, 0
predef CopyUncompressedPicToTilemap
@@ -6833,18 +6833,18 @@
call RunPaletteCommand
call SlidePlayerAndEnemySilhouettesOnScreen
xor a
- ld [hAutoBGTransferEnabled], a
+ ldh [hAutoBGTransferEnabled], a
ld hl, .emptyString
call PrintText
call SaveScreenTilesToBuffer1
call ClearScreen
ld a, $98
- ld [hAutoBGTransferDest + 1], a
+ ldh [hAutoBGTransferDest + 1], a
ld a, $1
- ld [hAutoBGTransferEnabled], a
+ ldh [hAutoBGTransferEnabled], a
call Delay3
ld a, $9c
- ld [hAutoBGTransferDest + 1], a
+ ldh [hAutoBGTransferDest + 1], a
call LoadScreenTilesFromBuffer1
coord hl, 9, 7
lb bc, 5, 10
@@ -6863,7 +6863,7 @@
pop af
ld [wMapPalOffset], a
ld a, [wSavedTilesetType]
- ld [hTilesetType], a
+ ldh [hTilesetType], a
scf
ret
.emptyString
@@ -6900,8 +6900,8 @@
ld h, a
ld a, [wPredefRegisters + 1]
ld l, a
- ld a, [hStartTileID]
- ld [hBaseTileID], a
+ ldh a, [hStartTileID]
+ ldh [hBaseTileID], a
ld b, $4c
ld a, [wIsInBattle]
and a
@@ -6931,7 +6931,7 @@
ld bc, -(SCREEN_WIDTH * 6 + 3)
.next
add hl, bc
- ld a, [hBaseTileID]
+ ldh a, [hBaseTileID]
add $31
jr CopyUncompressedPicToHL
@@ -6940,7 +6940,7 @@
ld h, a
ld a, [wPredefRegisters + 1]
ld l, a
- ld a, [hStartTileID]
+ ldh a, [hStartTileID]
CopyUncompressedPicToHL::
lb bc, 7, 7
ld de, SCREEN_WIDTH
@@ -7005,6 +7005,6 @@
ld hl, vSprites
ld de, vBackPic
ld c, (2*SPRITEBUFFERSIZE)/16 ; count of 16-byte chunks to be copied
- ld a, [hLoadedROMBank]
+ ldh a, [hLoadedROMBank]
ld b, a
jp CopyVideoData
--- a/engine/battle/effects.asm
+++ b/engine/battle/effects.asm
@@ -4,7 +4,7 @@
ret
_JumpMoveEffect:
- ld a, [hWhoseTurn]
+ ldh a, [hWhoseTurn]
and a
ld a, [wPlayerMoveEffect]
jr z, .next1
@@ -26,7 +26,7 @@
SleepEffect:
ld de, wEnemyMonStatus
ld bc, wEnemyBattleStatus2
- ld a, [hWhoseTurn]
+ ldh a, [hWhoseTurn]
and a
jp z, .sleepEffect
ld de, wBattleMonStatus
@@ -78,7 +78,7 @@
PoisonEffect:
ld hl, wEnemyMonStatus
ld de, wPlayerMoveEffect
- ld a, [hWhoseTurn]
+ ldh a, [hWhoseTurn]
and a
jr z, .poisonEffect
ld hl, wBattleMonStatus
@@ -121,7 +121,7 @@
set 3, [hl] ; mon is now poisoned
push de
dec de
- ld a, [hWhoseTurn]
+ ldh a, [hWhoseTurn]
and a
ld b, ANIM_C7
ld hl, wPlayerBattleStatus3
@@ -175,7 +175,7 @@
ExplodeEffect:
ld hl, wBattleMonHP
ld de, wPlayerBattleStatus2
- ld a, [hWhoseTurn]
+ ldh a, [hWhoseTurn]
and a
jr z, .faintUser
ld hl, wEnemyMonHP
@@ -196,7 +196,7 @@
ld [wAnimationType], a
call CheckTargetSubstitute ; test bit 4 of d063/d068 flags [target has substitute flag]
ret nz ; return if they have a substitute, can't effect them
- ld a, [hWhoseTurn]
+ ldh a, [hWhoseTurn]
and a
jp nz, opponentAttacker
ld a, [wEnemyMonStatus]
@@ -308,7 +308,7 @@
; any fire-type move that has a chance inflict burn (all but Fire Spin) will defrost a frozen target
and 1 << FRZ ; are they frozen?
ret z ; return if so
- ld a, [hWhoseTurn]
+ ldh a, [hWhoseTurn]
and a
jr nz, .opponent
;player [attacker]
@@ -346,7 +346,7 @@
StatModifierUpEffect:
ld hl, wPlayerMonStatMods
ld de, wPlayerMoveEffect
- ld a, [hWhoseTurn]
+ ldh a, [hWhoseTurn]
and a
jr z, .statModifierUpEffect
ld hl, wEnemyMonStatMods
@@ -382,7 +382,7 @@
push hl
ld hl, wBattleMonAttack + 1
ld de, wPlayerMonUnmodifiedAttack
- ld a, [hWhoseTurn]
+ ldh a, [hWhoseTurn]
and a
jr z, .pointToStats
ld hl, wEnemyMonAttack + 1
@@ -417,35 +417,35 @@
add hl, bc
pop bc
xor a
- ld [hMultiplicand], a
+ ldh [hMultiplicand], a
ld a, [de]
- ld [hMultiplicand + 1], a
+ ldh [hMultiplicand + 1], a
inc de
ld a, [de]
- ld [hMultiplicand + 2], a
+ ldh [hMultiplicand + 2], a
ld a, [hli]
- ld [hMultiplier], a
+ ldh [hMultiplier], a
call Multiply
ld a, [hl]
- ld [hDivisor], a
+ ldh [hDivisor], a
ld b, $4
call Divide
pop hl
; cap at 999
- ld a, [hProduct + 3]
+ ldh a, [hProduct + 3]
sub 999 % $100
- ld a, [hProduct + 2]
+ ldh a, [hProduct + 2]
sbc 999 / $100
jp c, UpdateStat
ld a, 999 / $100
- ld [hMultiplicand + 1], a
+ ldh [hMultiplicand + 1], a
ld a, 999 % $100
- ld [hMultiplicand + 2], a
+ ldh [hMultiplicand + 2], a
UpdateStat:
- ld a, [hProduct + 2]
+ ldh a, [hProduct + 2]
ld [hli], a
- ld a, [hProduct + 3]
+ ldh a, [hProduct + 3]
ld [hl], a
pop hl
UpdateStatDone:
@@ -455,7 +455,7 @@
ld hl, wPlayerBattleStatus2
ld de, wPlayerMoveNum
ld bc, wPlayerMonMinimized
- ld a, [hWhoseTurn]
+ ldh a, [hWhoseTurn]
and a
jr z, .asm_3f4e6
ld hl, wEnemyBattleStatus2
@@ -488,7 +488,7 @@
pop af
call nz, Bankswitch
.applyBadgeBoostsAndStatusPenalties
- ld a, [hWhoseTurn]
+ ldh a, [hWhoseTurn]
and a
call z, ApplyBadgeStatBoosts ; whenever the player uses a stat-up move, badge boosts get reapplied again to every stat,
; even to those not affected by the stat-up move (will be boosted further)
@@ -511,7 +511,7 @@
text_far _MonsStatsRoseText
text_asm
ld hl, GreatlyRoseText
- ld a, [hWhoseTurn]
+ ldh a, [hWhoseTurn]
and a
ld a, [wPlayerMoveEffect]
jr z, .playerTurn
@@ -534,7 +534,7 @@
ld hl, wEnemyMonStatMods
ld de, wPlayerMoveEffect
ld bc, wEnemyBattleStatus1
- ld a, [hWhoseTurn]
+ ldh a, [hWhoseTurn]
and a
jr z, .statModifierDownEffect
ld hl, wPlayerMonStatMods
@@ -601,7 +601,7 @@
push de
ld hl, wEnemyMonAttack + 1
ld de, wEnemyMonUnmodifiedAttack
- ld a, [hWhoseTurn]
+ ldh a, [hWhoseTurn]
and a
jr z, .pointToStat
ld hl, wBattleMonAttack + 1
@@ -637,33 +637,33 @@
add hl, bc
pop bc
xor a
- ld [hMultiplicand], a
+ ldh [hMultiplicand], a
ld a, [de]
- ld [hMultiplicand + 1], a
+ ldh [hMultiplicand + 1], a
inc de
ld a, [de]
- ld [hMultiplicand + 2], a
+ ldh [hMultiplicand + 2], a
ld a, [hli]
- ld [hMultiplier], a
+ ldh [hMultiplier], a
call Multiply
ld a, [hl]
- ld [hDivisor], a
+ ldh [hDivisor], a
ld b, $4
call Divide
pop hl
- ld a, [hProduct + 3]
+ ldh a, [hProduct + 3]
ld b, a
- ld a, [hProduct + 2]
+ ldh a, [hProduct + 2]
or b
jp nz, UpdateLoweredStat
- ld [hMultiplicand + 1], a
+ ldh [hMultiplicand + 1], a
ld a, $1
- ld [hMultiplicand + 2], a
+ ldh [hMultiplicand + 2], a
UpdateLoweredStat:
- ld a, [hProduct + 2]
+ ldh a, [hProduct + 2]
ld [hli], a
- ld a, [hProduct + 3]
+ ldh a, [hProduct + 3]
ld [hl], a
pop de
pop hl
@@ -678,7 +678,7 @@
jr nc, .ApplyBadgeBoostsAndStatusPenalties
call PlayCurrentMoveAnimation2
.ApplyBadgeBoostsAndStatusPenalties
- ld a, [hWhoseTurn]
+ ldh a, [hWhoseTurn]
and a
call nz, ApplyBadgeStatBoosts ; whenever the player uses a stat-down move, badge boosts get reapplied again to every stat,
; even to those not affected by the stat-up move (will be boosted further)
@@ -713,7 +713,7 @@
text_far _MonsStatsFellText
text_asm
ld hl, FellText
- ld a, [hWhoseTurn]
+ ldh a, [hWhoseTurn]
and a
ld a, [wPlayerMoveEffect]
jr z, .playerTurn
@@ -759,7 +759,7 @@
ld hl, wPlayerBattleStatus1
ld de, wPlayerBideAccumulatedDamage
ld bc, wPlayerNumAttacksLeft
- ld a, [hWhoseTurn]
+ ldh a, [hWhoseTurn]
and a
jr z, .bideEffect
ld hl, wEnemyBattleStatus1
@@ -778,7 +778,7 @@
inc a
inc a
ld [bc], a ; set Bide counter to 2 or 3 at random
- ld a, [hWhoseTurn]
+ ldh a, [hWhoseTurn]
add XSTATITEM_ANIM
jp PlayBattleAnimation2
@@ -785,7 +785,7 @@
ThrashPetalDanceEffect:
ld hl, wPlayerBattleStatus1
ld de, wPlayerNumAttacksLeft
- ld a, [hWhoseTurn]
+ ldh a, [hWhoseTurn]
and a
jr z, .thrashPetalDanceEffect
ld hl, wEnemyBattleStatus1
@@ -797,12 +797,12 @@
inc a
inc a
ld [de], a ; set thrash/petal dance counter to 2 or 3 at random
- ld a, [hWhoseTurn]
+ ldh a, [hWhoseTurn]
add ANIM_B0
jp PlayBattleAnimation2
SwitchAndTeleportEffect:
- ld a, [hWhoseTurn]
+ ldh a, [hWhoseTurn]
and a
jr nz, .handleEnemy
ld a, [wIsInBattle]
@@ -920,7 +920,7 @@
ld hl, wPlayerBattleStatus1
ld de, wPlayerNumAttacksLeft
ld bc, wPlayerNumHits
- ld a, [hWhoseTurn]
+ ldh a, [hWhoseTurn]
and a
jr z, .twoToFiveAttacksEffect
ld hl, wEnemyBattleStatus1
@@ -931,7 +931,7 @@
ret nz
set ATTACKING_MULTIPLE_TIMES, [hl] ; mon is now attacking multiple times
ld hl, wPlayerMoveEffect
- ld a, [hWhoseTurn]
+ ldh a, [hWhoseTurn]
and a
jr z, .setNumberOfHits
ld hl, wEnemyMoveEffect
@@ -967,7 +967,7 @@
ret nz
ld hl, wEnemyBattleStatus1
ld de, wPlayerMoveEffect
- ld a, [hWhoseTurn]
+ ldh a, [hWhoseTurn]
and a
jr z, .flinchSideEffect
ld hl, wPlayerBattleStatus1
@@ -992,7 +992,7 @@
ChargeEffect:
ld hl, wPlayerBattleStatus1
ld de, wPlayerMoveEffect
- ld a, [hWhoseTurn]
+ ldh a, [hWhoseTurn]
and a
ld b, XSTATITEM_ANIM
jr z, .chargeEffect
@@ -1074,7 +1074,7 @@
TrappingEffect:
ld hl, wPlayerBattleStatus1
ld de, wPlayerNumAttacksLeft
- ld a, [hWhoseTurn]
+ ldh a, [hWhoseTurn]
and a
jr z, .trappingEffect
ld hl, wEnemyBattleStatus1
@@ -1120,7 +1120,7 @@
jr nz, ConfusionEffectFailed
ConfusionSideEffectSuccess:
- ld a, [hWhoseTurn]
+ ldh a, [hWhoseTurn]
and a
ld hl, wEnemyBattleStatus1
ld bc, wEnemyConfusedCounter
@@ -1164,7 +1164,7 @@
HyperBeamEffect:
ld hl, wPlayerBattleStatus2
- ld a, [hWhoseTurn]
+ ldh a, [hWhoseTurn]
and a
jr z, .hyperBeamEffect
ld hl, wEnemyBattleStatus2
@@ -1175,7 +1175,7 @@
ClearHyperBeam:
push hl
ld hl, wEnemyBattleStatus2
- ld a, [hWhoseTurn]
+ ldh a, [hWhoseTurn]
and a
jr z, .playerTurn
ld hl, wPlayerBattleStatus2
@@ -1186,7 +1186,7 @@
RageEffect:
ld hl, wPlayerBattleStatus2
- ld a, [hWhoseTurn]
+ ldh a, [hWhoseTurn]
and a
jr z, .player
ld hl, wEnemyBattleStatus2
@@ -1201,7 +1201,7 @@
ld a, [wMoveMissed]
and a
jr nz, .mimicMissed
- ld a, [hWhoseTurn]
+ ldh a, [hWhoseTurn]
and a
ld hl, wBattleMonMoves
ld a, [wPlayerBattleStatus1]
@@ -1226,7 +1226,7 @@
and a
jr z, .getRandomMove
ld d, a
- ld a, [hWhoseTurn]
+ ldh a, [hWhoseTurn]
and a
ld hl, wBattleMonMoves
ld a, [wPlayerMoveListIndex]
@@ -1284,7 +1284,7 @@
jr nz, .moveMissed
ld de, wEnemyDisabledMove
ld hl, wEnemyMonMoves
- ld a, [hWhoseTurn]
+ ldh a, [hWhoseTurn]
and a
jr z, .disableEffect
ld de, wPlayerDisabledMove
@@ -1307,7 +1307,7 @@
jr z, .pickMoveToDisable ; loop until a non-00 move slot is found
ld [wd11e], a ; store move number
push hl
- ld a, [hWhoseTurn]
+ ldh a, [hWhoseTurn]
and a
ld hl, wBattleMonPP
jr nz, .enemyTurn
@@ -1345,7 +1345,7 @@
ld [de], a
call PlayCurrentMoveAnimation2
ld hl, wPlayerDisabledMoveNumber
- ld a, [hWhoseTurn]
+ ldh a, [hWhoseTurn]
and a
jr nz, .printDisableText
inc hl ; wEnemyDisabledMoveNumber
@@ -1430,7 +1430,7 @@
CheckTargetSubstitute:
push hl
ld hl, wEnemyBattleStatus2
- ld a, [hWhoseTurn]
+ ldh a, [hWhoseTurn]
and a
jr z, .next1
ld hl, wPlayerBattleStatus2
@@ -1442,7 +1442,7 @@
PlayCurrentMoveAnimation2:
; animation at MOVENUM will be played unless MOVENUM is 0
; plays wAnimationType 3 or 6
- ld a, [hWhoseTurn]
+ ldh a, [hWhoseTurn]
and a
ld a, [wPlayerMoveNum]
jr z, .notEnemyTurn
@@ -1454,7 +1454,7 @@
PlayBattleAnimation2:
; play animation ID at a and animation type 6 or 3
ld [wAnimationID], a
- ld a, [hWhoseTurn]
+ ldh a, [hWhoseTurn]
and a
ld a, $6
jr z, .storeAnimationType
@@ -1468,7 +1468,7 @@
; resets wAnimationType
xor a
ld [wAnimationType], a
- ld a, [hWhoseTurn]
+ ldh a, [hWhoseTurn]
and a
ld a, [wPlayerMoveNum]
jr z, .notEnemyTurn
--- a/engine/battle/experience.asm
+++ b/engine/battle/experience.asm
@@ -55,15 +55,15 @@
jr .gainStatExpLoop
.statExpDone
xor a
- ld [hMultiplicand], a
- ld [hMultiplicand + 1], a
+ ldh [hMultiplicand], a
+ ldh [hMultiplicand + 1], a
ld a, [wEnemyMonBaseExp]
- ld [hMultiplicand + 2], a
+ ldh [hMultiplicand + 2], a
ld a, [wEnemyMonLevel]
- ld [hMultiplier], a
+ ldh [hMultiplier], a
call Multiply
ld a, 7
- ld [hDivisor], a
+ ldh [hDivisor], a
ld b, 4
call Divide
ld hl, wPartyMon1OTID - (wPartyMon1DVs - 1)
@@ -91,12 +91,12 @@
inc hl
; add the gained exp to the party mon's exp
ld b, [hl]
- ld a, [hQuotient + 3]
+ ldh a, [hQuotient + 3]
ld [wExpAmountGained + 1], a
add b
ld [hld], a
ld b, [hl]
- ld a, [hQuotient + 2]
+ ldh a, [hQuotient + 2]
ld [wExpAmountGained], a
adc b
ld [hl], a
@@ -119,11 +119,11 @@
ld d, MAX_LEVEL
callab CalcExperience ; get max exp
; compare max exp with current exp
- ld a, [hExperience]
+ ldh a, [hExperience]
ld b, a
- ld a, [hExperience + 1]
+ ldh a, [hExperience + 1]
ld c, a
- ld a, [hExperience + 2]
+ ldh a, [hExperience + 2]
ld d, a
pop hl
ld a, [hld]
@@ -311,14 +311,14 @@
ld c, wEnemyMonBaseExp + 1 - wEnemyMonBaseStats
.divideLoop
xor a
- ld [hDividend], a
+ ldh [hDividend], a
ld a, [hl]
- ld [hDividend + 1], a
+ ldh [hDividend + 1], a
ld a, [wd11e]
- ld [hDivisor], a
+ ldh [hDivisor], a
ld b, $2
call Divide ; divide value by number of mons gaining exp
- ld a, [hQuotient + 3]
+ ldh a, [hQuotient + 3]
ld [hli], a
dec c
jr nz, .divideLoop
@@ -326,17 +326,17 @@
; multiplies exp by 1.5
BoostExp:
- ld a, [hQuotient + 2]
+ ldh a, [hQuotient + 2]
ld b, a
- ld a, [hQuotient + 3]
+ ldh a, [hQuotient + 3]
ld c, a
srl b
rr c
add c
- ld [hQuotient + 3], a
- ld a, [hQuotient + 2]
+ ldh [hQuotient + 3], a
+ ldh a, [hQuotient + 2]
adc b
- ld [hQuotient + 2], a
+ ldh [hQuotient + 2], a
ret
GainedText:
--- a/engine/battle/ghost_marowak_anim.asm
+++ b/engine/battle/ghost_marowak_anim.asm
@@ -1,7 +1,7 @@
MarowakAnim:
; animate the ghost being unveiled as a Marowak
ld a, $e4
- ld [rOBP1], a
+ ldh [rOBP1], a
call CopyMonPicFromBGToSpriteVRAM ; cover the BG ghost pic with a sprite ghost pic that looks the same
; now that the ghost pic is being displayed using sprites, clear the ghost pic from the BG tilemap
coord hl, 12, 0
@@ -9,12 +9,12 @@
call ClearScreenArea
call Delay3
xor a
- ld [hAutoBGTransferEnabled], a ; disable BG transfer so we don't see the Marowak too soon
+ ldh [hAutoBGTransferEnabled], a ; disable BG transfer so we don't see the Marowak too soon
; replace ghost pic with Marowak in BG
ld a, MAROWAK
ld [wChangeMonPicEnemyTurnSpecies], a
ld a, $1
- ld [hWhoseTurn], a
+ ldh [hWhoseTurn], a
callab ChangeMonPic
; alternate between black and light grey 8 times.
; this makes the ghost's body appear to flash
@@ -23,10 +23,10 @@
.fadeOutGhostLoop
ld c, 10
call DelayFrames
- ld a, [rOBP1]
+ ldh a, [rOBP1]
sla a
sla a
- ld [rOBP1], a
+ ldh [rOBP1], a
jr nz, .fadeOutGhostLoop
call ClearSprites
call CopyMonPicFromBGToSpriteVRAM ; copy Marowak pic from BG to sprite VRAM
@@ -34,17 +34,17 @@
.fadeInMarowakLoop
ld c, 10
call DelayFrames
- ld a, [rOBP1]
+ ldh a, [rOBP1]
srl b
rra
srl b
rra
- ld [rOBP1], a
+ ldh [rOBP1], a
ld a, b
and a
jr nz, .fadeInMarowakLoop
ld a, $1
- ld [hAutoBGTransferEnabled], a ; enable BG transfer so the BG Marowak pic will be visible after the sprite one is cleared
+ ldh [hAutoBGTransferEnabled], a ; enable BG transfer so the BG Marowak pic will be visible after the sprite one is cleared
call Delay3
jp ClearSprites
--- a/engine/battle/init_battle_variables.asm
+++ b/engine/battle/init_battle_variables.asm
@@ -1,5 +1,5 @@
InitBattleVariables:
- ld a, [hTilesetType]
+ ldh a, [hTilesetType]
ld [wSavedTilesetType], a
xor a
ld [wActionResultOrTookBattleTurn], a
--- a/engine/battle/move_effects/conversion.asm
+++ b/engine/battle/move_effects/conversion.asm
@@ -1,7 +1,7 @@
ConversionEffect_:
ld hl, wEnemyMonType1
ld de, wBattleMonType1
- ld a, [hWhoseTurn]
+ ldh a, [hWhoseTurn]
and a
ld a, [wEnemyBattleStatus1]
jr z, .conversionEffect
--- a/engine/battle/move_effects/drain_hp.asm
+++ b/engine/battle/move_effects/drain_hp.asm
@@ -14,7 +14,7 @@
.getAttackerHP
ld hl, wBattleMonHP
ld de, wBattleMonMaxHP
- ld a, [hWhoseTurn]
+ ldh a, [hWhoseTurn]
and a
jp z, .addDamageToAttackerHP
ld hl, wEnemyMonHP
@@ -69,7 +69,7 @@
ld [wHPBarNewHP+1], a
inc de
.next
- ld a, [hWhoseTurn]
+ ldh a, [hWhoseTurn]
and a
coord hl, 10, 9
ld a, $1
@@ -83,7 +83,7 @@
predef DrawEnemyHUDAndHPBar
callab ReadPlayerMonCurHPAndStatus
ld hl, SuckedHealthText
- ld a, [hWhoseTurn]
+ ldh a, [hWhoseTurn]
and a
ld a, [wPlayerMoveEffect]
jr z, .next3
--- a/engine/battle/move_effects/focus_energy.asm
+++ b/engine/battle/move_effects/focus_energy.asm
@@ -1,6 +1,6 @@
FocusEnergyEffect_:
ld hl, wPlayerBattleStatus2
- ld a, [hWhoseTurn]
+ ldh a, [hWhoseTurn]
and a
jr z, .notEnemy
ld hl, wEnemyBattleStatus2
--- a/engine/battle/move_effects/haze.asm
+++ b/engine/battle/move_effects/haze.asm
@@ -15,7 +15,7 @@
; cure non-volatile status, but only for the target
ld hl, wEnemyMonStatus
ld de, wEnemySelectedMove
- ld a, [hWhoseTurn]
+ ldh a, [hWhoseTurn]
and a
jr z, .cureStatuses
ld hl, wBattleMonStatus
--- a/engine/battle/move_effects/heal.asm
+++ b/engine/battle/move_effects/heal.asm
@@ -1,5 +1,5 @@
HealEffect_:
- ld a, [hWhoseTurn]
+ ldh a, [hWhoseTurn]
and a
ld de, wBattleMonHP
ld hl, wBattleMonMaxHP
@@ -27,7 +27,7 @@
ld c, 50
call DelayFrames
ld hl, wBattleMonStatus
- ld a, [hWhoseTurn]
+ ldh a, [hWhoseTurn]
and a
jr z, .restEffect
ld hl, wEnemyMonStatus
@@ -87,7 +87,7 @@
.playAnim
ld hl, PlayCurrentMoveAnimation
call BankswitchEtoF
- ld a, [hWhoseTurn]
+ ldh a, [hWhoseTurn]
and a
coord hl, 10, 9
ld a, $1
--- a/engine/battle/move_effects/leech_seed.asm
+++ b/engine/battle/move_effects/leech_seed.asm
@@ -5,7 +5,7 @@
jr nz, .moveMissed
ld hl, wEnemyBattleStatus2
ld de, wEnemyMonType1
- ld a, [hWhoseTurn]
+ ldh a, [hWhoseTurn]
and a
jr z, .leechSeedEffect
ld hl, wPlayerBattleStatus2
--- a/engine/battle/move_effects/mist.asm
+++ b/engine/battle/move_effects/mist.asm
@@ -1,6 +1,6 @@
MistEffect_:
ld hl, wPlayerBattleStatus2
- ld a, [hWhoseTurn]
+ ldh a, [hWhoseTurn]
and a
jr z, .mistEffect
ld hl, wEnemyBattleStatus2
--- a/engine/battle/move_effects/one_hit_ko.asm
+++ b/engine/battle/move_effects/one_hit_ko.asm
@@ -7,7 +7,7 @@
ld [wCriticalHitOrOHKO], a
ld hl, wBattleMonSpeed + 1
ld de, wEnemyMonSpeed + 1
- ld a, [hWhoseTurn]
+ ldh a, [hWhoseTurn]
and a
jr z, .compareSpeed
ld hl, wEnemyMonSpeed + 1
--- a/engine/battle/move_effects/paralyze.asm
+++ b/engine/battle/move_effects/paralyze.asm
@@ -1,7 +1,7 @@
ParalyzeEffect_:
ld hl, wEnemyMonStatus
ld de, wPlayerMoveType
- ld a, [hWhoseTurn]
+ ldh a, [hWhoseTurn]
and a
jp z, .next
ld hl, wBattleMonStatus
--- a/engine/battle/move_effects/pay_day.asm
+++ b/engine/battle/move_effects/pay_day.asm
@@ -2,7 +2,7 @@
xor a
ld hl, wcd6d
ld [hli], a
- ld a, [hWhoseTurn]
+ ldh a, [hWhoseTurn]
and a
ld a, [wBattleMonLevel]
jr z, .payDayEffect
@@ -10,28 +10,28 @@
.payDayEffect
; level * 2
add a
- ld [hDividend + 3], a
+ ldh [hDividend + 3], a
xor a
- ld [hDividend], a
- ld [hDividend + 1], a
- ld [hDividend + 2], a
+ ldh [hDividend], a
+ ldh [hDividend + 1], a
+ ldh [hDividend + 2], a
; convert to BCD
ld a, 100
- ld [hDivisor], a
+ ldh [hDivisor], a
ld b, $4
call Divide
- ld a, [hQuotient + 3]
+ ldh a, [hQuotient + 3]
ld [hli], a
- ld a, [hRemainder]
- ld [hDividend + 3], a
+ ldh a, [hRemainder]
+ ldh [hDividend + 3], a
ld a, 10
- ld [hDivisor], a
+ ldh [hDivisor], a
ld b, $4
call Divide
- ld a, [hQuotient + 3]
+ ldh a, [hQuotient + 3]
swap a
ld b, a
- ld a, [hRemainder]
+ ldh a, [hRemainder]
add b
ld [hl], a
ld de, wTotalPayDayMoney + 2
--- a/engine/battle/move_effects/recoil.asm
+++ b/engine/battle/move_effects/recoil.asm
@@ -1,5 +1,5 @@
RecoilEffect_:
- ld a, [hWhoseTurn]
+ ldh a, [hWhoseTurn]
and a
ld a, [wPlayerMoveNum]
ld hl, wBattleMonMaxHP
@@ -54,7 +54,7 @@
ld [hl], a
.getHPBarCoords
coord hl, 10, 9
- ld a, [hWhoseTurn]
+ ldh a, [hWhoseTurn]
and a
ld a, $1
jr z, .updateHPBar
--- a/engine/battle/move_effects/reflect_light_screen.asm
+++ b/engine/battle/move_effects/reflect_light_screen.asm
@@ -1,7 +1,7 @@
ReflectLightScreenEffect_:
ld hl, wPlayerBattleStatus3
ld de, wPlayerMoveEffect
- ld a, [hWhoseTurn]
+ ldh a, [hWhoseTurn]
and a
jr z, .reflectLightScreenEffect
ld hl, wEnemyBattleStatus3
--- a/engine/battle/move_effects/substitute.asm
+++ b/engine/battle/move_effects/substitute.asm
@@ -4,7 +4,7 @@
ld hl, wBattleMonMaxHP
ld de, wPlayerSubstituteHP
ld bc, wPlayerBattleStatus2
- ld a, [hWhoseTurn]
+ ldh a, [hWhoseTurn]
and a
jr z, .notEnemy
ld hl, wEnemyMonMaxHP
--- a/engine/battle/move_effects/transform.asm
+++ b/engine/battle/move_effects/transform.asm
@@ -3,7 +3,7 @@
ld de, wEnemyMonSpecies
ld bc, wEnemyBattleStatus3
ld a, [wEnemyBattleStatus1]
- ld a, [hWhoseTurn]
+ ldh a, [hWhoseTurn]
and a
jr nz, .hitTest
ld hl, wEnemyMonSpecies
@@ -18,7 +18,7 @@
push de
push bc
ld hl, wPlayerBattleStatus2
- ld a, [hWhoseTurn]
+ ldh a, [hWhoseTurn]
and a
jr z, .transformEffect
ld hl, wEnemyBattleStatus2
@@ -64,7 +64,7 @@
inc bc
inc bc
call CopyData
- ld a, [hWhoseTurn]
+ ldh a, [hWhoseTurn]
and a
jr z, .next
; save enemy mon DVs at wTransformedEnemyMonOriginalDVs
@@ -128,7 +128,7 @@
jp PrintText
.copyBasedOnTurn
- ld a, [hWhoseTurn]
+ ldh a, [hWhoseTurn]
and a
jr z, .gotStatsOrModsToCopy
push hl
--- a/engine/battle/scale_sprites.asm
+++ b/engine/battle/scale_sprites.asm
@@ -41,7 +41,7 @@
ScaleLastSpriteColumnByTwo:
ld a, 4*8 - 4 ; $1c, 4 tiles minus 4 unused rows
- ld [hSpriteInterlaceCounter], a
+ ldh [hSpriteInterlaceCounter], a
ld bc, -1
.columnInnerLoop
ld a, [de]
@@ -48,9 +48,9 @@
dec de
swap a ; only high nybble contains information
call ScalePixelsByTwo
- ld a, [hSpriteInterlaceCounter]
+ ldh a, [hSpriteInterlaceCounter]
dec a
- ld [hSpriteInterlaceCounter], a
+ ldh [hSpriteInterlaceCounter], a
jr nz, .columnInnerLoop
dec de ; skip last 4 rows of new column
dec de
--- a/engine/battle/trainer_ai.asm
+++ b/engine/battle/trainer_ai.asm
@@ -655,17 +655,17 @@
AICheckIfHPBelowFraction:
; return carry if enemy trainer's current HP is below 1 / a of the maximum
- ld [hDivisor], a
+ ldh [hDivisor], a
ld hl, wEnemyMonMaxHP
ld a, [hli]
- ld [hDividend], a
+ ldh [hDividend], a
ld a, [hl]
- ld [hDividend + 1], a
+ ldh [hDividend + 1], a
ld b, 2
call Divide
- ld a, [hQuotient + 3]
+ ldh a, [hQuotient + 3]
ld c, a
- ld a, [hQuotient + 2]
+ ldh a, [hQuotient + 2]
ld b, a
ld hl, wEnemyMonHP + 1
ld a, [hld]
--- a/engine/battle/unused_stats_functions.asm
+++ b/engine/battle/unused_stats_functions.asm
@@ -1,6 +1,6 @@
; does nothing since no stats are ever selected (barring glitches)
DoubleSelectedStats:
- ld a, [hWhoseTurn]
+ ldh a, [hWhoseTurn]
and a
ld a, [wPlayerStatsToDouble]
ld hl, wBattleMonAttack + 1
@@ -30,7 +30,7 @@
; does nothing since no stats are ever selected (barring glitches)
HalveSelectedStats:
- ld a, [hWhoseTurn]
+ ldh a, [hWhoseTurn]
and a
ld a, [wPlayerStatsToHalve]
ld hl, wBattleMonAttack
--- a/engine/battle/wild_encounters.asm
+++ b/engine/battle/wild_encounters.asm
@@ -48,10 +48,10 @@
.CanEncounter
; compare encounter chance with a random number to determine if there will be an encounter
ld b, a
- ld a, [hRandomAdd]
+ ldh a, [hRandomAdd]
cp b
jr nc, .CantEncounter2
- ld a, [hRandomSub]
+ ldh a, [hRandomSub]
ld b, a
ld hl, WildMonEncounterSlotChances
.determineEncounterSlot
@@ -90,7 +90,7 @@
.lastRepelStep
ld [wRepelRemainingSteps], a
ld a, TEXT_REPEL_WORE_OFF
- ld [hSpriteIndexOrTextID], a
+ ldh [hSpriteIndexOrTextID], a
call EnableAutoTextBoxDrawing
call DisplayTextID
.CantEncounter2
--- a/engine/debug/test_battle.asm
+++ b/engine/debug/test_battle.asm
@@ -41,5 +41,5 @@
; do it all again.
ld a, 1
ld [wUpdateSpritesEnabled], a
- ld [hAutoBGTransferEnabled], a
+ ldh [hAutoBGTransferEnabled], a
jr .loop
--- a/engine/events/black_out.asm
+++ b/engine/events/black_out.asm
@@ -6,34 +6,34 @@
ld [wIsInBattle], a
ld [wMapPalOffset], a
ld [wNPCMovementScriptFunctionNum], a
- ld [hJoyHeld], a
+ ldh [hJoyHeld], a
ld [wNPCMovementScriptPointerTableNum], a
ld [wFlags_0xcd60], a
- ld [hMoney], a
- ld [hMoney + 1], a
- ld [hMoney + 2], a
+ ldh [hMoney], a
+ ldh [hMoney + 1], a
+ ldh [hMoney + 2], a
call HasEnoughMoney
jr c, .lostmoney ; never happens
; Halve the player's money.
ld a, [wPlayerMoney]
- ld [hMoney], a
+ ldh [hMoney], a
ld a, [wPlayerMoney + 1]
- ld [hMoney + 1], a
+ ldh [hMoney + 1], a
ld a, [wPlayerMoney + 2]
- ld [hMoney + 2], a
+ ldh [hMoney + 2], a
xor a
- ld [hDivideBCDDivisor], a
- ld [hDivideBCDDivisor + 1], a
+ ldh [hDivideBCDDivisor], a
+ ldh [hDivideBCDDivisor + 1], a
ld a, 2
- ld [hDivideBCDDivisor + 2], a
+ ldh [hDivideBCDDivisor + 2], a
predef DivideBCDPredef3
- ld a, [hDivideBCDQuotient]
+ ldh a, [hDivideBCDQuotient]
ld [wPlayerMoney], a
- ld a, [hDivideBCDQuotient + 1]
+ ldh a, [hDivideBCDQuotient + 1]
ld [wPlayerMoney + 1], a
- ld a, [hDivideBCDQuotient + 2]
+ ldh a, [hDivideBCDQuotient + 2]
ld [wPlayerMoney + 2], a
.lostmoney
--- a/engine/events/card_key.asm
+++ b/engine/events/card_key.asm
@@ -28,7 +28,7 @@
call GetCoordsInFrontOfPlayer
push de
tx_pre_id CardKeySuccessText
- ld [hSpriteIndexOrTextID], a
+ ldh [hSpriteIndexOrTextID], a
call PrintPredefTextID
pop de
srl d
@@ -55,7 +55,7 @@
jp PlaySound
.noCardKey
tx_pre_id CardKeyFailText
- ld [hSpriteIndexOrTextID], a
+ ldh [hSpriteIndexOrTextID], a
jp PrintPredefTextID
SilphCoMapList:
--- a/engine/events/cinnabar_lab.asm
+++ b/engine/events/cinnabar_lab.asm
@@ -35,7 +35,7 @@
ld e, a
add hl, de
ld a, [hl]
- ld [hItemToRemoveID], a
+ ldh [hItemToRemoveID], a
cp DOME_FOSSIL
jr z, .choseDomeFossil
cp HELIX_FOSSIL
@@ -61,7 +61,7 @@
ld hl, LabFossil_610b3
call PrintText
ld a, [wFossilItem]
- ld [hItemToRemoveID], a
+ ldh [hItemToRemoveID], a
callba RemoveItemByID
ld hl, LabFossil_610b8
call PrintText
@@ -92,7 +92,7 @@
; Prints each fossil in the player's bag on a separate line in the menu.
ld hl, wFilteredBagItems
xor a
- ld [hItemCounter], a
+ ldh [hItemCounter], a
.loop
ld a, [hli]
cp $ff
@@ -101,7 +101,7 @@
ld [wd11e], a
call GetItemName
coord hl, 2, 2
- ld a, [hItemCounter]
+ ldh a, [hItemCounter]
ld bc, SCREEN_WIDTH * 2
call AddNTimes
ld de, wcd6d
--- a/engine/events/diploma.asm
+++ b/engine/events/diploma.asm
@@ -62,7 +62,7 @@
call Delay3
call GBPalNormal
ld a, $90
- ld [rOBP0], a
+ ldh [rOBP0], a
call WaitForTextScrollButtonPress
ld hl, wd730
res 6, [hl]
--- a/engine/events/hidden_items.asm
+++ b/engine/events/hidden_items.asm
@@ -67,9 +67,9 @@
and a
ret nz
xor a
- ld [hUnusedCoinsByte], a
- ld [hCoins], a
- ld [hCoins + 1], a
+ ldh [hUnusedCoinsByte], a
+ ldh [hCoins], a
+ ldh [hCoins + 1], a
ld a, [wHiddenObjectFunctionArgument]
sub COIN
cp 10
@@ -81,19 +81,19 @@
jr .bcd100
.bcd10
ld a, $10
- ld [hCoins + 1], a
+ ldh [hCoins + 1], a
jr .bcdDone
.bcd20
ld a, $20
- ld [hCoins + 1], a
+ ldh [hCoins + 1], a
jr .bcdDone
.bcd40 ; due to a typo, this is never used
ld a, $40
- ld [hCoins + 1], a
+ ldh [hCoins + 1], a
jr .bcdDone
.bcd100
ld a, $1
- ld [hCoins], a
+ ldh [hCoins], a
.bcdDone
ld de, wPlayerCoins + 1
ld hl, hCoins + 1
--- a/engine/events/hidden_objects/bookshelves.asm
+++ b/engine/events/hidden_objects/bookshelves.asm
@@ -24,7 +24,7 @@
pop af
call PrintPredefTextID
xor a
- ld [hFFDB], a
+ ldh [hFFDB], a
ret
.nextBookshelfEntry1
inc hl
@@ -33,7 +33,7 @@
jr .loop
.noMatch
ld a, $ff
- ld [hFFDB], a
+ ldh [hFFDB], a
jpba PrintCardKeyText
INCLUDE "data/tilesets/bookshelf_tile_ids.asm"
--- a/engine/events/hidden_objects/cinnabar_gym_quiz.asm
+++ b/engine/events/hidden_objects/cinnabar_gym_quiz.asm
@@ -12,14 +12,14 @@
ld a, [wHiddenObjectFunctionArgument]
push af
and $f
- ld [hGymGateIndex], a
+ ldh [hGymGateIndex], a
pop af
and $f0
swap a
- ld [hGymGateAnswer], a
+ ldh [hGymGateAnswer], a
ld hl, CinnabarGymQuizIntroText
call PrintText
- ld a, [hGymGateIndex]
+ ldh a, [hGymGateIndex]
dec a
add a
ld d, 0
@@ -77,7 +77,7 @@
CinnabarGymQuiz_1ea92:
call YesNoChoice
- ld a, [hGymGateAnswer]
+ ldh a, [hGymGateAnswer]
ld c, a
ld a, [wCurrentMenuItem]
cp c
@@ -84,11 +84,11 @@
jr nz, .wrongAnswer
ld hl, wCurrentMapScriptFlags
set 5, [hl]
- ld a, [hGymGateIndex]
- ld [hBackupGymGateIndex], a
+ ldh a, [hGymGateIndex]
+ ldh [hBackupGymGateIndex], a
ld hl, CinnabarGymQuizCorrectText
call PrintText
- ld a, [hBackupGymGateIndex]
+ ldh a, [hBackupGymGateIndex]
AdjustEventBit EVENT_CINNABAR_GYM_GATE0_UNLOCKED, 0
ld c, a
ld b, FLAG_SET
@@ -101,7 +101,7 @@
call WaitForSoundToFinish
ld hl, CinnabarGymQuizIncorrectText
call PrintText
- ld a, [hGymGateIndex]
+ ldh a, [hGymGateIndex]
add $2
AdjustEventBit EVENT_BEAT_CINNABAR_GYM_TRAINER_0, 2
ld c, a
@@ -111,7 +111,7 @@
ld a, c
and a
ret nz
- ld a, [hGymGateIndex]
+ ldh a, [hGymGateIndex]
add $2
ld [wOpponentAfterWrongAnswer], a
ret
@@ -122,7 +122,7 @@
text_promptbutton
text_asm
- ld a, [hBackupGymGateIndex]
+ ldh a, [hBackupGymGateIndex]
AdjustEventBit EVENT_CINNABAR_GYM_GATE0_UNLOCKED, 0
ld c, a
ld b, FLAG_TEST
@@ -144,9 +144,9 @@
; Update the overworld map with open floor blocks or locked gate blocks
; depending on event flags.
ld a, 6
- ld [hGymGateIndex], a
+ ldh [hGymGateIndex], a
.loop
- ld a, [hGymGateIndex]
+ ldh a, [hGymGateIndex]
dec a
add a
add a
@@ -161,8 +161,8 @@
ld a, [hl]
ld [wGymGateTileBlock], a
push bc
- ld a, [hGymGateIndex]
- ld [hBackupGymGateIndex], a
+ ldh a, [hGymGateIndex]
+ ldh [hBackupGymGateIndex], a
AdjustEventBit EVENT_CINNABAR_GYM_GATE0_UNLOCKED, 0
ld c, a
ld b, FLAG_TEST
--- a/engine/events/hidden_objects/museum_fossils.asm
+++ b/engine/events/hidden_objects/museum_fossils.asm
@@ -26,10 +26,10 @@
; Displays a pokemon's front sprite in a pop-up window.
; [wcf91] = pokemon internal id number
ld a, 1
- ld [hAutoBGTransferEnabled], a
+ ldh [hAutoBGTransferEnabled], a
call Delay3
xor a
- ld [hWY], a
+ ldh [hWY], a
call SaveScreenTilesToBuffer1
ld a, MON_SPRITE_POPUP
ld [wTextBoxID], a
@@ -41,7 +41,7 @@
ld de, vChars1 + $310
call LoadMonFrontSprite
ld a, $80
- ld [hStartTileID], a
+ ldh [hStartTileID], a
coord hl, 10, 11
predef AnimateSendingOutMon
call WaitForTextScrollButtonPress
@@ -48,5 +48,5 @@
call LoadScreenTilesFromBuffer1
call Delay3
ld a, $90
- ld [hWY], a
+ ldh [hWY], a
ret
--- a/engine/events/hidden_objects/safari_game.asm
+++ b/engine/events/hidden_objects/safari_game.asm
@@ -37,12 +37,12 @@
cp SFX_SAFARI_ZONE_PA
jr nz, .waitForMusicToPlay
ld a, TEXT_SAFARI_GAME_OVER
- ld [hSpriteIndexOrTextID], a
+ ldh [hSpriteIndexOrTextID], a
call DisplayTextID
xor a
ld [wPlayerMovingDirection], a
ld a, SAFARI_ZONE_GATE
- ld [hWarpDestinationMap], a
+ ldh [hWarpDestinationMap], a
ld a, $3
ld [wDestinationWarpID], a
ld a, $5
--- a/engine/events/hidden_objects/town_map.asm
+++ b/engine/events/hidden_objects/town_map.asm
@@ -8,9 +8,9 @@
set 6, [hl]
call GBPalWhiteOutWithDelay3
xor a
- ld [hWY], a
+ ldh [hWY], a
inc a
- ld [hAutoBGTransferEnabled], a
+ ldh [hAutoBGTransferEnabled], a
call LoadFontTilePatterns
callba DisplayTownMap
ld hl, wd730
@@ -17,6 +17,6 @@
res 6, [hl]
ld de, TextScriptEnd
push de
- ld a, [hLoadedROMBank]
+ ldh a, [hLoadedROMBank]
push af
jp CloseTextDisplay
--- a/engine/events/hidden_objects/vermilion_gym_trash.asm
+++ b/engine/events/hidden_objects/vermilion_gym_trash.asm
@@ -56,12 +56,12 @@
; first lock was in trash can 1 or 3. However, due to this bug, trash can 0 can
; have the second lock regardless of which trash can had the first lock.
- ld [hGymTrashCanRandNumMask], a
+ ldh [hGymTrashCanRandNumMask], a
push hl
call Random
swap a
ld b, a
- ld a, [hGymTrashCanRandNumMask]
+ ldh a, [hGymTrashCanRandNumMask]
and b
dec a
pop hl
--- a/engine/events/oaks_aide.asm
+++ b/engine/events/oaks_aide.asm
@@ -9,9 +9,9 @@
ld b, wPokedexOwnedEnd - wPokedexOwned
call CountSetBits
ld a, [wNumSetBits]
- ld [hOaksAideNumMonsOwned], a
+ ldh [hOaksAideNumMonsOwned], a
ld b, a
- ld a, [hOaksAideRequirement]
+ ldh a, [hOaksAideRequirement]
cp b
jr z, .giveItem
jr nc, .notEnoughOwnedMons
@@ -18,7 +18,7 @@
.giveItem
ld hl, OaksAideHereYouGoText
call PrintText
- ld a, [hOaksAideRewardItem]
+ ldh a, [hOaksAideRewardItem]
ld b, a
ld c, 1
call GiveItem
@@ -42,7 +42,7 @@
call PrintText
ld a, $ff
.done
- ld [hOaksAideResult], a
+ ldh [hOaksAideResult], a
ret
OaksAideHiText:
--- a/engine/events/pick_up_item.asm
+++ b/engine/events/pick_up_item.asm
@@ -1,7 +1,7 @@
PickUpItem:
call EnableAutoTextBoxDrawing
- ld a, [hSpriteIndexOrTextID]
+ ldh a, [hSpriteIndexOrTextID]
ld b, a
ld hl, wMissableObjectList
.missableObjectsListLoop
@@ -15,10 +15,10 @@
.isMissable
ld a, [hl]
- ld [hMissableObjectIndex], a
+ ldh [hMissableObjectIndex], a
ld hl, wMapSpriteExtraData
- ld a, [hSpriteIndexOrTextID]
+ ldh a, [hSpriteIndexOrTextID]
dec a
add a
ld d, 0
@@ -30,7 +30,7 @@
call GiveItem
jr nc, .BagFull
- ld a, [hMissableObjectIndex]
+ ldh a, [hMissableObjectIndex]
ld [wMissableObjectIndex], a
predef HideObject
ld a, 1
--- a/engine/events/poison.asm
+++ b/engine/events/poison.asm
@@ -52,7 +52,7 @@
ld [wJoyIgnore], a
call EnableAutoTextBoxDrawing
ld a, TEXT_MON_FAINTED
- ld [hSpriteIndexOrTextID], a
+ ldh [hSpriteIndexOrTextID], a
call DisplayTextID
pop de
pop hl
@@ -99,7 +99,7 @@
jr nz, .noBlackOut
call EnableAutoTextBoxDrawing
ld a, TEXT_BLACKED_OUT
- ld [hSpriteIndexOrTextID], a
+ ldh [hSpriteIndexOrTextID], a
call DisplayTextID
ld hl, wd72e
set 5, [hl]
--- a/engine/events/pokedex_rating.asm
+++ b/engine/events/pokedex_rating.asm
@@ -3,17 +3,17 @@
ld b, wPokedexSeenEnd - wPokedexSeen
call CountSetBits
ld a, [wNumSetBits]
- ld [hDexRatingNumMonsSeen], a
+ ldh [hDexRatingNumMonsSeen], a
ld hl, wPokedexOwned
ld b, wPokedexOwnedEnd - wPokedexOwned
call CountSetBits
ld a, [wNumSetBits]
- ld [hDexRatingNumMonsOwned], a
+ ldh [hDexRatingNumMonsOwned], a
ld hl, DexRatingsTable
.findRating
ld a, [hli]
ld b, a
- ld a, [hDexRatingNumMonsOwned]
+ ldh a, [hDexRatingNumMonsOwned]
cp b
jr c, .foundRating
inc hl
@@ -34,10 +34,10 @@
jp WaitForTextScrollButtonPress
.hallOfFame
ld de, wDexRatingNumMonsSeen
- ld a, [hDexRatingNumMonsSeen]
+ ldh a, [hDexRatingNumMonsSeen]
ld [de], a
inc de
- ld a, [hDexRatingNumMonsOwned]
+ ldh a, [hDexRatingNumMonsOwned]
ld [de], a
inc de
.copyRatingTextLoop
--- a/engine/events/pokemart.asm
+++ b/engine/events/pokemart.asm
@@ -77,7 +77,7 @@
jr c, .unsellableItem
ld a, PRICEDITEMLISTMENU
ld [wListMenuID], a
- ld [hHalveItemPrices], a ; halve prices when selling
+ ldh [hHalveItemPrices], a ; halve prices when selling
call DisplayChooseQuantityMenu
inc a
jr z, .sellMenuLoop ; if the player closed the choose quantity menu with the B button
@@ -152,7 +152,7 @@
ld a, 99
ld [wMaxItemQuantity], a
xor a
- ld [hHalveItemPrices], a ; don't halve item prices when buying
+ ldh [hHalveItemPrices], a ; don't halve item prices when buying
call DisplayChooseQuantityMenu
inc a
jr z, .buyMenuLoop ; if the player closed the choose quantity menu with the B button
--- a/engine/events/prize_menu.asm
+++ b/engine/events/prize_menu.asm
@@ -64,7 +64,7 @@
; display the three prizes' names
; (distinguishing between Pokemon names
; and Items (specifically TMs) names)
- ld a, [hSpriteIndexOrTextID]
+ ldh a, [hSpriteIndexOrTextID]
sub 3 ; prize-texts' id are 3, 4 and 5
ld [wWhichPrizeWindow], a ; prize-texts' id (relative, i.e. 0, 1 or 2)
add a
@@ -177,11 +177,11 @@
ld hl, wPrize1Price
add hl, de ; get selected prize's price
xor a
- ld [hUnusedCoinsByte], a
+ ldh [hUnusedCoinsByte], a
ld a, [hli]
- ld [hCoins], a
+ ldh [hCoins], a
ld a, [hl]
- ld [hCoins + 1], a
+ ldh [hCoins + 1], a
ret
HandlePrizeChoice:
--- a/engine/events/saffron_guards.asm
+++ b/engine/events/saffron_guards.asm
@@ -2,7 +2,7 @@
ld hl, GuardDrinksList
.drinkLoop
ld a, [hli]
- ld [hItemToRemoveID], a
+ ldh [hItemToRemoveID], a
and a
ret z
push hl
--- a/engine/events/vending_machine.asm
+++ b/engine/events/vending_machine.asm
@@ -37,10 +37,10 @@
cp 3 ; chose Cancel?
jr z, .notThirsty
xor a
- ld [hMoney], a
- ld [hMoney + 2], a
+ ldh [hMoney], a
+ ldh [hMoney + 2], a
ld a, $2
- ld [hMoney + 1], a
+ ldh [hMoney + 1], a
call HasEnoughMoney
jr nc, .enoughMoney
ld hl, VendingMachineText4
@@ -47,7 +47,7 @@
jp PrintText
.enoughMoney
call LoadVendingMachineItem
- ld a, [hVendingMachineItem]
+ ldh a, [hVendingMachineItem]
ld b, a
ld c, 1
call GiveItem
@@ -121,13 +121,13 @@
ld e, a
add hl, de
ld a, [hli]
- ld [hVendingMachineItem], a
+ ldh [hVendingMachineItem], a
ld a, [hli]
- ld [hVendingMachinePrice], a
+ ldh [hVendingMachinePrice], a
ld a, [hli]
- ld [hVendingMachinePrice + 1], a
+ ldh [hVendingMachinePrice + 1], a
ld a, [hl]
- ld [hVendingMachinePrice + 2], a
+ ldh [hVendingMachinePrice + 2], a
ret
INCLUDE "data/items/vending_prices.asm"
--- a/engine/gfx/hp_bar.asm
+++ b/engine/gfx/hp_bar.asm
@@ -21,22 +21,22 @@
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 @@
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
--- a/engine/gfx/mon_icons.asm
+++ b/engine/gfx/mon_icons.asm
@@ -169,7 +169,7 @@
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 @@
; 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 @@
push af
ld c, $10
ld h, wOAMBuffer / $100
- ld a, [hPartyMonIndex]
+ ldh a, [hPartyMonIndex]
swap a
ld l, a
add $10
--- a/engine/gfx/oam_dma.asm
+++ b/engine/gfx/oam_dma.asm
@@ -15,7 +15,7 @@
DMARoutine:
; initiate DMA
ld a, wOAMBuffer / $100
- ld [rDMA], a
+ ldh [rDMA], a
; wait for DMA to finish
ld a, $28
--- a/engine/gfx/palettes.asm
+++ b/engine/gfx/palettes.asm
@@ -335,13 +335,13 @@
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 @@
; 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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
inc d
.noCarry
ld a, [de]
- ld [rBGPD], a
+ ldh [rBGPD], a
dec c
jr nz, .loop
ret
--- 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 @@
ld [wDisableVBlankWYUpdate], a
xor a
.loop
- ld [hMutateWY], a
+ ldh [hMutateWY], a
call .MutateWY
call .MutateWY
dec b
@@ -30,10 +30,10 @@
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 @@
call GetPredefRegisters
xor a
.loop
- ld [hMutateWX], a
+ ldh [hMutateWX], a
call .MutateWX
ld c, 1
call DelayFrames
@@ -54,18 +54,18 @@
; 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
--- a/engine/gfx/sprite_oam.asm
+++ b/engine/gfx/sprite_oam.asm
@@ -13,13 +13,13 @@
.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 @@
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 @@
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 @@
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 @@
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 @@
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
--- a/engine/items/item_effects.asm
+++ b/engine/items/item_effects.asm
@@ -239,14 +239,14 @@
; Calculate MaxHP * 255.
xor a
- ld [hMultiplicand], a
+ ldh [hMultiplicand], a
ld hl, wEnemyMonMaxHP
ld a, [hli]
- ld [hMultiplicand + 1], a
+ ldh [hMultiplicand + 1], a
ld a, [hl]
- ld [hMultiplicand + 2], a
+ ldh [hMultiplicand + 2], a
ld a, 255
- ld [hMultiplier], a
+ ldh [hMultiplier], a
call Multiply
; Determine BallFactor. It's 8 for Great Balls and 12 for the others.
@@ -260,7 +260,7 @@
; Note that the results of all division operations are floored.
; Calculate (MaxHP * 255) / BallFactor.
- ld [hDivisor], a
+ ldh [hDivisor], a
ld b, 4 ; number of bytes in dividend
call Divide
@@ -281,17 +281,17 @@
.skip2
; Let W = ((MaxHP * 255) / BallFactor) / max(HP / 4, 1). Calculate W.
- ld [hDivisor], a
+ ldh [hDivisor], a
ld b, 4
call Divide
; If W > 255, store 255 in [hQuotient + 3].
; Let X = min(W, 255) = [hQuotient + 3].
- ld a, [hQuotient + 2]
+ ldh a, [hQuotient + 2]
and a
jr z, .skip3
ld a, 255
- ld [hQuotient + 3], a
+ ldh [hQuotient + 3], a
.skip3
pop bc ; b = Rand1 - Status
@@ -302,7 +302,7 @@
jr c, .failedToCapture
; If W > 255, the ball captures the Pokémon.
- ld a, [hQuotient + 2]
+ ldh a, [hQuotient + 2]
and a
jr nz, .captured
@@ -310,7 +310,7 @@
; If Rand2 > X, the ball fails to capture the Pokémon.
ld b, a
- ld a, [hQuotient + 3]
+ ldh a, [hQuotient + 3]
cp b
jr c, .failedToCapture
@@ -318,17 +318,17 @@
jr .skipShakeCalculations
.failedToCapture
- ld a, [hQuotient + 3]
+ ldh a, [hQuotient + 3]
ld [wPokeBallCaptureCalcTemp], a ; Save X.
; Calculate CatchRate * 100.
xor a
- ld [hMultiplicand], a
- ld [hMultiplicand + 1], a
+ ldh [hMultiplicand], a
+ ldh [hMultiplicand + 1], a
ld a, [wEnemyMonActualCatchRate]
- ld [hMultiplicand + 2], a
+ ldh [hMultiplicand + 2], a
ld a, 100
- ld [hMultiplier], a
+ ldh [hMultiplier], a
call Multiply
; Determine BallFactor2.
@@ -349,7 +349,7 @@
.skip4
; Let Y = (CatchRate * 100) / BallFactor2. Calculate Y.
ld a, b
- ld [hDivisor], a
+ ldh [hDivisor], a
ld b, 4
call Divide
@@ -356,7 +356,7 @@
; If Y > 255, there are 3 shakes.
; Note that this shouldn't be possible.
; The maximum value of Y is (255 * 100) / 150 = 170.
- ld a, [hQuotient + 2]
+ ldh a, [hQuotient + 2]
and a
ld b, $63 ; 3 shakes
jr nz, .setAnimData
@@ -363,12 +363,12 @@
; Calculate X * Y.
ld a, [wPokeBallCaptureCalcTemp]
- ld [hMultiplier], a
+ ldh [hMultiplier], a
call Multiply
; Calculate (X * Y) / 255.
ld a, 255
- ld [hDivisor], a
+ ldh [hDivisor], a
ld b, 4
call Divide
@@ -386,9 +386,9 @@
.addAilmentValue
; If the Pokémon has a status ailment, add Status2.
- ld a, [hQuotient + 3]
+ ldh a, [hQuotient + 3]
add b
- ld [hQuotient + 3], a
+ ldh [hQuotient + 3], a
.skip5
; Finally determine the number of shakes.
@@ -398,7 +398,7 @@
; 10 ≤ Z < 30: 1 shake
; 30 ≤ Z < 70: 2 shakes
; 70 ≤ Z: 3 shakes
- ld a, [hQuotient + 3]
+ ldh a, [hQuotient + 3]
cp 10
ld b, $20
jr c, .setAnimData
@@ -422,7 +422,7 @@
ld a, TOSS_ANIM
ld [wAnimationID], a
xor a
- ld [hWhoseTurn], a
+ ldh [hWhoseTurn], a
ld [wAnimationType], a
ld [wDamageMultipliers], a
ld a, [wWhichPokemon]
@@ -656,7 +656,7 @@
jp nc, NoCyclingAllowedHere
call ItemUseReloadOverworldData
xor a ; no keys pressed
- ld [hJoyHeld], a ; current joypad state
+ ldh [hJoyHeld], a ; current joypad state
inc a
ld [wWalkBikeSurfState], a ; change player state to bicycling
ld hl, GotOnBicycleText
@@ -687,11 +687,11 @@
jp PrintText
.tryToStopSurfing
xor a
- ld [hSpriteIndexOrTextID], a
+ ldh [hSpriteIndexOrTextID], a
ld d, 16 ; talking range in pixels (normal range)
call IsSpriteInFrontOfPlayer2
res 7, [hl]
- ld a, [hSpriteIndexOrTextID]
+ ldh a, [hSpriteIndexOrTextID]
and a ; is there a sprite in the way?
jr nz, .cannotStopSurfing
ld hl, TilePairCollisionsWater
@@ -1018,18 +1018,18 @@
call AddNTimes
ld a, [hli]
ld [wHPBarMaxHP + 1], a
- ld [hDividend], a
+ ldh [hDividend], a
ld a, [hl]
ld [wHPBarMaxHP], a
- ld [hDividend + 1], a
+ ldh [hDividend + 1], a
ld a, 5
- ld [hDivisor], a
+ ldh [hDivisor], a
ld b, 2 ; number of bytes
call Divide ; get 1/5 of max HP of pokemon that used Softboiled
ld bc, (wPartyMon1HP + 1) - (wPartyMon1MaxHP + 1)
add hl, bc ; hl now points to LSB of current HP of pokemon that used Softboiled
; subtract 1/5 of max HP from current HP of pokemon that used Softboiled
- ld a, [hQuotient + 3]
+ ldh a, [hQuotient + 3]
push af
ld b, a
ld a, [hl]
@@ -1037,7 +1037,7 @@
sub b
ld [hld], a
ld [wHPBarNewHP], a
- ld a, [hQuotient + 2]
+ ldh a, [hQuotient + 2]
ld b, a
ld a, [hl]
ld [wHPBarOldHP+1], a
@@ -1050,15 +1050,15 @@
call AddNTimes ; calculate coordinates of HP bar of pokemon that used Softboiled
ld a, SFX_HEAL_HP
call PlaySoundWaitForCurrent
- ld a, [hFlagsFFF6]
+ ldh a, [hFlagsFFF6]
set 0, a
- ld [hFlagsFFF6], a
+ ldh [hFlagsFFF6], a
ld a, $02
ld [wHPBarType], a
predef UpdateHPBar2 ; animate HP bar decrease of pokemon that used Softboiled
- ld a, [hFlagsFFF6]
+ ldh a, [hFlagsFFF6]
res 0, a
- ld [hFlagsFFF6], a
+ ldh [hFlagsFFF6], a
pop af
ld b, a ; store heal amount (1/5 of max HP)
ld hl, wHPBarOldHP + 1
@@ -1200,15 +1200,15 @@
jr z, .playStatusAilmentCuringSound
ld a, SFX_HEAL_HP
call PlaySoundWaitForCurrent
- ld a, [hFlagsFFF6]
+ ldh a, [hFlagsFFF6]
set 0, a
- ld [hFlagsFFF6], a
+ ldh [hFlagsFFF6], a
ld a, $02
ld [wHPBarType], a
predef UpdateHPBar2 ; animate the HP bar lengthening
- ld a, [hFlagsFFF6]
+ ldh a, [hFlagsFFF6]
res 0, a
- ld [hFlagsFFF6], a
+ ldh [hFlagsFFF6], a
ld a, REVIVE_MSG
ld [wPartyMenuTypeOrMessageID], a
ld a, [wcf91]
@@ -1224,13 +1224,13 @@
call PlaySoundWaitForCurrent
.showHealingItemMessage
xor a
- ld [hAutoBGTransferEnabled], a
+ ldh [hAutoBGTransferEnabled], a
call ClearScreen
dec a
ld [wUpdateSpritesEnabled], a
call RedrawPartyMenu ; redraws the party menu and displays the message
ld a, 1
- ld [hAutoBGTransferEnabled], a
+ ldh [hAutoBGTransferEnabled], a
ld c, 50
call DelayFrames
call WaitForTextScrollButtonPress
@@ -1347,11 +1347,11 @@
ld bc, wPartyMon1Exp - wPartyMon1Level
add hl, bc ; hl now points to MSB of experience
; update experience to minimum for new level
- ld a, [hExperience]
+ ldh a, [hExperience]
ld [hli], a
- ld a, [hExperience + 1]
+ ldh a, [hExperience + 1]
ld [hli], a
- ld a, [hExperience + 2]
+ ldh a, [hExperience + 2]
ld [hl], a
pop hl
ld a, [wWhichPokemon]
@@ -1459,7 +1459,7 @@
ld [wAnimationID], a
xor a
ld [wAnimationType], a
- ld [hWhoseTurn], a
+ ldh [hWhoseTurn], a
ld [de], a ; zero escape factor (for bait), zero bait factor (for rock)
.randomLoop ; loop until a random number less than 5 is generated
call Random
@@ -1698,7 +1698,7 @@
call LoadScreenTilesFromBuffer1 ; restore saved screen
call Delay3
xor a
- ld [hWhoseTurn], a ; set turn to player's turn
+ ldh [hWhoseTurn], a ; set turn to player's turn
callba StatModifierUpEffect ; do stat increase move
pop hl
pop af
@@ -2463,13 +2463,13 @@
AddBonusPP:
push bc
ld a, [de] ; normal max PP of move
- ld [hDividend + 3], a
+ ldh [hDividend + 3], a
xor a
- ld [hDividend], a
- ld [hDividend + 1], a
- ld [hDividend + 2], a
+ ldh [hDividend], a
+ ldh [hDividend + 1], a
+ ldh [hDividend + 2], a
ld a, 5
- ld [hDivisor], a
+ ldh [hDivisor], a
ld b, 4
call Divide
ld a, [hl] ; move PP
@@ -2480,7 +2480,7 @@
srl a
ld c, a ; c = number of PP Ups used
.loop
- ld a, [hQuotient + 3]
+ ldh a, [hQuotient + 3]
cp 8 ; is the amount greater than or equal to 8?
jr c, .addAmount
ld a, 7 ; cap the amount at 7
@@ -2822,13 +2822,13 @@
ld d, a
callab CalcExperience
pop de
- ld a, [hExperience]
+ ldh a, [hExperience]
ld [de], a
inc de
- ld a, [hExperience + 1]
+ ldh a, [hExperience + 1]
ld [de], a
inc de
- ld a, [hExperience + 2]
+ ldh a, [hExperience + 2]
ld [de], a
inc de
xor a
--- a/engine/items/tm_prices.asm
+++ b/engine/items/tm_prices.asm
@@ -16,10 +16,10 @@
swap a
.highNybbleIsPrice
and $f0
- ld [hItemPrice + 1], a
+ ldh [hItemPrice + 1], a
xor a
- ld [hItemPrice], a
- ld [hItemPrice + 2], a
+ ldh [hItemPrice], a
+ ldh [hItemPrice + 2], a
ret
INCLUDE "data/items/tm_prices.asm"
--- a/engine/items/town_map.asm
+++ b/engine/items/town_map.asm
@@ -6,7 +6,7 @@
ld [hl], $ff
push hl
ld a, $1
- ld [hJoy7], a
+ ldh [hJoy7], a
ld a, [wCurMap]
push af
ld b, $0
@@ -65,7 +65,7 @@
.inputLoop
call TownMapSpriteBlinkingAnimation
call JoypadLowSensitivity
- ld a, [hJoy5]
+ ldh a, [hJoy5]
ld b, a
and A_BUTTON | B_BUTTON | D_UP | D_DOWN
jr z, .inputLoop
@@ -77,7 +77,7 @@
jr nz, .pressedDown
xor a
ld [wTownMapSpriteBlinkingEnabled], a
- ld [hJoy7], a
+ ldh [hJoy7], a
ld [wAnimCounter], a
call ExitTownMap
pop hl
@@ -187,7 +187,7 @@
push hl
call DelayFrame
call JoypadLowSensitivity
- ld a, [hJoy5]
+ ldh a, [hJoy5]
ld b, a
pop hl
and A_BUTTON | B_BUTTON | D_UP | D_DOWN
--- a/engine/joypad.asm
+++ b/engine/joypad.asm
@@ -2,29 +2,29 @@
; hJoyReleased: (hJoyLast ^ hJoyInput) & hJoyLast
; hJoyPressed: (hJoyLast ^ hJoyInput) & hJoyInput
- ld a, [hJoyInput]
+ ldh a, [hJoyInput]
cp A_BUTTON + B_BUTTON + SELECT + START ; soft reset
jp z, TrySoftReset
ld b, a
- ld a, [hJoyLast]
+ ldh a, [hJoyLast]
ld e, a
xor b
ld d, a
and e
- ld [hJoyReleased], a
+ ldh [hJoyReleased], a
ld a, d
and b
- ld [hJoyPressed], a
+ ldh [hJoyPressed], a
ld a, b
- ld [hJoyLast], a
+ ldh [hJoyLast], a
ld a, [wd730]
bit 5, a
jr nz, DiscardButtonPresses
- ld a, [hJoyLast]
- ld [hJoyHeld], a
+ ldh a, [hJoyLast]
+ ldh [hJoyHeld], a
ld a, [wJoyIgnore]
and a
@@ -32,19 +32,19 @@
cpl
ld b, a
- ld a, [hJoyHeld]
+ ldh a, [hJoyHeld]
and b
- ld [hJoyHeld], a
- ld a, [hJoyPressed]
+ ldh [hJoyHeld], a
+ ldh a, [hJoyPressed]
and b
- ld [hJoyPressed], a
+ ldh [hJoyPressed], a
ret
DiscardButtonPresses:
xor a
- ld [hJoyHeld], a
- ld [hJoyPressed], a
- ld [hJoyReleased], a
+ ldh [hJoyHeld], a
+ ldh [hJoyPressed], a
+ ldh [hJoyReleased], a
ret
TrySoftReset:
@@ -52,7 +52,7 @@
; deselect (redundant)
ld a, $30
- ld [rJOYP], a
+ ldh [rJOYP], a
ld hl, hSoftReset
dec [hl]
--- a/engine/link/cable_club.asm
+++ b/engine/link/cable_club.asm
@@ -102,7 +102,7 @@
ld a, SERIAL_PATCH_LIST_PART_TERMINATOR
ld [de], a ; end of part 2
call Serial_SyncAndExchangeNybble
- ld a, [hSerialConnectionStatus]
+ ldh a, [hSerialConnectionStatus]
cp USING_INTERNAL_CLOCK
jr nz, .skipSendingTwoZeroBytes
; if using internal clock
@@ -109,18 +109,18 @@
; send two zero bytes for syncing purposes?
call Delay3
xor a
- ld [hSerialSendData], a
+ ldh [hSerialSendData], a
ld a, START_TRANSFER_INTERNAL_CLOCK
- ld [rSC], a
+ ldh [rSC], a
call DelayFrame
xor a
- ld [hSerialSendData], a
+ ldh [hSerialSendData], a
ld a, START_TRANSFER_INTERNAL_CLOCK
- ld [rSC], a
+ ldh [rSC], a
.skipSendingTwoZeroBytes
call Delay3
ld a, (1 << SERIAL)
- ld [rIE], a
+ ldh [rIE], a
ld hl, wSerialRandomNumberListBlock
ld de, wSerialOtherGameboyRandomNumberListBlock
ld bc, $11
@@ -138,10 +138,10 @@
ld bc, $c8
call Serial_ExchangeBytes
ld a, (1 << SERIAL) | (1 << TIMER) | (1 << VBLANK)
- ld [rIE], a
+ ldh [rIE], a
ld a, SFX_STOP_ALL_MUSIC
call PlaySound
- ld a, [hSerialConnectionStatus]
+ ldh a, [hSerialConnectionStatus]
cp USING_INTERNAL_CLOCK
jr z, .skipCopyingRandomNumberList ; the list generated by the gameboy clocking the connection is used by both gameboys
ld hl, wSerialOtherGameboyRandomNumberListBlock
@@ -263,7 +263,7 @@
ld [wTradeCenterPointerTableIndex], a
ld a, SFX_STOP_ALL_MUSIC
call PlaySound
- ld a, [hSerialConnectionStatus]
+ ldh a, [hSerialConnectionStatus]
cp USING_INTERNAL_CLOCK
ld c, 66
call z, DelayFrames ; delay if using internal clock
@@ -551,7 +551,7 @@
Coorda 1, 16
.cancelMenuItem_JoypadLoop
call JoypadLowSensitivity
- ld a, [hJoy5]
+ ldh a, [hJoy5]
and a ; pressed anything?
jr z, .cancelMenuItem_JoypadLoop
bit 0, a ; A button pressed?
@@ -663,7 +663,7 @@
push de
push hl
ld a, c
- ld [hPastLeadingZeros], a
+ ldh [hPastLeadingZeros], a
call GetMonName
pop hl
call PlaceString
@@ -837,7 +837,7 @@
call LoadHpBarAndStatusTilePatterns
xor a
ld [wUnusedCC5B], a
- ld a, [hSerialConnectionStatus]
+ ldh a, [hSerialConnectionStatus]
cp USING_EXTERNAL_CLOCK
jr z, .usingExternalClock
predef InternalClockTradeAnim
@@ -914,7 +914,7 @@
ld [wGrassRate], a
inc a ; LINK_STATE_IN_CABLE_CLUB
ld [wLinkState], a
- ld [hJoy5], a
+ ldh [hJoy5], a
ld a, 10
ld [wAudioFadeOutControl], a
ld a, BANK(Music_Celadon)
--- a/engine/link/cable_club_npc.asm
+++ b/engine/link/cable_club_npc.asm
@@ -15,27 +15,27 @@
ld a, 90
ld [wLinkTimeoutCounter], a
.establishConnectionLoop
- ld a, [hSerialConnectionStatus]
+ ldh a, [hSerialConnectionStatus]
cp USING_INTERNAL_CLOCK
jr z, .establishedConnection
cp USING_EXTERNAL_CLOCK
jr z, .establishedConnection
ld a, CONNECTION_NOT_ESTABLISHED
- ld [hSerialConnectionStatus], a
+ ldh [hSerialConnectionStatus], a
ld a, ESTABLISH_CONNECTION_WITH_EXTERNAL_CLOCK
- ld [rSB], a
+ ldh [rSB], a
xor a
- ld [hSerialReceiveData], a
+ ldh [hSerialReceiveData], a
ld a, START_TRANSFER_EXTERNAL_CLOCK
- ld [rSC], a
+ ldh [rSC], a
ld a, [wLinkTimeoutCounter]
dec a
ld [wLinkTimeoutCounter], a
jr z, .failedToEstablishConnection
ld a, ESTABLISH_CONNECTION_WITH_INTERNAL_CLOCK
- ld [rSB], a
+ ldh [rSB], a
ld a, START_TRANSFER_INTERNAL_CLOCK
- ld [rSC], a
+ ldh [rSC], a
call DelayFrame
jr .establishConnectionLoop
.establishedConnection
@@ -65,7 +65,7 @@
ld [hli], a
xor a
ld [hl], a
- ld [hSerialReceivedNewData], a
+ ldh [hSerialReceivedNewData], a
ld [wSerialExchangeNybbleSendData], a
call Serial_SyncAndExchangeNybble
ld hl, wUnknownSerialCounter
@@ -141,11 +141,11 @@
CloseLinkConnection:
call Delay3
ld a, CONNECTION_NOT_ESTABLISHED
- ld [hSerialConnectionStatus], a
+ ldh [hSerialConnectionStatus], a
ld a, ESTABLISH_CONNECTION_WITH_EXTERNAL_CLOCK
- ld [rSB], a
+ ldh [rSB], a
xor a
- ld [hSerialReceiveData], a
+ ldh [hSerialReceiveData], a
ld a, START_TRANSFER_EXTERNAL_CLOCK
- ld [rSC], a
+ ldh [rSC], a
ret
--- a/engine/math/bcd.asm
+++ b/engine/math/bcd.asm
@@ -6,39 +6,39 @@
DivideBCD::
xor a
- ld [hDivideBCDBuffer], a
- ld [hDivideBCDBuffer+1], a
- ld [hDivideBCDBuffer+2], a
+ ldh [hDivideBCDBuffer], a
+ ldh [hDivideBCDBuffer+1], a
+ ldh [hDivideBCDBuffer+2], a
ld d, $1
.mulBy10Loop
; multiply the divisor by 10 until the leading digit is nonzero
; to set up the standard long division algorithm
- ld a, [hDivideBCDDivisor]
+ ldh a, [hDivideBCDDivisor]
and $f0
jr nz, .next
inc d
- ld a, [hDivideBCDDivisor]
+ ldh a, [hDivideBCDDivisor]
swap a
and $f0
ld b, a
- ld a, [hDivideBCDDivisor+1]
+ ldh a, [hDivideBCDDivisor+1]
swap a
- ld [hDivideBCDDivisor+1], a
+ ldh [hDivideBCDDivisor+1], a
and $f
or b
- ld [hDivideBCDDivisor], a
- ld a, [hDivideBCDDivisor+1]
+ ldh [hDivideBCDDivisor], a
+ ldh a, [hDivideBCDDivisor+1]
and $f0
ld b, a
- ld a, [hDivideBCDDivisor+2]
+ ldh a, [hDivideBCDDivisor+2]
swap a
- ld [hDivideBCDDivisor+2], a
+ ldh [hDivideBCDDivisor+2], a
and $f
or b
- ld [hDivideBCDDivisor+1], a
- ld a, [hDivideBCDDivisor+2]
+ ldh [hDivideBCDDivisor+1], a
+ ldh a, [hDivideBCDDivisor+2]
and $f0
- ld [hDivideBCDDivisor+2], a
+ ldh [hDivideBCDDivisor+2], a
jr .mulBy10Loop
.next
push de
@@ -48,7 +48,7 @@
ld a, b
swap a
and $f0
- ld [hDivideBCDBuffer], a
+ ldh [hDivideBCDBuffer], a
dec d
jr z, .next2
push de
@@ -55,9 +55,9 @@
call DivideBCD_divDivisorBy10
call DivideBCD_getNextDigit
pop de
- ld a, [hDivideBCDBuffer]
+ ldh a, [hDivideBCDBuffer]
or b
- ld [hDivideBCDBuffer], a
+ ldh [hDivideBCDBuffer], a
dec d
jr z, .next2
push de
@@ -67,7 +67,7 @@
ld a, b
swap a
and $f0
- ld [hDivideBCDBuffer+1], a
+ ldh [hDivideBCDBuffer+1], a
dec d
jr z, .next2
push de
@@ -74,9 +74,9 @@
call DivideBCD_divDivisorBy10
call DivideBCD_getNextDigit
pop de
- ld a, [hDivideBCDBuffer+1]
+ ldh a, [hDivideBCDBuffer+1]
or b
- ld [hDivideBCDBuffer+1], a
+ ldh [hDivideBCDBuffer+1], a
dec d
jr z, .next2
push de
@@ -86,7 +86,7 @@
ld a, b
swap a
and $f0
- ld [hDivideBCDBuffer+2], a
+ ldh [hDivideBCDBuffer+2], a
dec d
jr z, .next2
push de
@@ -93,16 +93,16 @@
call DivideBCD_divDivisorBy10
call DivideBCD_getNextDigit
pop de
- ld a, [hDivideBCDBuffer+2]
+ ldh a, [hDivideBCDBuffer+2]
or b
- ld [hDivideBCDBuffer+2], a
+ ldh [hDivideBCDBuffer+2], a
.next2
- ld a, [hDivideBCDBuffer]
- ld [hDivideBCDQuotient], a ; the same memory location as hDivideBCDDivisor
- ld a, [hDivideBCDBuffer+1]
- ld [hDivideBCDQuotient+1], a
- ld a, [hDivideBCDBuffer+2]
- ld [hDivideBCDQuotient+2], a
+ ldh a, [hDivideBCDBuffer]
+ ldh [hDivideBCDQuotient], a ; the same memory location as hDivideBCDDivisor
+ ldh a, [hDivideBCDBuffer+1]
+ ldh [hDivideBCDQuotient+1], a
+ ldh a, [hDivideBCDBuffer+2]
+ ldh [hDivideBCDQuotient+2], a
pop de
ld a, $6
sub d
@@ -117,28 +117,28 @@
ret
DivideBCD_divDivisorBy10:
- ld a, [hDivideBCDDivisor+2]
+ ldh a, [hDivideBCDDivisor+2]
swap a
and $f
ld b, a
- ld a, [hDivideBCDDivisor+1]
+ ldh a, [hDivideBCDDivisor+1]
swap a
- ld [hDivideBCDDivisor+1], a
+ ldh [hDivideBCDDivisor+1], a
and $f0
or b
- ld [hDivideBCDDivisor+2], a
- ld a, [hDivideBCDDivisor+1]
+ ldh [hDivideBCDDivisor+2], a
+ ldh a, [hDivideBCDDivisor+1]
and $f
ld b, a
- ld a, [hDivideBCDDivisor]
+ ldh a, [hDivideBCDDivisor]
swap a
- ld [hDivideBCDDivisor], a
+ ldh [hDivideBCDDivisor], a
and $f0
or b
- ld [hDivideBCDDivisor+1], a
- ld a, [hDivideBCDDivisor]
+ ldh [hDivideBCDDivisor+1], a
+ ldh a, [hDivideBCDDivisor]
and $f
- ld [hDivideBCDDivisor], a
+ ldh [hDivideBCDDivisor], a
ret
DivideBCD_getNextDigit:
--- a/engine/math/multiply_divide.asm
+++ b/engine/math/multiply_divide.asm
@@ -2,120 +2,120 @@
ld a, $8
ld b, a
xor a
- ld [hProduct], a
- ld [hMultiplyBuffer], a
- ld [hMultiplyBuffer+1], a
- ld [hMultiplyBuffer+2], a
- ld [hMultiplyBuffer+3], a
+ ldh [hProduct], a
+ ldh [hMultiplyBuffer], a
+ ldh [hMultiplyBuffer+1], a
+ ldh [hMultiplyBuffer+2], a
+ ldh [hMultiplyBuffer+3], a
.loop
- ld a, [hMultiplier]
+ ldh a, [hMultiplier]
srl a
- ld [hMultiplier], a ; (aliases: hDivisor, hMultiplier, hPowerOf10)
+ ldh [hMultiplier], a ; (aliases: hDivisor, hMultiplier, hPowerOf10)
jr nc, .smallMultiplier
- ld a, [hMultiplyBuffer+3]
+ ldh a, [hMultiplyBuffer+3]
ld c, a
- ld a, [hMultiplicand+2]
+ ldh a, [hMultiplicand+2]
add c
- ld [hMultiplyBuffer+3], a
- ld a, [hMultiplyBuffer+2]
+ ldh [hMultiplyBuffer+3], a
+ ldh a, [hMultiplyBuffer+2]
ld c, a
- ld a, [hMultiplicand+1]
+ ldh a, [hMultiplicand+1]
adc c
- ld [hMultiplyBuffer+2], a
- ld a, [hMultiplyBuffer+1]
+ ldh [hMultiplyBuffer+2], a
+ ldh a, [hMultiplyBuffer+1]
ld c, a
- ld a, [hMultiplicand] ; (aliases: hMultiplicand)
+ ldh a, [hMultiplicand] ; (aliases: hMultiplicand)
adc c
- ld [hMultiplyBuffer+1], a
- ld a, [hMultiplyBuffer]
+ ldh [hMultiplyBuffer+1], a
+ ldh a, [hMultiplyBuffer]
ld c, a
- ld a, [hProduct] ; (aliases: hProduct, hPastLeadingZeros, hQuotient)
+ ldh a, [hProduct] ; (aliases: hProduct, hPastLeadingZeros, hQuotient)
adc c
- ld [hMultiplyBuffer], a
+ ldh [hMultiplyBuffer], a
.smallMultiplier
dec b
jr z, .done
- ld a, [hMultiplicand+2]
+ ldh a, [hMultiplicand+2]
sla a
- ld [hMultiplicand+2], a
- ld a, [hMultiplicand+1]
+ ldh [hMultiplicand+2], a
+ ldh a, [hMultiplicand+1]
rl a
- ld [hMultiplicand+1], a
- ld a, [hMultiplicand]
+ ldh [hMultiplicand+1], a
+ ldh a, [hMultiplicand]
rl a
- ld [hMultiplicand], a
- ld a, [hProduct]
+ ldh [hMultiplicand], a
+ ldh a, [hProduct]
rl a
- ld [hProduct], a
+ ldh [hProduct], a
jr .loop
.done
- ld a, [hMultiplyBuffer+3]
- ld [hProduct+3], a
- ld a, [hMultiplyBuffer+2]
- ld [hProduct+2], a
- ld a, [hMultiplyBuffer+1]
- ld [hProduct+1], a
- ld a, [hMultiplyBuffer]
- ld [hProduct], a
+ ldh a, [hMultiplyBuffer+3]
+ ldh [hProduct+3], a
+ ldh a, [hMultiplyBuffer+2]
+ ldh [hProduct+2], a
+ ldh a, [hMultiplyBuffer+1]
+ ldh [hProduct+1], a
+ ldh a, [hMultiplyBuffer]
+ ldh [hProduct], a
ret
_Divide::
xor a
- ld [hDivideBuffer], a
- ld [hDivideBuffer+1], a
- ld [hDivideBuffer+2], a
- ld [hDivideBuffer+3], a
- ld [hDivideBuffer+4], a
+ ldh [hDivideBuffer], a
+ ldh [hDivideBuffer+1], a
+ ldh [hDivideBuffer+2], a
+ ldh [hDivideBuffer+3], a
+ ldh [hDivideBuffer+4], a
ld a, $9
ld e, a
.asm_37db3
- ld a, [hDivideBuffer]
+ ldh a, [hDivideBuffer]
ld c, a
- ld a, [hDividend+1] ; (aliases: hMultiplicand)
+ ldh a, [hDividend+1] ; (aliases: hMultiplicand)
sub c
ld d, a
- ld a, [hDivisor] ; (aliases: hDivisor, hMultiplier, hPowerOf10)
+ ldh a, [hDivisor] ; (aliases: hDivisor, hMultiplier, hPowerOf10)
ld c, a
- ld a, [hDividend] ; (aliases: hProduct, hPastLeadingZeros, hQuotient)
+ ldh a, [hDividend] ; (aliases: hProduct, hPastLeadingZeros, hQuotient)
sbc c
jr c, .asm_37dce
- ld [hDividend], a ; (aliases: hProduct, hPastLeadingZeros, hQuotient)
+ ldh [hDividend], a ; (aliases: hProduct, hPastLeadingZeros, hQuotient)
ld a, d
- ld [hDividend+1], a ; (aliases: hMultiplicand)
- ld a, [hDivideBuffer+4]
+ ldh [hDividend+1], a ; (aliases: hMultiplicand)
+ ldh a, [hDivideBuffer+4]
inc a
- ld [hDivideBuffer+4], a
+ ldh [hDivideBuffer+4], a
jr .asm_37db3
.asm_37dce
ld a, b
cp $1
jr z, .asm_37e18
- ld a, [hDivideBuffer+4]
+ ldh a, [hDivideBuffer+4]
sla a
- ld [hDivideBuffer+4], a
- ld a, [hDivideBuffer+3]
+ ldh [hDivideBuffer+4], a
+ ldh a, [hDivideBuffer+3]
rl a
- ld [hDivideBuffer+3], a
- ld a, [hDivideBuffer+2]
+ ldh [hDivideBuffer+3], a
+ ldh a, [hDivideBuffer+2]
rl a
- ld [hDivideBuffer+2], a
- ld a, [hDivideBuffer+1]
+ ldh [hDivideBuffer+2], a
+ ldh a, [hDivideBuffer+1]
rl a
- ld [hDivideBuffer+1], a
+ ldh [hDivideBuffer+1], a
dec e
jr nz, .asm_37e04
ld a, $8
ld e, a
- ld a, [hDivideBuffer]
- ld [hDivisor], a ; (aliases: hDivisor, hMultiplier, hPowerOf10)
+ ldh a, [hDivideBuffer]
+ ldh [hDivisor], a ; (aliases: hDivisor, hMultiplier, hPowerOf10)
xor a
- ld [hDivideBuffer], a
- ld a, [hDividend+1] ; (aliases: hMultiplicand)
- ld [hDividend], a ; (aliases: hProduct, hPastLeadingZeros, hQuotient)
- ld a, [hDividend+2]
- ld [hDividend+1], a ; (aliases: hMultiplicand)
- ld a, [hDividend+3]
- ld [hDividend+2], a
+ ldh [hDivideBuffer], a
+ ldh a, [hDividend+1] ; (aliases: hMultiplicand)
+ ldh [hDividend], a ; (aliases: hProduct, hPastLeadingZeros, hQuotient)
+ ldh a, [hDividend+2]
+ ldh [hDividend+1], a ; (aliases: hMultiplicand)
+ ldh a, [hDividend+3]
+ ldh [hDividend+2], a
.asm_37e04
ld a, e
cp $1
@@ -122,22 +122,22 @@
jr nz, .asm_37e0a
dec b
.asm_37e0a
- ld a, [hDivisor] ; (aliases: hDivisor, hMultiplier, hPowerOf10)
+ ldh a, [hDivisor] ; (aliases: hDivisor, hMultiplier, hPowerOf10)
srl a
- ld [hDivisor], a ; (aliases: hDivisor, hMultiplier, hPowerOf10)
- ld a, [hDivideBuffer]
+ ldh [hDivisor], a ; (aliases: hDivisor, hMultiplier, hPowerOf10)
+ ldh a, [hDivideBuffer]
rr a
- ld [hDivideBuffer], a
+ ldh [hDivideBuffer], a
jr .asm_37db3
.asm_37e18
- ld a, [hDividend+1] ; (aliases: hMultiplicand)
- ld [hRemainder], a ; (aliases: hDivisor, hMultiplier, hPowerOf10)
- ld a, [hDivideBuffer+4]
- ld [hQuotient+3], a
- ld a, [hDivideBuffer+3]
- ld [hQuotient+2], a
- ld a, [hDivideBuffer+2]
- ld [hQuotient+1], a ; (aliases: hMultiplicand)
- ld a, [hDivideBuffer+1]
- ld [hDividend], a ; (aliases: hProduct, hPastLeadingZeros, hQuotient)
+ ldh a, [hDividend+1] ; (aliases: hMultiplicand)
+ ldh [hRemainder], a ; (aliases: hDivisor, hMultiplier, hPowerOf10)
+ ldh a, [hDivideBuffer+4]
+ ldh [hQuotient+3], a
+ ldh a, [hDivideBuffer+3]
+ ldh [hQuotient+2], a
+ ldh a, [hDivideBuffer+2]
+ ldh [hQuotient+1], a ; (aliases: hMultiplicand)
+ ldh a, [hDivideBuffer+1]
+ ldh [hDividend], a ; (aliases: hProduct, hPastLeadingZeros, hQuotient)
ret
--- a/engine/math/random.asm
+++ b/engine/math/random.asm
@@ -1,13 +1,13 @@
Random_::
; Generate a random 16-bit value.
- ld a, [rDIV]
+ ldh a, [rDIV]
ld b, a
- ld a, [hRandomAdd]
+ ldh a, [hRandomAdd]
adc b
- ld [hRandomAdd], a
- ld a, [rDIV]
+ ldh [hRandomAdd], a
+ ldh a, [rDIV]
ld b, a
- ld a, [hRandomSub]
+ ldh a, [hRandomSub]
sbc b
- ld [hRandomSub], a
+ ldh [hRandomSub], a
ret
--- a/engine/menus/display_text_id_init.asm
+++ b/engine/menus/display_text_id_init.asm
@@ -5,7 +5,7 @@
ld a, [wAutoTextBoxDrawingControl]
bit 0, a
jr nz, .skipDrawingTextBoxBorder
- ld a, [hSpriteIndexOrTextID] ; text ID (or sprite ID)
+ ldh a, [hSpriteIndexOrTextID] ; text ID (or sprite ID)
and a
jr nz, .notStartMenu
; if text ID is 0 (i.e. the start menu)
@@ -71,8 +71,8 @@
ld b, $9c ; window background address
call CopyScreenTileBufferToVRAM ; transfer background in WRAM to VRAM
xor a
- ld [hWY], a ; put the window on the screen
+ ldh [hWY], a ; put the window on the screen
call LoadFontTilePatterns
ld a, $01
- ld [hAutoBGTransferEnabled], a ; enable continuous WRAM to VRAM transfer each V-blank
+ ldh [hAutoBGTransferEnabled], a ; enable continuous WRAM to VRAM transfer each V-blank
ret
--- a/engine/menus/league_pc.asm
+++ b/engine/menus/league_pc.asm
@@ -6,10 +6,10 @@
push hl
ld a, [wUpdateSpritesEnabled]
push af
- ld a, [hTilesetType]
+ ldh a, [hTilesetType]
push af
xor a
- ld [hTilesetType], a
+ ldh [hTilesetType], a
ld [wSpriteFlipped], a
ld [wUpdateSpritesEnabled], a
ld [wHoFTeamIndex2], a
@@ -40,7 +40,7 @@
jr nz, .loop
.doneShowingTeams
pop af
- ld [hTilesetType], a
+ ldh [hTilesetType], a
pop af
ld [wUpdateSpritesEnabled], a
pop hl
@@ -56,7 +56,7 @@
push bc
call LeaguePCShowMon
call WaitForTextScrollButtonPress
- ld a, [hJoyHeld]
+ ldh a, [hJoyHeld]
bit 1, a
jr nz, .exit
ld hl, wHallOfFame + HOF_MON
--- a/engine/menus/main_menu.asm
+++ b/engine/menus/main_menu.asm
@@ -94,11 +94,11 @@
set 5, [hl]
.inputLoop
xor a
- ld [hJoyPressed], a
- ld [hJoyReleased], a
- ld [hJoyHeld], a
+ ldh [hJoyPressed], a
+ ldh [hJoyReleased], a
+ ldh [hJoyHeld], a
call Joypad
- ld a, [hJoyHeld]
+ ldh a, [hJoyHeld]
bit 0, a
jr nz, .pressedA
bit 1, a
@@ -205,7 +205,7 @@
jr z, .useEnemyMenuSelection ; if the enemy pressed A or B but the player didn't, use the enemy's selection
; the enemy and the player both pressed A or B
; The gameboy that is clocking the connection wins.
- ld a, [hSerialConnectionStatus]
+ ldh a, [hSerialConnectionStatus]
cp USING_INTERNAL_CLOCK
jr z, .doneChoosingMenuSelection
.useEnemyMenuSelection
@@ -214,13 +214,13 @@
and $3
ld [wCurrentMenuItem], a
.doneChoosingMenuSelection
- ld a, [hSerialConnectionStatus]
+ ldh a, [hSerialConnectionStatus]
cp USING_INTERNAL_CLOCK
jr nz, .skipStartingTransfer
call DelayFrame
call DelayFrame
ld a, START_TRANSFER_INTERNAL_CLOCK
- ld [rSC], a
+ ldh [rSC], a
.skipStartingTransfer
ld b, $7f
ld c, $7f
@@ -314,9 +314,9 @@
; enter map after using a special warp or loading the game from the main menu
SpecialEnterMap::
xor a
- ld [hJoyPressed], a
- ld [hJoyHeld], a
- ld [hJoy5], a
+ ldh [hJoyPressed], a
+ ldh [hJoyHeld], a
+ ldh [hJoy5], a
ld [wd72d], a
ld hl, wd732
set 0, [hl] ; count play time
@@ -344,7 +344,7 @@
DisplayContinueGameInfo:
xor a
- ld [hAutoBGTransferEnabled], a
+ ldh [hAutoBGTransferEnabled], a
coord hl, 4, 7
ld b, 8
ld c, 14
@@ -362,13 +362,13 @@
coord hl, 13, 15
call PrintPlayTime
ld a, 1
- ld [hAutoBGTransferEnabled], a
+ ldh [hAutoBGTransferEnabled], a
ld c, 30
jp DelayFrames
PrintSaveScreenText:
xor a
- ld [hAutoBGTransferEnabled], a
+ ldh [hAutoBGTransferEnabled], a
coord hl, 4, 0
ld b, $8
ld c, $e
@@ -388,7 +388,7 @@
coord hl, 13, 8
call PrintPlayTime
ld a, $1
- ld [hAutoBGTransferEnabled], a
+ ldh [hAutoBGTransferEnabled], a
ld c, 30
jp DelayFrames
@@ -465,7 +465,7 @@
ld a, [wOptionsTextSpeedCursorX] ; text speed cursor X coordinate
ld [wTopMenuItemX], a
ld a, $01
- ld [hAutoBGTransferEnabled], a ; enable auto background transfer
+ ldh [hAutoBGTransferEnabled], a ; enable auto background transfer
call Delay3
.loop
call PlaceMenuCursor
@@ -472,7 +472,7 @@
call SetOptionsFromCursorPositions
.getJoypadStateLoop
call JoypadLowSensitivity
- ld a, [hJoy5]
+ ldh a, [hJoy5]
ld b, a
and A_BUTTON | B_BUTTON | START | D_RIGHT | D_LEFT | D_UP | D_DOWN ; any key besides select pressed?
jr z, .getJoypadStateLoop
--- a/engine/menus/naming_screen.asm
+++ b/engine/menus/naming_screen.asm
@@ -132,7 +132,7 @@
pop af
ld [wCurrentMenuItem], a
call JoypadLowSensitivity
- ld a, [hJoyPressed]
+ ldh a, [hJoyPressed]
and a
jr z, .inputLoop
ld hl, .namingScreenButtonFunctions
@@ -337,7 +337,7 @@
PrintAlphabet:
xor a
- ld [hAutoBGTransferEnabled], a
+ ldh [hAutoBGTransferEnabled], a
ld a, [wAlphabetCase]
and a
ld de, LowerCaseAlphabet
@@ -362,7 +362,7 @@
jr nz, .outerLoop
call PlaceString
ld a, $1
- ld [hAutoBGTransferEnabled], a
+ ldh [hAutoBGTransferEnabled], a
jp Delay3
INCLUDE "data/text/alphabets.asm"
--- a/engine/menus/party_menu.asm
+++ b/engine/menus/party_menu.asm
@@ -19,7 +19,7 @@
; f8: leveled up
DrawPartyMenu_::
xor a
- ld [hAutoBGTransferEnabled], a
+ ldh [hAutoBGTransferEnabled], a
call ClearScreen
call UpdateSprites
callba LoadMonPartySpriteGfxWithLCDDisabled ; load pokemon icon graphics
@@ -34,7 +34,7 @@
ld de, wPartySpecies
xor a
ld c, a
- ld [hPartyMonIndex], a
+ ldh [hPartyMonIndex], a
ld [wWhichPartyMenuHPBar], a
.loop
ld a, [de]
@@ -50,10 +50,10 @@
pop hl
call PlaceString ; print the pokemon's name
callba WriteMonPartySpriteOAMByPartyIndex ; place the appropriate pokemon icon
- ld a, [hPartyMonIndex]
+ ldh a, [hPartyMonIndex]
ld [wWhichPokemon], a
inc a
- ld [hPartyMonIndex], a
+ ldh [hPartyMonIndex], a
call LoadMonData
pop hl
push hl
@@ -88,14 +88,14 @@
pop hl
push hl
ld bc, SCREEN_WIDTH + 1 ; down 1 row and right 1 column
- ld a, [hFlagsFFF6]
+ ldh a, [hFlagsFFF6]
set 0, a
- ld [hFlagsFFF6], a
+ ldh [hFlagsFFF6], a
add hl, bc
predef DrawHP2 ; draw HP bar and prints current / max HP
- ld a, [hFlagsFFF6]
+ ldh a, [hFlagsFFF6]
res 0, a
- ld [hFlagsFFF6], a
+ ldh [hFlagsFFF6], a
call SetPartyMenuHPBarColor ; color the HP bar (on SGB)
pop hl
jr .printLevel
@@ -213,7 +213,7 @@
pop af
ld [hl], a
ld a, 1
- ld [hAutoBGTransferEnabled], a
+ ldh [hAutoBGTransferEnabled], a
call Delay3
jp GBPalNormal
.printItemUseMessage
--- a/engine/menus/pc.asm
+++ b/engine/menus/pc.asm
@@ -117,10 +117,10 @@
; removes one of the specified item ID [hItemToRemoveID] from bag (if existent)
RemoveItemByID::
ld hl, wBagItems
- ld a, [hItemToRemoveID]
+ ldh a, [hItemToRemoveID]
ld b, a
xor a
- ld [hItemToRemoveIndex], a
+ ldh [hItemToRemoveIndex], a
.loop
ld a, [hli]
cp -1 ; reached terminator?
@@ -128,14 +128,14 @@
cp b
jr z, .foundItem
inc hl
- ld a, [hItemToRemoveIndex]
+ ldh a, [hItemToRemoveIndex]
inc a
- ld [hItemToRemoveIndex], a
+ ldh [hItemToRemoveIndex], a
jr .loop
.foundItem
ld a, $1
ld [wItemQuantity], a
- ld a, [hItemToRemoveIndex]
+ ldh a, [hItemToRemoveIndex]
ld [wWhichPokemon], a
ld hl, wNumBagItems
jp RemoveItemFromInventory
--- a/engine/menus/pokedex.asm
+++ b/engine/menus/pokedex.asm
@@ -10,7 +10,7 @@
ld [wLastMenuItem], a
inc a
ld [wd11e], a
- ld [hJoy7], a
+ ldh [hJoy7], a
.setUpGraphics
ld b, SET_PAL_GENERIC
call RunPaletteCommand
@@ -35,7 +35,7 @@
ld [wMenuWatchMovingOutOfBounds], a
ld [wCurrentMenuItem], a
ld [wLastMenuItem], a
- ld [hJoy7], a
+ ldh [hJoy7], a
ld [wWastedByteCD3A], a
ld [wOverrideSimulatedJoypadStatesMask], a
pop af
@@ -156,7 +156,7 @@
; sets carry flag if player presses A, unsets carry flag if player presses B
HandlePokedexListMenu:
xor a
- ld [hAutoBGTransferEnabled], a
+ ldh [hAutoBGTransferEnabled], a
; draw the horizontal line separating the seen and owned amounts from the menu
coord hl, 15, 8
ld a, "─"
@@ -216,7 +216,7 @@
ld [wDexMaxSeenMon], a
.loop
xor a
- ld [hAutoBGTransferEnabled], a
+ ldh [hAutoBGTransferEnabled], a
coord hl, 4, 2
lb bc, 14, 10
call ClearScreenArea
@@ -280,7 +280,7 @@
dec d
jr nz, .printPokemonLoop
ld a, 01
- ld [hAutoBGTransferEnabled], a
+ ldh [hAutoBGTransferEnabled], a
call Delay3
call GBPalNormal
call HandleMenuInput
@@ -400,7 +400,7 @@
ld hl, wd72c
set 1, [hl]
ld a, $33 ; 3/7 volume
- ld [rNR50], a
+ ldh [rNR50], a
call GBPalWhiteOut ; zero all palettes
call ClearScreen
ld a, [wd11e] ; pokemon ID
@@ -410,10 +410,10 @@
call RunPaletteCommand
pop af
ld [wd11e], a
- ld a, [hTilesetType]
+ ldh a, [hTilesetType]
push af
xor a
- ld [hTilesetType], a
+ ldh [hTilesetType], a
coord hl, 0, 0
ld de, 1
@@ -548,9 +548,9 @@
lb bc, 2, 5 ; 2 bytes, 5 digits
call PrintNumber ; print weight
coord hl, 14, 8
- ld a, [hDexWeight + 1]
+ ldh a, [hDexWeight + 1]
sub 10
- ld a, [hDexWeight]
+ ldh a, [hDexWeight]
sbc 0
jr nc, .next
ld [hl], "0" ; if the weight is less than 10, put a 0 before the decimal point
@@ -560,24 +560,24 @@
ld [hld], a ; make space for the decimal point by moving the last digit forward one tile
ld [hl], "<DOT>" ; decimal point tile
pop af
- ld [hDexWeight + 1], a ; restore original value of [hDexWeight + 1]
+ ldh [hDexWeight + 1], a ; restore original value of [hDexWeight + 1]
pop af
- ld [hDexWeight], a ; restore original value of [hDexWeight]
+ ldh [hDexWeight], a ; restore original value of [hDexWeight]
pop hl
inc hl ; hl = address of pokedex description text
coord bc, 1, 11
ld a, %10
- ld [hClearLetterPrintingDelayFlags], a
+ ldh [hClearLetterPrintingDelayFlags], a
call TextCommandProcessor ; print pokedex description text
xor a
- ld [hClearLetterPrintingDelayFlags], a
+ ldh [hClearLetterPrintingDelayFlags], a
.waitForButtonPress
call JoypadLowSensitivity
- ld a, [hJoy5]
+ ldh a, [hJoy5]
and A_BUTTON | B_BUTTON
jr z, .waitForButtonPress
pop af
- ld [hTilesetType], a
+ ldh [hTilesetType], a
call GBPalWhiteOut
call ClearScreen
call RunDefaultPaletteCommand
@@ -586,7 +586,7 @@
ld hl, wd72c
res 1, [hl]
ld a, $77 ; max volume
- ld [rNR50], a
+ ldh [rNR50], a
ret
HeightWeightText:
--- a/engine/menus/save.asm
+++ b/engine/menus/save.asm
@@ -70,7 +70,7 @@
ld bc, wSpriteDataEnd - wSpriteDataStart
call CopyData
ld a, [sTilesetType]
- ld [hTilesetType], a
+ ldh [hTilesetType], a
ld hl, sCurBoxData
ld de, wBoxDataStart
ld bc, wBoxDataEnd - wBoxDataStart
@@ -217,7 +217,7 @@
ld de, sCurBoxData
ld bc, wBoxDataEnd - wBoxDataStart
call CopyData
- ld a, [hTilesetType]
+ ldh a, [hTilesetType]
ld [sTilesetType], a
ld hl, sPlayerName
ld bc, sMainDataCheckSum - sPlayerName
@@ -420,7 +420,7 @@
DisplayChangeBoxMenu:
xor a
- ld [hAutoBGTransferEnabled], a
+ ldh [hAutoBGTransferEnabled], a
ld a, A_BUTTON | B_BUTTON
ld [wMenuWatchedKeys], a
ld a, 11
@@ -486,7 +486,7 @@
dec a
jr nz, .loop
ld a, 1
- ld [hAutoBGTransferEnabled], a
+ ldh [hAutoBGTransferEnabled], a
ret
ChooseABoxText:
--- a/engine/menus/start_sub_menus.asm
+++ b/engine/menus/start_sub_menus.asm
@@ -50,7 +50,7 @@
ld hl, wTopMenuItemY
ld a, c
ld [hli], a ; top menu item Y
- ld a, [hFieldMoveMonMenuTopMenuItemX]
+ ldh a, [hFieldMoveMonMenuTopMenuItemX]
ld [hli], a ; top menu item X
xor a
ld [hli], a ; current menu item ID
@@ -239,11 +239,11 @@
ld bc, wPartyMon2 - wPartyMon1
call AddNTimes
ld a, [hli]
- ld [hDividend], a
+ ldh [hDividend], a
ld a, [hl]
- ld [hDividend + 1], a
+ ldh [hDividend + 1], a
ld a, 5
- ld [hDivisor], a
+ ldh [hDivisor], a
ld b, 2 ; number of bytes
call Divide
ld bc, wPartyMon1HP - wPartyMon1MaxHP
@@ -250,10 +250,10 @@
add hl, bc
ld a, [hld]
ld b, a
- ld a, [hQuotient + 3]
+ ldh a, [hQuotient + 3]
sub b
ld b, [hl]
- ld a, [hQuotient + 2]
+ ldh a, [hQuotient + 2]
sbc b
jp nc, .notHealthyEnough
ld a, [wPartyAndBillsPCSavedMenuItem]
@@ -454,10 +454,10 @@
call GBPalWhiteOut
call ClearScreen
call UpdateSprites
- ld a, [hTilesetType]
+ ldh a, [hTilesetType]
push af
xor a
- ld [hTilesetType], a
+ ldh [hTilesetType], a
call DrawTrainerInfo
predef DrawBadges ; draw badges
ld b, SET_PAL_TRAINER_CARD
@@ -471,7 +471,7 @@
call ReloadMapData
call LoadGBPal
pop af
- ld [hTilesetType], a
+ ldh [hTilesetType], a
jp RedisplayStartMenu
; loads tile patterns and draws everything except for gym leader faces / badges
@@ -648,7 +648,7 @@
StartMenu_Option::
xor a
- ld [hAutoBGTransferEnabled], a
+ ldh [hAutoBGTransferEnabled], a
call ClearScreen
call UpdateSprites
callab DisplayOptionMenu
@@ -737,10 +737,10 @@
inc d
.noCarry2
ld a, [hl]
- ld [hSwapTemp], a
+ ldh [hSwapTemp], a
ld a, [de]
ld [hl], a
- ld a, [hSwapTemp]
+ ldh a, [hSwapTemp]
ld [de], a
ld hl, wPartyMons
ld bc, wPartyMon2 - wPartyMon1
--- a/engine/menus/swap_items.asm
+++ b/engine/menus/swap_items.asm
@@ -77,18 +77,18 @@
cp b
jr z, .swapSameItemType
.swapDifferentItems
- ld [hSwapItemID], a ; save second item ID
+ ldh [hSwapItemID], a ; save second item ID
ld a, [hld]
- ld [hSwapItemQuantity], a ; save second item quantity
+ ldh [hSwapItemQuantity], a ; save second item quantity
ld a, [de]
ld [hli], a ; put first item ID in second item slot
inc de
ld a, [de]
ld [hl], a ; put first item quantity in second item slot
- ld a, [hSwapItemQuantity]
+ ldh a, [hSwapItemQuantity]
ld [de], a ; put second item quantity in first item slot
dec de
- ld a, [hSwapItemID]
+ ldh a, [hSwapItemID]
ld [de], a ; put second item ID in first item slot
xor a
ld [wMenuItemToSwap], a ; 0 means no item is currently being swapped
--- a/engine/menus/text_box.asm
+++ b/engine/menus/text_box.asm
@@ -584,7 +584,7 @@
call TextBoxBorder
call UpdateSprites
ld a, 12
- ld [hFieldMoveMonMenuTopMenuItemX], a
+ ldh [hFieldMoveMonMenuTopMenuItemX], a
coord hl, 13, 12
ld de, PokemonMenuEntries
jp PlaceString
@@ -673,7 +673,7 @@
.donePrintingNames
pop hl
ld a, [wFieldMovesLeftmostXCoord]
- ld [hFieldMoveMonMenuTopMenuItemX], a
+ ldh [hFieldMoveMonMenuTopMenuItemX], a
coord hl, 0, 12
ld a, [wFieldMovesLeftmostXCoord]
inc a
--- a/engine/movie/credits.asm
+++ b/engine/movie/credits.asm
@@ -19,7 +19,7 @@
coord hl, 0, 14
call FillFourRowsWithBlack
ld a, %11000000
- ld [rBGP], a
+ ldh [rBGP], a
call EnableLCD
ld a, SFX_STOP_ALL_MUSIC
call PlaySoundWaitForCurrent
@@ -38,7 +38,7 @@
ld b, 4
.loop
ld a, [hli]
- ld [rBGP], a
+ ldh [rBGP], a
ld c, 5
call DelayFrames
dec b
@@ -47,7 +47,7 @@
DisplayCreditsMon:
xor a
- ld [hAutoBGTransferEnabled], a
+ ldh [hAutoBGTransferEnabled], a
call SaveScreenTilesToBuffer1
call FillMiddleOfScreenWithWhite
@@ -67,17 +67,17 @@
ld hl, vBGMap0 + $c
call CreditsCopyTileMapToVRAM
xor a
- ld [hAutoBGTransferEnabled], a
+ ldh [hAutoBGTransferEnabled], a
call LoadScreenTilesFromBuffer1
ld hl, vBGMap0
call CreditsCopyTileMapToVRAM
ld a, $A7
- ld [rWX], a
+ ldh [rWX], a
ld hl, vBGMap1
call CreditsCopyTileMapToVRAM
call FillMiddleOfScreenWithWhite
ld a, %11111100 ; make the mon a black silhouette
- ld [rBGP], a
+ ldh [rBGP], a
; scroll the mon left by one tile 7 times
ld bc, 7
@@ -92,16 +92,16 @@
ld c, 20
.scrollLoop2
call ScrollCreditsMonLeft
- ld a, [rWX]
+ ldh a, [rWX]
sub 8
- ld [rWX], a
+ ldh [rWX], a
dec c
jr nz, .scrollLoop2
xor a
- ld [hWY], a
+ ldh [hWY], a
ld a, %11000000
- ld [rBGP], a
+ ldh [rBGP], a
ret
INCLUDE "data/credits/credits_mons.asm"
@@ -119,13 +119,13 @@
ret
ScrollCreditsMonLeft_SetSCX:
- ld a, [rLY]
+ ldh a, [rLY]
cp l
jr nz, ScrollCreditsMonLeft_SetSCX
ld a, h
- ld [rSCX], a
+ ldh [rSCX], a
.loop
- ld a, [rLY]
+ ldh a, [rLY]
cp h
jr z, .loop
ret
@@ -138,11 +138,11 @@
CreditsCopyTileMapToVRAM:
ld a, l
- ld [hAutoBGTransferDest], a
+ ldh [hAutoBGTransferDest], a
ld a, h
- ld [hAutoBGTransferDest + 1], a
+ ldh [hAutoBGTransferDest + 1], a
ld a, 1
- ld [hAutoBGTransferEnabled], a
+ ldh [hAutoBGTransferEnabled], a
jp Delay3
ZeroMemory:
--- a/engine/movie/evolution.asm
+++ b/engine/movie/evolution.asm
@@ -13,13 +13,13 @@
ld [wNewSoundID], a
call PlaySound
ld a, $1
- ld [hAutoBGTransferEnabled], a
+ ldh [hAutoBGTransferEnabled], a
ld a, SFX_TINK
call PlaySound
call Delay3
xor a
- ld [hAutoBGTransferEnabled], a
- ld [hTilesetType], a
+ ldh [hAutoBGTransferEnabled], a
+ ldh [hTilesetType], a
ld a, [wEvoOldSpecies]
ld [wWholeScreenPaletteMonSpecies], a
ld c, 0
@@ -37,7 +37,7 @@
ld [wd0b5], a
call Evolution_LoadPic
ld a, $1
- ld [hAutoBGTransferEnabled], a
+ ldh [hAutoBGTransferEnabled], a
ld a, [wEvoOldSpecies]
call PlayCry
call WaitForSoundToFinish
@@ -117,7 +117,7 @@
Evolution_ChangeMonPic:
push bc
xor a
- ld [hAutoBGTransferEnabled], a
+ ldh [hAutoBGTransferEnabled], a
coord hl, 7, 2
lb bc, 7, 7
ld de, SCREEN_WIDTH - 7
@@ -134,7 +134,7 @@
dec b
jr nz, .loop
ld a, 1
- ld [hAutoBGTransferEnabled], a
+ ldh [hAutoBGTransferEnabled], a
call Delay3
pop bc
ret
@@ -143,7 +143,7 @@
call DelayFrame
push bc
call JoypadLowSensitivity
- ld a, [hJoy5]
+ ldh a, [hJoy5]
pop bc
and B_BUTTON
jr nz, .pressedB
--- a/engine/movie/gamefreak.asm
+++ b/engine/movie/gamefreak.asm
@@ -1,8 +1,8 @@
LoadShootingStarGraphics:
ld a, $f9
- ld [rOBP0], a
+ ldh [rOBP0], a
ld a, $a4
- ld [rOBP1], a
+ ldh [rOBP1], a
ld de, AnimationTileset2 + $30 ; star tile (top left quadrant)
ld hl, vChars1 + $200
lb bc, BANK(AnimationTileset2), $01
@@ -201,9 +201,9 @@
jr nz, .innerLoop
; Toggle the palette so that the lower star in the small stars tile blinks in
; and out.
- ld a, [rOBP1]
+ ldh a, [rOBP1]
xor %10100000
- ld [rOBP1], a
+ ldh [rOBP1], a
ld c, 3
call CheckForUserInterruption
--- a/engine/movie/hall_of_fame.asm
+++ b/engine/movie/hall_of_fame.asm
@@ -19,12 +19,12 @@
call FillMemory
xor a
ld [wUpdateSpritesEnabled], a
- ld [hTilesetType], a
+ ldh [hTilesetType], a
ld [wSpriteFlipped], a
ld [wLetterPrintingDelayFlags], a ; no delay
ld [wHoFMonOrPlayer], a ; mon
inc a
- ld [hAutoBGTransferEnabled], a
+ ldh [hAutoBGTransferEnabled], a
ld hl, wNumHoFTeams
ld a, [hl]
inc a
@@ -32,7 +32,7 @@
inc [hl]
.skipInc
ld a, $90
- ld [hWY], a
+ ldh [hWY], a
ld c, BANK(Music_HallOfFame)
ld a, MUSIC_HALL_OF_FAME
call PlayMusic
@@ -86,7 +86,7 @@
call HoFDisplayPlayerStats
call HoFFadeOutScreenAndMusic
xor a
- ld [hWY], a
+ ldh [hWY], a
ld hl, rLCDC
res 3, [hl]
ret
@@ -97,9 +97,9 @@
HoFShowMonOrPlayer:
call ClearScreen
ld a, $d0
- ld [hSCY], a
+ ldh [hSCY], a
ld a, $c0
- ld [hSCX], a
+ ldh [hSCX], a
ld a, [wHoFMonSpecies]
ld [wcf91], a
ld [wd0b5], a
@@ -121,7 +121,7 @@
ld c, 0
call RunPaletteCommand
ld a, %11100100
- ld [rBGP], a
+ ldh [rBGP], a
ld c, $31 ; back pic
call HoFLoadMonPlayerPicTileIDs
ld d, $a0
@@ -133,7 +133,7 @@
.next2
call .ScrollPic ; scroll back pic left
xor a
- ld [hSCY], a
+ ldh [hSCY], a
ld c, a ; front pic
call HoFLoadMonPlayerPicTileIDs
ld d, 0
@@ -142,9 +142,9 @@
.ScrollPic
call DelayFrame
- ld a, [hSCX]
+ ldh a, [hSCX]
add e
- ld [hSCX], a
+ ldh [hSCX], a
cp d
jr nz, .ScrollPic
ret
--- a/engine/movie/intro.asm
+++ b/engine/movie/intro.asm
@@ -12,15 +12,15 @@
PlayIntro:
xor a
- ld [hJoyHeld], a
+ ldh [hJoyHeld], a
inc a
- ld [hAutoBGTransferEnabled], a
+ ldh [hAutoBGTransferEnabled], a
call PlayShootingStar
call PlayIntroScene
call GBFadeOutToWhite
xor a
- ld [hSCX], a
- ld [hAutoBGTransferEnabled], a
+ ldh [hSCX], a
+ ldh [hAutoBGTransferEnabled], a
call ClearSprites
call DelayFrame
ret
@@ -29,11 +29,11 @@
ld b, SET_PAL_NIDORINO_INTRO
call RunPaletteCommand
ldPal a, BLACK, DARK_GRAY, LIGHT_GRAY, WHITE
- ld [rBGP], a
- ld [rOBP0], a
- ld [rOBP1], a
+ ldh [rBGP], a
+ ldh [rOBP0], a
+ ldh [rOBP1], a
xor a
- ld [hSCX], a
+ ldh [hSCX], a
ld b, GENGAR_INTRO_TILES1
call IntroCopyTiles
ld a, 0
@@ -245,7 +245,7 @@
cp MOVE_GENGAR_LEFT
jr z, .moveGengarLeft
; move Gengar right
- ld a, [hSCX]
+ ldh a, [hSCX]
dec a
dec a
jr .next
@@ -259,11 +259,11 @@
call UpdateIntroNidorinoOAM
pop de
.moveGengarLeft
- ld a, [hSCX]
+ ldh a, [hSCX]
inc a
inc a
.next
- ld [hSCX], a
+ ldh [hSCX], a
push de
ld c, 2
call CheckForUserInterruption
@@ -313,7 +313,7 @@
call RunPaletteCommand
callba LoadCopyrightAndTextBoxTiles
ldPal a, BLACK, DARK_GRAY, LIGHT_GRAY, WHITE
- ld [rBGP], a
+ ldh [rBGP], a
ld c, 180
call DelayFrames
call ClearScreen
--- a/engine/movie/oak_speech/init_player_data.asm
+++ b/engine/movie/oak_speech/init_player_data.asm
@@ -2,11 +2,11 @@
InitPlayerData2:
call Random
- ld a, [hRandomSub]
+ ldh a, [hRandomSub]
ld [wPlayerID], a
call Random
- ld a, [hRandomAdd]
+ ldh a, [hRandomAdd]
ld [wPlayerID + 1], a
ld a, $ff
--- a/engine/movie/oak_speech/oak_speech.asm
+++ b/engine/movie/oak_speech/oak_speech.asm
@@ -52,7 +52,7 @@
ld [wDestinationMap], a
call SpecialWarpIn
xor a
- ld [hTilesetType], a
+ ldh [hTilesetType], a
ld a, [wd732]
bit 1, a ; possibly a debug mode bit
jp nz, .skipChoosingNames
@@ -104,12 +104,12 @@
ld hl, OakSpeechText3
call PrintText
.next
- ld a, [hLoadedROMBank]
+ ldh a, [hLoadedROMBank]
push af
ld a, SFX_SHRINK
call PlaySound
pop af
- ld [hLoadedROMBank], a
+ ldh [hLoadedROMBank], a
ld [MBC1RomBank], a
ld c, 4
call DelayFrames
@@ -126,7 +126,7 @@
lb bc, BANK(ShrinkPic2), $00
call IntroDisplayPicCenteredOrUpperRight
call ResetPlayerSpriteData
- ld a, [hLoadedROMBank]
+ ldh a, [hLoadedROMBank]
push af
ld a, BANK(Music_PalletTown)
ld [wAudioROMBank], a
@@ -137,7 +137,7 @@
ld [wNewSoundID], a
call PlaySound
pop af
- ld [hLoadedROMBank], a
+ ldh [hLoadedROMBank], a
ld [MBC1RomBank], a
ld c, 20
call DelayFrames
@@ -175,7 +175,7 @@
ld b, 6
.next
ld a, [hli]
- ld [rBGP], a
+ ldh [rBGP], a
ld c, 10
call DelayFrames
dec b
@@ -192,18 +192,18 @@
MovePicLeft:
ld a, 119
- ld [rWX], a
+ ldh [rWX], a
call DelayFrame
ld a, %11100100
- ld [rBGP], a
+ ldh [rBGP], a
.next
call DelayFrame
- ld a, [rWX]
+ ldh a, [rWX]
sub 8
cp $FF
ret z
- ld [rWX], a
+ ldh [rWX], a
jr .next
DisplayPicCenteredOrUpperRight:
@@ -229,5 +229,5 @@
coord hl, 6, 4
.next
xor a
- ld [hStartTileID], a
+ ldh [hStartTileID], a
predef_jump CopyUncompressedPicToTilemap
--- a/engine/movie/oak_speech/oak_speech2.asm
+++ b/engine/movie/oak_speech/oak_speech2.asm
@@ -90,13 +90,13 @@
push hl
push de
push bc
- ld [hSlideDirection], a
+ ldh [hSlideDirection], a
ld a, d
- ld [hSlideAmount], a
+ ldh [hSlideAmount], a
ld a, e
- ld [hSlidingRegionSize], a
+ ldh [hSlidingRegionSize], a
ld c, a
- ld a, [hSlideDirection]
+ ldh a, [hSlideDirection]
and a
jr nz, .next
; If sliding right, point hl to the end of the pic's tiles.
@@ -107,8 +107,8 @@
ld e, l
.loop
xor a
- ld [hAutoBGTransferEnabled], a
- ld a, [hSlideDirection]
+ ldh [hAutoBGTransferEnabled], a
+ ldh a, [hSlideDirection]
and a
jr nz, .slideLeft
; sliding right
@@ -123,7 +123,7 @@
.next2
dec c
jr nz, .loop
- ld a, [hSlideDirection]
+ ldh a, [hSlideDirection]
and a
jr z, .next3
; If sliding left, we need to zero the last tile in the pic (there is no need
@@ -134,13 +134,13 @@
ld [hl], a
.next3
ld a, 1
- ld [hAutoBGTransferEnabled], a
+ ldh [hAutoBGTransferEnabled], a
call Delay3
- ld a, [hSlidingRegionSize]
+ ldh a, [hSlidingRegionSize]
ld c, a
ld h, d
ld l, e
- ld a, [hSlideDirection]
+ ldh a, [hSlideDirection]
and a
jr nz, .slideLeft2
inc hl
@@ -150,9 +150,9 @@
.next4
ld d, h
ld e, l
- ld a, [hSlideAmount]
+ ldh a, [hSlideAmount]
dec a
- ld [hSlideAmount], a
+ ldh [hSlideAmount], a
jr nz, .loop
pop bc
pop de
--- a/engine/movie/title.asm
+++ b/engine/movie/title.asm
@@ -11,7 +11,7 @@
ld de, wRivalName
call CopyFixedLengthText
xor a
- ld [hWY], a
+ ldh [hWY], a
ld [wLetterPrintingDelayFlags], a
ld hl, wd732
ld [hli], a
@@ -24,14 +24,14 @@
DisplayTitleScreen:
call GBPalWhiteOut
ld a, $1
- ld [hAutoBGTransferEnabled], a
+ ldh [hAutoBGTransferEnabled], a
xor a
- ld [hTilesetType], a
- ld [hSCX], a
+ ldh [hTilesetType], a
+ ldh [hSCX], a
ld a, $40
- ld [hSCY], a
+ ldh [hSCY], a
ld a, $90
- ld [hWY], a
+ ldh [hWY], a
call ClearScreen
call DisableLCD
call LoadFontTilePatterns
@@ -130,7 +130,7 @@
call TitleScreenCopyTileMapToVRAM
call SaveScreenTilesToBuffer1
ld a, $40
- ld [hWY], a
+ ldh [hWY], a
call LoadScreenTilesFromBuffer2
ld a, vBGMap0 / $100
call TitleScreenCopyTileMapToVRAM
@@ -138,7 +138,7 @@
call RunPaletteCommand
call GBPalNormal
ld a, %11100100
- ld [rOBP0], a
+ ldh [rOBP0], a
; make pokemon logo bounce up and down
ld bc, hSCY ; background scroll Y
@@ -190,7 +190,7 @@
; scroll game version in from the right
call PrintGameVersionOnTitleScreen
ld a, SCREEN_HEIGHT_PX
- ld [hWY], a
+ ldh [hWY], a
ld d, 144
.scrollTitleScreenGameVersionLoop
ld h, d
@@ -237,9 +237,9 @@
call GBPalWhiteOutWithDelay3
call ClearSprites
xor a
- ld [hWY], a
+ ldh [hWY], a
inc a
- ld [hAutoBGTransferEnabled], a
+ ldh [hAutoBGTransferEnabled], a
call ClearScreen
ld a, vBGMap0 / $100
call TitleScreenCopyTileMapToVRAM
@@ -247,7 +247,7 @@
call TitleScreenCopyTileMapToVRAM
call Delay3
call LoadGBPal
- ld a, [hJoyHeld]
+ ldh a, [hJoyHeld]
ld b, a
and D_UP | SELECT | B_BUTTON
cp D_UP | SELECT | B_BUTTON
@@ -280,7 +280,7 @@
call LoadTitleMonSprite
ld a, $90
- ld [hWY], a
+ ldh [hWY], a
ld d, 1 ; scroll out
callba TitleScroll
ret
@@ -289,20 +289,20 @@
ld d, 0 ; scroll in
callba TitleScroll
xor a
- ld [hWY], a
+ ldh [hWY], a
ret
ScrollTitleScreenGameVersion:
.wait
- ld a, [rLY]
+ ldh a, [rLY]
cp l
jr nz, .wait
ld a, h
- ld [rSCX], a
+ ldh [rSCX], a
.wait2
- ld a, [rLY]
+ ldh a, [rLY]
cp h
jr z, .wait2
ret
@@ -358,12 +358,12 @@
jp LoadFrontSpriteByMonIndex
TitleScreenCopyTileMapToVRAM:
- ld [hAutoBGTransferDest + 1], a
+ ldh [hAutoBGTransferDest + 1], a
jp Delay3
LoadCopyrightAndTextBoxTiles:
xor a
- ld [hWY], a
+ ldh [hWY], a
call ClearScreen
call LoadTextBoxTilePatterns
--- a/engine/movie/title2.asm
+++ b/engine/movie/title2.asm
@@ -69,15 +69,15 @@
.ScrollBetween:
.wait
- ld a, [rLY] ; rLY
+ ldh a, [rLY] ; rLY
cp l
jr nz, .wait
ld a, h
- ld [rSCX], a
+ ldh [rSCX], a
.wait2
- ld a, [rLY] ; rLY
+ ldh a, [rLY] ; rLY
cp h
jr z, .wait2
ret
--- a/engine/movie/trade.asm
+++ b/engine/movie/trade.asm
@@ -20,14 +20,14 @@
TradeAnimCommon:
ld a, [wOptions]
push af
- ld a, [hSCY]
+ ldh a, [hSCY]
push af
- ld a, [hSCX]
+ ldh a, [hSCX]
push af
xor a
ld [wOptions], a
- ld [hSCY], a
- ld [hSCX], a
+ ldh [hSCY], a
+ ldh [hSCX], a
push de
.loop
pop de
@@ -49,9 +49,9 @@
jp hl ; call trade func, which will return to the top of the loop
.done
pop af
- ld [hSCX], a
+ ldh [hSCX], a
pop af
- ld [hSCY], a
+ ldh [hSCY], a
pop af
ld [wOptions], a
ret
@@ -137,10 +137,10 @@
Trade_CopyTileMapToVRAM:
ld a, $1
- ld [hAutoBGTransferEnabled], a
+ ldh [hAutoBGTransferEnabled], a
call Delay3
xor a
- ld [hAutoBGTransferEnabled], a
+ ldh [hAutoBGTransferEnabled], a
ret
Trade_Delay80:
@@ -181,10 +181,10 @@
jr z, .next
ld a, $f0 ; SGB OBP0
.next
- ld [rOBP0], a
+ ldh [rOBP0], a
call EnableLCD
xor a
- ld [hAutoBGTransferEnabled], a
+ ldh [hAutoBGTransferEnabled], a
ld a, [wTradedPlayerMonSpecies]
ld [wd11e], a
call GetMonName
@@ -198,7 +198,7 @@
Trade_LoadMonPartySpriteGfx:
ld a, %11010000
- ld [rOBP1], a
+ ldh [rOBP1], a
jpba LoadMonPartySpriteGfx
Trade_SwapNames:
@@ -224,14 +224,14 @@
Trade_ShowPlayerMon:
ld a, %10101011
- ld [rLCDC], a
+ ldh [rLCDC], a
ld a, $50
- ld [hWY], a
+ ldh [hWY], a
ld a, $86
- ld [rWX], a
- ld [hSCX], a
+ ldh [rWX], a
+ ldh [hSCX], a
xor a
- ld [hAutoBGTransferEnabled], a
+ ldh [hAutoBGTransferEnabled], a
coord hl, 4, 0
ld b, 6
ld c, 10
@@ -247,8 +247,8 @@
push af
call DelayFrame
pop af
- ld [rWX], a
- ld [hSCX], a
+ ldh [rWX], a
+ ldh [hSCX], a
dec a
dec a
and a
@@ -261,7 +261,7 @@
ld a, [wTradedPlayerMonSpecies]
call PlayCry
xor a
- ld [hAutoBGTransferEnabled], a
+ ldh [hAutoBGTransferEnabled], a
ret
Trade_DrawOpenEndOfLinkCable:
@@ -277,10 +277,10 @@
call Trade_CopyCableTilesOffScreen
ld a, $a0
- ld [hSCX], a
+ ldh [hSCX], a
call DelayFrame
ld a, %10001011
- ld [rLCDC], a
+ ldh [rLCDC], a
coord hl, 6, 2
ld b, $7 ; open end of link cable tile ID list index
call CopyTileIDsFromList_ZeroBaseTileID
@@ -289,9 +289,9 @@
call PlaySound
ld c, 20
.loop
- ld a, [hSCX]
+ ldh a, [hSCX]
add 4
- ld [hSCX], a
+ ldh [hSCX], a
dec c
jr nz, .loop
ret
@@ -302,7 +302,7 @@
ld c, 10
call DelayFrames
ld a, %11100100
- ld [rOBP0], a
+ ldh [rOBP0], a
xor a
ld [wLinkCableAnimBulgeToggle], a
lb bc, $20, $60
@@ -336,13 +336,13 @@
.ballSpriteReachedEdgeOfScreen
call ClearSprites
ld a, $1
- ld [hAutoBGTransferEnabled], a
+ ldh [hAutoBGTransferEnabled], a
call ClearScreen
ld b, $98
call CopyScreenTileBufferToVRAM
call Delay3
xor a
- ld [hAutoBGTransferEnabled], a
+ ldh [hAutoBGTransferEnabled], a
ret
Trade_BallInsideLinkCableOAM:
@@ -360,13 +360,13 @@
call Trade_PrintEnemyMonInfoText
call Trade_CopyTileMapToVRAM
ld a, $1
- ld [hAutoBGTransferEnabled], a
+ ldh [hAutoBGTransferEnabled], a
ld a, [wTradedEnemyMonSpecies]
call Trade_LoadMonSprite
ld a, TRADE_BALL_POOF_ANIM
call Trade_ShowAnimation
ld a, $1
- ld [hAutoBGTransferEnabled], a
+ ldh [hAutoBGTransferEnabled], a
ld a, [wTradedEnemyMonSpecies]
call PlayCry
call Trade_Delay100
@@ -381,7 +381,7 @@
ld a, $1
ld [wTradedMonMovingRight], a
ld a, %11100100
- ld [rOBP0], a
+ ldh [rOBP0], a
ld a, $54
ld [wBaseCoordX], a
ld a, $1c
@@ -397,7 +397,7 @@
ld b, $6
call Trade_AnimMonMoveHorizontal
ld a, $1
- ld [hAutoBGTransferEnabled], a
+ ldh [hAutoBGTransferEnabled], a
call Trade_DrawCableAcrossScreen
ld b, $4
call Trade_AnimMonMoveHorizontal
@@ -405,7 +405,7 @@
ld b, $6
call Trade_AnimMonMoveHorizontal
xor a
- ld [hAutoBGTransferEnabled], a
+ ldh [hAutoBGTransferEnabled], a
call Trade_AnimMonMoveVertical
jp ClearSprites
@@ -430,7 +430,7 @@
ld b, $6
call Trade_AnimMonMoveHorizontal
ld a, $1
- ld [hAutoBGTransferEnabled], a
+ ldh [hAutoBGTransferEnabled], a
call Trade_DrawCableAcrossScreen
ld b, $4
call Trade_AnimMonMoveHorizontal
@@ -438,24 +438,24 @@
ld b, $6
call Trade_AnimMonMoveHorizontal
xor a
- ld [hAutoBGTransferEnabled], a
+ ldh [hAutoBGTransferEnabled], a
jp ClearSprites
Trade_InitGameboyTransferGfx:
; Initialises the graphics for showing a mon moving between gameboys.
ld a, $1
- ld [hAutoBGTransferEnabled], a
+ ldh [hAutoBGTransferEnabled], a
call ClearScreen
xor a
- ld [hAutoBGTransferEnabled], a
+ ldh [hAutoBGTransferEnabled], a
call Trade_LoadMonPartySpriteGfx
call DelayFrame
ld a, %10101011
- ld [rLCDC], a
+ ldh [rLCDC], a
xor a
- ld [hSCX], a
+ ldh [hSCX], a
ld a, $90
- ld [hWY], a
+ ldh [hWY], a
ret
Trade_DrawLeftGameboy:
@@ -555,11 +555,11 @@
call CopyToRedrawRowOrColumnSrcTiles
pop hl
ld a, h
- ld [hRedrawRowOrColumnDest + 1], a
+ ldh [hRedrawRowOrColumnDest + 1], a
ld a, l
- ld [hRedrawRowOrColumnDest], a
+ ldh [hRedrawRowOrColumnDest], a
ld a, REDRAW_ROW
- ld [hRedrawRowOrColumnMode], a
+ ldh [hRedrawRowOrColumnMode], a
ld c, 10
jp DelayFrames
@@ -574,14 +574,14 @@
dec a
jr z, .movingRight
; moving left
- ld a, [hSCX]
+ ldh a, [hSCX]
sub $2
jr .next
.movingRight
- ld a, [hSCX]
+ ldh a, [hSCX]
add $2
.next
- ld [hSCX], a
+ ldh [hSCX], a
call DelayFrame
dec d
jr nz, .scrollLoop
@@ -596,9 +596,9 @@
push de
push bc
push hl
- ld a, [rBGP]
+ ldh a, [rBGP]
xor $3c ; make link cable flash
- ld [rBGP], a
+ ldh [rBGP], a
ld hl, wOAMBuffer + $02
ld de, $4
ld c, $14
@@ -731,9 +731,9 @@
ld b, SET_PAL_POKEMON_WHOLE_SCREEN
ld c, 0
call RunPaletteCommand
- ld a, [hAutoBGTransferEnabled]
+ ldh a, [hAutoBGTransferEnabled]
xor $1
- ld [hAutoBGTransferEnabled], a
+ ldh [hAutoBGTransferEnabled], a
call GetMonHeader
coord hl, 7, 2
call LoadFlippedFrontSpriteByMonIndex
@@ -743,16 +743,16 @@
Trade_ShowClearedWindow:
; clears the window and covers the BG entirely with the window
ld a, $1
- ld [hAutoBGTransferEnabled], a
+ ldh [hAutoBGTransferEnabled], a
call ClearScreen
ld a, %11100011
- ld [rLCDC], a
+ ldh [rLCDC], a
ld a, $7
- ld [rWX], a
+ ldh [rWX], a
xor a
- ld [hWY], a
+ ldh [hWY], a
ld a, $90
- ld [hSCX], a
+ ldh [hSCX], a
ret
Trade_SlideTextBoxOffScreen:
@@ -764,10 +764,10 @@
call DelayFrames
.loop
call DelayFrame
- ld a, [rWX]
+ ldh a, [rWX]
inc a
inc a
- ld [rWX], a
+ ldh [rWX], a
cp $a1
jr nz, .loop
call Trade_ClearTileMap
@@ -774,7 +774,7 @@
ld c, 10
call DelayFrames
ld a, $7
- ld [rWX], a
+ ldh [rWX], a
ret
PrintTradeWentToText:
--- a/engine/overworld/auto_movement.asm
+++ b/engine/overworld/auto_movement.asm
@@ -66,7 +66,7 @@
call FillMemory
ld [hl], $ff
ld a, [wSpriteIndex]
- ld [hSpriteIndex], a
+ ldh [hSpriteIndex], a
ld de, wNPCMovementDirections2
call MoveSprite
ld a, $1
@@ -91,7 +91,7 @@
ret nz ; return if Oak is still moving
ld a, [wNumStepsToTake]
ld [wSimulatedJoypadStatesIndex], a
- ld [hNPCMovementDirections2Index], a
+ ldh [hNPCMovementDirections2Index], a
predef ConvertNPCMovementDirectionsToJoypadMasks
call StartSimulatingJoypadStates
ld a, $2
@@ -282,7 +282,7 @@
jr .loop
.notRival
ld a, [wSpriteIndex]
- ld [hSpriteIndex], a
+ ldh [hSpriteIndex], a
jp SetSpriteMovementBytesToFF
RivalIDs:
--- a/engine/overworld/clear_variables.asm
+++ b/engine/overworld/clear_variables.asm
@@ -1,14 +1,14 @@
ClearVariablesOnEnterMap::
ld a, SCREEN_HEIGHT_PX
- ld [hWY], a
- ld [rWY], a
+ ldh [hWY], a
+ ldh [rWY], a
xor a
- ld [hAutoBGTransferEnabled], a
+ ldh [hAutoBGTransferEnabled], a
ld [wStepCounter], a
ld [wLoneAttackNo], a
- ld [hJoyPressed], a
- ld [hJoyReleased], a
- ld [hJoyHeld], a
+ ldh [hJoyPressed], a
+ ldh [hJoyReleased], a
+ ldh [hJoyHeld], a
ld [wActionResultOrTookBattleTurn], a
ld [wUnusedD5A3], a
ld hl, wCardKeyDoorY
--- a/engine/overworld/cut.asm
+++ b/engine/overworld/cut.asm
@@ -38,7 +38,7 @@
call ClearSprites
call RestoreScreenTilesAndReloadTilePatterns
ld a, SCREEN_HEIGHT_PX
- ld [hWY], a
+ ldh [hWY], a
call Delay3
call LoadGBPal
call LoadCurrentMapView
@@ -45,7 +45,7 @@
call SaveScreenTilesToBuffer2
call Delay3
xor a
- ld [hWY], a
+ ldh [hWY], a
ld hl, UsedCutText
call PrintText
call LoadScreenTilesFromBuffer2
@@ -63,7 +63,7 @@
ld a, SFX_CUT
call PlaySound
ld a, $90
- ld [hWY], a
+ ldh [hWY], a
call UpdateSprites
jp RedrawMapView
@@ -75,7 +75,7 @@
xor a
ld [wWhichAnimationOffsets], a
ld a, %11100100
- ld [rOBP1], a
+ ldh [rOBP1], a
ld a, [wCutTile]
cp $52
jr z, .grass
--- a/engine/overworld/cut2.asm
+++ b/engine/overworld/cut2.asm
@@ -15,9 +15,9 @@
ld [wCoordAdjustmentAmount], a
ld c, 2
call AdjustOAMBlockXPos2
- ld a, [rOBP1]
+ ldh a, [rOBP1]
xor $64
- ld [rOBP1], a
+ ldh [rOBP1], a
call DelayFrame
pop bc
dec c
@@ -65,9 +65,9 @@
ld [wCoordAdjustmentAmount], a
ld c, 1
call AdjustOAMBlockXPos2
- ld a, [rOBP1]
+ ldh a, [rOBP1]
xor $64
- ld [rOBP1], a
+ ldh [rOBP1], a
call DelayFrame
pop bc
dec c
--- a/engine/overworld/dust_smoke.asm
+++ b/engine/overworld/dust_smoke.asm
@@ -6,7 +6,7 @@
ld a, $ff
ld [wUpdateSpritesEnabled], a
ld a, %11100100
- ld [rOBP1], a
+ ldh [rOBP1], a
call LoadSmokeTileFourTimes
callba WriteCutOrBoulderDustAnimationOAMBlock
ld c, 8 ; number of steps in animation
@@ -18,9 +18,9 @@
ld c, 4
jp hl
.returnAddress
- ld a, [rOBP1]
+ ldh a, [rOBP1]
xor %01100100
- ld [rOBP1], a
+ ldh [rOBP1], a
call Delay3
pop bc
dec c
--- a/engine/overworld/elevator.asm
+++ b/engine/overworld/elevator.asm
@@ -6,7 +6,7 @@
call Delay3
ld a, SFX_STOP_ALL_MUSIC
call PlaySound
- ld a, [hSCY]
+ ldh a, [hSCY]
ld d, a
ld e, $1
ld b, 100
@@ -15,7 +15,7 @@
xor $fe
ld e, a
add d
- ld [hSCY], a
+ ldh [hSCY], a
push bc
ld c, BANK(SFX_Collision_1)
ld a, SFX_COLLISION
@@ -26,7 +26,7 @@
dec b
jr nz, .shakeLoop
ld a, d
- ld [hSCY], a
+ ldh [hSCY], a
ld a, SFX_STOP_ALL_MUSIC
call PlaySound
ld c, BANK(SFX_Safari_Zone_PA)
--- a/engine/overworld/healing_machine.asm
+++ b/engine/overworld/healing_machine.asm
@@ -8,10 +8,10 @@
push af
ld [hl], $ff
push hl
- ld a, [rOBP1]
+ ldh a, [rOBP1]
push af
ld a, $e0
- ld [rOBP1], a
+ ldh [rOBP1], a
ld hl, wOAMBuffer + $84
ld de, PokeCenterOAMData
call CopyHealingMachineOAM
@@ -56,7 +56,7 @@
ld c, 32
call DelayFrames
pop af
- ld [rOBP1], a
+ ldh [rOBP1], a
pop hl
pop af
ld [hl], a
@@ -78,9 +78,9 @@
FlashSprite8Times:
ld b, 8
.loop
- ld a, [rOBP1]
+ ldh a, [rOBP1]
xor d
- ld [rOBP1], a
+ ldh [rOBP1], a
ld c, 10
call DelayFrames
dec b
--- a/engine/overworld/hidden_objects.asm
+++ b/engine/overworld/hidden_objects.asm
@@ -58,7 +58,7 @@
ld [wHiddenObjectX], a
ld c, a
call CheckIfCoordsInFrontOfPlayerMatch
- ld a, [hCoordsInFrontOfPlayerMatch]
+ ldh a, [hCoordsInFrontOfPlayerMatch]
and a
jr z, .foundMatchingObject
inc hl
@@ -81,7 +81,7 @@
ret
.noMatch
ld a, $ff
- ld [hDidntFindAnyHiddenObject], a
+ ldh [hDidntFindAnyHiddenObject], a
ret
; checks if the coordinates in front of the player's sprite match Y in b and X in c
@@ -127,7 +127,7 @@
.didNotMatch
ld a, $ff
.done
- ld [hCoordsInFrontOfPlayerMatch], a
+ ldh [hCoordsInFrontOfPlayerMatch], a
ret
INCLUDE "data/events/hidden_objects.asm"
--- a/engine/overworld/ledges.asm
+++ b/engine/overworld/ledges.asm
@@ -36,7 +36,7 @@
inc hl
jr .loop
.foundMatch
- ld a, [hJoyHeld]
+ ldh a, [hJoyHeld]
and e
ret z
ld a, $ff
--- a/engine/overworld/map_sprites.asm
+++ b/engine/overworld/map_sprites.asm
@@ -39,7 +39,7 @@
ld b, $10 ; number of sprite slots
ld hl, wSpritePlayerStateData2PictureID
xor a
- ld [hFourTileSpriteCount], a
+ ldh [hFourTileSpriteCount], a
.copyPictureIDLoop ; loop to copy picture ID from $C2XD to $C2XE
ld a, [hli] ; $C2XD (sprite picture ID)
ld [hld], a ; $C2XE
@@ -98,7 +98,7 @@
cp SPRITE_BALL ; is it a 4-tile sprite?
jr c, .notFourTileSprite
pop af
- ld a, [hFourTileSpriteCount]
+ ldh a, [hFourTileSpriteCount]
add 11
jr .storeVRAMSlot
.notFourTileSprite
@@ -105,7 +105,7 @@
pop af
.storeVRAMSlot
ld [hl], a ; store VRAM slot at $C2XE
- ld [hVRAMSlot], a ; used to determine if it's 4-tile sprite later
+ ldh [hVRAMSlot], a ; used to determine if it's 4-tile sprite later
ld a, b ; a = current sprite picture ID
dec a
add a
@@ -128,7 +128,7 @@
push bc
ld hl, vNPCSprites ; VRAM base address
ld bc, $c0 ; number of bytes per VRAM slot
- ld a, [hVRAMSlot]
+ ldh a, [hVRAMSlot]
cp 11 ; is it a 4-tile sprite?
jr nc, .fourTileSpriteVRAMAddr
ld d, a
@@ -141,13 +141,13 @@
jr .loadStillTilePattern
.fourTileSpriteVRAMAddr
ld hl, vSprites + $7c0 ; address for second 4-tile sprite
- ld a, [hFourTileSpriteCount]
+ ldh a, [hFourTileSpriteCount]
and a
jr nz, .loadStillTilePattern
; if it's the first 4-tile sprite
ld hl, vSprites + $780 ; address for first 4-tile sprite
inc a
- ld [hFourTileSpriteCount], a
+ ldh [hFourTileSpriteCount], a
.loadStillTilePattern
pop bc
pop de
@@ -167,7 +167,7 @@
.skipFirstLoad
pop de
pop hl
- ld a, [hVRAMSlot]
+ ldh a, [hVRAMSlot]
cp 11 ; is it a 4-tile sprite?
jr nc, .skipSecondLoad ; if so, there is no second block
push de
--- a/engine/overworld/missable_objects.asm
+++ b/engine/overworld/missable_objects.asm
@@ -31,19 +31,19 @@
sub d
ld h, a
ld a, h
- ld [hDividend], a
+ ldh [hDividend], a
ld a, l
- ld [hDividend+1], a
+ ldh [hDividend+1], a
xor a
- ld [hDividend+2], a
- ld [hDividend+3], a
+ ldh [hDividend+2], a
+ ldh [hDividend+3], a
ld a, $3
- ld [hDivisor], a
+ ldh [hDivisor], a
ld b, $2
call Divide ; divide difference by 3, resulting in the global offset (number of missable items before ours)
ld a, [wCurMap]
ld b, a
- ld a, [hDividend+3]
+ ldh a, [hDividend+3]
ld c, a ; store global offset in c
ld de, wMissableObjectList
pop hl
@@ -99,7 +99,7 @@
; tests if current sprite is a missable object that is hidden/has been removed
IsObjectHidden:
- ld a, [hCurrentSpriteOffset]
+ ldh a, [hCurrentSpriteOffset]
swap a
ld b, a
ld hl, wMissableObjectList
@@ -120,7 +120,7 @@
.notHidden
xor a
.hidden
- ld [hIsHiddenMissableObject], a
+ ldh [hIsHiddenMissableObject], a
ret
; adds missable object (items, leg. pokemon, etc.) to the map
--- a/engine/overworld/movement.asm
+++ b/engine/overworld/movement.asm
@@ -14,7 +14,7 @@
; the maximum number for map tiles
.checkIfTextBoxInFrontOfSprite
aCoord 8, 9
- ld [hTilePlayerStandingOn], a
+ ldh [hTilePlayerStandingOn], a
cp MAP_TILESET_SIZE
jr c, .lowerLeftTileIsMapTile
.disableSprite
@@ -63,7 +63,7 @@
ld a, [wd736]
bit 7, a ; is the player sprite spinning due to a spin tile?
jr nz, .skipSpriteAnim
- ld a, [hCurrentSpriteOffset]
+ ldh a, [hCurrentSpriteOffset]
add $7
ld l, a
ld a, [hl]
@@ -89,7 +89,7 @@
; lower priority than the background so that it's partially obscured by the
; grass. Only the lower half of the sprite is permitted to have the priority
; bit set by later logic.
- ld a, [hTilePlayerStandingOn]
+ ldh a, [hTilePlayerStandingOn]
ld c, a
ld a, [wGrassTile]
cp c
@@ -103,7 +103,7 @@
UnusedReadSpriteDataFunction:
push bc
push af
- ld a, [hCurrentSpriteOffset]
+ ldh a, [hCurrentSpriteOffset]
ld c, a
pop af
add c
@@ -112,7 +112,7 @@
ret
UpdateNPCSprite:
- ld a, [hCurrentSpriteOffset]
+ ldh a, [hCurrentSpriteOffset]
swap a
dec a
add a
@@ -122,7 +122,7 @@
ld a, [hl] ; read movement byte 2
ld [wCurSpriteMovement2], a
ld h, $c1
- ld a, [hCurrentSpriteOffset]
+ ldh a, [hCurrentSpriteOffset]
ld l, a
inc l
ld a, [hl] ; c1x1
@@ -131,7 +131,7 @@
call CheckSpriteAvailability
ret c ; if sprite is invisible, on tile >=MAP_TILESET_SIZE, in grass or player is currently walking
ld h, $c1
- ld a, [hCurrentSpriteOffset]
+ ldh a, [hCurrentSpriteOffset]
ld l, a
inc l
ld a, [hl] ; c1x1
@@ -151,7 +151,7 @@
ret nz ; don't do anything yet if player is currently moving (redundant, already tested in CheckSpriteAvailability)
call InitializeSpriteScreenPosition
ld h, $c2
- ld a, [hCurrentSpriteOffset]
+ ldh a, [hCurrentSpriteOffset]
add $6
ld l, a
ld a, [hl] ; c2x6: movement byte 1
@@ -264,11 +264,11 @@
TryWalking:
push hl
ld h, $c1
- ld a, [hCurrentSpriteOffset]
+ ldh a, [hCurrentSpriteOffset]
add $9
ld l, a
ld [hl], c ; c1x9 (update facing direction)
- ld a, [hCurrentSpriteOffset]
+ ldh a, [hCurrentSpriteOffset]
add $3
ld l, a
ld [hl], d ; c1x3 (update Y movement delta)
@@ -282,7 +282,7 @@
pop de
ret c ; cannot walk there (reinitialization of delay values already done)
ld h, $c2
- ld a, [hCurrentSpriteOffset]
+ ldh a, [hCurrentSpriteOffset]
add $4
ld l, a
ld a, [hl] ; c2x4: Y position
@@ -291,7 +291,7 @@
ld a, [hl] ; c2x5: X position
add e
ld [hl], a ; update X position
- ld a, [hCurrentSpriteOffset]
+ ldh a, [hCurrentSpriteOffset]
ld l, a
ld [hl], $10 ; c2x0=16: walk animation counter
dec h
@@ -301,7 +301,7 @@
; update the walking animation parameters for a sprite that is currently walking
UpdateSpriteInWalkingAnimation:
- ld a, [hCurrentSpriteOffset]
+ ldh a, [hCurrentSpriteOffset]
add $7
ld l, a
ld a, [hl] ; c1x7 (counter until next walk animation frame)
@@ -317,7 +317,7 @@
and $3
ld [hl], a ; advance to next animation frame every 4 ticks (16 ticks total for one step)
.noNextAnimationFrame
- ld a, [hCurrentSpriteOffset]
+ ldh a, [hCurrentSpriteOffset]
add $3
ld l, a
ld a, [hli] ; c1x3 (movement Y delta)
@@ -330,7 +330,7 @@
ld a, [hl] ; c1x6 (screen X position)
add b
ld [hl], a ; update screen X position
- ld a, [hCurrentSpriteOffset]
+ ldh a, [hCurrentSpriteOffset]
ld l, a
inc h
ld a, [hl] ; c2x0 (walk animation counter)
@@ -343,7 +343,7 @@
ld a, [hl] ; c2x6 (movement byte 1)
cp $fe
jr nc, .initNextMovementCounter ; values $fe and $ff
- ld a, [hCurrentSpriteOffset]
+ ldh a, [hCurrentSpriteOffset]
inc a
ld l, a
dec h
@@ -351,14 +351,14 @@
ret
.initNextMovementCounter
call Random
- ld a, [hCurrentSpriteOffset]
+ ldh a, [hCurrentSpriteOffset]
add $8
ld l, a
- ld a, [hRandomAdd]
+ ldh a, [hRandomAdd]
and $7f
ld [hl], a ; c2x8: set next movement delay to a random value in [0,$7f]
dec h ; note that value 0 actually makes the delay $100 (bug?)
- ld a, [hCurrentSpriteOffset]
+ ldh a, [hCurrentSpriteOffset]
inc a
ld l, a
ld [hl], $2 ; c1x1 = 2 (movement status)
@@ -375,7 +375,7 @@
; update delay value (c2x8) for sprites in the delayed state (c1x1)
UpdateSpriteMovementDelay:
ld h, $c2
- ld a, [hCurrentSpriteOffset]
+ ldh a, [hCurrentSpriteOffset]
add $6
ld l, a
ld a, [hl] ; c2x6: movement byte 1
@@ -390,13 +390,13 @@
jr nz, notYetMoving
.moving
dec h
- ld a, [hCurrentSpriteOffset]
+ ldh a, [hCurrentSpriteOffset]
inc a
ld l, a
ld [hl], $1 ; c1x1 = 1 (mark as ready to move)
notYetMoving:
ld h, wSpriteStateData1 / $100
- ld a, [hCurrentSpriteOffset]
+ ldh a, [hCurrentSpriteOffset]
add wSpritePlayerStateData1AnimFrameCounter - wSpritePlayerStateData1
ld l, a
ld [hl], $0 ; c1x8 = 0 (walk animation frame)
@@ -429,7 +429,7 @@
.notFacingRight
ld c, SPRITE_FACING_LEFT
.facingDirectionDetermined
- ld a, [hCurrentSpriteOffset]
+ ldh a, [hCurrentSpriteOffset]
add $9
ld l, a
ld [hl], c ; c1x9: set facing direction
@@ -440,7 +440,7 @@
inc l
ld [hl], $ff ; $c1x2: set sprite image to $ff (invisible/off screen)
inc h
- ld a, [hCurrentSpriteOffset]
+ ldh a, [hCurrentSpriteOffset]
add $2
ld l, a
ld a, $8
@@ -451,7 +451,7 @@
; calculates the sprite's screen position form its map position and the player position
InitializeSpriteScreenPosition:
ld h, wSpriteStateData2 / $100
- ld a, [hCurrentSpriteOffset]
+ ldh a, [hCurrentSpriteOffset]
add wSpritePlayerStateData2MapY - wSpritePlayerStateData2
ld l, a
ld a, [wYCoord]
@@ -475,17 +475,17 @@
; tests if sprite is off screen or otherwise unable to do anything
CheckSpriteAvailability:
predef IsObjectHidden
- ld a, [hIsHiddenMissableObject]
+ ldh a, [hIsHiddenMissableObject]
and a
jp nz, .spriteInvisible
ld h, wSpriteStateData2 / $100
- ld a, [hCurrentSpriteOffset]
+ ldh a, [hCurrentSpriteOffset]
add wSpritePlayerStateData2MovementByte1 - wSpritePlayerStateData2
ld l, a
ld a, [hl] ; c2x6: movement byte 1
cp $fe
jr c, .skipXVisibilityTest ; movement byte 1 < $fe (i.e. the sprite's movement is scripted)
- ld a, [hCurrentSpriteOffset]
+ ldh a, [hCurrentSpriteOffset]
add wSpritePlayerStateData2MapY - wSpritePlayerStateData2
ld l, a
ld b, [hl] ; c2x4: Y pos (+4)
@@ -527,7 +527,7 @@
jr c, .spriteVisible ; standing on tile with ID >=MAP_TILESET_SIZE (top right tile)
.spriteInvisible
ld h, wSpriteStateData1 / $100
- ld a, [hCurrentSpriteOffset]
+ ldh a, [hCurrentSpriteOffset]
add wSpritePlayerStateData1ImageIndex - wSpritePlayerStateData1
ld l, a
ld [hl], $ff ; c1x2
@@ -540,7 +540,7 @@
jr nz, .done ; if player is currently walking, we're done
call UpdateSpriteImage
inc h
- ld a, [hCurrentSpriteOffset]
+ ldh a, [hCurrentSpriteOffset]
add $7
ld l, a
ld a, [wGrassTile]
@@ -556,7 +556,7 @@
UpdateSpriteImage:
ld h, $c1
- ld a, [hCurrentSpriteOffset]
+ ldh a, [hCurrentSpriteOffset]
add $8
ld l, a
ld a, [hli] ; c1x8: walk animation frame
@@ -564,10 +564,10 @@
ld a, [hl] ; c1x9: facing direction
add b
ld b, a
- ld a, [hTilePlayerStandingOn]
+ ldh a, [hTilePlayerStandingOn]
add b
ld b, a
- ld a, [hCurrentSpriteOffset]
+ ldh a, [hCurrentSpriteOffset]
add $2
ld l, a
ld [hl], b ; c1x2: sprite to display
@@ -581,7 +581,7 @@
; set carry on failure, clears carry on success
CanWalkOntoTile:
ld h, wSpriteStateData2 / $100
- ld a, [hCurrentSpriteOffset]
+ ldh a, [hCurrentSpriteOffset]
add wSpritePlayerStateData2MovementByte1 - wSpritePlayerStateData2
ld l, a
ld a, [hl] ; c2x6 (movement byte 1)
@@ -602,7 +602,7 @@
cp c
jr nz, .tilePassableLoop
ld h, $c2
- ld a, [hCurrentSpriteOffset]
+ ldh a, [hCurrentSpriteOffset]
add $6
ld l, a
ld a, [hl] ; $c2x6 (movement byte 1)
@@ -609,7 +609,7 @@
inc a
jr z, .impassable ; if $ff, no movement allowed (however, changing direction is)
ld h, wSpriteStateData1 / $100
- ld a, [hCurrentSpriteOffset]
+ ldh a, [hCurrentSpriteOffset]
add wSpritePlayerStateData1YPixels - wSpritePlayerStateData1
ld l, a
ld a, [hli] ; c1x4 (screen Y pos)
@@ -628,7 +628,7 @@
pop bc
pop de
ld h, wSpriteStateData1 / $100
- ld a, [hCurrentSpriteOffset]
+ ldh a, [hCurrentSpriteOffset]
add $c
ld l, a
ld a, [hl] ; c1xc (directions in which sprite collision would occur)
@@ -635,7 +635,7 @@
and b ; check against chosen direction (1,2,4 or 8)
jr nz, .impassable ; collision between sprites, don't go there
ld h, wSpriteStateData2 / $100
- ld a, [hCurrentSpriteOffset]
+ ldh a, [hCurrentSpriteOffset]
add wSpritePlayerStateData2YDisplacement - wSpritePlayerStateData2
ld l, a
ld a, [hli] ; c2x2 (sprite Y displacement, initialized at $8, keep track of where a sprite did go)
@@ -666,7 +666,7 @@
ret
.impassable
ld h, wSpriteStateData1 / $100
- ld a, [hCurrentSpriteOffset]
+ ldh a, [hCurrentSpriteOffset]
inc a
ld l, a
ld [hl], $2 ; c1x1 = 2 (set movement status to delayed)
@@ -677,11 +677,11 @@
inc l
ld [hl], a ; c1x5 = 0 (clear X movement delta)
inc h
- ld a, [hCurrentSpriteOffset]
+ ldh a, [hCurrentSpriteOffset]
add $8
ld l, a
call Random
- ld a, [hRandomAdd]
+ ldh a, [hRandomAdd]
and $7f
ld [hl], a ; c2x8: set next movement delay to a random value in [0,$7f] (again with delay $100 if value is 0)
scf ; set carry (marking failure to walk)
@@ -692,7 +692,7 @@
; hl: output pointer
GetTileSpriteStandsOn:
ld h, wSpriteStateData1 / $100
- ld a, [hCurrentSpriteOffset]
+ ldh a, [hCurrentSpriteOffset]
add wSpritePlayerStateData1YPixels - wSpritePlayerStateData1
ld l, a
ld a, [hli] ; c1x4: screen Y position
@@ -784,7 +784,7 @@
ld a, [hl]
add b
ld [hl], a
- ld a, [hCurrentSpriteOffset]
+ ldh a, [hCurrentSpriteOffset]
add $9
ld l, a
ld a, c
@@ -817,7 +817,7 @@
GetSpriteScreenXYPointerCommon:
ld hl, wSpriteStateData1
- ld a, [hCurrentSpriteOffset]
+ ldh a, [hCurrentSpriteOffset]
add l
add b
ld l, a
@@ -825,7 +825,7 @@
AnimScriptedNPCMovement:
ld hl, wSpriteStateData2
- ld a, [hCurrentSpriteOffset]
+ ldh a, [hCurrentSpriteOffset]
add wSpritePlayerStateData2ImageBaseOffset - wSpritePlayerStateData2
ld l, a
ld a, [hl] ; VRAM slot
@@ -833,7 +833,7 @@
swap a
ld b, a
ld hl, wSpriteStateData1
- ld a, [hCurrentSpriteOffset]
+ ldh a, [hCurrentSpriteOffset]
add wSpritePlayerStateData1FacingDirection - wSpritePlayerStateData1
ld l, a
ld a, [hl] ; facing direction
@@ -849,21 +849,21 @@
.anim
add b
ld b, a
- ld [hSpriteVRAMSlotAndFacing], a
+ ldh [hSpriteVRAMSlotAndFacing], a
call AdvanceScriptedNPCAnimFrameCounter
ld hl, wSpriteStateData1
- ld a, [hCurrentSpriteOffset]
+ ldh a, [hCurrentSpriteOffset]
add wSpritePlayerStateData1ImageIndex - wSpritePlayerStateData1
ld l, a
- ld a, [hSpriteVRAMSlotAndFacing]
+ ldh a, [hSpriteVRAMSlotAndFacing]
ld b, a
- ld a, [hSpriteAnimFrameCounter]
+ ldh a, [hSpriteAnimFrameCounter]
add b
ld [hl], a
ret
AdvanceScriptedNPCAnimFrameCounter:
- ld a, [hCurrentSpriteOffset]
+ ldh a, [hCurrentSpriteOffset]
add $7
ld l, a
ld a, [hl] ; intra-animation frame counter
@@ -878,5 +878,5 @@
inc a
and $3
ld [hl], a
- ld [hSpriteAnimFrameCounter], a
+ ldh [hSpriteAnimFrameCounter], a
ret
--- a/engine/overworld/pathfinding.asm
+++ b/engine/overworld/pathfinding.asm
@@ -8,29 +8,29 @@
ld hl, wNPCMovementDirections2
ld de, $0
.loop
- ld a, [hFindPathYProgress]
+ ldh a, [hFindPathYProgress]
ld b, a
- ld a, [hNPCPlayerYDistance] ; Y distance in steps
+ ldh a, [hNPCPlayerYDistance] ; Y distance in steps
call CalcDifference
ld d, a
and a
jr nz, .asm_f8da
- ld a, [hFindPathFlags]
+ ldh a, [hFindPathFlags]
set 0, a ; current end of path matches the player's Y coordinate
- ld [hFindPathFlags], a
+ ldh [hFindPathFlags], a
.asm_f8da
- ld a, [hFindPathXProgress]
+ ldh a, [hFindPathXProgress]
ld b, a
- ld a, [hNPCPlayerXDistance] ; X distance in steps
+ ldh a, [hNPCPlayerXDistance] ; X distance in steps
call CalcDifference
ld e, a
and a
jr nz, .asm_f8ec
- ld a, [hFindPathFlags]
+ ldh a, [hFindPathFlags]
set 1, a ; current end of path matches the player's X coordinate
- ld [hFindPathFlags], a
+ ldh [hFindPathFlags], a
.asm_f8ec
- ld a, [hFindPathFlags]
+ ldh a, [hFindPathFlags]
cp $3 ; has the end of the path reached the player's position?
jr z, .done
; Compare whether the X distance between the player and the current of the path
@@ -39,7 +39,7 @@
cp d
jr c, .yDistanceGreater
; x distance is greater
- ld a, [hNPCPlayerRelativePosFlags]
+ ldh a, [hNPCPlayerRelativePosFlags]
bit 1, a
jr nz, .playerIsLeftOfNPC
ld d, NPC_MOVEMENT_RIGHT
@@ -47,12 +47,12 @@
.playerIsLeftOfNPC
ld d, NPC_MOVEMENT_LEFT
.next1
- ld a, [hFindPathXProgress]
+ ldh a, [hFindPathXProgress]
add 1
- ld [hFindPathXProgress], a
+ ldh [hFindPathXProgress], a
jr .storeDirection
.yDistanceGreater
- ld a, [hNPCPlayerRelativePosFlags]
+ ldh a, [hNPCPlayerRelativePosFlags]
bit 0, a
jr nz, .playerIsAboveNPC
ld d, NPC_MOVEMENT_DOWN
@@ -60,15 +60,15 @@
.playerIsAboveNPC
ld d, NPC_MOVEMENT_UP
.next2
- ld a, [hFindPathYProgress]
+ ldh a, [hFindPathYProgress]
add 1
- ld [hFindPathYProgress], a
+ ldh [hFindPathYProgress], a
.storeDirection
ld a, d
ld [hli], a
- ld a, [hFindPathNumSteps]
+ ldh a, [hFindPathNumSteps]
inc a
- ld [hFindPathNumSteps], a
+ ldh [hFindPathNumSteps], a
jp .loop
.done
ld [hl], $ff
@@ -76,13 +76,13 @@
CalcPositionOfPlayerRelativeToNPC:
xor a
- ld [hNPCPlayerRelativePosFlags], a
+ ldh [hNPCPlayerRelativePosFlags], a
ld a, [wSpritePlayerStateData1YPixels]
ld d, a
ld a, [wSpritePlayerStateData1XPixels]
ld e, a
ld hl, wSpriteStateData1
- ld a, [hNPCSpriteOffset]
+ ldh a, [hNPCSpriteOffset]
add l
add wSpritePlayerStateData1YPixels - wSpritePlayerStateData1
ld l, a
@@ -115,7 +115,7 @@
ld [hli], a
call DivideBytes ; divide Y absolute distance by 16
ld a, [hl] ; quotient
- ld [hNPCPlayerYDistance], a
+ ldh [hNPCPlayerYDistance], a
pop hl
inc hl
ld b, e
@@ -136,23 +136,23 @@
res 1, [hl]
pop hl
.divideXDistance
- ld [hDividend2], a
+ ldh [hDividend2], a
ld a, 16
- ld [hDivisor2], a
+ ldh [hDivisor2], a
call DivideBytes ; divide X absolute distance by 16
- ld a, [hQuotient2]
- ld [hNPCPlayerXDistance], a
- ld a, [hNPCPlayerRelativePosPerspective]
+ ldh a, [hQuotient2]
+ ldh [hNPCPlayerXDistance], a
+ ldh a, [hNPCPlayerRelativePosPerspective]
and a
ret z
- ld a, [hNPCPlayerRelativePosFlags]
+ ldh a, [hNPCPlayerRelativePosFlags]
cpl
and $3
- ld [hNPCPlayerRelativePosFlags], a
+ ldh [hNPCPlayerRelativePosFlags], a
ret
ConvertNPCMovementDirectionsToJoypadMasks:
- ld a, [hNPCMovementDirections2Index]
+ ldh a, [hNPCMovementDirections2Index]
ld [wNPCMovementDirections2Index], a
dec a
ld de, wSimulatedJoypadStatesEnd
@@ -166,9 +166,9 @@
call ConvertNPCMovementDirectionToJoypadMask
ld [de], a
inc de
- ld a, [hNPCMovementDirections2Index]
+ ldh a, [hNPCMovementDirections2Index]
dec a
- ld [hNPCMovementDirections2Index], a
+ ldh [hNPCMovementDirections2Index], a
jr nz, .loop
ret
--- a/engine/overworld/player_animations.asm
+++ b/engine/overworld/player_animations.asm
@@ -516,9 +516,9 @@
call UpdateSprites
call Delay3
xor a
- ld [hJoyHeld], a
- ld [hJoyPressed], a
- ld [hJoyReleased], a
+ ldh [hJoyHeld], a
+ ldh [hJoyPressed], a
+ ldh [hJoyReleased], a
ld [wPlayerJumpingYScreenCoordsIndex], a
ld hl, wd736
res 6, [hl] ; not jumping down a ledge any more
--- a/engine/overworld/player_state.asm
+++ b/engine/overworld/player_state.asm
@@ -17,7 +17,7 @@
ld a, [hli] ; target warp
ld [wDestinationWarpID], a
ld a, [hl] ; target map
- ld [hWarpDestinationMap], a
+ ldh [hWarpDestinationMap], a
ld hl, wd736
set 2, [hl] ; standing on warp flag
ret
@@ -297,7 +297,7 @@
GetTileTwoStepsInFrontOfPlayer:
xor a
- ld [hPlayerFacing], a
+ ldh [hPlayerFacing], a
ld hl, wYCoord
ld a, [hli]
ld d, a
@@ -378,33 +378,33 @@
ld hl, wSprite01StateData2MapY
add hl, de
ld a, [hli] ; map Y position
- ld [hPlayerYCoord], a
+ ldh [hPlayerYCoord], a
ld a, [hl] ; map X position
- ld [hPlayerXCoord], a
+ ldh [hPlayerXCoord], a
ld a, [wNumSprites]
ld c, a
ld de, $f
ld hl, wSprite01StateData2MapY
- ld a, [hPlayerFacing]
+ ldh a, [hPlayerFacing]
and $3 ; facing up or down?
jr z, .pushingHorizontallyLoop
.pushingVerticallyLoop
inc hl
- ld a, [hPlayerXCoord]
+ ldh a, [hPlayerXCoord]
cp [hl]
jr nz, .nextSprite1 ; if X coordinates don't match
dec hl
ld a, [hli]
ld b, a
- ld a, [hPlayerFacing]
+ ldh a, [hPlayerFacing]
rrca
jr c, .pushingDown
; pushing up
- ld a, [hPlayerYCoord]
+ ldh a, [hPlayerYCoord]
dec a
jr .compareYCoords
.pushingDown
- ld a, [hPlayerYCoord]
+ ldh a, [hPlayerYCoord]
inc a
.compareYCoords
cp b
@@ -417,19 +417,19 @@
.pushingHorizontallyLoop
ld a, [hli]
ld b, a
- ld a, [hPlayerYCoord]
+ ldh a, [hPlayerYCoord]
cp b
jr nz, .nextSprite2
ld b, [hl]
- ld a, [hPlayerFacing]
+ ldh a, [hPlayerFacing]
bit 2, a
jr nz, .pushingLeft
; pushing right
- ld a, [hPlayerXCoord]
+ ldh a, [hPlayerXCoord]
inc a
jr .compareXCoords
.pushingLeft
- ld a, [hPlayerXCoord]
+ ldh a, [hPlayerXCoord]
dec a
.compareXCoords
cp b
--- a/engine/overworld/push_boulder.asm
+++ b/engine/overworld/push_boulder.asm
@@ -6,15 +6,15 @@
bit 1, a ; has boulder dust animation from previous push played yet?
ret nz
xor a
- ld [hSpriteIndexOrTextID], a
+ ldh [hSpriteIndexOrTextID], a
call IsSpriteInFrontOfPlayer
- ld a, [hSpriteIndexOrTextID]
+ ldh a, [hSpriteIndexOrTextID]
ld [wBoulderSpriteIndex], a
and a
jp z, ResetBoulderPushFlags
ld hl, wSpritePlayerStateData1MovementStatus
ld d, $0
- ld a, [hSpriteIndexOrTextID]
+ ldh a, [hSpriteIndexOrTextID]
swap a
ld e, a
add hl, de
@@ -27,7 +27,7 @@
bit 6, [hl]
set 6, [hl] ; indicate that the player has tried pushing
ret z ; the player must try pushing twice before the boulder will move
- ld a, [hJoyHeld]
+ ldh a, [hJoyHeld]
and D_RIGHT | D_LEFT | D_UP | D_DOWN
ret z
predef CheckForCollisionWhenPushingBoulder
@@ -34,7 +34,7 @@
ld a, [wTileInFrontOfBoulderAndBoulderCollisionResult]
and a ; was there a collision?
jp nz, ResetBoulderPushFlags
- ld a, [hJoyHeld]
+ ldh a, [hJoyHeld]
ld b, a
ld a, [wSpritePlayerStateData1FacingDirection]
cp SPRITE_FACING_UP
@@ -92,7 +92,7 @@
call ResetBoulderPushFlags
set 7, [hl]
ld a, [wBoulderSpriteIndex]
- ld [hSpriteIndex], a
+ ldh [hSpriteIndex], a
call GetSpriteMovementByte2Pointer
ld [hl], $10
ld a, SFX_CUT
--- a/engine/overworld/special_warps.asm
+++ b/engine/overworld/special_warps.asm
@@ -34,7 +34,7 @@
cp TRADE_CENTER
jr nz, .notTradeCenter
ld hl, TradeCenterSpec1
- ld a, [hSerialConnectionStatus]
+ ldh a, [hSerialConnectionStatus]
cp USING_INTERNAL_CLOCK ; which gameboy is clocking determines who is on the left and who is on the right
jr z, .copyWarpData
ld hl, TradeCenterSpec2
@@ -43,7 +43,7 @@
cp COLOSSEUM
jr nz, .notColosseum
ld hl, ColosseumSpec1
- ld a, [hSerialConnectionStatus]
+ ldh a, [hSerialConnectionStatus]
cp USING_INTERNAL_CLOCK
jr z, .copyWarpData
ld hl, ColosseumSpec2
--- a/engine/overworld/sprite_collisions.asm
+++ b/engine/overworld/sprite_collisions.asm
@@ -6,7 +6,7 @@
ld l, a
sub wSpritePlayerStateData2ImageBaseOffset - wSpritePlayerStateData2
ld c, a
- ld [hCurrentSpriteOffset], a
+ ldh [hCurrentSpriteOffset], a
ld a, [hl]
and a
jr z, .skipSprite ; tests $c2Xe
@@ -31,10 +31,10 @@
UpdateNonPlayerSprite:
dec a
swap a
- ld [hTilePlayerStandingOn], a ; $10 * sprite#
+ ldh [hTilePlayerStandingOn], a ; $10 * sprite#
ld a, [wNPCMovementScriptSpriteOffset] ; some sprite offset?
ld b, a
- ld a, [hCurrentSpriteOffset]
+ ldh a, [hCurrentSpriteOffset]
cp b
jr nz, .unequal
jp DoScriptedNPCMovement
@@ -54,7 +54,7 @@
nop
ld h, wSpriteStateData1 / $100
- ld a, [hCurrentSpriteOffset]
+ ldh a, [hCurrentSpriteOffset]
add wSpriteStateData1 % $100
ld l, a
@@ -79,7 +79,7 @@
and $f0
or c
- ld [hFF90], a ; store Y coordinate adjusted for direction of movement
+ ldh [hFF90], a ; store Y coordinate adjusted for direction of movement
ld a, [hli] ; a = [$c1i5] (delta X) (-1, 0, or 1)
call SetSpriteCollisionValues
@@ -92,7 +92,7 @@
and $f0
or c
- ld [hFF91], a ; store X coordinate adjusted for direction of movement
+ ldh [hFF91], a ; store X coordinate adjusted for direction of movement
ld a, l
add 7
@@ -102,18 +102,18 @@
ld [hld], a ; zero [$c1id] XXX what's [$c1id] for?
ld [hld], a ; zero [$c1ic] (directions in which collisions occurred)
- ld a, [hFF91]
+ ldh a, [hFF91]
ld [hld], a ; [$c1ib] = adjusted X coordinate
- ld a, [hFF90]
+ ldh a, [hFF90]
ld [hl], a ; [$c1ia] = adjusted Y coordinate
xor a ; zero the loop counter
.loop
- ld [hFF8F], a ; store loop counter
+ ldh [hFF8F], a ; store loop counter
swap a
ld e, a
- ld a, [hCurrentSpriteOffset]
+ ldh a, [hCurrentSpriteOffset]
cp e ; does the loop sprite match the current sprite?
jp z, .next ; go to the next sprite if they match
@@ -128,7 +128,7 @@
inc a
jp z, .next ; go the next sprite if offscreen
- ld a, [hCurrentSpriteOffset]
+ ldh a, [hCurrentSpriteOffset]
add 10
ld l, a
@@ -154,7 +154,7 @@
cpl
inc a
.noCarry1
- ld [hFF90], a ; store the distance between the two sprites' adjusted Y values
+ ldh [hFF90], a ; store the distance between the two sprites' adjusted Y values
; Use the carry flag set by the above subtraction to determine which sprite's
; Y coordinate is larger. This information is used later to set [$c1ic],
@@ -176,11 +176,11 @@
ld b, 9
.next1
- ld a, [hFF90] ; a = distance between adjusted Y coordinates
+ ldh a, [hFF90] ; a = distance between adjusted Y coordinates
sub b
- ld [hFF92], a ; store distance adjusted using sprite i's direction
+ ldh [hFF92], a ; store distance adjusted using sprite i's direction
ld a, b
- ld [hFF90], a ; store 7 or 9 depending on sprite i's delta Y
+ ldh [hFF90], a ; store 7 or 9 depending on sprite i's delta Y
jr c, .checkXDistance
; If sprite j's delta Y is 0, then b = 7, else b = 9.
@@ -193,7 +193,7 @@
ld b, 9
.next2
- ld a, [hFF92] ; a = distance adjusted using sprite i's direction
+ ldh a, [hFF92] ; a = distance adjusted using sprite i's direction
sub b ; adjust distance using sprite j's direction
jr z, .checkXDistance
jr nc, .next ; go to next sprite if distance is still positive after both adjustments
@@ -225,7 +225,7 @@
cpl
inc a
.noCarry2
- ld [hFF91], a ; store the distance between the two sprites' adjusted X values
+ ldh [hFF91], a ; store the distance between the two sprites' adjusted X values
; Use the carry flag set by the above subtraction to determine which sprite's
; X coordinate is larger. This information is used later to set [$c1ic],
@@ -247,11 +247,11 @@
ld b, 9
.next3
- ld a, [hFF91] ; a = distance between adjusted X coordinates
+ ldh a, [hFF91] ; a = distance between adjusted X coordinates
sub b
- ld [hFF92], a ; store distance adjusted using sprite i's direction
+ ldh [hFF92], a ; store distance adjusted using sprite i's direction
ld a, b
- ld [hFF91], a ; store 7 or 9 depending on sprite i's delta X
+ ldh [hFF91], a ; store 7 or 9 depending on sprite i's delta X
jr c, .collision
; If sprite j's delta X is 0, then b = 7, else b = 9.
@@ -264,15 +264,15 @@
ld b, 9
.next4
- ld a, [hFF92] ; a = distance adjusted using sprite i's direction
+ ldh a, [hFF92] ; a = distance adjusted using sprite i's direction
sub b ; adjust distance using sprite j's direction
jr z, .collision
jr nc, .next ; go to next sprite if distance is still positive after both adjustments
.collision
- ld a, [hFF91] ; a = 7 or 9 depending on sprite i's delta X
+ ldh a, [hFF91] ; a = 7 or 9 depending on sprite i's delta X
ld b, a
- ld a, [hFF90] ; a = 7 or 9 depending on sprite i's delta Y
+ ldh a, [hFF90] ; a = 7 or 9 depending on sprite i's delta Y
inc l
; If delta X isn't 0 and delta Y is 0, then b = %0011, else b = %1100.
@@ -294,7 +294,7 @@
; set bit in [$c1ie] or [$c1if] to indicate which sprite the collision occurred with
inc l
inc l
- ld a, [hFF8F] ; a = loop counter
+ ldh a, [hFF8F] ; a = loop counter
ld de, SpriteCollisionBitTable
add a
add e
@@ -311,7 +311,7 @@
ld [hl], a
.next
- ld a, [hFF8F] ; a = loop counter
+ ldh a, [hFF8F] ; a = loop counter
inc a
cp $10
jp nz, .loop
--- a/engine/overworld/tilesets.asm
+++ b/engine/overworld/tilesets.asm
@@ -23,9 +23,9 @@
dec c
jr nz, .copyTilesetHeaderLoop
ld a, [hl]
- ld [hTilesetType], a
+ ldh [hTilesetType], a
xor a
- ld [hMovingBGTilesCounter1], a
+ ldh [hMovingBGTilesCounter1], a
pop hl
ld a, [wCurMapTileset]
push hl
@@ -38,7 +38,7 @@
jr c, .asm_c797
ld a, [wCurMapTileset]
ld b, a
- ld a, [hPreviousTileset]
+ ldh a, [hPreviousTileset]
cp b
jr z, .done
.asm_c797
--- a/engine/overworld/trainer_sight.asm
+++ b/engine/overworld/trainer_sight.asm
@@ -2,19 +2,19 @@
ld hl, wSpriteStateData1
ld de, wSpritePlayerStateData1YPixels - wSpritePlayerStateData1
ld a, [wSpriteIndex]
- ld [hSpriteIndex], a
+ ldh [hSpriteIndex], a
call GetSpriteDataPointer
ld a, [hli] ; c1x4 (screen Y pos)
- ld [hSpriteScreenYCoord], a
+ ldh [hSpriteScreenYCoord], a
inc hl
ld a, [hl] ; c1x6 (screen X pos)
- ld [hSpriteScreenXCoord], a
+ ldh [hSpriteScreenXCoord], a
ld de, wSpritePlayerStateData2MapY - wSpritePlayerStateData1XPixels
add hl, de
ld a, [hli] ; c2x4 (map Y pos)
- ld [hSpriteMapYCoord], a
+ ldh [hSpriteMapYCoord], a
ld a, [hl] ; c2x5 (map X pos)
- ld [hSpriteMapXCoord], a
+ ldh [hSpriteMapXCoord], a
ret
_GetSpritePosition2::
@@ -21,7 +21,7 @@
ld hl, wSpriteStateData1
ld de, wSpritePlayerStateData1YPixels - wSpritePlayerStateData1
ld a, [wSpriteIndex]
- ld [hSpriteIndex], a
+ ldh [hSpriteIndex], a
call GetSpriteDataPointer
ld a, [hli] ; c1x4 (screen Y pos)
ld [wSavedSpriteScreenY], a
@@ -40,18 +40,18 @@
ld hl, wSpriteStateData1
ld de, wSpritePlayerStateData1YPixels - wSpritePlayerStateData1
ld a, [wSpriteIndex]
- ld [hSpriteIndex], a
+ ldh [hSpriteIndex], a
call GetSpriteDataPointer
- ld a, [hSpriteScreenYCoord] ; c1x4 (screen Y pos)
+ ldh a, [hSpriteScreenYCoord] ; c1x4 (screen Y pos)
ld [hli], a
inc hl
- ld a, [hSpriteScreenXCoord] ; c1x6 (screen X pos)
+ ldh a, [hSpriteScreenXCoord] ; c1x6 (screen X pos)
ld [hl], a
ld de, wSpritePlayerStateData2MapY - wSpritePlayerStateData1XPixels
add hl, de
- ld a, [hSpriteMapYCoord] ; c2x4 (map Y pos)
+ ldh a, [hSpriteMapYCoord] ; c2x4 (map Y pos)
ld [hli], a
- ld a, [hSpriteMapXCoord] ; c2x5 (map X pos)
+ ldh a, [hSpriteMapXCoord] ; c2x5 (map X pos)
ld [hl], a
ret
@@ -59,7 +59,7 @@
ld hl, wSpriteStateData1
ld de, wSpritePlayerStateData1YPixels - wSpritePlayerStateData1
ld a, [wSpriteIndex]
- ld [hSpriteIndex], a
+ ldh [hSpriteIndex], a
call GetSpriteDataPointer
ld a, [wSavedSpriteScreenY]
ld [hli], a ; c1x4 (screen Y pos)
@@ -144,7 +144,7 @@
call FillMemory ; write the necessary steps to reach player
ld [hl], $ff ; write end of list sentinel
ld a, [wSpriteIndex]
- ld [hSpriteIndex], a
+ ldh [hSpriteIndex], a
jp MoveSprite_
; input: de = offset within sprite entry
@@ -152,7 +152,7 @@
GetSpriteDataPointer:
push de
add hl, de
- ld a, [hSpriteIndex]
+ ldh a, [hSpriteIndex]
swap a
ld d, $0
ld e, a
--- a/engine/overworld/turn_sprite.asm
+++ b/engine/overworld/turn_sprite.asm
@@ -1,12 +1,12 @@
UpdateSpriteFacingOffsetAndDelayMovement::
ld h, $c2
- ld a, [hCurrentSpriteOffset]
+ ldh a, [hCurrentSpriteOffset]
add $8
ld l, a
ld a, $7f ; maximum movement delay
ld [hl], a ; c2x8 (movement delay)
dec h
- ld a, [hCurrentSpriteOffset]
+ ldh a, [hCurrentSpriteOffset]
add $9
ld l, a
ld a, [hld] ; c1x9 (facing direction)
@@ -14,7 +14,7 @@
xor a
ld [hld], a
ld [hl], a ; c1x8 (walk animation frame)
- ld a, [hCurrentSpriteOffset]
+ ldh a, [hCurrentSpriteOffset]
add $2
ld l, a
ld a, [hl] ; c1x2 (facing and animation table offset)
--- a/engine/overworld/update_map.asm
+++ b/engine/overworld/update_map.asm
@@ -50,13 +50,13 @@
ld a, [wIsInBattle]
inc a
ret z
- ld a, [hAutoBGTransferEnabled]
+ ldh a, [hAutoBGTransferEnabled]
push af
- ld a, [hTilesetType]
+ ldh a, [hTilesetType]
push af
xor a
- ld [hAutoBGTransferEnabled], a
- ld [hTilesetType], a ; no flower/water BG tile animations
+ ldh [hAutoBGTransferEnabled], a
+ ldh [hTilesetType], a ; no flower/water BG tile animations
call LoadCurrentMapView
call RunDefaultPaletteCommand
ld hl, wMapViewVRAMPointer
@@ -73,7 +73,7 @@
ld a, h
ld [wBuffer + 1], a ; this copy of the address is not used
ld a, 2
- ld [hRedrawMapViewRowOffset], a
+ ldh [hRedrawMapViewRowOffset], a
ld c, SCREEN_HEIGHT / 2 ; number of rows of 2x2 tiles (this covers the whole screen)
.redrawRowLoop
push bc
@@ -81,7 +81,7 @@
push hl
ld hl, wTileMap - 2 * SCREEN_WIDTH
ld de, SCREEN_WIDTH
- ld a, [hRedrawMapViewRowOffset]
+ ldh a, [hRedrawMapViewRowOffset]
.calcWRAMAddrLoop
add hl, de
dec a
@@ -89,7 +89,7 @@
call CopyToRedrawRowOrColumnSrcTiles
pop hl
ld de, BG_MAP_WIDTH
- ld a, [hRedrawMapViewRowOffset]
+ ldh a, [hRedrawMapViewRowOffset]
ld c, a
.calcVRAMAddrLoop
add hl, de
@@ -98,11 +98,11 @@
or $98
dec c
jr nz, .calcVRAMAddrLoop
- ld [hRedrawRowOrColumnDest + 1], a
+ ldh [hRedrawRowOrColumnDest + 1], a
ld a, l
- ld [hRedrawRowOrColumnDest], a
+ ldh [hRedrawRowOrColumnDest], a
ld a, REDRAW_ROW
- ld [hRedrawRowOrColumnMode], a
+ ldh [hRedrawRowOrColumnMode], a
call DelayFrame
ld hl, hRedrawMapViewRowOffset
inc [hl]
@@ -112,9 +112,9 @@
dec c
jr nz, .redrawRowLoop
pop af
- ld [hTilesetType], a
+ ldh [hTilesetType], a
pop af
- ld [hAutoBGTransferEnabled], a
+ ldh [hAutoBGTransferEnabled], a
ret
CompareHLWithBC:
--- a/engine/play_time.asm
+++ b/engine/play_time.asm
@@ -56,6 +56,6 @@
ld [wd730], a
ret z
xor a
- ld [hJoyPressed], a
- ld [hJoyHeld], a
+ ldh [hJoyPressed], a
+ ldh [hJoyHeld], a
ret
--- a/engine/pokemon/add_mon.asm
+++ b/engine/pokemon/add_mon.asm
@@ -15,7 +15,7 @@
ret nc ; return if the party is already full
ld [de], a
ld a, [de]
- ld [hNewPartyLength], a
+ ldh [hNewPartyLength], a
add e
ld e, a
jr nc, .noCarry
@@ -32,7 +32,7 @@
jr z, .next2
ld hl, wEnemyMonOT
.next2
- ld a, [hNewPartyLength]
+ ldh a, [hNewPartyLength]
dec a
call SkipFixedLengthTextEntries
ld d, h
@@ -44,7 +44,7 @@
and a
jr nz, .skipNaming
ld hl, wPartyMonNicks
- ld a, [hNewPartyLength]
+ ldh a, [hNewPartyLength]
dec a
call SkipFixedLengthTextEntries
ld a, NAME_MON_SCREEN
@@ -57,7 +57,7 @@
jr z, .next3
ld hl, wEnemyMons
.next3
- ld a, [hNewPartyLength]
+ ldh a, [hNewPartyLength]
dec a
ld bc, wPartyMon2 - wPartyMon1
call AddNTimes
@@ -129,10 +129,10 @@
xor a
ld b, a
call CalcStat ; calc HP stat (set cur Hp to max HP)
- ld a, [hMultiplicand+1]
+ ldh a, [hMultiplicand+1]
ld [de], a
inc de
- ld a, [hMultiplicand+2]
+ ldh a, [hMultiplicand+2]
ld [de], a
inc de
xor a
@@ -204,13 +204,13 @@
callab CalcExperience
pop de
inc de
- ld a, [hExperience] ; write experience
+ ldh a, [hExperience] ; write experience
ld [de], a
inc de
- ld a, [hExperience + 1]
+ ldh a, [hExperience + 1]
ld [de], a
inc de
- ld a, [hExperience + 2]
+ ldh a, [hExperience + 2]
ld [de], a
xor a
ld b, NUM_STATS * 2
--- a/engine/pokemon/bills_pc.asm
+++ b/engine/pokemon/bills_pc.asm
@@ -1,6 +1,6 @@
DisplayPCMainMenu::
xor a
- ld [hAutoBGTransferEnabled], a
+ ldh [hAutoBGTransferEnabled], a
call SaveScreenTilesToBuffer2
ld a, [wNumHoFTeams]
and a
@@ -82,7 +82,7 @@
ld [wCurrentMenuItem], a
ld [wLastMenuItem], a
ld a, 1
- ld [hAutoBGTransferEnabled], a
+ ldh [hAutoBGTransferEnabled], a
ret
SomeonesPCText: db "SOMEONE's PC@"
@@ -168,7 +168,7 @@
ld de, BoxNoPCText
call PlaceString
ld a, 1
- ld [hAutoBGTransferEnabled], a
+ ldh [hAutoBGTransferEnabled], a
call Delay3
call HandleMenuInput
bit 1, a
@@ -501,7 +501,7 @@
text_end
CableClubLeftGameboy::
- ld a, [hSerialConnectionStatus]
+ ldh a, [hSerialConnectionStatus]
cp USING_EXTERNAL_CLOCK
ret z
ld a, [wSpritePlayerStateData1FacingDirection]
@@ -518,7 +518,7 @@
tx_pre_jump JustAMomentText
CableClubRightGameboy::
- ld a, [hSerialConnectionStatus]
+ ldh a, [hSerialConnectionStatus]
cp USING_INTERNAL_CLOCK
ret z
ld a, [wSpritePlayerStateData1FacingDirection]
--- a/engine/pokemon/evos_moves.asm
+++ b/engine/pokemon/evos_moves.asm
@@ -11,7 +11,7 @@
; this is only called after battle
; it is supposed to do level up evolutions, though there is a bug that allows item evolutions to occur
EvolutionAfterBattle:
- ld a, [hTilesetType]
+ ldh a, [hTilesetType]
push af
xor a
ld [wEvolutionOccurred], a
@@ -120,12 +120,12 @@
ld c, 50
call DelayFrames
xor a
- ld [hAutoBGTransferEnabled], a
+ ldh [hAutoBGTransferEnabled], a
coord hl, 0, 0
lb bc, 12, 20
call ClearScreenArea
ld a, $1
- ld [hAutoBGTransferEnabled], a
+ ldh [hAutoBGTransferEnabled], a
ld a, $ff
ld [wUpdateSpritesEnabled], a
call ClearSprites
@@ -245,7 +245,7 @@
pop bc
pop hl
pop af
- ld [hTilesetType], a
+ ldh [hTilesetType], a
ld a, [wLinkState]
cp LINK_STATE_TRADING
ret z
--- a/engine/pokemon/experience.asm
+++ b/engine/pokemon/experience.asm
@@ -10,15 +10,15 @@
push hl
ld hl, wLoadedMonExp + 2 ; current exp
; compare exp needed for level d with current exp
- ld a, [hExperience + 2]
+ ldh a, [hExperience + 2]
ld c, a
ld a, [hld]
sub c
- ld a, [hExperience + 1]
+ ldh a, [hExperience + 1]
ld c, a
ld a, [hld]
sbc c
- ld a, [hExperience]
+ ldh a, [hExperience]
ld c, a
ld a, [hl]
sbc c
@@ -38,56 +38,56 @@
add hl, bc
call CalcDSquared
ld a, d
- ld [hMultiplier], a
+ ldh [hMultiplier], a
call Multiply
ld a, [hl]
and $f0
swap a
- ld [hMultiplier], a
+ ldh [hMultiplier], a
call Multiply
ld a, [hli]
and $f
- ld [hDivisor], a
+ ldh [hDivisor], a
ld b, $4
call Divide
- ld a, [hQuotient + 1]
+ ldh a, [hQuotient + 1]
push af
- ld a, [hQuotient + 2]
+ ldh a, [hQuotient + 2]
push af
- ld a, [hQuotient + 3]
+ ldh a, [hQuotient + 3]
push af
call CalcDSquared
ld a, [hl]
and $7f
- ld [hMultiplier], a
+ ldh [hMultiplier], a
call Multiply
- ld a, [hProduct + 1]
+ ldh a, [hProduct + 1]
push af
- ld a, [hProduct + 2]
+ ldh a, [hProduct + 2]
push af
- ld a, [hProduct + 3]
+ ldh a, [hProduct + 3]
push af
ld a, [hli]
push af
xor a
- ld [hMultiplicand], a
- ld [hMultiplicand + 1], a
+ ldh [hMultiplicand], a
+ ldh [hMultiplicand + 1], a
ld a, d
- ld [hMultiplicand + 2], a
+ ldh [hMultiplicand + 2], a
ld a, [hli]
- ld [hMultiplier], a
+ ldh [hMultiplier], a
call Multiply
ld b, [hl]
- ld a, [hProduct + 3]
+ ldh a, [hProduct + 3]
sub b
- ld [hProduct + 3], a
+ ldh [hProduct + 3], a
ld b, $0
- ld a, [hProduct + 2]
+ ldh a, [hProduct + 2]
sbc b
- ld [hProduct + 2], a
- ld a, [hProduct + 1]
+ ldh [hProduct + 2], a
+ ldh a, [hProduct + 1]
sbc b
- ld [hProduct + 1], a
+ ldh [hProduct + 1], a
; The difference of the linear term and the constant term consists of 3 bytes
; starting at hProduct + 1. Below, hExperience (an alias of that address) will
; be used instead for the further work of adding or subtracting the squared
@@ -96,54 +96,54 @@
and $80
jr nz, .subtractSquaredTerm ; check sign
pop bc
- ld a, [hExperience + 2]
+ ldh a, [hExperience + 2]
add b
- ld [hExperience + 2], a
+ ldh [hExperience + 2], a
pop bc
- ld a, [hExperience + 1]
+ ldh a, [hExperience + 1]
adc b
- ld [hExperience + 1], a
+ ldh [hExperience + 1], a
pop bc
- ld a, [hExperience]
+ ldh a, [hExperience]
adc b
- ld [hExperience], a
+ ldh [hExperience], a
jr .addCubedTerm
.subtractSquaredTerm
pop bc
- ld a, [hExperience + 2]
+ ldh a, [hExperience + 2]
sub b
- ld [hExperience + 2], a
+ ldh [hExperience + 2], a
pop bc
- ld a, [hExperience + 1]
+ ldh a, [hExperience + 1]
sbc b
- ld [hExperience + 1], a
+ ldh [hExperience + 1], a
pop bc
- ld a, [hExperience]
+ ldh a, [hExperience]
sbc b
- ld [hExperience], a
+ ldh [hExperience], a
.addCubedTerm
pop bc
- ld a, [hExperience + 2]
+ ldh a, [hExperience + 2]
add b
- ld [hExperience + 2], a
+ ldh [hExperience + 2], a
pop bc
- ld a, [hExperience + 1]
+ ldh a, [hExperience + 1]
adc b
- ld [hExperience + 1], a
+ ldh [hExperience + 1], a
pop bc
- ld a, [hExperience]
+ ldh a, [hExperience]
adc b
- ld [hExperience], a
+ ldh [hExperience], a
ret
; calculates d*d
CalcDSquared:
xor a
- ld [hMultiplicand], a
- ld [hMultiplicand + 1], a
+ ldh [hMultiplicand], a
+ ldh [hMultiplicand + 1], a
ld a, d
- ld [hMultiplicand + 2], a
- ld [hMultiplier], a
+ ldh [hMultiplicand + 2], a
+ ldh [hMultiplier], a
jp Multiply
INCLUDE "data/growth_rates.asm"
--- a/engine/pokemon/learn_move.asm
+++ b/engine/pokemon/learn_move.asm
@@ -126,13 +126,13 @@
call TextBoxBorder
coord hl, 6, 8
ld de, wMovesString
- ld a, [hFlagsFFF6]
+ ldh a, [hFlagsFFF6]
set 2, a
- ld [hFlagsFFF6], a
+ ldh [hFlagsFFF6], a
call PlaceString
- ld a, [hFlagsFFF6]
+ ldh a, [hFlagsFFF6]
res 2, a
- ld [hFlagsFFF6], a
+ ldh [hFlagsFFF6], a
ld hl, wTopMenuItemY
ld a, 8
ld [hli], a ; wTopMenuItemY
--- a/engine/pokemon/status_screen.asm
+++ b/engine/pokemon/status_screen.asm
@@ -40,7 +40,7 @@
push hl
call DrawHPBar
pop hl
- ld a, [hFlagsFFF6]
+ ldh a, [hFlagsFFF6]
bit 0, a
jr z, .printFractionBelowBar
ld bc, $9 ; right of bar
@@ -80,7 +80,7 @@
ld hl, wd72c
set 1, [hl]
ld a, $33
- ld [rNR50], a ; Reduce the volume
+ ldh [rNR50], a ; Reduce the volume
call GBPalWhiteOutWithDelay3
call ClearScreen
call UpdateSprites
@@ -101,10 +101,10 @@
ld hl, vChars2 + $720
lb bc, BANK(PTile), (PTileEnd - PTile) / $8
call CopyVideoDataDouble ; P (for PP), inline
- ld a, [hTilesetType]
+ ldh a, [hTilesetType]
push af
xor a
- ld [hTilesetType], a
+ ldh [hTilesetType], a
coord hl, 19, 1
lb bc, 6, 10
call DrawLineBox ; Draws the box around name, HP and status
@@ -174,7 +174,7 @@
call PlayCry ; play Pokémon cry
call WaitForTextScrollButtonPress ; wait for button
pop af
- ld [hTilesetType], a
+ ldh [hTilesetType], a
ret
.GetStringPointer
@@ -298,11 +298,11 @@
next "SPECIAL@"
StatusScreen2:
- ld a, [hTilesetType]
+ ldh a, [hTilesetType]
push af
xor a
- ld [hTilesetType], a
- ld [hAutoBGTransferEnabled], a
+ ldh [hTilesetType], a
+ ldh [hAutoBGTransferEnabled], a
ld bc, NUM_MOVES + 1
ld hl, wMoves
call FillMemory
@@ -427,15 +427,15 @@
coord hl, 9, 1
call PlaceString
ld a, $1
- ld [hAutoBGTransferEnabled], a
+ ldh [hAutoBGTransferEnabled], a
call Delay3
call WaitForTextScrollButtonPress ; wait for button
pop af
- ld [hTilesetType], a
+ ldh [hTilesetType], a
ld hl, wd72c
res 1, [hl]
ld a, $77
- ld [rNR50], a
+ ldh [rNR50], a
call GBPalWhiteOut
jp ClearScreen
@@ -447,13 +447,13 @@
ld d, a
callab CalcExperience
ld hl, wLoadedMonExp + 2
- ld a, [hExperience + 2]
+ ldh a, [hExperience + 2]
sub [hl]
ld [hld], a
- ld a, [hExperience + 1]
+ ldh a, [hExperience + 1]
sbc [hl]
ld [hld], a
- ld a, [hExperience]
+ ldh a, [hExperience]
sbc [hl]
ld [hld], a
ret
--- a/engine/slots/game_corner_slots.asm
+++ b/engine/slots/game_corner_slots.asm
@@ -22,7 +22,7 @@
ld a, 250
.next
ld [wSlotMachineSevenAndBarModeChance], a
- ld a, [hLoadedROMBank]
+ ldh a, [hLoadedROMBank]
ld [wSlotMachineSavedROMBank], a
call PromptUserToPlaySlots
ret
--- a/engine/slots/slot_machine.asm
+++ b/engine/slots/slot_machine.asm
@@ -25,7 +25,7 @@
call RunPaletteCommand
call GBPalNormal
ld a, $e4
- ld [rOBP0], a
+ ldh [rOBP0], a
ld hl, wd730
set 6, [hl]
xor a
@@ -454,9 +454,9 @@
jp hl
.flashScreenLoop
- ld a, [rBGP]
+ ldh a, [rBGP]
xor $40
- ld [rBGP], a
+ ldh [rBGP], a
ld c, 5
call DelayFrames
dec b
@@ -472,7 +472,7 @@
call SlotMachine_PayCoinsToPlayer
call SlotMachine_PrintPayoutCoins
ld a, $e4
- ld [rOBP0], a
+ ldh [rOBP0], a
jp .done
SymbolLinedUpSlotMachineText:
@@ -695,9 +695,9 @@
ld a, [wAnimCounter]
dec a
jr nz, .skip1
- ld a, [rOBP0]
+ ldh a, [rOBP0]
xor $40 ; make the slot wheel symbols flash
- ld [rOBP0], a
+ ldh [rOBP0], a
ld a, 5
.skip1
ld [wAnimCounter], a
@@ -825,7 +825,7 @@
SlotMachine_HandleInputWhileWheelsSpin:
call DelayFrame
call JoypadLowSensitivity
- ld a, [hJoy5]
+ ldh a, [hJoy5]
and A_BUTTON
ret z
ld hl, wStoppingWhichSlotMachineWheel
--- a/home.asm
+++ b/home.asm
@@ -30,11 +30,11 @@
call JoypadLowSensitivity
pop bc
- ld a, [hJoyHeld]
+ ldh a, [hJoyHeld]
cp D_UP + SELECT + B_BUTTON
jr z, .input
- ld a, [hJoy5]
+ ldh a, [hJoy5]
and START | A_BUTTON
jr nz, .input
@@ -53,10 +53,10 @@
; a = ID of destination warp within destination map
LoadDestinationWarpPosition::
ld b, a
- ld a, [hLoadedROMBank]
+ ldh a, [hLoadedROMBank]
push af
ld a, [wPredefParentBank]
- ld [hLoadedROMBank], a
+ ldh [hLoadedROMBank], a
ld [MBC1RomBank], a
ld a, b
add a
@@ -68,7 +68,7 @@
ld de, wCurrentTileBlockMapViewPointer
call CopyData
pop af
- ld [hLoadedROMBank], a
+ ldh [hLoadedROMBank], a
ld [MBC1RomBank], a
ret
@@ -90,14 +90,14 @@
ld a, [wUpdateSpritesEnabled]
dec a
ret nz
- ld a, [hLoadedROMBank]
+ ldh a, [hLoadedROMBank]
push af
ld a, BANK(_UpdateSprites)
- ld [hLoadedROMBank], a
+ ldh [hLoadedROMBank], a
ld [MBC1RomBank], a
call _UpdateSprites
pop af
- ld [hLoadedROMBank], a
+ ldh [hLoadedROMBank], a
ld [MBC1RomBank], a
ret
@@ -134,7 +134,7 @@
bit 1, a
ret nz
ld a, $77
- ld [rNR50], a
+ ldh [rNR50], a
ret
.fadingOut
ld a, [wAudioFadeOutCounter]
@@ -146,7 +146,7 @@
.counterReachedZero
ld a, [wAudioFadeOutCounterReloadValue]
ld [wAudioFadeOutCounter], a
- ld a, [rNR50]
+ ldh a, [rNR50]
and a ; has the volume reached 0?
jr z, .fadeOutComplete
ld b, a
@@ -159,7 +159,7 @@
dec a
swap a
or c
- ld [rNR50], a
+ ldh [rNR50], a
ret
.fadeOutComplete
ld a, [wAudioFadeOutControl]
@@ -227,14 +227,14 @@
; [wWhichPokemon] = index (within the inventory) of the item to remove
; [wItemQuantity] = quantity to remove
RemoveItemFromInventory::
- ld a, [hLoadedROMBank]
+ ldh a, [hLoadedROMBank]
push af
ld a, BANK(RemoveItemFromInventory_)
- ld [hLoadedROMBank], a
+ ldh [hLoadedROMBank], a
ld [MBC1RomBank], a
call RemoveItemFromInventory_
pop af
- ld [hLoadedROMBank], a
+ ldh [hLoadedROMBank], a
ld [MBC1RomBank], a
ret
@@ -246,15 +246,15 @@
; sets carry flag if successful, unsets carry flag if unsuccessful
AddItemToInventory::
push bc
- ld a, [hLoadedROMBank]
+ ldh a, [hLoadedROMBank]
push af
ld a, BANK(AddItemToInventory_)
- ld [hLoadedROMBank], a
+ ldh [hLoadedROMBank], a
ld [MBC1RomBank], a
call AddItemToInventory_
pop bc
ld a, b
- ld [hLoadedROMBank], a
+ ldh [hLoadedROMBank], a
ld [MBC1RomBank], a
pop bc
ret
@@ -264,7 +264,7 @@
; reloads text box tile patterns, current map view, and tileset tile patterns
ReloadMapData::
- ld a, [hLoadedROMBank]
+ ldh a, [hLoadedROMBank]
push af
ld a, [wCurMap]
call SwitchToMapRomBank
@@ -274,13 +274,13 @@
call LoadTilesetTilePatternData
call EnableLCD
pop af
- ld [hLoadedROMBank], a
+ ldh [hLoadedROMBank], a
ld [MBC1RomBank], a
ret
; reloads tileset tile patterns
ReloadTilesetTilePatterns::
- ld a, [hLoadedROMBank]
+ ldh a, [hLoadedROMBank]
push af
ld a, [wCurMap]
call SwitchToMapRomBank
@@ -288,7 +288,7 @@
call LoadTilesetTilePatternData
call EnableLCD
pop af
- ld [hLoadedROMBank], a
+ ldh [hLoadedROMBank], a
ld [MBC1RomBank], a
ret
@@ -325,15 +325,15 @@
; OUTPUT:
; clears carry flag if the item is tossed, sets carry flag if not
TossItem::
- ld a, [hLoadedROMBank]
+ ldh a, [hLoadedROMBank]
push af
ld a, BANK(TossItem_)
- ld [hLoadedROMBank], a
+ ldh [hLoadedROMBank], a
ld [MBC1RomBank], a
call TossItem_
pop de
ld a, d
- ld [hLoadedROMBank], a
+ ldh [hLoadedROMBank], a
ld [MBC1RomBank], a
ret
@@ -359,15 +359,15 @@
; [wTextBoxID] = text box ID
; b, c = y, x cursor position (TWO_OPTION_MENU only)
DisplayTextBoxID::
- ld a, [hLoadedROMBank]
+ ldh a, [hLoadedROMBank]
push af
ld a, BANK(DisplayTextBoxID_)
- ld [hLoadedROMBank], a
+ ldh [hLoadedROMBank], a
ld [MBC1RomBank], a
call DisplayTextBoxID_
pop bc
ld a, b
- ld [hLoadedROMBank], a
+ ldh [hLoadedROMBank], a
ld [MBC1RomBank], a
ret
@@ -401,15 +401,15 @@
ld a, [hli]
ld h, [hl]
ld l, a
- ld a, [hLoadedROMBank]
+ ldh a, [hLoadedROMBank]
push af
ld a, [wNPCMovementScriptBank]
- ld [hLoadedROMBank], a
+ ldh [hLoadedROMBank], a
ld [MBC1RomBank], a
ld a, [wNPCMovementScriptFunctionNum]
call CallFunctionInTable
pop af
- ld [hLoadedROMBank], a
+ ldh [hLoadedROMBank], a
ld [MBC1RomBank], a
ret
@@ -511,9 +511,9 @@
SetSpriteFacingDirection::
ld a, $9
- ld [hSpriteDataOffset], a
+ ldh [hSpriteDataOffset], a
call GetPointerWithinSpriteStateData1
- ld a, [hSpriteFacingDirection]
+ ldh a, [hSpriteFacingDirection]
ld [hl], a
ret
@@ -573,7 +573,7 @@
CheckBoulderCoords::
push hl
ld hl, wSpritePlayerStateData2MapY
- ld a, [hSpriteIndex]
+ ldh a, [hSpriteIndex]
swap a
ld d, $0
ld e, a
@@ -595,9 +595,9 @@
ld h, $c2
_GetPointerWithinSpriteStateData:
- ld a, [hSpriteDataOffset]
+ ldh a, [hSpriteDataOffset]
ld b, a
- ld a, [hSpriteIndex]
+ ldh a, [hSpriteIndex]
swap a
add b
ld l, a
@@ -615,7 +615,7 @@
ld a, [de]
cp $ff
jr z, .endOfList
- ld [hRLEByteValue], a ; store byte value to be written
+ ldh [hRLEByteValue], a ; store byte value to be written
inc de
ld a, [de]
ld b, $0
@@ -623,7 +623,7 @@
ld a, [wRLEByteCount]
add c
ld [wRLEByteCount], a ; update total number of written bytes
- ld a, [hRLEByteValue]
+ ldh a, [hRLEByteValue]
call FillMemory ; write a c-times to output
inc de
jr .listLoop
@@ -640,7 +640,7 @@
call GetSpriteMovementByte1Pointer
ld [hl], $fe
call GetSpriteMovementByte2Pointer
- ld a, [hSpriteMovementByte2]
+ ldh a, [hSpriteMovementByte2]
ld [hl], a
pop hl
ret
@@ -658,7 +658,7 @@
; returns the sprite movement byte 1 pointer for sprite [hSpriteIndex] in hl
GetSpriteMovementByte1Pointer::
ld h, $C2
- ld a, [hSpriteIndex]
+ ldh a, [hSpriteIndex]
swap a
add 6
ld l, a
@@ -668,7 +668,7 @@
GetSpriteMovementByte2Pointer::
push de
ld hl, wMapSpriteData
- ld a, [hSpriteIndex]
+ ldh a, [hSpriteIndex]
dec a
add a
ld d, 0
@@ -799,7 +799,7 @@
ret
LoadFontTilePatterns::
- ld a, [rLCDC]
+ ldh a, [rLCDC]
bit 7, a ; is the LCD enabled?
jr nz, .on
.off
@@ -815,7 +815,7 @@
jp CopyVideoDataDouble ; if LCD is on, transfer during V-blank
LoadTextBoxTilePatterns::
- ld a, [rLCDC]
+ ldh a, [rLCDC]
bit 7, a ; is the LCD enabled?
jr nz, .on
.off
@@ -831,7 +831,7 @@
jp CopyVideoData ; if LCD is on, transfer during V-blank
LoadHpBarAndStatusTilePatterns::
- ld a, [rLCDC]
+ ldh a, [rLCDC]
bit 7, a ; is the LCD enabled?
jr nz, .on
.off
@@ -878,13 +878,13 @@
LoadScreenTilesFromBuffer2::
call LoadScreenTilesFromBuffer2DisableBGTransfer
ld a, 1
- ld [hAutoBGTransferEnabled], a
+ ldh [hAutoBGTransferEnabled], a
ret
; loads screen tiles stored in wTileMapBackup2 but leaves hAutoBGTransferEnabled disabled
LoadScreenTilesFromBuffer2DisableBGTransfer::
xor a
- ld [hAutoBGTransferEnabled], a
+ ldh [hAutoBGTransferEnabled], a
ld hl, wTileMapBackup2
coord de, 0, 0
ld bc, SCREEN_WIDTH * SCREEN_HEIGHT
@@ -899,13 +899,13 @@
LoadScreenTilesFromBuffer1::
xor a
- ld [hAutoBGTransferEnabled], a
+ ldh [hAutoBGTransferEnabled], a
ld hl, wTileMapBackup
coord de, 0, 0
ld bc, SCREEN_WIDTH * SCREEN_HEIGHT
call CopyData
ld a, 1
- ld [hAutoBGTransferEnabled], a
+ ldh [hAutoBGTransferEnabled], a
ret
DelayFrames::
@@ -945,7 +945,7 @@
GetItemPrice::
; Stores item's price as BCD at hItemPrice (3 bytes)
; Input: [wcf91] = item id
- ld a, [hLoadedROMBank]
+ ldh a, [hLoadedROMBank]
push af
ld a, [wListMenuID]
cp MOVESLISTMENU
@@ -953,7 +953,7 @@
jr nz, .ok
ld a, $f ; hardcoded Bank
.ok
- ld [hLoadedROMBank], a
+ ldh [hLoadedROMBank], a
ld [MBC1RomBank], a
ld hl, wItemPrices
ld a, [hli]
@@ -969,21 +969,21 @@
jr nz, .loop
dec hl
ld a, [hld]
- ld [hItemPrice + 2], a
+ ldh [hItemPrice + 2], a
ld a, [hld]
- ld [hItemPrice + 1], a
+ ldh [hItemPrice + 1], a
ld a, [hl]
- ld [hItemPrice], a
+ ldh [hItemPrice], a
jr .done
.getTMPrice
ld a, BANK(GetMachinePrice)
- ld [hLoadedROMBank], a
+ ldh [hLoadedROMBank], a
ld [MBC1RomBank], a
call GetMachinePrice
.done
ld de, hItemPrice
pop af
- ld [hLoadedROMBank], a
+ ldh [hLoadedROMBank], a
ld [MBC1RomBank], a
ret
@@ -1018,52 +1018,52 @@
; ([hJoy7] == 1, [hJoy6] == 0)
JoypadLowSensitivity::
call Joypad
- ld a, [hJoy7] ; flag
+ ldh a, [hJoy7] ; flag
and a ; get all currently pressed buttons or only newly pressed buttons?
- ld a, [hJoyPressed] ; newly pressed buttons
+ ldh a, [hJoyPressed] ; newly pressed buttons
jr z, .storeButtonState
- ld a, [hJoyHeld] ; all currently pressed buttons
+ ldh a, [hJoyHeld] ; all currently pressed buttons
.storeButtonState
- ld [hJoy5], a
- ld a, [hJoyPressed] ; newly pressed buttons
+ ldh [hJoy5], a
+ ldh a, [hJoyPressed] ; newly pressed buttons
and a ; have any buttons been newly pressed since last check?
jr z, .noNewlyPressedButtons
.newlyPressedButtons
ld a, 30 ; half a second delay
- ld [hFrameCounter], a
+ ldh [hFrameCounter], a
ret
.noNewlyPressedButtons
- ld a, [hFrameCounter]
+ ldh a, [hFrameCounter]
and a ; is the delay over?
jr z, .delayOver
.delayNotOver
xor a
- ld [hJoy5], a ; report no buttons as pressed
+ ldh [hJoy5], a ; report no buttons as pressed
ret
.delayOver
; if [hJoy6] = 0 and A or B is pressed, report no buttons as pressed
- ld a, [hJoyHeld]
+ ldh a, [hJoyHeld]
and A_BUTTON | B_BUTTON
jr z, .setShortDelay
- ld a, [hJoy6] ; flag
+ ldh a, [hJoy6] ; flag
and a
jr nz, .setShortDelay
xor a
- ld [hJoy5], a
+ ldh [hJoy5], a
.setShortDelay
ld a, 5 ; 1/12 of a second delay
- ld [hFrameCounter], a
+ ldh [hFrameCounter], a
ret
WaitForTextScrollButtonPress::
- ld a, [hDownArrowBlinkCount1]
+ ldh a, [hDownArrowBlinkCount1]
push af
- ld a, [hDownArrowBlinkCount2]
+ ldh a, [hDownArrowBlinkCount2]
push af
xor a
- ld [hDownArrowBlinkCount1], a
+ ldh [hDownArrowBlinkCount1], a
ld a, $6
- ld [hDownArrowBlinkCount2], a
+ ldh [hDownArrowBlinkCount2], a
.loop
push hl
ld a, [wTownMapSpriteBlinkingEnabled]
@@ -1076,13 +1076,13 @@
pop hl
call JoypadLowSensitivity
predef CableClub_Run
- ld a, [hJoy5]
+ ldh a, [hJoy5]
and A_BUTTON | B_BUTTON
jr z, .loop
pop af
- ld [hDownArrowBlinkCount2], a
+ ldh [hDownArrowBlinkCount2], a
pop af
- ld [hDownArrowBlinkCount1], a
+ ldh [hDownArrowBlinkCount1], a
ret
; (unless in link battle) waits for A or B being pressed and outputs the scrolling sound effect
@@ -1125,14 +1125,14 @@
push hl
push de
push bc
- ld a, [hLoadedROMBank]
+ ldh a, [hLoadedROMBank]
push af
ld a, BANK(_Divide)
- ld [hLoadedROMBank], a
+ ldh [hLoadedROMBank], a
ld [MBC1RomBank], a
call _Divide
pop af
- ld [hLoadedROMBank], a
+ ldh [hLoadedROMBank], a
ld [MBC1RomBank], a
pop bc
pop de
@@ -1157,14 +1157,14 @@
jr z, .waitOneFrame
ld a, [wOptions]
and $f
- ld [hFrameCounter], a
+ ldh [hFrameCounter], a
jr .checkButtons
.waitOneFrame
ld a, 1
- ld [hFrameCounter], a
+ ldh [hFrameCounter], a
.checkButtons
call Joypad
- ld a, [hJoyHeld]
+ ldh a, [hJoyHeld]
.checkAButton
bit 0, a ; is the A button pressed?
jr z, .checkBButton
@@ -1176,7 +1176,7 @@
call DelayFrame
jr .done
.buttonsNotPressed ; if neither A nor B is pressed
- ld a, [hFrameCounter]
+ ldh a, [hFrameCounter]
and a
jr nz, .checkButtons
.done
@@ -1278,14 +1278,14 @@
ld [wPartyMenuAnimMonEnabled], a
HandleMenuInput_::
- ld a, [hDownArrowBlinkCount1]
+ ldh a, [hDownArrowBlinkCount1]
push af
- ld a, [hDownArrowBlinkCount2]
+ ldh a, [hDownArrowBlinkCount2]
push af ; save existing values on stack
xor a
- ld [hDownArrowBlinkCount1], a ; blinking down arrow timing value 1
+ ldh [hDownArrowBlinkCount1], a ; blinking down arrow timing value 1
ld a, 6
- ld [hDownArrowBlinkCount2], a ; blinking down arrow timing value 2
+ ldh [hDownArrowBlinkCount2], a ; blinking down arrow timing value 2
.loop1
xor a
ld [wAnimCounter], a ; counter for pokemon shaking animation
@@ -1300,7 +1300,7 @@
.getJoypadState
pop hl
call JoypadLowSensitivity
- ld a, [hJoy5]
+ ldh a, [hJoy5]
and a ; was a key pressed?
jr nz, .keyPressed
push hl
@@ -1314,9 +1314,9 @@
.giveUpWaiting
; if a key wasn't pressed within the specified number of checks
pop af
- ld [hDownArrowBlinkCount2], a
+ ldh [hDownArrowBlinkCount2], a
pop af
- ld [hDownArrowBlinkCount1], a ; restore previous values
+ ldh [hDownArrowBlinkCount1], a ; restore previous values
xor a
ld [wMenuWrappingEnabled], a ; disable menu wrapping
ret
@@ -1323,7 +1323,7 @@
.keyPressed
xor a
ld [wCheckFor180DegreeTurn], a
- ld a, [hJoy5]
+ ldh a, [hJoy5]
ld b, a
bit 6, a ; pressed Up key?
jr z, .checkIfDownPressed
@@ -1365,7 +1365,7 @@
and b ; does the menu care about any of the pressed keys?
jp z, .loop1
.checkIfAButtonOrBButtonPressed
- ld a, [hJoy5]
+ ldh a, [hJoy5]
and A_BUTTON | B_BUTTON
jr z, .skipPlayingSound
.AButtonOrBButtonPressed
@@ -1378,12 +1378,12 @@
call PlaySound
.skipPlayingSound
pop af
- ld [hDownArrowBlinkCount2], a
+ ldh [hDownArrowBlinkCount2], a
pop af
- ld [hDownArrowBlinkCount1], a ; restore previous values
+ ldh [hDownArrowBlinkCount1], a ; restore previous values
xor a
ld [wMenuWrappingEnabled], a ; disable menu wrapping
- ld a, [hJoy5]
+ ldh a, [hJoy5]
ret
.noWrappingAround
ld a, [wMenuWatchMovingOutOfBounds]
@@ -1411,7 +1411,7 @@
and a ; was the previous menu id 0?
jr z, .checkForArrow1
push af
- ld a, [hFlagsFFF6]
+ ldh a, [hFlagsFFF6]
bit 1, a ; is the menu double spaced?
jr z, .doubleSpaced1
ld bc, 20
@@ -1437,7 +1437,7 @@
and a
jr z, .checkForArrow2
push af
- ld a, [hFlagsFFF6]
+ ldh a, [hFlagsFFF6]
bit 1, a ; is the menu double spaced?
jr z, .doubleSpaced2
ld bc, 20
@@ -1504,36 +1504,36 @@
cp b
jr nz, .downArrowOff
.downArrowOn
- ld a, [hDownArrowBlinkCount1]
+ ldh a, [hDownArrowBlinkCount1]
dec a
- ld [hDownArrowBlinkCount1], a
+ ldh [hDownArrowBlinkCount1], a
ret nz
- ld a, [hDownArrowBlinkCount2]
+ ldh a, [hDownArrowBlinkCount2]
dec a
- ld [hDownArrowBlinkCount2], a
+ ldh [hDownArrowBlinkCount2], a
ret nz
ld a, " "
ld [hl], a
ld a, $ff
- ld [hDownArrowBlinkCount1], a
+ ldh [hDownArrowBlinkCount1], a
ld a, $06
- ld [hDownArrowBlinkCount2], a
+ ldh [hDownArrowBlinkCount2], a
ret
.downArrowOff
- ld a, [hDownArrowBlinkCount1]
+ ldh a, [hDownArrowBlinkCount1]
and a
ret z
dec a
- ld [hDownArrowBlinkCount1], a
+ ldh [hDownArrowBlinkCount1], a
ret nz
dec a
- ld [hDownArrowBlinkCount1], a
- ld a, [hDownArrowBlinkCount2]
+ ldh [hDownArrowBlinkCount1], a
+ ldh a, [hDownArrowBlinkCount2]
dec a
- ld [hDownArrowBlinkCount2], a
+ ldh [hDownArrowBlinkCount2], a
ret nz
ld a, $06
- ld [hDownArrowBlinkCount2], a
+ ldh [hDownArrowBlinkCount2], a
ld a, "▼"
ld [hl], a
ret
@@ -1640,17 +1640,17 @@
GBPalNormal::
; Reset BGP and OBP0.
ld a, %11100100 ; 3210
- ld [rBGP], a
+ ldh [rBGP], a
ld a, %11010000 ; 3100
- ld [rOBP0], a
+ ldh [rOBP0], a
ret
GBPalWhiteOut::
; White out all palettes.
xor a
- ld [rBGP], a
- ld [rOBP0], a
- ld [rOBP1], a
+ ldh [rBGP], a
+ ldh [rOBP0], a
+ ldh [rOBP1], a
ret
RunDefaultPaletteCommand::
@@ -1730,7 +1730,7 @@
push de
push bc
callba Random_
- ld a, [hRandomAdd]
+ ldh a, [hRandomAdd]
pop bc
pop de
pop hl
@@ -1742,22 +1742,22 @@
jpba UpdateCinnabarGymGateTileBlocks_
CheckForHiddenObjectOrBookshelfOrCardKeyDoor::
- ld a, [hLoadedROMBank]
+ ldh a, [hLoadedROMBank]
push af
- ld a, [hJoyHeld]
+ ldh a, [hJoyHeld]
bit 0, a ; A button
jr z, .nothingFound
; A button is pressed
ld a, BANK(CheckForHiddenObject)
ld [MBC1RomBank], a
- ld [hLoadedROMBank], a
+ ldh [hLoadedROMBank], a
call CheckForHiddenObject
- ld a, [hDidntFindAnyHiddenObject]
+ ldh a, [hDidntFindAnyHiddenObject]
and a
jr nz, .hiddenObjectNotFound
ld a, [wHiddenObjectFunctionRomBank]
ld [MBC1RomBank], a
- ld [hLoadedROMBank], a
+ ldh [hLoadedROMBank], a
ld de, .returnAddress
push de
jp hl
@@ -1766,20 +1766,20 @@
jr .done
.hiddenObjectNotFound
callba PrintBookshelfText
- ld a, [hFFDB]
+ ldh a, [hFFDB]
and a
jr z, .done
.nothingFound
ld a, $ff
.done
- ld [hItemAlreadyFound], a
+ ldh [hItemAlreadyFound], a
pop af
ld [MBC1RomBank], a
- ld [hLoadedROMBank], a
+ ldh [hLoadedROMBank], a
ret
PrintPredefTextID::
- ld [hSpriteIndexOrTextID], a
+ ldh [hSpriteIndexOrTextID], a
ld hl, TextPredefs
call SetMapTextPointer
ld hl, wTextPredefFlag
@@ -1788,17 +1788,17 @@
RestoreMapTextPointer::
ld hl, wMapTextPtr
- ld a, [hSavedMapTextPtr]
+ ldh a, [hSavedMapTextPtr]
ld [hli], a
- ld a, [hSavedMapTextPtr + 1]
+ ldh a, [hSavedMapTextPtr + 1]
ld [hl], a
ret
SetMapTextPointer::
ld a, [wMapTextPtr]
- ld [hSavedMapTextPtr], a
+ ldh [hSavedMapTextPtr], a
ld a, [wMapTextPtr + 1]
- ld [hSavedMapTextPtr + 1], a
+ ldh [hSavedMapTextPtr + 1], a
ld a, l
ld [wMapTextPtr], a
ld a, h
--- a/home/audio.asm
+++ b/home/audio.asm
@@ -170,10 +170,10 @@
.noFadeOut
xor a
ld [wNewSoundID], a
- ld a, [hLoadedROMBank]
- ld [hSavedROMBank], a
+ ldh a, [hLoadedROMBank]
+ ldh [hSavedROMBank], a
ld a, [wAudioROMBank]
- ld [hLoadedROMBank], a
+ ldh [hLoadedROMBank], a
ld [MBC1RomBank], a
cp BANK(Audio1_PlaySound)
jr nz, .checkForAudio2
@@ -197,8 +197,8 @@
call Audio3_PlaySound
.next2
- ld a, [hSavedROMBank]
- ld [hLoadedROMBank], a
+ ldh a, [hSavedROMBank]
+ ldh [hLoadedROMBank], a
ld [MBC1RomBank], a
jr .done
--- a/home/bankswitch.asm
+++ b/home/bankswitch.asm
@@ -2,10 +2,10 @@
; switches to bank # in a
; Only use this when in the home bank!
ld [wBankswitchHomeTemp], a
- ld a, [hLoadedROMBank]
+ ldh a, [hLoadedROMBank]
ld [wBankswitchHomeSavedROMBank], a
ld a, [wBankswitchHomeTemp]
- ld [hLoadedROMBank], a
+ ldh [hLoadedROMBank], a
ld [MBC1RomBank], a
ret
@@ -12,7 +12,7 @@
BankswitchBack::
; returns from BankswitchHome
ld a, [wBankswitchHomeSavedROMBank]
- ld [hLoadedROMBank], a
+ ldh [hLoadedROMBank], a
ld [MBC1RomBank], a
ret
@@ -19,10 +19,10 @@
Bankswitch::
; self-contained bankswitch, use this when not in the home bank
; switches to the bank in b
- ld a, [hLoadedROMBank]
+ ldh a, [hLoadedROMBank]
push af
ld a, b
- ld [hLoadedROMBank], a
+ ldh [hLoadedROMBank], a
ld [MBC1RomBank], a
ld bc, .Return
push bc
@@ -30,6 +30,6 @@
.Return
pop bc
ld a, b
- ld [hLoadedROMBank], a
+ ldh [hLoadedROMBank], a
ld [MBC1RomBank], a
ret
--- a/home/copy.asm
+++ b/home/copy.asm
@@ -1,14 +1,14 @@
FarCopyData::
; Copy bc bytes from a:hl to de.
ld [wBuffer], a
- ld a, [hLoadedROMBank]
+ ldh a, [hLoadedROMBank]
push af
ld a, [wBuffer]
- ld [hLoadedROMBank], a
+ ldh [hLoadedROMBank], a
ld [MBC1RomBank], a
call CopyData
pop af
- ld [hLoadedROMBank], a
+ ldh [hLoadedROMBank], a
ld [MBC1RomBank], a
ret
--- a/home/copy2.asm
+++ b/home/copy2.asm
@@ -1,25 +1,25 @@
FarCopyData2::
; Identical to FarCopyData, but uses hROMBankTemp
; as temp space instead of wBuffer.
- ld [hROMBankTemp], a
- ld a, [hLoadedROMBank]
+ ldh [hROMBankTemp], a
+ ldh a, [hLoadedROMBank]
push af
- ld a, [hROMBankTemp]
- ld [hLoadedROMBank], a
+ ldh a, [hROMBankTemp]
+ ldh [hLoadedROMBank], a
ld [MBC1RomBank], a
call CopyData
pop af
- ld [hLoadedROMBank], a
+ ldh [hLoadedROMBank], a
ld [MBC1RomBank], a
ret
FarCopyData3::
; Copy bc bytes from a:de to hl.
- ld [hROMBankTemp], a
- ld a, [hLoadedROMBank]
+ ldh [hROMBankTemp], a
+ ldh a, [hLoadedROMBank]
push af
- ld a, [hROMBankTemp]
- ld [hLoadedROMBank], a
+ ldh a, [hROMBankTemp]
+ ldh [hLoadedROMBank], a
ld [MBC1RomBank], a
push hl
push de
@@ -31,7 +31,7 @@
pop de
pop hl
pop af
- ld [hLoadedROMBank], a
+ ldh [hLoadedROMBank], a
ld [MBC1RomBank], a
ret
@@ -38,11 +38,11 @@
FarCopyDataDouble::
; Expand bc bytes of 1bpp image data
; from a:hl to 2bpp data at de.
- ld [hROMBankTemp], a
- ld a, [hLoadedROMBank]
+ ldh [hROMBankTemp], a
+ ldh a, [hLoadedROMBank]
push af
- ld a, [hROMBankTemp]
- ld [hLoadedROMBank], a
+ ldh a, [hROMBankTemp]
+ ldh [hLoadedROMBank], a
ld [MBC1RomBank], a
.loop
ld a, [hli]
@@ -55,7 +55,7 @@
or b
jr nz, .loop
pop af
- ld [hLoadedROMBank], a
+ ldh [hLoadedROMBank], a
ld [MBC1RomBank], a
ret
@@ -64,27 +64,27 @@
; tiles from b:de to hl, 8 tiles at a time.
; This takes c/8 frames.
- ld a, [hAutoBGTransferEnabled]
+ ldh a, [hAutoBGTransferEnabled]
push af
xor a ; disable auto-transfer while copying
- ld [hAutoBGTransferEnabled], a
+ ldh [hAutoBGTransferEnabled], a
- ld a, [hLoadedROMBank]
- ld [hROMBankTemp], a
+ ldh a, [hLoadedROMBank]
+ ldh [hROMBankTemp], a
ld a, b
- ld [hLoadedROMBank], a
+ ldh [hLoadedROMBank], a
ld [MBC1RomBank], a
ld a, e
- ld [hVBlankCopySource], a
+ ldh [hVBlankCopySource], a
ld a, d
- ld [hVBlankCopySource + 1], a
+ ldh [hVBlankCopySource + 1], a
ld a, l
- ld [hVBlankCopyDest], a
+ ldh [hVBlankCopyDest], a
ld a, h
- ld [hVBlankCopyDest + 1], a
+ ldh [hVBlankCopyDest + 1], a
.loop
ld a, c
@@ -92,18 +92,18 @@
jr nc, .keepgoing
.done
- ld [hVBlankCopySize], a
+ ldh [hVBlankCopySize], a
call DelayFrame
- ld a, [hROMBankTemp]
- ld [hLoadedROMBank], a
+ ldh a, [hROMBankTemp]
+ ldh [hLoadedROMBank], a
ld [MBC1RomBank], a
pop af
- ld [hAutoBGTransferEnabled], a
+ ldh [hAutoBGTransferEnabled], a
ret
.keepgoing
ld a, 8
- ld [hVBlankCopySize], a
+ ldh [hVBlankCopySize], a
call DelayFrame
ld a, c
sub 8
@@ -114,26 +114,26 @@
; Wait for the next VBlank, then copy c 1bpp
; tiles from b:de to hl, 8 tiles at a time.
; This takes c/8 frames.
- ld a, [hAutoBGTransferEnabled]
+ ldh a, [hAutoBGTransferEnabled]
push af
xor a ; disable auto-transfer while copying
- ld [hAutoBGTransferEnabled], a
- ld a, [hLoadedROMBank]
- ld [hROMBankTemp], a
+ ldh [hAutoBGTransferEnabled], a
+ ldh a, [hLoadedROMBank]
+ ldh [hROMBankTemp], a
ld a, b
- ld [hLoadedROMBank], a
+ ldh [hLoadedROMBank], a
ld [MBC1RomBank], a
ld a, e
- ld [hVBlankCopyDoubleSource], a
+ ldh [hVBlankCopyDoubleSource], a
ld a, d
- ld [hVBlankCopyDoubleSource + 1], a
+ ldh [hVBlankCopyDoubleSource + 1], a
ld a, l
- ld [hVBlankCopyDoubleDest], a
+ ldh [hVBlankCopyDoubleDest], a
ld a, h
- ld [hVBlankCopyDoubleDest + 1], a
+ ldh [hVBlankCopyDoubleDest + 1], a
.loop
ld a, c
@@ -141,18 +141,18 @@
jr nc, .keepgoing
.done
- ld [hVBlankCopyDoubleSize], a
+ ldh [hVBlankCopyDoubleSize], a
call DelayFrame
- ld a, [hROMBankTemp]
- ld [hLoadedROMBank], a
+ ldh a, [hROMBankTemp]
+ ldh [hLoadedROMBank], a
ld [MBC1RomBank], a
pop af
- ld [hAutoBGTransferEnabled], a
+ ldh [hAutoBGTransferEnabled], a
ret
.keepgoing
ld a, 8
- ld [hVBlankCopyDoubleSize], a
+ ldh [hVBlankCopyDoubleSize], a
call DelayFrame
ld a, c
sub 8
@@ -200,16 +200,16 @@
.setup
ld a, d
- ld [hVBlankCopyBGSource+1], a
+ ldh [hVBlankCopyBGSource+1], a
call GetRowColAddressBgMap
ld a, l
- ld [hVBlankCopyBGDest], a
+ ldh [hVBlankCopyBGDest], a
ld a, h
- ld [hVBlankCopyBGDest+1], a
+ ldh [hVBlankCopyBGDest+1], a
ld a, c
- ld [hVBlankCopyBGNumRows], a
+ ldh [hVBlankCopyBGNumRows], a
ld a, e
- ld [hVBlankCopyBGSource], a
+ ldh [hVBlankCopyBGSource], a
ret
ClearScreen::
--- a/home/fade.asm
+++ b/home/fade.asm
@@ -11,11 +11,11 @@
dec h
.ok
ld a, [hli]
- ld [rBGP], a
+ ldh [rBGP], a
ld a, [hli]
- ld [rOBP0], a
+ ldh [rOBP0], a
ld a, [hli]
- ld [rOBP1], a
+ ldh [rOBP1], a
ret
GBFadeInFromBlack::
@@ -29,11 +29,11 @@
GBFadeIncCommon:
ld a, [hli]
- ld [rBGP], a
+ ldh [rBGP], a
ld a, [hli]
- ld [rOBP0], a
+ ldh [rOBP0], a
ld a, [hli]
- ld [rOBP1], a
+ ldh [rOBP1], a
ld c, 8
call DelayFrames
dec b
@@ -51,11 +51,11 @@
GBFadeDecCommon:
ld a, [hld]
- ld [rOBP1], a
+ ldh [rOBP1], a
ld a, [hld]
- ld [rOBP0], a
+ ldh [rOBP0], a
ld a, [hld]
- ld [rBGP], a
+ ldh [rBGP], a
ld c, 8
call DelayFrames
dec b
--- a/home/init.asm
+++ b/home/init.asm
@@ -21,22 +21,22 @@
di
xor a
- ld [rIF], a
- ld [rIE], a
- ld [rSCX], a
- ld [rSCY], a
- ld [rSB], a
- ld [rSC], a
- ld [rWX], a
- ld [rWY], a
- ld [rTMA], a
- ld [rTAC], a
- ld [rBGP], a
- ld [rOBP0], a
- ld [rOBP1], a
+ ldh [rIF], a
+ ldh [rIE], a
+ ldh [rSCX], a
+ ldh [rSCY], a
+ ldh [rSB], a
+ ldh [rSC], a
+ ldh [rWX], a
+ ldh [rWY], a
+ ldh [rTMA], a
+ ldh [rTAC], a
+ ldh [rBGP], a
+ ldh [rOBP0], a
+ ldh [rOBP1], a
ld a, rLCDC_ENABLE_MASK
- ld [rLCDC], a
+ ldh [rLCDC], a
call DisableLCD
ld sp, wStack
@@ -60,27 +60,27 @@
call ClearSprites
ld a, BANK(WriteDMACodeToHRAM)
- ld [hLoadedROMBank], a
+ ldh [hLoadedROMBank], a
ld [MBC1RomBank], a
call WriteDMACodeToHRAM
xor a
- ld [hTilesetType], a
- ld [rSTAT], a
- ld [hSCX], a
- ld [hSCY], a
- ld [rIF], a
+ ldh [hTilesetType], a
+ ldh [rSTAT], a
+ ldh [hSCX], a
+ ldh [hSCY], a
+ ldh [rIF], a
ld a, 1 << VBLANK + 1 << TIMER + 1 << SERIAL
- ld [rIE], a
+ ldh [rIE], a
ld a, 144 ; move the window off-screen
- ld [hWY], a
- ld [rWY], a
+ ldh [hWY], a
+ ldh [rWY], a
ld a, 7
- ld [rWX], a
+ ldh [rWX], a
ld a, CONNECTION_NOT_ESTABLISHED
- ld [hSerialConnectionStatus], a
+ ldh [hSerialConnectionStatus], a
ld h, vBGMap0 / $100
call ClearBgMap
@@ -88,9 +88,9 @@
call ClearBgMap
ld a, rLCDC_DEFAULT
- ld [rLCDC], a
+ ldh [rLCDC], a
ld a, 16
- ld [hSoftReset], a
+ ldh [hSoftReset], a
call StopAllSounds
ei
@@ -101,9 +101,9 @@
ld [wAudioROMBank], a
ld [wAudioSavedROMBank], a
ld a, $9c
- ld [hAutoBGTransferDest + 1], a
+ ldh [hAutoBGTransferDest + 1], a
xor a
- ld [hAutoBGTransferDest], a
+ ldh [hAutoBGTransferDest], a
dec a
ld [wUpdateSpritesEnabled], a
@@ -114,7 +114,7 @@
call GBPalNormal
call ClearSprites
ld a, rLCDC_DEFAULT
- ld [rLCDC], a
+ ldh [rLCDC], a
jp SetDefaultNamesBeforeTitlescreen
--- a/home/joypad.asm
+++ b/home/joypad.asm
@@ -6,9 +6,9 @@
ld a, 1 << 5 ; select direction keys
ld c, 0
- ld [rJOYP], a
+ ldh [rJOYP], a
REPT 6
- ld a, [rJOYP]
+ ldh a, [rJOYP]
ENDR
cpl
and %1111
@@ -16,18 +16,18 @@
ld b, a
ld a, 1 << 4 ; select button keys
- ld [rJOYP], a
+ ldh [rJOYP], a
REPT 10
- ld a, [rJOYP]
+ ldh a, [rJOYP]
ENDR
cpl
and %1111
or b
- ld [hJoyInput], a
+ ldh [hJoyInput], a
ld a, 1 << 4 + 1 << 5 ; deselect keys
- ld [rJOYP], a
+ ldh [rJOYP], a
ret
Joypad::
--- a/home/lcd.asm
+++ b/home/lcd.asm
@@ -1,25 +1,25 @@
DisableLCD::
xor a
- ld [rIF], a
- ld a, [rIE]
+ ldh [rIF], a
+ ldh a, [rIE]
ld b, a
res 0, a
- ld [rIE], a
+ ldh [rIE], a
.wait
- ld a, [rLY]
+ ldh a, [rLY]
cp LY_VBLANK
jr nz, .wait
- ld a, [rLCDC]
+ ldh a, [rLCDC]
and $ff ^ rLCDC_ENABLE_MASK
- ld [rLCDC], a
+ ldh [rLCDC], a
ld a, b
- ld [rIE], a
+ ldh [rIE], a
ret
EnableLCD::
- ld a, [rLCDC]
+ ldh a, [rLCDC]
set rLCDC_ENABLE, a
- ld [rLCDC], a
+ ldh [rLCDC], a
ret
--- a/home/list_menu.asm
+++ b/home/list_menu.asm
@@ -3,9 +3,9 @@
; [wListPointer] = address of the list (2 bytes)
DisplayListMenuID::
xor a
- ld [hAutoBGTransferEnabled], a ; disable auto-transfer
+ ldh [hAutoBGTransferEnabled], a ; disable auto-transfer
ld a, 1
- ld [hJoy7], a ; joypad state update flag
+ ldh [hJoy7], a ; joypad state update flag
ld a, [wBattleType]
and a ; is it the Old Man battle?
jr nz, .specialBattleType
@@ -57,10 +57,10 @@
DisplayListMenuIDLoop::
xor a
- ld [hAutoBGTransferEnabled], a ; disable transfer
+ ldh [hAutoBGTransferEnabled], a ; disable transfer
call PrintListMenuEntries
ld a, 1
- ld [hAutoBGTransferEnabled], a ; enable transfer
+ ldh [hAutoBGTransferEnabled], a ; enable transfer
call Delay3
ld a, [wBattleType]
and a ; is it the Old Man battle?
@@ -163,7 +163,7 @@
ld a, [wCurrentMenuItem]
ld [wChosenMenuItem], a
xor a
- ld [hJoy7], a ; joypad state update flag
+ ldh [hJoy7], a ; joypad state update flag
ld hl, wd730
res 6, [hl] ; turn on letter printing delay
jp BankswitchBack
@@ -219,7 +219,7 @@
jp .incrementQuantity
.waitForKeyPressLoop
call JoypadLowSensitivity
- ld a, [hJoyPressed] ; newly pressed buttons
+ ldh a, [hJoyPressed] ; newly pressed buttons
bit 0, a ; was the A button pressed?
jp nz, .buttonAPressed
bit 1, a ; was the B button pressed?
@@ -272,22 +272,22 @@
pop bc
dec b
jr nz, .addLoop
- ld a, [hHalveItemPrices]
+ ldh a, [hHalveItemPrices]
and a ; should the price be halved (for selling items)?
jr z, .skipHalvingPrice
xor a
- ld [hDivideBCDDivisor], a
- ld [hDivideBCDDivisor + 1], a
+ ldh [hDivideBCDDivisor], a
+ ldh [hDivideBCDDivisor + 1], a
ld a, $02
- ld [hDivideBCDDivisor + 2], a
+ ldh [hDivideBCDDivisor + 2], a
predef DivideBCDPredef3 ; halves the price
; store the halved price
- ld a, [hDivideBCDQuotient]
- ld [hMoney], a
- ld a, [hDivideBCDQuotient + 1]
- ld [hMoney + 1], a
- ld a, [hDivideBCDQuotient + 2]
- ld [hMoney + 2], a
+ ldh a, [hDivideBCDQuotient]
+ ldh [hMoney], a
+ ldh a, [hDivideBCDQuotient + 1]
+ ldh [hMoney + 1], a
+ ldh a, [hDivideBCDQuotient + 2]
+ ldh [hMoney + 2], a
.skipHalvingPrice
coord hl, 12, 10
ld de, SpacesBetweenQuantityAndPriceText
@@ -324,7 +324,7 @@
ld [wMenuExitMethod], a
ld [wMenuWatchMovingOutOfBounds], a
xor a
- ld [hJoy7], a
+ ldh [hJoy7], a
ld hl, wd730
res 6, [hl]
call BankswitchBack
--- a/home/move_mon.asm
+++ b/home/move_mon.asm
@@ -21,10 +21,10 @@
.statsLoop
inc c
call CalcStat
- ld a, [hMultiplicand+1]
+ ldh a, [hMultiplicand+1]
ld [de], a
inc de
- ld a, [hMultiplicand+2]
+ ldh a, [hMultiplicand+2]
ld [de], a
inc de
ld a, c
@@ -57,22 +57,22 @@
add hl, bc ; skip to corresponding stat exp value
.statExpLoop ; calculates ceil(Sqrt(stat exp)) in b
xor a
- ld [hMultiplicand], a
- ld [hMultiplicand+1], a
+ ldh [hMultiplicand], a
+ ldh [hMultiplicand+1], a
inc b ; increment current stat exp bonus
ld a, b
cp $ff
jr z, .statExpDone
- ld [hMultiplicand+2], a
- ld [hMultiplier], a
+ ldh [hMultiplicand+2], a
+ ldh [hMultiplier], a
call Multiply
ld a, [hld]
ld d, a
- ld a, [hProduct + 3]
+ ldh a, [hProduct + 3]
sub d
ld a, [hli]
ld d, a
- ld a, [hProduct + 2]
+ ldh a, [hProduct + 2]
sbc d ; test if (current stat exp bonus)^2 < stat exp
jr c, .statExpLoop
.statExpDone
@@ -152,22 +152,22 @@
jr nc, .noCarry2
inc d ; de = (Base + IV) * 2 + ceil(Sqrt(stat exp)) / 4
.noCarry2
- ld [hMultiplicand+2], a
+ ldh [hMultiplicand+2], a
ld a, d
- ld [hMultiplicand+1], a
+ ldh [hMultiplicand+1], a
xor a
- ld [hMultiplicand], a
+ ldh [hMultiplicand], a
ld a, [wCurEnemyLVL]
- ld [hMultiplier], a
+ ldh [hMultiplier], a
call Multiply ; ((Base + IV) * 2 + ceil(Sqrt(stat exp)) / 4) * Level
- ld a, [hMultiplicand]
- ld [hDividend], a
- ld a, [hMultiplicand+1]
- ld [hDividend+1], a
- ld a, [hMultiplicand+2]
- ld [hDividend+2], a
+ ldh a, [hMultiplicand]
+ ldh [hDividend], a
+ ldh a, [hMultiplicand+1]
+ ldh [hDividend+1], a
+ ldh a, [hMultiplicand+2]
+ ldh [hDividend+2], a
ld a, $64
- ld [hDivisor], a
+ ldh [hDivisor], a
ld a, $3
ld b, a
call Divide ; (((Base + IV) * 2 + ceil(Sqrt(stat exp)) / 4) * Level) / 100
@@ -177,38 +177,38 @@
jr nz, .notHPStat
ld a, [wCurEnemyLVL]
ld b, a
- ld a, [hMultiplicand+2]
+ ldh a, [hMultiplicand+2]
add b
- ld [hMultiplicand+2], a
+ ldh [hMultiplicand+2], a
jr nc, .noCarry3
- ld a, [hMultiplicand+1]
+ ldh a, [hMultiplicand+1]
inc a
- ld [hMultiplicand+1], a ; HP: (((Base + IV) * 2 + ceil(Sqrt(stat exp)) / 4) * Level) / 100 + Level
+ ldh [hMultiplicand+1], a ; HP: (((Base + IV) * 2 + ceil(Sqrt(stat exp)) / 4) * Level) / 100 + Level
.noCarry3
ld a, 10 ; +10 for HP stat
.notHPStat
ld b, a
- ld a, [hMultiplicand+2]
+ ldh a, [hMultiplicand+2]
add b
- ld [hMultiplicand+2], a
+ ldh [hMultiplicand+2], a
jr nc, .noCarry4
- ld a, [hMultiplicand+1]
+ ldh a, [hMultiplicand+1]
inc a ; non-HP: (((Base + IV) * 2 + ceil(Sqrt(stat exp)) / 4) * Level) / 100 + 5
- ld [hMultiplicand+1], a ; HP: (((Base + IV) * 2 + ceil(Sqrt(stat exp)) / 4) * Level) / 100 + Level + 10
+ ldh [hMultiplicand+1], a ; HP: (((Base + IV) * 2 + ceil(Sqrt(stat exp)) / 4) * Level) / 100 + Level + 10
.noCarry4
- ld a, [hMultiplicand+1] ; check for overflow (>999)
+ ldh a, [hMultiplicand+1] ; check for overflow (>999)
cp 999 / $100 + 1
jr nc, .overflow
cp 999 / $100
jr c, .noOverflow
- ld a, [hMultiplicand+2]
+ ldh a, [hMultiplicand+2]
cp 999 % $100 + 1
jr c, .noOverflow
.overflow
ld a, 999 / $100 ; overflow: cap at 999
- ld [hMultiplicand+1], a
+ ldh [hMultiplicand+1], a
ld a, 999 % $100
- ld [hMultiplicand+2], a
+ ldh [hMultiplicand+2], a
.noOverflow
pop bc
pop de
@@ -216,27 +216,27 @@
ret
AddEnemyMonToPlayerParty::
- ld a, [hLoadedROMBank]
+ ldh a, [hLoadedROMBank]
push af
ld a, BANK(_AddEnemyMonToPlayerParty)
- ld [hLoadedROMBank], a
+ ldh [hLoadedROMBank], a
ld [MBC1RomBank], a
call _AddEnemyMonToPlayerParty
pop bc
ld a, b
- ld [hLoadedROMBank], a
+ ldh [hLoadedROMBank], a
ld [MBC1RomBank], a
ret
MoveMon::
- ld a, [hLoadedROMBank]
+ ldh a, [hLoadedROMBank]
push af
ld a, BANK(_MoveMon)
- ld [hLoadedROMBank], a
+ ldh [hLoadedROMBank], a
ld [MBC1RomBank], a
call _MoveMon
pop bc
ld a, b
- ld [hLoadedROMBank], a
+ ldh [hLoadedROMBank], a
ld [MBC1RomBank], a
ret
--- a/home/names.asm
+++ b/home/names.asm
@@ -1,9 +1,9 @@
GetMonName::
push hl
- ld a, [hLoadedROMBank]
+ ldh a, [hLoadedROMBank]
push af
ld a, BANK(MonsterNames)
- ld [hLoadedROMBank], a
+ ldh [hLoadedROMBank], a
ld [MBC1RomBank], a
ld a, [wd11e]
dec a
@@ -19,7 +19,7 @@
ld [hl], "@"
pop de
pop af
- ld [hLoadedROMBank], a
+ ldh [hLoadedROMBank], a
ld [MBC1RomBank], a
pop hl
ret
--- a/home/names2.asm
+++ b/home/names2.asm
@@ -22,7 +22,7 @@
cp HM01
jp nc, GetMachineName
- ld a, [hLoadedROMBank]
+ ldh a, [hLoadedROMBank]
push af
push hl
push bc
@@ -40,7 +40,7 @@
.otherEntries
;2-7 = OTHER ENTRIES
ld a, [wPredefBank]
- ld [hLoadedROMBank], a
+ ldh [hLoadedROMBank], a
ld [MBC1RomBank], a
ld a, [wNameListType] ;VariousNames' entryID
dec a
@@ -53,12 +53,12 @@
ld hl, NamePointers
add hl, de
ld a, [hli]
- ld [hSwapTemp + 1], a
+ ldh [hSwapTemp + 1], a
ld a, [hl]
- ld [hSwapTemp], a
- ld a, [hSwapTemp]
+ ldh [hSwapTemp], a
+ ldh a, [hSwapTemp]
ld h, a
- ld a, [hSwapTemp + 1]
+ ldh a, [hSwapTemp + 1]
ld l, a
ld a, [wd0b5]
ld b, a
@@ -88,6 +88,6 @@
pop bc
pop hl
pop af
- ld [hLoadedROMBank], a
+ ldh [hLoadedROMBank], a
ld [MBC1RomBank], a
ret
--- a/home/overworld.asm
+++ b/home/overworld.asm
@@ -67,16 +67,16 @@
ld a, [wd730]
bit 7, a ; are we simulating button presses?
jr z, .notSimulating
- ld a, [hJoyHeld]
+ ldh a, [hJoyHeld]
jr .checkIfStartIsPressed
.notSimulating
- ld a, [hJoyPressed]
+ ldh a, [hJoyPressed]
.checkIfStartIsPressed
bit 3, a ; start button
jr z, .startButtonNotPressed
; if START is pressed
xor a ; TEXT_START_MENU
- ld [hSpriteIndexOrTextID], a
+ ldh [hSpriteIndexOrTextID], a
jp .displayDialogue
.startButtonNotPressed
bit 0, a ; A button
@@ -88,11 +88,11 @@
call IsPlayerCharacterBeingControlledByGame
jr nz, .checkForOpponent
call CheckForHiddenObjectOrBookshelfOrCardKeyDoor
- ld a, [hItemAlreadyFound]
+ ldh a, [hItemAlreadyFound]
and a
jp z, OverworldLoop ; jump if a hidden object or bookshelf was found, but not if a card key door was found
call IsSpriteOrSignInFrontOfPlayer
- ld a, [hSpriteIndexOrTextID]
+ ldh a, [hSpriteIndexOrTextID]
and a
jp z, OverworldLoop
.displayDialogue
@@ -145,7 +145,7 @@
jp OverworldLoop
.checkIfDownButtonIsPressed
- ld a, [hJoyHeld] ; current joypad state
+ ldh a, [hJoyHeld] ; current joypad state
bit 7, a ; down button
jr z, .checkIfUpButtonIsPressed
ld a, 1
@@ -332,7 +332,7 @@
set 5, [hl]
set 6, [hl]
xor a
- ld [hJoyHeld], a
+ ldh [hJoyHeld], a
ld a, [wCurMap]
cp CINNABAR_GYM
jr nz, .notCinnabarGym
@@ -381,7 +381,7 @@
ld a, [wCurMap]
cp ROUTE_17 ; Cycling Road
jr nz, .goFaster
- ld a, [hJoyHeld]
+ ldh a, [hJoyHeld]
and D_UP | D_LEFT | D_RIGHT
ret nz
.goFaster
@@ -431,7 +431,7 @@
call Joypad
pop bc
pop de
- ld a, [hJoyHeld]
+ ldh a, [hJoyHeld]
and D_DOWN | D_UP | D_LEFT | D_RIGHT
jr z, CheckWarpsNoCollisionRetry2 ; if directional buttons aren't being pressed, do not pass through the warp
jr WarpFound1
@@ -455,7 +455,7 @@
ld a, [hli]
ld [wDestinationWarpID], a
ld a, [hl]
- ld [hWarpDestinationMap], a
+ ldh [hWarpDestinationMap], a
jr WarpFound2
.retry1
inc hl
@@ -477,7 +477,7 @@
ld a, [hli]
ld [wDestinationWarpID], a
ld a, [hli]
- ld [hWarpDestinationMap], a
+ ldh [hWarpDestinationMap], a
WarpFound2::
ld a, [wNumberOfWarps]
@@ -492,7 +492,7 @@
ld [wLastMap], a
ld a, [wCurMapWidth]
ld [wUnusedD366], a ; not read
- ld a, [hWarpDestinationMap]
+ ldh a, [hWarpDestinationMap]
ld [wCurMap], a
cp ROCK_TUNNEL_1F
jr nz, .notRockTunnel
@@ -506,7 +506,7 @@
; for maps that can have the 0xFF destination map, which means to return to the outside map
; not all these maps are necessarily indoors, though
.indoorMaps
- ld a, [hWarpDestinationMap] ; destination map
+ ldh a, [hWarpDestinationMap] ; destination map
cp $ff
jr z, .goBackOutside
; if not going back to the previous map
@@ -763,7 +763,7 @@
ld hl, wd72e
res 5, [hl]
ld a, BANK(ResetStatusAndHalveMoneyOnBlackout) ; also BANK(SpecialWarpIn) and BANK(SpecialEnterMap)
- ld [hLoadedROMBank], a
+ ldh [hLoadedROMBank], a
ld [MBC1RomBank], a
call ResetStatusAndHalveMoneyOnBlackout
call SpecialWarpIn
@@ -794,7 +794,7 @@
res 5, [hl] ; forced to ride bike
call LeaveMapAnim
ld a, BANK(SpecialWarpIn)
- ld [hLoadedROMBank], a
+ ldh [hLoadedROMBank], a
ld [MBC1RomBank], a
call SpecialWarpIn
jp SpecialEnterMap
@@ -813,7 +813,7 @@
dec a
jr z, .ridingBike
- ld a, [hTilesetType]
+ ldh a, [hTilesetType]
and a
jr nz, .determineGraphics
jr .startWalking
@@ -899,9 +899,9 @@
; a 3-byte border at the edges of the map is kept so that there is space for map connections
ld hl, wOverworldMap
ld a, [wCurMapWidth]
- ld [hMapWidth], a
+ ldh [hMapWidth], a
add MAP_BORDER * 2 ; east and west
- ld [hMapStride], a ; map width + border
+ ldh [hMapStride], a ; map width + border
ld b, 0
ld c, a
; make space for north border (next 3 lines)
@@ -918,7 +918,7 @@
ld b, a
.rowLoop ; copy one row each iteration
push hl
- ld a, [hMapWidth] ; map width (without border)
+ ldh a, [hMapWidth] ; map width (without border)
ld c, a
.rowInnerLoop
ld a, [de]
@@ -928,7 +928,7 @@
jr nz, .rowInnerLoop
; add the map width plus the border to the base address of the current row to get the next row's address
pop hl
- ld a, [hMapStride] ; map width + border
+ ldh a, [hMapStride] ; map width + border
add l
ld l, a
jr nc, .noCarry
@@ -950,9 +950,9 @@
ld a, [wNorthConnectionStripDest + 1]
ld d, a
ld a, [wNorthConnectionStripWidth]
- ld [hNorthSouthConnectionStripWidth], a
+ ldh [hNorthSouthConnectionStripWidth], a
ld a, [wNorthConnectedMapWidth]
- ld [hNorthSouthConnectedMapWidth], a
+ ldh [hNorthSouthConnectedMapWidth], a
call LoadNorthSouthConnectionsTileMap
.southConnection
ld a, [wMapConn2Ptr]
@@ -968,9 +968,9 @@
ld a, [wSouthConnectionStripDest + 1]
ld d, a
ld a, [wSouthConnectionStripWidth]
- ld [hNorthSouthConnectionStripWidth], a
+ ldh [hNorthSouthConnectionStripWidth], a
ld a, [wSouthConnectedMapWidth]
- ld [hNorthSouthConnectedMapWidth], a
+ ldh [hNorthSouthConnectedMapWidth], a
call LoadNorthSouthConnectionsTileMap
.westConnection
ld a, [wMapConn3Ptr]
@@ -988,7 +988,7 @@
ld a, [wWestConnectionStripHeight]
ld b, a
ld a, [wWestConnectedMapWidth]
- ld [hEastWestConnectedMapWidth], a
+ ldh [hEastWestConnectedMapWidth], a
call LoadEastWestConnectionsTileMap
.eastConnection
ld a, [wMapConn4Ptr]
@@ -1006,7 +1006,7 @@
ld a, [wEastConnectionStripHeight]
ld b, a
ld a, [wEastConnectedMapWidth]
- ld [hEastWestConnectedMapWidth], a
+ ldh [hEastWestConnectedMapWidth], a
call LoadEastWestConnectionsTileMap
.done
ret
@@ -1016,7 +1016,7 @@
.loop
push de
push hl
- ld a, [hNorthSouthConnectionStripWidth]
+ ldh a, [hNorthSouthConnectionStripWidth]
ld b, a
.innerLoop
ld a, [hli]
@@ -1026,7 +1026,7 @@
jr nz, .innerLoop
pop hl
pop de
- ld a, [hNorthSouthConnectedMapWidth]
+ ldh a, [hNorthSouthConnectedMapWidth]
add l
ld l, a
jr nc, .noCarry1
@@ -1055,7 +1055,7 @@
jr nz, .innerLoop
pop de
pop hl
- ld a, [hEastWestConnectedMapWidth]
+ ldh a, [hEastWestConnectedMapWidth]
add l
ld l, a
jr nc, .noCarry1
@@ -1077,7 +1077,7 @@
; if not, [hSpriteIndexOrTextID] is set to 0
IsSpriteOrSignInFrontOfPlayer::
xor a
- ld [hSpriteIndexOrTextID], a
+ ldh [hSpriteIndexOrTextID], a
ld a, [wNumSigns]
and a
jr z, .extendRangeOverCounter
@@ -1107,7 +1107,7 @@
dec c
add hl, bc
ld a, [hl]
- ld [hSpriteIndexOrTextID], a ; store sign text ID
+ ldh [hSpriteIndexOrTextID], a ; store sign text ID
pop bc
pop hl
ret
@@ -1213,7 +1213,7 @@
ld l, a ; hl = $c1x1
set 7, [hl] ; set flag to make the sprite face the player
ld a, e
- ld [hSpriteIndexOrTextID], a
+ ldh [hSpriteIndexOrTextID], a
ret
; function to check if the player will jump down a ledge and check if the tile ahead is passable (when not surfing)
@@ -1232,9 +1232,9 @@
and d ; check if a sprite is in the direction the player is trying to go
jr nz, .collision
xor a
- ld [hSpriteIndexOrTextID], a
+ ldh [hSpriteIndexOrTextID], a
call IsSpriteInFrontOfPlayer ; check for sprite collisions again? when does the above check fail to detect a sprite collision?
- ld a, [hSpriteIndexOrTextID]
+ ldh a, [hSpriteIndexOrTextID]
and a ; was there a sprite collision?
jr nz, .collision
; if no sprite collision
@@ -1372,10 +1372,10 @@
; this builds a tile map from the tile block map based on the current X/Y coordinates of the player's character
LoadCurrentMapView::
- ld a, [hLoadedROMBank]
+ ldh a, [hLoadedROMBank]
push af
ld a, [wTilesetBank] ; tile data ROM bank
- ld [hLoadedROMBank], a
+ ldh [hLoadedROMBank], a
ld [MBC1RomBank], a ; switch to ROM bank that contains tile data
ld a, [wCurrentTileBlockMapViewPointer] ; address of upper left corner of current map view
ld e, a
@@ -1457,7 +1457,7 @@
dec b
jr nz, .rowLoop2
pop af
- ld [hLoadedROMBank], a
+ ldh [hLoadedROMBank], a
ld [MBC1RomBank], a ; restore previous ROM bank
ret
@@ -1627,12 +1627,12 @@
ld c, a
sla b
sla c
- ld a, [hSCY]
+ ldh a, [hSCY]
add b
- ld [hSCY], a ; update background scroll Y
- ld a, [hSCX]
+ ldh [hSCY], a ; update background scroll Y
+ ldh a, [hSCX]
add c
- ld [hSCX], a ; update background scroll X
+ ldh [hSCX], a ; update background scroll X
; shift all the sprites in the direction opposite of the player's motion
; so that the player appears to move relative to them
ld hl, wSprite01StateData1YPixels
@@ -1714,11 +1714,11 @@
coord hl, 0, 0
call CopyToRedrawRowOrColumnSrcTiles
ld a, [wMapViewVRAMPointer]
- ld [hRedrawRowOrColumnDest], a
+ ldh [hRedrawRowOrColumnDest], a
ld a, [wMapViewVRAMPointer + 1]
- ld [hRedrawRowOrColumnDest + 1], a
+ ldh [hRedrawRowOrColumnDest + 1], a
ld a, REDRAW_ROW
- ld [hRedrawRowOrColumnMode], a
+ ldh [hRedrawRowOrColumnMode], a
ret
CopyToRedrawRowOrColumnSrcTiles::
@@ -1744,11 +1744,11 @@
ld a, h
and $03
or $98
- ld [hRedrawRowOrColumnDest + 1], a
+ ldh [hRedrawRowOrColumnDest + 1], a
ld a, l
- ld [hRedrawRowOrColumnDest], a
+ ldh [hRedrawRowOrColumnDest], a
ld a, REDRAW_ROW
- ld [hRedrawRowOrColumnMode], a
+ ldh [hRedrawRowOrColumnMode], a
ret
ScheduleEastColumnRedraw::
@@ -1762,11 +1762,11 @@
add 18
and $1f
or b
- ld [hRedrawRowOrColumnDest], a
+ ldh [hRedrawRowOrColumnDest], a
ld a, [wMapViewVRAMPointer + 1]
- ld [hRedrawRowOrColumnDest + 1], a
+ ldh [hRedrawRowOrColumnDest + 1], a
ld a, REDRAW_COL
- ld [hRedrawRowOrColumnMode], a
+ ldh [hRedrawRowOrColumnMode], a
ret
ScheduleColumnRedrawHelper::
@@ -1793,11 +1793,11 @@
coord hl, 0, 0
call ScheduleColumnRedrawHelper
ld a, [wMapViewVRAMPointer]
- ld [hRedrawRowOrColumnDest], a
+ ldh [hRedrawRowOrColumnDest], a
ld a, [wMapViewVRAMPointer + 1]
- ld [hRedrawRowOrColumnDest + 1], a
+ ldh [hRedrawRowOrColumnDest + 1], a
ld a, REDRAW_COL
- ld [hRedrawRowOrColumnMode], a
+ ldh [hRedrawRowOrColumnMode], a
ret
; function to write the tiles that make up a tile block to memory
@@ -1855,17 +1855,17 @@
ld a, [wCurMap]
cp ROUTE_17 ; Cycling Road
jr nz, .notForcedDownwards
- ld a, [hJoyHeld]
+ ldh a, [hJoyHeld]
and D_DOWN | D_UP | D_LEFT | D_RIGHT | B_BUTTON | A_BUTTON
jr nz, .notForcedDownwards
ld a, D_DOWN
- ld [hJoyHeld], a ; on the cycling road, if there isn't a trainer and the player isn't pressing buttons, simulate a down press
+ ldh [hJoyHeld], a ; on the cycling road, if there isn't a trainer and the player isn't pressing buttons, simulate a down press
.notForcedDownwards
ld a, [wd730]
bit 7, a
ret z
; if simulating button presses
- ld a, [hJoyHeld]
+ ldh a, [hJoyHeld]
ld b, a
ld a, [wOverrideSimulatedJoypadStatesMask] ; bit mask for button presses that override simulated ones
and b
@@ -1882,11 +1882,11 @@
inc h
.noCarry
ld a, [hl]
- ld [hJoyHeld], a ; store simulated button press in joypad state
+ ldh [hJoyHeld], a ; store simulated button press in joypad state
and a
ret nz
- ld [hJoyPressed], a
- ld [hJoyReleased], a
+ ldh [hJoyPressed], a
+ ldh [hJoyReleased], a
ret
; if done simulating button presses
@@ -1896,7 +1896,7 @@
ld [wSimulatedJoypadStatesIndex], a
ld [wSimulatedJoypadStatesEnd], a
ld [wJoyIgnore], a
- ld [hJoyHeld], a
+ ldh [hJoyHeld], a
ld hl, wd736
ld a, [hl]
and $f8
@@ -2041,7 +2041,7 @@
ld b, a
res 7, a
ld [wCurMapTileset], a
- ld [hPreviousTileset], a
+ ldh [hPreviousTileset], a
bit 7, b
ret nz
ld hl, MapHeaderPointers
@@ -2134,9 +2134,9 @@
ld c, a
ld de, wSignTextIDs
ld a, d
- ld [hSignCoordPointer], a
+ ldh [hSignCoordPointer], a
ld a, e
- ld [hSignCoordPointer + 1], a
+ ldh [hSignCoordPointer + 1], a
ld de, wSignCoords
.signLoop
ld a, [hli]
@@ -2146,17 +2146,17 @@
ld [de], a
inc de
push de
- ld a, [hSignCoordPointer]
+ ldh a, [hSignCoordPointer]
ld d, a
- ld a, [hSignCoordPointer + 1]
+ ldh a, [hSignCoordPointer + 1]
ld e, a
ld a, [hli]
ld [de], a
inc de
ld a, d
- ld [hSignCoordPointer], a
+ ldh [hSignCoordPointer], a
ld a, e
- ld [hSignCoordPointer + 1], a
+ ldh [hSignCoordPointer + 1], a
pop de
dec c
jr nz, .signLoop
@@ -2210,24 +2210,24 @@
ld a, [hli]
ld [de], a ; store movement byte 1 at C2X6
ld a, [hli]
- ld [hLoadSpriteTemp1], a ; save movement byte 2
+ ldh [hLoadSpriteTemp1], a ; save movement byte 2
ld a, [hli]
- ld [hLoadSpriteTemp2], a ; save text ID and flags byte
+ ldh [hLoadSpriteTemp2], a ; save text ID and flags byte
push bc
push hl
ld b, $00
ld hl, wMapSpriteData
add hl, bc
- ld a, [hLoadSpriteTemp1]
+ ldh a, [hLoadSpriteTemp1]
ld [hli], a ; store movement byte 2 in byte 0 of sprite entry
- ld a, [hLoadSpriteTemp2]
+ ldh a, [hLoadSpriteTemp2]
ld [hl], a ; this appears pointless, since the value is overwritten immediately after
- ld a, [hLoadSpriteTemp2]
- ld [hLoadSpriteTemp1], a
+ ldh a, [hLoadSpriteTemp2]
+ ldh [hLoadSpriteTemp1], a
and $3f
ld [hl], a ; store text ID in byte 1 of sprite entry
pop hl
- ld a, [hLoadSpriteTemp1]
+ ldh a, [hLoadSpriteTemp1]
bit 6, a
jr nz, .trainerSprite
bit 7, a
@@ -2235,25 +2235,25 @@
jr .regularSprite
.trainerSprite
ld a, [hli]
- ld [hLoadSpriteTemp1], a ; save trainer class
+ ldh [hLoadSpriteTemp1], a ; save trainer class
ld a, [hli]
- ld [hLoadSpriteTemp2], a ; save trainer number (within class)
+ ldh [hLoadSpriteTemp2], a ; save trainer number (within class)
push hl
ld hl, wMapSpriteExtraData
add hl, bc
- ld a, [hLoadSpriteTemp1]
+ ldh a, [hLoadSpriteTemp1]
ld [hli], a ; store trainer class in byte 0 of the entry
- ld a, [hLoadSpriteTemp2]
+ ldh a, [hLoadSpriteTemp2]
ld [hl], a ; store trainer number in byte 1 of the entry
pop hl
jr .nextSprite
.itemBallSprite
ld a, [hli]
- ld [hLoadSpriteTemp1], a ; save item number
+ ldh [hLoadSpriteTemp1], a ; save item number
push hl
ld hl, wMapSpriteExtraData
add hl, bc
- ld a, [hLoadSpriteTemp1]
+ ldh a, [hLoadSpriteTemp1]
ld [hli], a ; store item number in byte 0 of the entry
xor a
ld [hl], a ; zero byte 1, since it is not used
@@ -2291,10 +2291,10 @@
ld a, [wCurMap]
ld c, a
ld b, $00
- ld a, [hLoadedROMBank]
+ ldh a, [hLoadedROMBank]
push af
ld a, BANK(MapSongBanks)
- ld [hLoadedROMBank], a
+ ldh [hLoadedROMBank], a
ld [MBC1RomBank], a
ld hl, MapSongBanks
add hl, bc
@@ -2304,7 +2304,7 @@
ld a, [hl]
ld [wMapMusicROMBank], a ; music 2
pop af
- ld [hLoadedROMBank], a
+ ldh [hLoadedROMBank], a
ld [MBC1RomBank], a
ret
@@ -2322,7 +2322,7 @@
; function to load map data
LoadMapData::
- ld a, [hLoadedROMBank]
+ ldh a, [hLoadedROMBank]
push af
call DisableLCD
ld a, $98
@@ -2329,8 +2329,8 @@
ld [wMapViewVRAMPointer + 1], a
xor a
ld [wMapViewVRAMPointer], a
- ld [hSCY], a
- ld [hSCX], a
+ ldh [hSCY], a
+ ldh [hSCX], a
ld [wWalkCounter], a
ld [wUnusedD119], a
ld [wWalkBikeSurfStateCopy], a
@@ -2377,7 +2377,7 @@
call PlayDefaultMusicFadeOutCurrent
.restoreRomBank
pop af
- ld [hLoadedROMBank], a
+ ldh [hLoadedROMBank], a
ld [MBC1RomBank], a
ret
@@ -2393,10 +2393,10 @@
ld hl, MapHeaderBanks
add hl, bc
ld a, [hl]
- ld [hMapROMBank], a ; save map ROM bank
+ ldh [hMapROMBank], a ; save map ROM bank
call BankswitchBack
- ld a, [hMapROMBank]
- ld [hLoadedROMBank], a
+ ldh a, [hMapROMBank]
+ ldh [hLoadedROMBank], a
ld [MBC1RomBank], a ; switch to map ROM bank
pop bc
pop hl
--- a/home/pics.asm
+++ b/home/pics.asm
@@ -63,7 +63,7 @@
LoadUncompressedSpriteData::
push de
and $f
- ld [hSpriteWidth], a ; each byte contains 8 pixels (in 1bpp), so tiles=bytes for width
+ ldh [hSpriteWidth], a ; each byte contains 8 pixels (in 1bpp), so tiles=bytes for width
ld b, a
ld a, $7
sub b ; 7-w
@@ -74,7 +74,7 @@
add a
add a
sub b ; 7*((8-w)/2) ; skip for horizontal center (in tiles)
- ld [hSpriteOffset], a
+ ldh [hSpriteOffset], a
ld a, c
swap a
and $f
@@ -82,16 +82,16 @@
add a
add a
add a ; 8*tiles is height in bytes
- ld [hSpriteHeight], a
+ ldh [hSpriteHeight], a
ld a, $7
sub b ; 7-h ; skip for vertical center (in tiles, relative to current column)
ld b, a
- ld a, [hSpriteOffset]
+ ldh a, [hSpriteOffset]
add b ; 7*((8-w)/2) + 7-h ; combined overall offset (in tiles)
add a
add a
add a ; 8*(7*((8-w)/2) + 7-h) ; combined overall offset (in bytes)
- ld [hSpriteOffset], a
+ ldh [hSpriteOffset], a
xor a
ld [MBC1SRamBank], a
ld hl, sSpriteBuffer0
@@ -110,15 +110,15 @@
; copies and aligns the sprite data properly inside the sprite buffer
; sprite buffers are 7*7 tiles in size, the loaded sprite is centered within this area
AlignSpriteDataCentered::
- ld a, [hSpriteOffset]
+ ldh a, [hSpriteOffset]
ld b, $0
ld c, a
add hl, bc
- ld a, [hSpriteWidth]
+ ldh a, [hSpriteWidth]
.columnLoop
push af
push hl
- ld a, [hSpriteHeight]
+ ldh a, [hSpriteHeight]
ld c, a
.columnInnerLoop
ld a, [de]
@@ -157,7 +157,7 @@
ld de, sSpriteBuffer1 + (SPRITEBUFFERSIZE - 1) ; source 2: end of buffer 1
ld bc, sSpriteBuffer0 + (SPRITEBUFFERSIZE - 1) ; source 1: end of buffer 0
ld a, SPRITEBUFFERSIZE/2 ; $c4
- ld [hSpriteInterlaceCounter], a
+ ldh [hSpriteInterlaceCounter], a
.interlaceLoop
ld a, [de]
dec de
@@ -171,9 +171,9 @@
ld a, [bc]
dec bc
ld [hld], a ; write byte of source 1
- ld a, [hSpriteInterlaceCounter]
+ ldh a, [hSpriteInterlaceCounter]
dec a
- ld [hSpriteInterlaceCounter], a
+ ldh [hSpriteInterlaceCounter], a
jr nz, .interlaceLoop
ld a, [wSpriteFlipped]
and a
@@ -191,6 +191,6 @@
pop hl
ld de, sSpriteBuffer1
ld c, (2*SPRITEBUFFERSIZE)/16 ; $31, number of 16 byte chunks to be copied
- ld a, [hLoadedROMBank]
+ ldh a, [hLoadedROMBank]
ld b, a
jp CopyVideoData
--- a/home/pokemon.asm
+++ b/home/pokemon.asm
@@ -122,18 +122,18 @@
ld de, vFrontPic
call LoadMonFrontSprite
pop hl
- ld a, [hLoadedROMBank]
+ ldh a, [hLoadedROMBank]
push af
ld a, BANK(CopyUncompressedPicToHL)
- ld [hLoadedROMBank], a
+ ldh [hLoadedROMBank], a
ld [MBC1RomBank], a
xor a
- ld [hStartTileID], a
+ ldh [hStartTileID], a
call CopyUncompressedPicToHL
xor a
ld [wSpriteFlipped], a
pop af
- ld [hLoadedROMBank], a
+ ldh [hLoadedROMBank], a
ld [MBC1RomBank], a
ret
@@ -175,10 +175,10 @@
ret
DisplayPartyMenu::
- ld a, [hTilesetType]
+ ldh a, [hTilesetType]
push af
xor a
- ld [hTilesetType], a
+ ldh [hTilesetType], a
call GBPalWhiteOutWithDelay3
call ClearSprites
call PartyMenuInit
@@ -186,10 +186,10 @@
jp HandlePartyMenuInput
GoBackToPartyMenu::
- ld a, [hTilesetType]
+ ldh a, [hTilesetType]
push af
xor a
- ld [hTilesetType], a
+ ldh [hTilesetType], a
call PartyMenuInit
call RedrawPartyMenu
jp HandlePartyMenuInput
@@ -251,7 +251,7 @@
and a
jp nz, .swappingPokemon
pop af
- ld [hTilesetType], a
+ ldh [hTilesetType], a
bit 1, b
jr nz, .noPokemonChosen
ld a, [wPartyCount]
@@ -325,15 +325,15 @@
ret
PrintStatusConditionNotFainted::
- ld a, [hLoadedROMBank]
+ ldh a, [hLoadedROMBank]
push af
ld a, BANK(PrintStatusAilment)
- ld [hLoadedROMBank], a
+ ldh [hLoadedROMBank], a
ld [MBC1RomBank], a
call PrintStatusAilment ; print status condition
pop bc
ld a, b
- ld [hLoadedROMBank], a
+ ldh [hLoadedROMBank], a
ld [MBC1RomBank], a
ret
@@ -382,10 +382,10 @@
; INPUT:
; [wd0b5] = pokemon ID
GetMonHeader::
- ld a, [hLoadedROMBank]
+ ldh a, [hLoadedROMBank]
push af
ld a, BANK(BaseStats)
- ld [hLoadedROMBank], a
+ ldh [hLoadedROMBank], a
ld [MBC1RomBank], a
push bc
push de
@@ -440,7 +440,7 @@
pop de
pop bc
pop af
- ld [hLoadedROMBank], a
+ ldh [hLoadedROMBank], a
ld [MBC1RomBank], a
ret
--- a/home/predef.asm
+++ b/home/predef.asm
@@ -8,18 +8,18 @@
; A hack for LoadDestinationWarpPosition.
; See LoadTilesetHeader (predef $19).
- ld a, [hLoadedROMBank]
+ ldh a, [hLoadedROMBank]
ld [wPredefParentBank], a
push af
ld a, BANK(GetPredefPointer)
- ld [hLoadedROMBank], a
+ ldh [hLoadedROMBank], a
ld [MBC1RomBank], a
call GetPredefPointer
ld a, [wPredefBank]
- ld [hLoadedROMBank], a
+ ldh [hLoadedROMBank], a
ld [MBC1RomBank], a
ld de, .done
@@ -28,7 +28,7 @@
.done
pop af
- ld [hLoadedROMBank], a
+ ldh [hLoadedROMBank], a
ld [MBC1RomBank], a
ret
--- a/home/print_num.asm
+++ b/home/print_num.asm
@@ -6,9 +6,9 @@
; in bits 7 and 6 of b respectively.
push bc
xor a
- ld [hPastLeadingZeros], a
- ld [hNumToPrint], a
- ld [hNumToPrint + 1], a
+ ldh [hPastLeadingZeros], a
+ ldh [hNumToPrint], a
+ ldh [hNumToPrint + 1], a
ld a, b
and $f
cp 1
@@ -17,26 +17,26 @@
jr z, .word
.long
ld a, [de]
- ld [hNumToPrint], a
+ ldh [hNumToPrint], a
inc de
ld a, [de]
- ld [hNumToPrint + 1], a
+ ldh [hNumToPrint + 1], a
inc de
ld a, [de]
- ld [hNumToPrint + 2], a
+ ldh [hNumToPrint + 2], a
jr .start
.word
ld a, [de]
- ld [hNumToPrint + 1], a
+ ldh [hNumToPrint + 1], a
inc de
ld a, [de]
- ld [hNumToPrint + 2], a
+ ldh [hNumToPrint + 2], a
jr .start
.byte
ld a, [de]
- ld [hNumToPrint + 2], a
+ ldh [hNumToPrint + 2], a
.start
push de
@@ -66,7 +66,7 @@
ELSE
xor a
ENDC
- ld [hPowerOf10 + 0], a
+ ldh [hPowerOf10 + 0], a
IF (\1) / $100
ld a, \1 / $100 % $100
@@ -73,10 +73,10 @@
ELSE
xor a
ENDC
- ld [hPowerOf10 + 1], a
+ ldh [hPowerOf10 + 1], a
ld a, \1 / $1 % $100
- ld [hPowerOf10 + 2], a
+ ldh [hPowerOf10 + 2], a
call .PrintDigit
call .NextDigit
@@ -90,7 +90,7 @@
.tens
ld c, 0
- ld a, [hNumToPrint + 2]
+ ldh a, [hNumToPrint + 2]
.mod
cp 10
jr c, .ok
@@ -100,9 +100,9 @@
.ok
ld b, a
- ld a, [hPastLeadingZeros]
+ ldh a, [hPastLeadingZeros]
or c
- ld [hPastLeadingZeros], a
+ ldh [hPastLeadingZeros], a
jr nz, .past
call .PrintLeadingZero
jr .next
@@ -127,67 +127,67 @@
; Print the quotient, and keep the modulus.
ld c, 0
.loop
- ld a, [hPowerOf10]
+ ldh a, [hPowerOf10]
ld b, a
- ld a, [hNumToPrint]
- ld [hSavedNumToPrint], a
+ ldh a, [hNumToPrint]
+ ldh [hSavedNumToPrint], a
cp b
jr c, .underflow0
sub b
- ld [hNumToPrint], a
- ld a, [hPowerOf10 + 1]
+ ldh [hNumToPrint], a
+ ldh a, [hPowerOf10 + 1]
ld b, a
- ld a, [hNumToPrint + 1]
- ld [hSavedNumToPrint + 1], a
+ ldh a, [hNumToPrint + 1]
+ ldh [hSavedNumToPrint + 1], a
cp b
jr nc, .noborrow1
- ld a, [hNumToPrint]
+ ldh a, [hNumToPrint]
or 0
jr z, .underflow1
dec a
- ld [hNumToPrint], a
- ld a, [hNumToPrint + 1]
+ ldh [hNumToPrint], a
+ ldh a, [hNumToPrint + 1]
.noborrow1
sub b
- ld [hNumToPrint + 1], a
- ld a, [hPowerOf10 + 2]
+ ldh [hNumToPrint + 1], a
+ ldh a, [hPowerOf10 + 2]
ld b, a
- ld a, [hNumToPrint + 2]
- ld [hSavedNumToPrint + 2], a
+ ldh a, [hNumToPrint + 2]
+ ldh [hSavedNumToPrint + 2], a
cp b
jr nc, .noborrow2
- ld a, [hNumToPrint + 1]
+ ldh a, [hNumToPrint + 1]
and a
jr nz, .borrowed
- ld a, [hNumToPrint]
+ ldh a, [hNumToPrint]
and a
jr z, .underflow2
dec a
- ld [hNumToPrint], a
+ ldh [hNumToPrint], a
xor a
.borrowed
dec a
- ld [hNumToPrint + 1], a
- ld a, [hNumToPrint + 2]
+ ldh [hNumToPrint + 1], a
+ ldh a, [hNumToPrint + 2]
.noborrow2
sub b
- ld [hNumToPrint + 2], a
+ ldh [hNumToPrint + 2], a
inc c
jr .loop
.underflow2
- ld a, [hSavedNumToPrint + 1]
- ld [hNumToPrint + 1], a
+ ldh a, [hSavedNumToPrint + 1]
+ ldh [hNumToPrint + 1], a
.underflow1
- ld a, [hSavedNumToPrint]
- ld [hNumToPrint], a
+ ldh a, [hSavedNumToPrint]
+ ldh [hNumToPrint], a
.underflow0
- ld a, [hPastLeadingZeros]
+ ldh a, [hPastLeadingZeros]
or c
jr z, .PrintLeadingZero
@@ -194,7 +194,7 @@
ld a, "0"
add c
ld [hl], a
- ld [hPastLeadingZeros], a
+ ldh [hPastLeadingZeros], a
ret
.PrintLeadingZero:
@@ -211,7 +211,7 @@
jr nz, .inc
bit BIT_LEFT_ALIGN, d
jr z, .inc
- ld a, [hPastLeadingZeros]
+ ldh a, [hPastLeadingZeros]
and a
ret z
.inc
--- a/home/serial.asm
+++ b/home/serial.asm
@@ -3,46 +3,46 @@
push bc
push de
push hl
- ld a, [hSerialConnectionStatus]
+ ldh a, [hSerialConnectionStatus]
inc a
jr z, .connectionNotYetEstablished
- ld a, [rSB]
- ld [hSerialReceiveData], a
- ld a, [hSerialSendData]
- ld [rSB], a
- ld a, [hSerialConnectionStatus]
+ ldh a, [rSB]
+ ldh [hSerialReceiveData], a
+ ldh a, [hSerialSendData]
+ ldh [rSB], a
+ ldh a, [hSerialConnectionStatus]
cp USING_INTERNAL_CLOCK
jr z, .done
; using external clock
ld a, START_TRANSFER_EXTERNAL_CLOCK
- ld [rSC], a
+ ldh [rSC], a
jr .done
.connectionNotYetEstablished
- ld a, [rSB]
- ld [hSerialReceiveData], a
- ld [hSerialConnectionStatus], a
+ ldh a, [rSB]
+ ldh [hSerialReceiveData], a
+ ldh [hSerialConnectionStatus], a
cp USING_INTERNAL_CLOCK
jr z, .usingInternalClock
; using external clock
xor a
- ld [rSB], a
+ ldh [rSB], a
ld a, $3
- ld [rDIV], a
+ ldh [rDIV], a
.waitLoop
- ld a, [rDIV]
+ ldh a, [rDIV]
bit 7, a
jr nz, .waitLoop
ld a, START_TRANSFER_EXTERNAL_CLOCK
- ld [rSC], a
+ ldh [rSC], a
jr .done
.usingInternalClock
xor a
- ld [rSB], a
+ ldh [rSB], a
.done
ld a, $1
- ld [hSerialReceivedNewData], a
+ ldh [hSerialReceivedNewData], a
ld a, SERIAL_NO_DATA_BYTE
- ld [hSerialSendData], a
+ ldh [hSerialSendData], a
pop hl
pop de
pop bc
@@ -54,10 +54,10 @@
; bc = length of data
Serial_ExchangeBytes::
ld a, 1
- ld [hSerialIgnoringInitialData], a
+ ldh [hSerialIgnoringInitialData], a
.loop
ld a, [hl]
- ld [hSerialSendData], a
+ ldh [hSerialSendData], a
call Serial_ExchangeByte
push bc
ld b, a
@@ -66,7 +66,7 @@
.waitLoop
dec a
jr nz, .waitLoop
- ld a, [hSerialIgnoringInitialData]
+ ldh a, [hSerialIgnoringInitialData]
and a
ld a, b
pop bc
@@ -75,7 +75,7 @@
cp SERIAL_PREAMBLE_BYTE
jr nz, .loop
xor a
- ld [hSerialIgnoringInitialData], a
+ ldh [hSerialIgnoringInitialData], a
jr .loop
.storeReceivedByte
ld [de], a
@@ -88,17 +88,17 @@
Serial_ExchangeByte::
xor a
- ld [hSerialReceivedNewData], a
- ld a, [hSerialConnectionStatus]
+ ldh [hSerialReceivedNewData], a
+ ldh a, [hSerialConnectionStatus]
cp USING_INTERNAL_CLOCK
jr nz, .loop
ld a, START_TRANSFER_INTERNAL_CLOCK
- ld [rSC], a
+ ldh [rSC], a
.loop
- ld a, [hSerialReceivedNewData]
+ ldh a, [hSerialReceivedNewData]
and a
jr nz, .ok
- ld a, [hSerialConnectionStatus]
+ ldh a, [hSerialConnectionStatus]
cp USING_EXTERNAL_CLOCK
jr nz, .doNotIncrementUnknownCounter
call IsUnknownCounterZero
@@ -116,7 +116,7 @@
jr nz, .loop
jp SetUnknownCounterToFFFF
.doNotIncrementUnknownCounter
- ld a, [rIE]
+ ldh a, [rIE]
and (1 << SERIAL) | (1 << TIMER) | (1 << LCD_STAT) | (1 << VBLANK)
cp (1 << SERIAL)
jr nz, .loop
@@ -128,7 +128,7 @@
dec a
ld [wUnknownSerialCounter2 + 1], a
jr nz, .loop
- ld a, [hSerialConnectionStatus]
+ ldh a, [hSerialConnectionStatus]
cp USING_EXTERNAL_CLOCK
jr z, .ok
ld a, 255
@@ -137,8 +137,8 @@
jr nz, .waitLoop
.ok
xor a
- ld [hSerialReceivedNewData], a
- ld a, [rIE]
+ ldh [hSerialReceivedNewData], a
+ ldh a, [rIE]
and (1 << SERIAL) | (1 << TIMER) | (1 << LCD_STAT) | (1 << VBLANK)
sub (1 << SERIAL)
jr nz, .skipReloadingUnknownCounter2
@@ -146,7 +146,7 @@
ld a, $50
ld [wUnknownSerialCounter2 + 1], a
.skipReloadingUnknownCounter2
- ld a, [hSerialReceiveData]
+ ldh a, [hSerialReceiveData]
cp SERIAL_NO_DATA_BYTE
ret nz
call IsUnknownCounterZero
@@ -164,13 +164,13 @@
call IsUnknownCounterZero
jr z, SetUnknownCounterToFFFF
.done
- ld a, [rIE]
+ ldh a, [rIE]
and (1 << SERIAL) | (1 << TIMER) | (1 << LCD_STAT) | (1 << VBLANK)
cp (1 << SERIAL)
ld a, SERIAL_NO_DATA_BYTE
ret z
ld a, [hl]
- ld [hSerialSendData], a
+ ldh [hSerialSendData], a
call DelayFrame
jp Serial_ExchangeByte
@@ -203,18 +203,18 @@
ld de, wLinkMenuSelectionReceiveBuffer
ld c, 2 ; number of bytes to save
ld a, 1
- ld [hSerialIgnoringInitialData], a
+ ldh [hSerialIgnoringInitialData], a
.loop
call DelayFrame
ld a, [hl]
- ld [hSerialSendData], a
+ ldh [hSerialSendData], a
call Serial_ExchangeByte
ld b, a
inc hl
- ld a, [hSerialIgnoringInitialData]
+ ldh a, [hSerialIgnoringInitialData]
and a
ld a, 0
- ld [hSerialIgnoringInitialData], a
+ ldh [hSerialIgnoringInitialData], a
jr nz, .loop
ld a, b
ld [de], a
@@ -273,20 +273,20 @@
call .doExchange
ld a, [wSerialExchangeNybbleSendData]
add $60
- ld [hSerialSendData], a
- ld a, [hSerialConnectionStatus]
+ ldh [hSerialSendData], a
+ ldh a, [hSerialConnectionStatus]
cp USING_INTERNAL_CLOCK
jr nz, .doExchange
ld a, START_TRANSFER_INTERNAL_CLOCK
- ld [rSC], a
+ ldh [rSC], a
.doExchange
- ld a, [hSerialReceiveData]
+ ldh a, [hSerialReceiveData]
ld [wSerialExchangeNybbleTempReceiveData], a
and $f0
cp $60
ret nz
xor a
- ld [hSerialReceiveData], a
+ ldh [hSerialReceiveData], a
ld a, [wSerialExchangeNybbleTempReceiveData]
and $f
ld [wSerialExchangeNybbleReceiveData], a
@@ -294,19 +294,19 @@
Serial_SendZeroByte::
xor a
- ld [hSerialSendData], a
- ld a, [hSerialConnectionStatus]
+ ldh [hSerialSendData], a
+ ldh a, [hSerialConnectionStatus]
cp USING_INTERNAL_CLOCK
ret nz
ld a, START_TRANSFER_INTERNAL_CLOCK
- ld [rSC], a
+ ldh [rSC], a
ret
Serial_TryEstablishingExternallyClockedConnection::
ld a, ESTABLISH_CONNECTION_WITH_EXTERNAL_CLOCK
- ld [rSB], a
+ ldh [rSB], a
xor a
- ld [hSerialReceiveData], a
+ ldh [hSerialReceiveData], a
ld a, START_TRANSFER_EXTERNAL_CLOCK
- ld [rSC], a
+ ldh [rSC], a
ret
--- a/home/start_menu.asm
+++ b/home/start_menu.asm
@@ -1,6 +1,6 @@
DisplayStartMenu::
ld a, BANK(StartMenu_Pokedex)
- ld [hLoadedROMBank], a
+ ldh [hLoadedROMBank], a
ld [MBC1RomBank], a
ld a, [wWalkBikeSurfState] ; walking/biking/surfing
ld [wWalkBikeSurfStateCopy], a
@@ -78,7 +78,7 @@
; EXIT falls through to here
CloseStartMenu::
call Joypad
- ld a, [hJoyPressed]
+ ldh a, [hJoyPressed]
bit 0, a ; was A button newly pressed?
jr nz, CloseStartMenu
call LoadTextBoxTilePatterns
--- a/home/text.asm
+++ b/home/text.asm
@@ -62,7 +62,7 @@
cp "<NEXT>"
jr nz, .NotNext
ld bc, 2 * SCREEN_WIDTH
- ld a, [hFlagsFFF6]
+ ldh a, [hFlagsFFF6]
bit 2, a
jr z, .ok
ld bc, SCREEN_WIDTH
@@ -141,12 +141,12 @@
PlacePKMN:: print_name PlacePKMNText
PlaceMoveTargetsName::
- ld a, [hWhoseTurn]
+ ldh a, [hWhoseTurn]
xor 1
jr PlaceMoveUsersName.place
PlaceMoveUsersName::
- ld a, [hWhoseTurn]
+ ldh a, [hWhoseTurn]
.place:
push de
@@ -313,7 +313,7 @@
push af
set 1, a
ld e, a
- ld a, [hClearLetterPrintingDelayFlags]
+ ldh a, [hClearLetterPrintingDelayFlags]
xor e
ld [wLetterPrintingDelayFlags], a
ld a, c
@@ -489,7 +489,7 @@
; wait for button press or 30 frames
push bc
call Joypad
- ld a, [hJoyHeld]
+ ldh a, [hJoyHeld]
and A_BUTTON | B_BUTTON
jr nz, .done
ld c, 30 ; half a second
@@ -565,7 +565,7 @@
push de
call Joypad
pop de
- ld a, [hJoyHeld] ; joypad state
+ ldh a, [hJoyHeld] ; joypad state
and A_BUTTON | B_BUTTON
jr nz, .next ; if so, skip the delay
ld c, 10
@@ -590,7 +590,7 @@
TextCommand_FAR::
; write text from a different bank (little endian)
pop hl
- ld a, [hLoadedROMBank]
+ ldh a, [hLoadedROMBank]
push af
ld a, [hli]
@@ -599,7 +599,7 @@
ld d, a
ld a, [hli]
- ld [hLoadedROMBank], a
+ ldh [hLoadedROMBank], a
ld [MBC1RomBank], a
push hl
@@ -609,7 +609,7 @@
pop hl
pop af
- ld [hLoadedROMBank], a
+ ldh [hLoadedROMBank], a
ld [MBC1RomBank], a
jp NextTextCommand
--- a/home/text_script.asm
+++ b/home/text_script.asm
@@ -1,7 +1,7 @@
; this function is used to display sign messages, sprite dialog, etc.
; INPUT: [hSpriteIndexOrTextID] = sprite ID or text ID
DisplayTextID::
- ld a, [hLoadedROMBank]
+ ldh a, [hLoadedROMBank]
push af
callba DisplayTextIDInit ; initialization
ld hl, wTextPredefFlag
@@ -12,13 +12,13 @@
call SwitchToMapRomBank
.skipSwitchToMapBank
ld a, 30 ; half a second
- ld [hFrameCounter], a ; used as joypad poll timer
+ ldh [hFrameCounter], a ; used as joypad poll timer
ld hl, wMapTextPtr
ld a, [hli]
ld h, [hl]
ld l, a ; hl = map text pointer
ld d, $00
- ld a, [hSpriteIndexOrTextID] ; text ID
+ ldh a, [hSpriteIndexOrTextID] ; text ID
ld [wSpriteIndex], a
dict TEXT_START_MENU, DisplayStartMenu
@@ -29,7 +29,7 @@
ld a, [wNumSprites]
ld e, a
- ld a, [hSpriteIndexOrTextID] ; sprite ID
+ ldh a, [hSpriteIndexOrTextID] ; sprite ID
cp e
jr z, .spriteHandling
jr nc, .skipSpriteHandling
@@ -42,7 +42,7 @@
pop bc
pop de
ld hl, wMapSpriteData ; NPC text entries
- ld a, [hSpriteIndexOrTextID]
+ ldh a, [hSpriteIndexOrTextID]
dec a
add a
add l
@@ -97,7 +97,7 @@
; loop to hold the dialogue box open as long as the player keeps holding down the A button
HoldTextDisplayOpen::
call Joypad
- ld a, [hJoyHeld]
+ ldh a, [hJoyHeld]
bit 0, a ; is the A button being pressed?
jr nz, HoldTextDisplayOpen
@@ -105,11 +105,11 @@
ld a, [wCurMap]
call SwitchToMapRomBank
ld a, $90
- ld [hWY], a ; move the window off the screen
+ ldh [hWY], a ; move the window off the screen
call DelayFrame
call LoadGBPal
xor a
- ld [hAutoBGTransferEnabled], a ; disable continuous WRAM to VRAM transfer each V-blank
+ ldh [hAutoBGTransferEnabled], a ; disable continuous WRAM to VRAM transfer each V-blank
; loop to make sprites face the directions they originally faced before the dialogue
ld hl, wSprite01StateData2 + 9 ; should be wSprite01StateData1FacingDirection?
ld c, $0f
@@ -123,7 +123,7 @@
dec c
jr nz, .restoreSpriteFacingDirectionLoop
ld a, BANK(InitMapSprites)
- ld [hLoadedROMBank], a
+ ldh [hLoadedROMBank], a
ld [MBC1RomBank], a
call InitMapSprites ; reload sprite tile pattern data (since it was partially overwritten by text tile patterns)
ld hl, wFontLoaded
@@ -133,7 +133,7 @@
call z, LoadPlayerSpriteGraphics
call LoadCurrentMapView
pop af
- ld [hLoadedROMBank], a
+ ldh [hLoadedROMBank], a
ld [MBC1RomBank], a
jp UpdateSprites
@@ -146,14 +146,14 @@
call LoadItemList
ld a, PRICEDITEMLISTMENU
ld [wListMenuID], a
- ld a, [hLoadedROMBank]
+ ldh a, [hLoadedROMBank]
push af
ld a, BANK(DisplayPokemartDialogue_)
- ld [hLoadedROMBank], a
+ ldh [hLoadedROMBank], a
ld [MBC1RomBank], a
call DisplayPokemartDialogue_
pop af
- ld [hLoadedROMBank], a
+ ldh [hLoadedROMBank], a
ld [MBC1RomBank], a
jp AfterDisplayingTextID
@@ -180,19 +180,19 @@
DisplayPokemonCenterDialogue::
; zeroing these doesn't appear to serve any purpose
xor a
- ld [hItemPrice], a
- ld [hItemPrice + 1], a
- ld [hItemPrice + 2], a
+ ldh [hItemPrice], a
+ ldh [hItemPrice + 1], a
+ ldh [hItemPrice + 2], a
inc hl
- ld a, [hLoadedROMBank]
+ ldh a, [hLoadedROMBank]
push af
ld a, BANK(DisplayPokemonCenterDialogue_)
- ld [hLoadedROMBank], a
+ ldh [hLoadedROMBank], a
ld [MBC1RomBank], a
call DisplayPokemonCenterDialogue_
pop af
- ld [hLoadedROMBank], a
+ ldh [hLoadedROMBank], a
ld [MBC1RomBank], a
jp AfterDisplayingTextID
--- a/home/trainers.asm
+++ b/home/trainers.asm
@@ -144,7 +144,7 @@
ld a, D_RIGHT | D_LEFT | D_UP | D_DOWN
ld [wJoyIgnore], a
xor a
- ld [hJoyHeld], a
+ ldh [hJoyHeld], a
call TrainerWalkUpToPlayer_Bank0
ld hl, wCurMapScript
inc [hl] ; increment map script index (next script function is usually DisplayEnemyTrainerTextAndStartBattle)
@@ -157,7 +157,7 @@
ret nz ; return if the enemy trainer hasn't finished walking to the player's sprite
ld [wJoyIgnore], a
ld a, [wSpriteIndex]
- ld [hSpriteIndexOrTextID], a
+ ldh [hSpriteIndexOrTextID], a
call DisplayTextID
; fall through
@@ -211,9 +211,9 @@
ResetButtonPressedAndMapScript::
xor a
ld [wJoyIgnore], a
- ld [hJoyHeld], a
- ld [hJoyPressed], a
- ld [hJoyReleased], a
+ ldh [hJoyHeld], a
+ ldh [hJoyPressed], a
+ ldh [hJoyReleased], a
ld [wCurMapScript], a ; reset battle status
ret
@@ -302,7 +302,7 @@
; hl = text if the player wins
; de = text if the player loses
SaveEndBattleTextPointers::
- ld a, [hLoadedROMBank]
+ ldh a, [hLoadedROMBank]
ld [wEndBattleTextRomBank], a
ld a, h
ld [wEndBattleWinTextPointer], a
@@ -337,10 +337,10 @@
res 7, [hl]
pop hl
ret z
- ld a, [hLoadedROMBank]
+ ldh a, [hLoadedROMBank]
push af
ld a, [wEndBattleTextRomBank]
- ld [hLoadedROMBank], a
+ ldh [hLoadedROMBank], a
ld [MBC1RomBank], a
push hl
callba SaveTrainerName
@@ -348,7 +348,7 @@
call PrintText
pop hl
pop af
- ld [hLoadedROMBank], a
+ ldh [hLoadedROMBank], a
ld [MBC1RomBank], a
callba FreezeEnemyTrainerSprite
jp WaitForSoundToFinish
--- a/home/uncompress.asm
+++ b/home/uncompress.asm
@@ -2,10 +2,10 @@
; bank is given in a, sprite input stream is pointed to in wSpriteInputPtr
UncompressSpriteData::
ld b, a
- ld a, [hLoadedROMBank]
+ ldh a, [hLoadedROMBank]
push af
ld a, b
- ld [hLoadedROMBank], a
+ ldh [hLoadedROMBank], a
ld [MBC1RomBank], a
ld a, SRAM_ENABLE
ld [MBC1SRamEnable], a
@@ -13,7 +13,7 @@
ld [MBC1SRamBank], a
call _UncompressSpriteData
pop af
- ld [hLoadedROMBank], a
+ ldh [hLoadedROMBank], a
ld [MBC1RomBank], a
ret
--- a/home/vblank.asm
+++ b/home/vblank.asm
@@ -5,19 +5,19 @@
push de
push hl
- ld a, [hLoadedROMBank]
+ ldh a, [hLoadedROMBank]
ld [wVBlankSavedROMBank], a
- ld a, [hSCX]
- ld [rSCX], a
- ld a, [hSCY]
- ld [rSCY], a
+ ldh a, [hSCX]
+ ldh [rSCX], a
+ ldh a, [hSCY]
+ ldh [rSCY], a
ld a, [wDisableVBlankWYUpdate]
and a
jr nz, .ok
- ld a, [hWY]
- ld [rWY], a
+ ldh a, [hWY]
+ ldh [rWY], a
.ok
call AutoBgMapTransfer
@@ -28,7 +28,7 @@
call UpdateMovingBgTiles
call hDMARoutine
ld a, BANK(PrepareOAMData)
- ld [hLoadedROMBank], a
+ ldh [hLoadedROMBank], a
ld [MBC1RomBank], a
call PrepareOAMData
@@ -36,24 +36,24 @@
call Random
- ld a, [hVBlankOccurred]
+ ldh a, [hVBlankOccurred]
and a
jr z, .skipZeroing
xor a
- ld [hVBlankOccurred], a
+ ldh [hVBlankOccurred], a
.skipZeroing
- ld a, [hFrameCounter]
+ ldh a, [hFrameCounter]
and a
jr z, .skipDec
dec a
- ld [hFrameCounter], a
+ ldh [hFrameCounter], a
.skipDec
call FadeOutAudio
ld a, [wAudioROMBank] ; music ROM bank
- ld [hLoadedROMBank], a
+ ldh [hLoadedROMBank], a
ld [MBC1RomBank], a
cp BANK(Audio1_UpdateMusic)
@@ -74,12 +74,12 @@
callba TrackPlayTime ; keep track of time played
- ld a, [hDisableJoypadPolling]
+ ldh a, [hDisableJoypadPolling]
and a
call z, ReadJoypad
ld a, [wVBlankSavedROMBank]
- ld [hLoadedROMBank], a
+ ldh [hLoadedROMBank], a
ld [MBC1RomBank], a
pop hl
@@ -96,10 +96,10 @@
NOT_VBLANKED EQU 1
ld a, NOT_VBLANKED
- ld [hVBlankOccurred], a
+ ldh [hVBlankOccurred], a
.halt
halt
- ld a, [hVBlankOccurred]
+ ldh a, [hVBlankOccurred]
and a
jr nz, .halt
ret
--- a/home/vcopy.asm
+++ b/home/vcopy.asm
@@ -40,19 +40,19 @@
; However, this function is also called repeatedly to redraw the whole screen
; when necessary. It is also used in trade animation and elevator code.
RedrawRowOrColumn::
- ld a, [hRedrawRowOrColumnMode]
+ ldh a, [hRedrawRowOrColumnMode]
and a
ret z
ld b, a
xor a
- ld [hRedrawRowOrColumnMode], a
+ ldh [hRedrawRowOrColumnMode], a
dec b
jr nz, .redrawRow
.redrawColumn
ld hl, wRedrawRowOrColumnSrcTiles
- ld a, [hRedrawRowOrColumnDest]
+ ldh a, [hRedrawRowOrColumnDest]
ld e, a
- ld a, [hRedrawRowOrColumnDest + 1]
+ ldh a, [hRedrawRowOrColumnDest + 1]
ld d, a
ld c, SCREEN_HEIGHT
.loop1
@@ -75,13 +75,13 @@
dec c
jr nz, .loop1
xor a
- ld [hRedrawRowOrColumnMode], a
+ ldh [hRedrawRowOrColumnMode], a
ret
.redrawRow
ld hl, wRedrawRowOrColumnSrcTiles
- ld a, [hRedrawRowOrColumnDest]
+ ldh a, [hRedrawRowOrColumnDest]
ld e, a
- ld a, [hRedrawRowOrColumnDest + 1]
+ ldh a, [hRedrawRowOrColumnDest + 1]
ld d, a
push de
call .DrawHalf ; draw upper half
@@ -120,15 +120,15 @@
; the above function, RedrawRowOrColumn, is used when walking to
; improve efficiency.
AutoBgMapTransfer::
- ld a, [hAutoBGTransferEnabled]
+ ldh a, [hAutoBGTransferEnabled]
and a
ret z
ld hl, sp + 0
ld a, h
- ld [hSPTemp], a
+ ldh [hSPTemp], a
ld a, l
- ld [hSPTemp + 1], a ; save stack pinter
- ld a, [hAutoBGTransferPortion]
+ ldh [hSPTemp + 1], a ; save stack pinter
+ ldh a, [hAutoBGTransferPortion]
and a
jr z, .transferTopThird
dec a
@@ -136,9 +136,9 @@
.transferBottomThird
coord hl, 0, 12
ld sp, hl
- ld a, [hAutoBGTransferDest + 1]
+ ldh a, [hAutoBGTransferDest + 1]
ld h, a
- ld a, [hAutoBGTransferDest]
+ ldh a, [hAutoBGTransferDest]
ld l, a
ld de, (12 * 32)
add hl, de
@@ -147,9 +147,9 @@
.transferTopThird
coord hl, 0, 0
ld sp, hl
- ld a, [hAutoBGTransferDest + 1]
+ ldh a, [hAutoBGTransferDest + 1]
ld h, a
- ld a, [hAutoBGTransferDest]
+ ldh a, [hAutoBGTransferDest]
ld l, a
ld a, TRANSFERMIDDLE
jr .doTransfer
@@ -156,15 +156,15 @@
.transferMiddleThird
coord hl, 0, 6
ld sp, hl
- ld a, [hAutoBGTransferDest + 1]
+ ldh a, [hAutoBGTransferDest + 1]
ld h, a
- ld a, [hAutoBGTransferDest]
+ ldh a, [hAutoBGTransferDest]
ld l, a
ld de, (6 * 32)
add hl, de
ld a, TRANSFERBOTTOM
.doTransfer
- ld [hAutoBGTransferPortion], a ; store next portion
+ ldh [hAutoBGTransferPortion], a ; store next portion
ld b, 6
TransferBgRows::
@@ -192,9 +192,9 @@
dec b
jr nz, TransferBgRows
- ld a, [hSPTemp]
+ ldh a, [hSPTemp]
ld h, a
- ld a, [hSPTemp + 1]
+ ldh a, [hSPTemp + 1]
ld l, a
ld sp, hl
ret
@@ -202,27 +202,27 @@
; Copies [hVBlankCopyBGNumRows] rows from hVBlankCopyBGSource to hVBlankCopyBGDest.
; If hVBlankCopyBGSource is XX00, the transfer is disabled.
VBlankCopyBgMap::
- ld a, [hVBlankCopyBGSource] ; doubles as enabling byte
+ ldh a, [hVBlankCopyBGSource] ; doubles as enabling byte
and a
ret z
ld hl, sp + 0
ld a, h
- ld [hSPTemp], a
+ ldh [hSPTemp], a
ld a, l
- ld [hSPTemp + 1], a ; save stack pointer
- ld a, [hVBlankCopyBGSource]
+ ldh [hSPTemp + 1], a ; save stack pointer
+ ldh a, [hVBlankCopyBGSource]
ld l, a
- ld a, [hVBlankCopyBGSource + 1]
+ ldh a, [hVBlankCopyBGSource + 1]
ld h, a
ld sp, hl
- ld a, [hVBlankCopyBGDest]
+ ldh a, [hVBlankCopyBGDest]
ld l, a
- ld a, [hVBlankCopyBGDest + 1]
+ ldh a, [hVBlankCopyBGDest + 1]
ld h, a
- ld a, [hVBlankCopyBGNumRows]
+ ldh a, [hVBlankCopyBGNumRows]
ld b, a
xor a
- ld [hVBlankCopyBGSource], a ; disable transfer so it doesn't continue next V-blank
+ ldh [hVBlankCopyBGSource], a ; disable transfer so it doesn't continue next V-blank
jr TransferBgRows
@@ -234,31 +234,31 @@
; The process is straightforward:
; copy each byte twice.
- ld a, [hVBlankCopyDoubleSize]
+ ldh a, [hVBlankCopyDoubleSize]
and a
ret z
ld hl, sp + 0
ld a, h
- ld [hSPTemp], a
+ ldh [hSPTemp], a
ld a, l
- ld [hSPTemp + 1], a
+ ldh [hSPTemp + 1], a
- ld a, [hVBlankCopyDoubleSource]
+ ldh a, [hVBlankCopyDoubleSource]
ld l, a
- ld a, [hVBlankCopyDoubleSource + 1]
+ ldh a, [hVBlankCopyDoubleSource + 1]
ld h, a
ld sp, hl
- ld a, [hVBlankCopyDoubleDest]
+ ldh a, [hVBlankCopyDoubleDest]
ld l, a
- ld a, [hVBlankCopyDoubleDest + 1]
+ ldh a, [hVBlankCopyDoubleDest + 1]
ld h, a
- ld a, [hVBlankCopyDoubleSize]
+ ldh a, [hVBlankCopyDoubleSize]
ld b, a
xor a ; transferred
- ld [hVBlankCopyDoubleSize], a
+ ldh [hVBlankCopyDoubleSize], a
.loop
REPT 3
@@ -286,19 +286,19 @@
jr nz, .loop
ld a, l
- ld [hVBlankCopyDoubleDest], a
+ ldh [hVBlankCopyDoubleDest], a
ld a, h
- ld [hVBlankCopyDoubleDest + 1], a
+ ldh [hVBlankCopyDoubleDest + 1], a
ld hl, sp + 0
ld a, l
- ld [hVBlankCopyDoubleSource], a
+ ldh [hVBlankCopyDoubleSource], a
ld a, h
- ld [hVBlankCopyDoubleSource + 1], a
+ ldh [hVBlankCopyDoubleSource + 1], a
- ld a, [hSPTemp]
+ ldh a, [hSPTemp]
ld h, a
- ld a, [hSPTemp + 1]
+ ldh a, [hSPTemp + 1]
ld l, a
ld sp, hl
@@ -312,31 +312,31 @@
; Source and destination addresses are updated,
; so transfer can continue in subsequent calls.
- ld a, [hVBlankCopySize]
+ ldh a, [hVBlankCopySize]
and a
ret z
ld hl, sp + 0
ld a, h
- ld [hSPTemp], a
+ ldh [hSPTemp], a
ld a, l
- ld [hSPTemp + 1], a
+ ldh [hSPTemp + 1], a
- ld a, [hVBlankCopySource]
+ ldh a, [hVBlankCopySource]
ld l, a
- ld a, [hVBlankCopySource + 1]
+ ldh a, [hVBlankCopySource + 1]
ld h, a
ld sp, hl
- ld a, [hVBlankCopyDest]
+ ldh a, [hVBlankCopyDest]
ld l, a
- ld a, [hVBlankCopyDest + 1]
+ ldh a, [hVBlankCopyDest + 1]
ld h, a
- ld a, [hVBlankCopySize]
+ ldh a, [hVBlankCopySize]
ld b, a
xor a ; transferred
- ld [hVBlankCopySize], a
+ ldh [hVBlankCopySize], a
.loop
REPT 7
@@ -356,19 +356,19 @@
jr nz, .loop
ld a, l
- ld [hVBlankCopyDest], a
+ ldh [hVBlankCopyDest], a
ld a, h
- ld [hVBlankCopyDest + 1], a
+ ldh [hVBlankCopyDest + 1], a
ld hl, sp + 0
ld a, l
- ld [hVBlankCopySource], a
+ ldh [hVBlankCopySource], a
ld a, h
- ld [hVBlankCopySource + 1], a
+ ldh [hVBlankCopySource + 1], a
- ld a, [hSPTemp]
+ ldh a, [hSPTemp]
ld h, a
- ld a, [hSPTemp + 1]
+ ldh a, [hSPTemp + 1]
ld l, a
ld sp, hl
@@ -379,13 +379,13 @@
; Animate water and flower
; tiles in the overworld.
- ld a, [hTilesetType]
+ ldh a, [hTilesetType]
and a
ret z ; no animations if indoors (or if a menu set this to 0)
- ld a, [hMovingBGTilesCounter1]
+ ldh a, [hMovingBGTilesCounter1]
inc a
- ld [hMovingBGTilesCounter1], a
+ ldh [hMovingBGTilesCounter1], a
cp 20
ret c
cp 21
@@ -417,17 +417,17 @@
dec c
jr nz, .left
.done
- ld a, [hTilesetType]
+ ldh a, [hTilesetType]
rrca
ret nc
; if in a cave, no flower animations
xor a
- ld [hMovingBGTilesCounter1], a
+ ldh [hMovingBGTilesCounter1], a
ret
.flower
xor a
- ld [hMovingBGTilesCounter1], a
+ ldh [hMovingBGTilesCounter1], a
ld a, [wMovingBGTilesCounter2]
and 3
--- a/macros/farcall.asm
+++ b/macros/farcall.asm
@@ -25,13 +25,13 @@
ENDM
homecall: MACRO
- ld a, [hLoadedROMBank]
+ ldh a, [hLoadedROMBank]
push af
ld a, BANK(\1)
- ld [hLoadedROMBank], a
+ ldh [hLoadedROMBank], a
ld [MBC1RomBank], a
call \1
pop af
- ld [hLoadedROMBank], a
+ ldh [hLoadedROMBank], a
ld [MBC1RomBank], a
ENDM
--- a/scripts/AgathasRoom.asm
+++ b/scripts/AgathasRoom.asm
@@ -63,8 +63,8 @@
call ArePlayerCoordsInArray
jp nc, CheckFightingMapTrainers
xor a
- ld [hJoyPressed], a
- ld [hJoyHeld], a
+ ldh [hJoyPressed], a
+ ldh [hJoyHeld], a
ld [wSimulatedJoypadStatesEnd], a
ld [wSimulatedJoypadStatesIndex], a
ld a, [wCoordIndex]
@@ -74,7 +74,7 @@
jr z, AgathaScriptWalkIntoRoom
.stopPlayerFromLeaving
ld a, $2
- ld [hSpriteIndexOrTextID], a
+ ldh [hSpriteIndexOrTextID], a
call DisplayTextID ; "Don't run away!"
ld a, D_UP
ld [wSimulatedJoypadStatesEnd], a
@@ -110,7 +110,7 @@
cp $ff
jp z, ResetAgathaScript
ld a, $1
- ld [hSpriteIndexOrTextID], a
+ ldh [hSpriteIndexOrTextID], a
call DisplayTextID
ld a, $1
ld [wChampionsRoomCurScript], a
--- a/scripts/BikeShop.asm
+++ b/scripts/BikeShop.asm
@@ -23,7 +23,7 @@
call GiveItem
jr nc, .BagFull
ld a, BIKE_VOUCHER
- ld [hItemToRemoveID], a
+ ldh [hItemToRemoveID], a
callba RemoveItemByID
SetEvent EVENT_GOT_BICYCLE
ld hl, BikeShopText_1d824
--- a/scripts/BillsHouse.asm
+++ b/scripts/BillsHouse.asm
@@ -23,7 +23,7 @@
ld de, MovementData_1e7a0
.notDown
ld a, $1
- ld [hSpriteIndex], a
+ ldh [hSpriteIndex], a
call MoveSprite
ld a, $2
ld [wBillsHouseCurScript], a
@@ -66,13 +66,13 @@
ld a, $2
ld [wSpriteIndex], a
ld a, $c
- ld [hSpriteScreenYCoord], a
+ ldh [hSpriteScreenYCoord], a
ld a, $40
- ld [hSpriteScreenXCoord], a
+ ldh [hSpriteScreenXCoord], a
ld a, $6
- ld [hSpriteMapYCoord], a
+ ldh [hSpriteMapYCoord], a
ld a, $5
- ld [hSpriteMapXCoord], a
+ ldh [hSpriteMapXCoord], a
call SetSpritePosition1
ld a, HS_BILL_1
ld [wMissableObjectIndex], a
@@ -80,7 +80,7 @@
ld c, 8
call DelayFrames
ld a, $2
- ld [hSpriteIndex], a
+ ldh [hSpriteIndex], a
ld de, MovementData_1e807
call MoveSprite
ld a, $4
@@ -109,7 +109,7 @@
BillsHouseScript5:
ld a, $4
- ld [hSpriteIndexOrTextID], a
+ ldh [hSpriteIndexOrTextID], a
call DisplayTextID
ld a, $0
ld [wBillsHouseCurScript], a
--- a/scripts/BrunosRoom.asm
+++ b/scripts/BrunosRoom.asm
@@ -63,8 +63,8 @@
call ArePlayerCoordsInArray
jp nc, CheckFightingMapTrainers
xor a
- ld [hJoyPressed], a
- ld [hJoyHeld], a
+ ldh [hJoyPressed], a
+ ldh [hJoyHeld], a
ld [wSimulatedJoypadStatesEnd], a
ld [wSimulatedJoypadStatesIndex], a
ld a, [wCoordIndex]
@@ -74,7 +74,7 @@
jr z, BrunoScriptWalkIntoRoom
.stopPlayerFromLeaving
ld a, $2
- ld [hSpriteIndexOrTextID], a
+ ldh [hSpriteIndexOrTextID], a
call DisplayTextID ; "Don't run away!"
ld a, D_UP
ld [wSimulatedJoypadStatesEnd], a
@@ -110,7 +110,7 @@
cp $ff
jp z, ResetBrunoScript
ld a, $1
- ld [hSpriteIndexOrTextID], a
+ ldh [hSpriteIndexOrTextID], a
jp DisplayTextID
BrunosRoom_TextPointers:
--- a/scripts/CeladonGym.asm
+++ b/scripts/CeladonGym.asm
@@ -44,7 +44,7 @@
CeladonGymText_48963:
ld a, $9
- ld [hSpriteIndexOrTextID], a
+ ldh [hSpriteIndexOrTextID], a
call DisplayTextID
SetEvent EVENT_BEAT_ERIKA
lb bc, TM_MEGA_DRAIN, 1
@@ -51,13 +51,13 @@
call GiveItem
jr nc, .BagFull
ld a, $a
- ld [hSpriteIndexOrTextID], a
+ ldh [hSpriteIndexOrTextID], a
call DisplayTextID
SetEvent EVENT_GOT_TM21
jr .gymVictory
.BagFull
ld a, $b
- ld [hSpriteIndexOrTextID], a
+ ldh [hSpriteIndexOrTextID], a
call DisplayTextID
.gymVictory
ld hl, wObtainedBadges
@@ -170,7 +170,7 @@
ld hl, CeladonGymText_48a63
ld de, CeladonGymText_48a63
call SaveEndBattleTextPointers
- ld a, [hSpriteIndex]
+ ldh a, [hSpriteIndex]
ld [wSpriteIndex], a
call EngageMapTrainer
call InitBattleEnemyParameters
--- a/scripts/CeladonMartRoof.asm
+++ b/scripts/CeladonMartRoof.asm
@@ -79,7 +79,7 @@
ld e, a
add hl, de
ld a, [hl]
- ld [hItemToRemoveID], a
+ ldh [hItemToRemoveID], a
cp FRESH_WATER
jr z, .gaveFreshWater
cp SODA_POP
@@ -186,7 +186,7 @@
CeladonMartRoofScript_PrintDrinksInBag:
ld hl, wFilteredBagItems
xor a
- ld [hItemCounter], a
+ ldh [hItemCounter], a
.loop
ld a, [hli]
cp $ff
@@ -195,7 +195,7 @@
ld [wd11e], a
call GetItemName
coord hl, 2, 2
- ld a, [hItemCounter]
+ ldh a, [hItemCounter]
ld bc, SCREEN_WIDTH * 2
call AddNTimes
ld de, wcd6d
--- a/scripts/CeruleanCity.asm
+++ b/scripts/CeruleanCity.asm
@@ -27,7 +27,7 @@
ld [wJoyIgnore], a
SetEvent EVENT_BEAT_CERULEAN_ROCKET_THIEF
ld a, $2
- ld [hSpriteIndexOrTextID], a
+ ldh [hSpriteIndexOrTextID], a
call DisplayTextID
xor a
ld [wJoyIgnore], a
@@ -53,7 +53,7 @@
ld [wSprite02StateData1FacingDirection], a
call Delay3
ld a, $2
- ld [hSpriteIndexOrTextID], a
+ ldh [hSpriteIndexOrTextID], a
jp DisplayTextID
.asm_194f7
CheckEvent EVENT_BEAT_CERULEAN_RIVAL
@@ -72,7 +72,7 @@
ld a, MUSIC_MEET_RIVAL
call PlayMusic
xor a
- ld [hJoyHeld], a
+ ldh [hJoyHeld], a
ld a, $f0
ld [wJoyIgnore], a
ld a, [wXCoord]
@@ -79,9 +79,9 @@
cp $14
jr z, .asm_19535
ld a, $1
- ld [hSpriteIndex], a
+ ldh [hSpriteIndex], a
ld a, $5
- ld [hSpriteDataOffset], a
+ ldh [hSpriteDataOffset], a
call GetPointerWithinSpriteStateData2
ld [hl], $19
.asm_19535
@@ -90,7 +90,7 @@
predef ShowObject
ld de, CeruleanCityMovement1
ld a, $1
- ld [hSpriteIndex], a
+ ldh [hSpriteIndex], a
call MoveSprite
ld a, $1
ld [wCeruleanCityCurScript], a
@@ -114,9 +114,9 @@
CeruleanCityScript_1955d:
ld a, 1
- ld [hSpriteIndex], a
+ ldh [hSpriteIndex], a
xor a ; SPRITE_FACING_DOWN
- ld [hSpriteFacingDirection], a
+ ldh [hSpriteFacingDirection], a
jp SetSpriteFacingDirectionAndDelay ; face object
CeruleanCityScript1:
@@ -126,7 +126,7 @@
xor a
ld [wJoyIgnore], a
ld a, $1
- ld [hSpriteIndexOrTextID], a
+ ldh [hSpriteIndexOrTextID], a
call DisplayTextID
ld hl, wd72d
set 6, [hl]
@@ -154,7 +154,7 @@
ld [wTrainerNo], a
xor a
- ld [hJoyHeld], a
+ ldh [hJoyHeld], a
call CeruleanCityScript_1955d
ld a, $2
ld [wCeruleanCityCurScript], a
@@ -169,7 +169,7 @@
ld [wJoyIgnore], a
SetEvent EVENT_BEAT_CERULEAN_RIVAL
ld a, $1
- ld [hSpriteIndexOrTextID], a
+ ldh [hSpriteIndexOrTextID], a
call DisplayTextID
ld a, SFX_STOP_ALL_MUSIC
ld [wNewSoundID], a
@@ -176,7 +176,7 @@
call PlaySound
callba Music_RivalAlternateStart
ld a, $1
- ld [hSpriteIndex], a
+ ldh [hSpriteIndex], a
call SetSpriteMovementBytesToFF
ld a, [wXCoord]
cp $14
@@ -187,7 +187,7 @@
ld de, CeruleanCityMovement3
.asm_195f3
ld a, $1
- ld [hSpriteIndex], a
+ ldh [hSpriteIndex], a
call MoveSprite
ld a, $3
ld [wCeruleanCityCurScript], a
@@ -289,7 +289,7 @@
ld hl, CeruleanCityText_196ee
ld de, CeruleanCityText_196ee
call SaveEndBattleTextPointers
- ld a, [hSpriteIndexOrTextID]
+ ldh a, [hSpriteIndexOrTextID]
ld [wSpriteIndex], a
call EngageMapTrainer
call InitBattleEnemyParameters
@@ -356,7 +356,7 @@
CeruleanCityText7:
text_asm
- ld a, [hRandomAdd]
+ ldh a, [hRandomAdd]
cp 180
jr c, .asm_e9fc9
ld hl, CeruleanCityText_19730
@@ -388,7 +388,7 @@
CeruleanCityText8:
text_asm
- ld a, [hRandomAdd]
+ ldh a, [hRandomAdd]
cp 180
jr c, .asm_e28da
ld hl, CeruleanCityText_1976f
--- a/scripts/CeruleanGym.asm
+++ b/scripts/CeruleanGym.asm
@@ -44,7 +44,7 @@
CeruleanGymScript_5c70d:
ld a, $5
- ld [hSpriteIndexOrTextID], a
+ ldh [hSpriteIndexOrTextID], a
call DisplayTextID
SetEvent EVENT_BEAT_MISTY
lb bc, TM_BUBBLEBEAM, 1
@@ -51,13 +51,13 @@
call GiveItem
jr nc, .BagFull
ld a, $6
- ld [hSpriteIndexOrTextID], a
+ ldh [hSpriteIndexOrTextID], a
call DisplayTextID
SetEvent EVENT_GOT_TM11
jr .gymVictory
.BagFull
ld a, $7
- ld [hSpriteIndexOrTextID], a
+ ldh [hSpriteIndexOrTextID], a
call DisplayTextID
.gymVictory
ld hl, wObtainedBadges
@@ -121,7 +121,7 @@
ld hl, CeruleanGymText_5c7d8
ld de, CeruleanGymText_5c7d8
call SaveEndBattleTextPointers
- ld a, [hSpriteIndex]
+ ldh a, [hSpriteIndex]
ld [wSpriteIndex], a
call EngageMapTrainer
call InitBattleEnemyParameters
@@ -128,7 +128,7 @@
ld a, $2
ld [wGymLeaderNo], a
xor a
- ld [hJoyHeld], a
+ ldh [hJoyHeld], a
ld a, $3
ld [wCeruleanGymCurScript], a
.done
--- a/scripts/ChampionsRoom.asm
+++ b/scripts/ChampionsRoom.asm
@@ -55,7 +55,7 @@
ld hl, wOptions
res 7, [hl] ; Turn on battle animations to make the battle feel more epic.
ld a, $1
- ld [hSpriteIndexOrTextID], a
+ ldh [hSpriteIndexOrTextID], a
call DisplayTextID
call Delay3
ld hl, wd72d
@@ -84,7 +84,7 @@
ld [wTrainerNo], a
xor a
- ld [hJoyHeld], a
+ ldh [hJoyHeld], a
ld a, $3
ld [wChampionsRoomCurScript], a
ret
@@ -98,10 +98,10 @@
ld a, $f0
ld [wJoyIgnore], a
ld a, $1
- ld [hSpriteIndexOrTextID], a
+ ldh [hSpriteIndexOrTextID], a
call GaryScript_760c8
ld a, $1
- ld [hSpriteIndex], a
+ ldh [hSpriteIndex], a
call SetSpriteMovementBytesToFF
ld a, $4
ld [wChampionsRoomCurScript], a
@@ -110,14 +110,14 @@
GaryScript4:
callba Music_Cities1AlternateTempo
ld a, $2
- ld [hSpriteIndexOrTextID], a
+ ldh [hSpriteIndexOrTextID], a
call GaryScript_760c8
ld a, $2
- ld [hSpriteIndex], a
+ ldh [hSpriteIndex], a
call SetSpriteMovementBytesToFF
ld de, OakEntranceAfterVictoryMovement
ld a, $2
- ld [hSpriteIndex], a
+ ldh [hSpriteIndex], a
call MoveSprite
ld a, HS_CHAMPIONS_ROOM_OAK
ld [wMissableObjectIndex], a
@@ -141,17 +141,17 @@
ld a, PLAYER_DIR_LEFT
ld [wPlayerMovingDirection], a
ld a, $1
- ld [hSpriteIndex], a
+ ldh [hSpriteIndex], a
ld a, SPRITE_FACING_LEFT
- ld [hSpriteFacingDirection], a
+ ldh [hSpriteFacingDirection], a
call SetSpriteFacingDirectionAndDelay
ld a, $2
- ld [hSpriteIndex], a
+ ldh [hSpriteIndex], a
xor a ; SPRITE_FACING_DOWN
- ld [hSpriteFacingDirection], a
+ ldh [hSpriteFacingDirection], a
call SetSpriteFacingDirectionAndDelay
ld a, $3
- ld [hSpriteIndexOrTextID], a
+ ldh [hSpriteIndexOrTextID], a
call GaryScript_760c8
ld a, $6
ld [wChampionsRoomCurScript], a
@@ -159,12 +159,12 @@
GaryScript6:
ld a, $2
- ld [hSpriteIndex], a
+ ldh [hSpriteIndex], a
ld a, SPRITE_FACING_RIGHT
- ld [hSpriteFacingDirection], a
+ ldh [hSpriteFacingDirection], a
call SetSpriteFacingDirectionAndDelay
ld a, $4
- ld [hSpriteIndexOrTextID], a
+ ldh [hSpriteIndexOrTextID], a
call GaryScript_760c8
ld a, $7
ld [wChampionsRoomCurScript], a
@@ -172,16 +172,16 @@
GaryScript7:
ld a, $2
- ld [hSpriteIndex], a
+ ldh [hSpriteIndex], a
xor a ; SPRITE_FACING_DOWN
- ld [hSpriteFacingDirection], a
+ ldh [hSpriteFacingDirection], a
call SetSpriteFacingDirectionAndDelay
ld a, $5
- ld [hSpriteIndexOrTextID], a
+ ldh [hSpriteIndexOrTextID], a
call GaryScript_760c8
ld de, OakExitGaryRoomMovement
ld a, $2
- ld [hSpriteIndex], a
+ ldh [hSpriteIndex], a
call MoveSprite
ld a, $8
ld [wChampionsRoomCurScript], a
--- a/scripts/CinnabarGym.asm
+++ b/scripts/CinnabarGym.asm
@@ -36,7 +36,7 @@
ret
CinnabarGymScript_757a0:
- ld a, [hSpriteIndexOrTextID]
+ ldh a, [hSpriteIndexOrTextID]
ld [wTrainerHeaderFlagBit], a
ret
@@ -50,7 +50,7 @@
ld a, [wOpponentAfterWrongAnswer]
and a
ret z
- ld [hSpriteIndex], a
+ ldh [hSpriteIndex], a
cp $4
jr nz, .asm_757c3
ld a, PLAYER_DIR_DOWN
@@ -85,7 +85,7 @@
ld [wJoyIgnore], a
ld a, [wOpponentAfterWrongAnswer]
ld [wTrainerHeaderFlagBit], a
- ld [hSpriteIndexOrTextID], a
+ ldh [hSpriteIndexOrTextID], a
jp DisplayTextID
CinnabarGymFlagAction:
@@ -96,7 +96,7 @@
cp $ff
jp z, CinnabarGymScript_75792
ld a, [wTrainerHeaderFlagBit]
- ld [hGymGateIndex], a
+ ldh [hGymGateIndex], a
AdjustEventBit EVENT_BEAT_CINNABAR_GYM_TRAINER_0, 2
ld c, a
ld b, FLAG_TEST
@@ -111,7 +111,7 @@
call WaitForSoundToFinish
.asm_7581b
ld a, [wTrainerHeaderFlagBit]
- ld [hGymGateIndex], a
+ ldh [hGymGateIndex], a
AdjustEventBit EVENT_BEAT_CINNABAR_GYM_TRAINER_0, 2
ld c, a
ld b, FLAG_SET
@@ -141,7 +141,7 @@
ld [wJoyIgnore], a
CinnabarGymScript3_75857:
ld a, $a
- ld [hSpriteIndexOrTextID], a
+ ldh [hSpriteIndexOrTextID], a
call DisplayTextID
SetEvent EVENT_BEAT_BLAINE
lb bc, TM_FIRE_BLAST, 1
@@ -148,13 +148,13 @@
call GiveItem
jr nc, .BagFull
ld a, $b
- ld [hSpriteIndexOrTextID], a
+ ldh [hSpriteIndexOrTextID], a
call DisplayTextID
SetEvent EVENT_GOT_TM38
jr .gymVictory
.BagFull
ld a, $c
- ld [hSpriteIndexOrTextID], a
+ ldh [hSpriteIndexOrTextID], a
call DisplayTextID
.gymVictory
ld hl, wObtainedBadges
@@ -185,7 +185,7 @@
dw TM38NoRoomText
CinnabarGymScript_758b7:
- ld a, [hSpriteIndexOrTextID]
+ ldh a, [hSpriteIndexOrTextID]
ld [wSpriteIndex], a
call EngageMapTrainer
call InitBattleEnemyParameters
--- a/scripts/CinnabarIsland.asm
+++ b/scripts/CinnabarIsland.asm
@@ -25,10 +25,10 @@
ld a, PLAYER_DIR_UP
ld [wPlayerMovingDirection], a
ld a, $8
- ld [hSpriteIndexOrTextID], a
+ ldh [hSpriteIndexOrTextID], a
call DisplayTextID
xor a
- ld [hJoyHeld], a
+ ldh [hJoyHeld], a
ld a, $1
ld [wSimulatedJoypadStatesIndex], a
ld a, D_DOWN
--- a/scripts/CopycatsHouse2F.asm
+++ b/scripts/CopycatsHouse2F.asm
@@ -29,7 +29,7 @@
ld hl, ReceivedTM31Text
call PrintText
ld a, POKE_DOLL
- ld [hItemToRemoveID], a
+ ldh [hItemToRemoveID], a
callba RemoveItemByID
SetEvent EVENT_GOT_TM31
jr .asm_62ecd
--- a/scripts/Daycare.asm
+++ b/scripts/Daycare.asm
@@ -73,11 +73,11 @@
ld d, MAX_LEVEL
callab CalcExperience
ld hl, wDayCareMonExp
- ld a, [hExperience]
+ ldh a, [hExperience]
ld [hli], a
- ld a, [hExperience + 1]
+ ldh a, [hExperience + 1]
ld [hli], a
- ld a, [hExperience + 2]
+ ldh a, [hExperience + 2]
ld [hl], a
ld d, MAX_LEVEL
@@ -138,11 +138,11 @@
and a
jp nz, .leaveMonInDayCare
ld hl, wDayCareTotalCost
- ld [hMoney], a
+ ldh [hMoney], a
ld a, [hli]
- ld [hMoney + 1], a
+ ldh [hMoney + 1], a
ld a, [hl]
- ld [hMoney + 2], a
+ ldh [hMoney + 2], a
call HasEnoughMoney
jr nc, .enoughMoney
ld hl, DayCareNotEnoughMoneyText
--- a/scripts/FightingDojo.asm
+++ b/scripts/FightingDojo.asm
@@ -30,7 +30,7 @@
CheckEvent EVENT_BEAT_KARATE_MASTER
ret nz
xor a
- ld [hJoyHeld], a
+ ldh [hJoyHeld], a
ld [wcf0d], a
ld a, [wYCoord]
cp $3
@@ -43,12 +43,12 @@
ld a, PLAYER_DIR_RIGHT
ld [wPlayerMovingDirection], a
ld a, $1
- ld [hSpriteIndex], a
+ ldh [hSpriteIndex], a
ld a, SPRITE_FACING_LEFT
- ld [hSpriteFacingDirection], a
+ ldh [hSpriteFacingDirection], a
call SetSpriteFacingDirectionAndDelay
ld a, $1
- ld [hSpriteIndexOrTextID], a
+ ldh [hSpriteIndexOrTextID], a
call DisplayTextID
ret
@@ -62,9 +62,9 @@
ld a, PLAYER_DIR_RIGHT
ld [wPlayerMovingDirection], a
ld a, $1
- ld [hSpriteIndex], a
+ ldh [hSpriteIndex], a
ld a, SPRITE_FACING_LEFT
- ld [hSpriteFacingDirection], a
+ ldh [hSpriteFacingDirection], a
call SetSpriteFacingDirectionAndDelay
.asm_5cde4
@@ -72,7 +72,7 @@
ld [wJoyIgnore], a
SetEventRange EVENT_BEAT_KARATE_MASTER, EVENT_BEAT_FIGHTING_DOJO_TRAINER_3
ld a, $8
- ld [hSpriteIndexOrTextID], a
+ ldh [hSpriteIndexOrTextID], a
call DisplayTextID
xor a
ld [wJoyIgnore], a
@@ -142,7 +142,7 @@
ld hl, FightingDojoText_5ce93
ld de, FightingDojoText_5ce93
call SaveEndBattleTextPointers
- ld a, [hSpriteIndexOrTextID]
+ ldh a, [hSpriteIndexOrTextID]
ld [wSpriteIndex], a
call EngageMapTrainer
call InitBattleEnemyParameters
--- a/scripts/FuchsiaGym.asm
+++ b/scripts/FuchsiaGym.asm
@@ -44,7 +44,7 @@
ld [wJoyIgnore], a
FuchsiaGymScript3_75497:
ld a, $9
- ld [hSpriteIndexOrTextID], a
+ ldh [hSpriteIndexOrTextID], a
call DisplayTextID
SetEvent EVENT_BEAT_KOGA
lb bc, TM_TOXIC, 1
@@ -51,13 +51,13 @@
call GiveItem
jr nc, .BagFull
ld a, $a
- ld [hSpriteIndexOrTextID], a
+ ldh [hSpriteIndexOrTextID], a
call DisplayTextID
SetEvent EVENT_GOT_TM06
jr .gymVictory
.BagFull
ld a, $b
- ld [hSpriteIndexOrTextID], a
+ ldh [hSpriteIndexOrTextID], a
call DisplayTextID
.gymVictory
ld hl, wObtainedBadges
@@ -161,7 +161,7 @@
ld hl, KogaAfterBattleText
ld de, KogaAfterBattleText
call SaveEndBattleTextPointers
- ld a, [hSpriteIndex]
+ ldh a, [hSpriteIndex]
ld [wSpriteIndex], a
call EngageMapTrainer
call InitBattleEnemyParameters
@@ -168,7 +168,7 @@
ld a, $5
ld [wGymLeaderNo], a
xor a
- ld [hJoyHeld], a
+ ldh [hJoyHeld], a
ld a, $3
ld [wFuchsiaGymCurScript], a
.done
--- a/scripts/GameCorner.asm
+++ b/scripts/GameCorner.asm
@@ -12,7 +12,7 @@
res 6, [hl]
ret z
call Random
- ld a, [hRandomAdd]
+ ldh a, [hRandomAdd]
cp $7
jr nc, .asm_48be2
ld a, $8
@@ -57,10 +57,10 @@
ld a, $f0
ld [wJoyIgnore], a
ld a, $d
- ld [hSpriteIndexOrTextID], a
+ ldh [hSpriteIndexOrTextID], a
call DisplayTextID
ld a, $b
- ld [hSpriteIndex], a
+ ldh [hSpriteIndex], a
call SetSpriteMovementBytesToFF
ld de, MovementData_48c5a
ld a, [wYCoord]
@@ -75,7 +75,7 @@
ld de, MovementData_48c63
.asm_48c4d
ld a, $b
- ld [hSpriteIndex], a
+ ldh [hSpriteIndex], a
call MoveSprite
ld a, $2
ld [wGameCornerCurScript], a
@@ -150,10 +150,10 @@
call Has9990Coins
jr nc, .asm_48d14
xor a
- ld [hMoney], a
- ld [hMoney + 2], a
+ ldh [hMoney], a
+ ldh [hMoney + 2], a
ld a, $10
- ld [hMoney + 1], a
+ ldh [hMoney + 1], a
call HasEnoughMoney
jr nc, .asm_48cdb
ld hl, CeladonGameCornerText_48d31
@@ -160,19 +160,19 @@
jr .asm_48d1c
.asm_48cdb
xor a
- ld [hMoney], a
- ld [hMoney + 2], a
+ ldh [hMoney], a
+ ldh [hMoney + 2], a
ld a, $10
- ld [hMoney + 1], a
+ ldh [hMoney + 1], a
ld hl, hMoney + 2
ld de, wPlayerMoney + 2
ld c, $3
predef SubBCDPredef
xor a
- ld [hUnusedCoinsByte], a
- ld [hCoins], a
+ ldh [hUnusedCoinsByte], a
+ ldh [hCoins], a
ld a, $50
- ld [hCoins + 1], a
+ ldh [hCoins + 1], a
ld de, wPlayerCoins + 1
ld hl, hCoins + 1
ld c, $2
@@ -236,10 +236,10 @@
call Has9990Coins
jr nc, .asm_48d8e
xor a
- ld [hUnusedCoinsByte], a
- ld [hCoins], a
+ ldh [hUnusedCoinsByte], a
+ ldh [hCoins], a
ld a, $10
- ld [hCoins + 1], a
+ ldh [hCoins + 1], a
ld de, wPlayerCoins + 1
ld hl, hCoins + 1
ld c, $2
@@ -316,10 +316,10 @@
call Has9990Coins
jr nc, .asm_48e18
xor a
- ld [hUnusedCoinsByte], a
- ld [hCoins], a
+ ldh [hUnusedCoinsByte], a
+ ldh [hCoins], a
ld a, $20
- ld [hCoins + 1], a
+ ldh [hCoins + 1], a
ld de, wPlayerCoins + 1
ld hl, hCoins + 1
ld c, $2
@@ -368,10 +368,10 @@
call Has9990Coins
jr z, .asm_48e7a
xor a
- ld [hUnusedCoinsByte], a
- ld [hCoins], a
+ ldh [hUnusedCoinsByte], a
+ ldh [hCoins], a
ld a, $20
- ld [hCoins + 1], a
+ ldh [hCoins + 1], a
ld de, wPlayerCoins + 1
ld hl, hCoins + 1
ld c, $2
@@ -418,14 +418,14 @@
ld hl, CeladonGameCornerText_48ed3
ld de, CeladonGameCornerText_48ed3
call SaveEndBattleTextPointers
- ld a, [hSpriteIndex]
+ ldh a, [hSpriteIndex]
ld [wSpriteIndex], a
call EngageMapTrainer
call InitBattleEnemyParameters
xor a
- ld [hJoyHeld], a
- ld [hJoyPressed], a
- ld [hJoyReleased], a
+ ldh [hJoyHeld], a
+ ldh [hJoyPressed], a
+ ldh [hJoyReleased], a
ld a, $1
ld [wGameCornerCurScript], a
jp TextScriptEnd
@@ -521,7 +521,7 @@
Has9990Coins:
ld a, $99
- ld [hCoins], a
+ ldh [hCoins], a
ld a, $90
- ld [hCoins + 1], a
+ ldh [hCoins + 1], a
jp HasEnoughCoins
--- a/scripts/HallOfFame.asm
+++ b/scripts/HallOfFame.asm
@@ -79,10 +79,10 @@
ld a, PLAYER_DIR_RIGHT
ld [wPlayerMovingDirection], a
ld a, $1
- ld [hSpriteIndex], a
+ ldh [hSpriteIndex], a
call SetSpriteMovementBytesToFF
ld a, SPRITE_FACING_LEFT
- ld [hSpriteFacingDirection], a
+ ldh [hSpriteFacingDirection], a
call SetSpriteFacingDirectionAndDelay
call Delay3
xor a
@@ -90,7 +90,7 @@
inc a ; PLAYER_DIR_RIGHT
ld [wPlayerMovingDirection], a
ld a, $1
- ld [hSpriteIndexOrTextID], a
+ ldh [hSpriteIndexOrTextID], a
call DisplayTextID
ld a, $ff
ld [wJoyIgnore], a
--- a/scripts/LancesRoom.asm
+++ b/scripts/LancesRoom.asm
@@ -59,12 +59,12 @@
call ArePlayerCoordsInArray
jp nc, CheckFightingMapTrainers
xor a
- ld [hJoyHeld], a
+ ldh [hJoyHeld], a
ld a, [wCoordIndex]
cp $3 ; Is player standing next to Lance's sprite?
jr nc, .notStandingNextToLance
ld a, $1
- ld [hSpriteIndexOrTextID], a
+ ldh [hSpriteIndexOrTextID], a
jp DisplayTextID
.notStandingNextToLance
cp $5 ; Is player standing on the entrance staircase?
@@ -91,7 +91,7 @@
cp $ff
jp z, ResetLanceScript
ld a, $1
- ld [hSpriteIndexOrTextID], a
+ ldh [hSpriteIndexOrTextID], a
jp DisplayTextID
WalkToLance:
--- a/scripts/LoreleisRoom.asm
+++ b/scripts/LoreleisRoom.asm
@@ -65,8 +65,8 @@
call ArePlayerCoordsInArray
jp nc, CheckFightingMapTrainers
xor a
- ld [hJoyPressed], a
- ld [hJoyHeld], a
+ ldh [hJoyPressed], a
+ ldh [hJoyHeld], a
ld [wSimulatedJoypadStatesEnd], a
ld [wSimulatedJoypadStatesIndex], a
ld a, [wCoordIndex]
@@ -76,7 +76,7 @@
jr z, LoreleiScriptWalkIntoRoom
.stopPlayerFromLeaving
ld a, $2
- ld [hSpriteIndexOrTextID], a
+ ldh [hSpriteIndexOrTextID], a
call DisplayTextID ; "Don't run away!"
ld a, D_UP
ld [wSimulatedJoypadStatesEnd], a
@@ -112,7 +112,7 @@
cp $ff
jp z, ResetLoreleiScript
ld a, $1
- ld [hSpriteIndexOrTextID], a
+ ldh [hSpriteIndexOrTextID], a
jp DisplayTextID
LoreleisRoom_TextPointers:
--- a/scripts/MtMoonB2F.asm
+++ b/scripts/MtMoonB2F.asm
@@ -62,9 +62,9 @@
cp $d
jp nz, MtMoon3Script_49d91
xor a
- ld [hJoyHeld], a
+ ldh [hJoyHeld], a
ld a, $1
- ld [hSpriteIndexOrTextID], a
+ ldh [hSpriteIndexOrTextID], a
jp DisplayTextID
MtMoon3Script_49d91:
@@ -88,7 +88,7 @@
MtMoon3Script4:
ld a, $1
- ld [hSpriteIndex], a
+ ldh [hSpriteIndex], a
call SetSpriteMovementBytesToFF
ld hl, CoordsData_49dea
call ArePlayerCoordsInArray
@@ -102,7 +102,7 @@
ld de, MovementData_49df8
.asm_49dda
ld a, $1
- ld [hSpriteIndex], a
+ ldh [hSpriteIndex], a
call MoveSprite
ld a, $5
ld [wMtMoonB2FCurScript], a
@@ -136,7 +136,7 @@
ld a, $1
ld [wDoNotWaitForButtonPressAfterDisplayingText], a
ld a, $a
- ld [hSpriteIndexOrTextID], a
+ ldh [hSpriteIndexOrTextID], a
call DisplayTextID
CheckEvent EVENT_GOT_DOME_FOSSIL
jr z, .asm_49e1d
@@ -222,7 +222,7 @@
ld hl, MtMoon3Text_49f8a
ld de, MtMoon3Text_49f8a
call SaveEndBattleTextPointers
- ld a, [hSpriteIndex]
+ ldh a, [hSpriteIndex]
ld [wSpriteIndex], a
call EngageMapTrainer
call InitBattleEnemyParameters
--- a/scripts/MtMoonPokecenter.asm
+++ b/scripts/MtMoonPokecenter.asm
@@ -34,10 +34,10 @@
ld a, [wCurrentMenuItem]
and a
jp nz, .choseNo
- ld [hMoney], a
- ld [hMoney + 2], a
+ ldh [hMoney], a
+ ldh [hMoney + 2], a
ld a, $5
- ld [hMoney + 1], a
+ ldh [hMoney + 1], a
call HasEnoughMoney
jr nc, .enoughMoney
ld hl, .NoMoneyText
--- a/scripts/Museum1F.asm
+++ b/scripts/Museum1F.asm
@@ -23,9 +23,9 @@
ret nz
.asm_5c120
xor a
- ld [hJoyHeld], a
+ ldh [hJoyHeld], a
ld a, $1
- ld [hSpriteIndexOrTextID], a
+ ldh [hSpriteIndexOrTextID], a
jp DisplayTextID
Museum1FScript1:
@@ -71,7 +71,7 @@
ld [wTextBoxID], a
call DisplayTextBoxID
xor a
- ld [hJoyHeld], a
+ ldh [hJoyHeld], a
ld hl, Museum1FText_5c21f
call PrintText
call YesNoChoice
@@ -79,10 +79,10 @@
and a
jr nz, .asm_de133
xor a
- ld [hMoney], a
- ld [hMoney + 1], a
+ ldh [hMoney], a
+ ldh [hMoney + 1], a
ld a, $50
- ld [hMoney + 2], a
+ ldh [hMoney + 2], a
call HasEnoughMoney
jr nc, .asm_0f3e3
ld hl, Museum1FText_5c229
--- a/scripts/OaksLab.asm
+++ b/scripts/OaksLab.asm
@@ -48,7 +48,7 @@
OaksLabScript1:
ld a, $8
- ld [hSpriteIndex], a
+ ldh [hSpriteIndex], a
ld de, OakEntryMovement
call MoveSprite
@@ -86,14 +86,14 @@
ld [wSimulatedJoypadStatesIndex], a
call StartSimulatingJoypadStates
ld a, $1
- ld [hSpriteIndex], a
+ ldh [hSpriteIndex], a
xor a
- ld [hSpriteFacingDirection], a
+ ldh [hSpriteFacingDirection], a
call SetSpriteFacingDirectionAndDelay
ld a, $5
- ld [hSpriteIndex], a
+ ldh [hSpriteIndex], a
xor a
- ld [hSpriteFacingDirection], a
+ ldh [hSpriteFacingDirection], a
call SetSpriteFacingDirectionAndDelay
ld a, $4
@@ -111,9 +111,9 @@
SetEvent EVENT_FOLLOWED_OAK_INTO_LAB
SetEvent EVENT_FOLLOWED_OAK_INTO_LAB_2
ld a, $1
- ld [hSpriteIndex], a
+ ldh [hSpriteIndex], a
ld a, SPRITE_FACING_UP
- ld [hSpriteFacingDirection], a
+ ldh [hSpriteFacingDirection], a
call SetSpriteFacingDirectionAndDelay
call UpdateSprites
ld hl, wFlags_D733
@@ -128,19 +128,19 @@
ld a, $fc
ld [wJoyIgnore], a
ld a, $11
- ld [hSpriteIndexOrTextID], a
+ ldh [hSpriteIndexOrTextID], a
call DisplayTextID
call Delay3
ld a, $12
- ld [hSpriteIndexOrTextID], a
+ ldh [hSpriteIndexOrTextID], a
call DisplayTextID
call Delay3
ld a, $13
- ld [hSpriteIndexOrTextID], a
+ ldh [hSpriteIndexOrTextID], a
call DisplayTextID
call Delay3
ld a, $14
- ld [hSpriteIndexOrTextID], a
+ ldh [hSpriteIndexOrTextID], a
call DisplayTextID
SetEvent EVENT_OAK_ASKED_TO_CHOOSE_MON
xor a
@@ -155,18 +155,18 @@
cp $6
ret nz
ld a, $5
- ld [hSpriteIndex], a
+ ldh [hSpriteIndex], a
xor a ; SPRITE_FACING_DOWN
- ld [hSpriteFacingDirection], a
+ ldh [hSpriteFacingDirection], a
call SetSpriteFacingDirectionAndDelay
ld a, $1
- ld [hSpriteIndex], a
+ ldh [hSpriteIndex], a
xor a
- ld [hSpriteFacingDirection], a
+ ldh [hSpriteFacingDirection], a
call SetSpriteFacingDirectionAndDelay
call UpdateSprites
ld a, $c
- ld [hSpriteIndexOrTextID], a
+ ldh [hSpriteIndexOrTextID], a
call DisplayTextID
ld a, $1
ld [wSimulatedJoypadStatesIndex], a
@@ -254,9 +254,9 @@
jr nz, .moveBlue
push hl
ld a, $1
- ld [hSpriteIndex], a
+ ldh [hSpriteIndex], a
ld a, $4
- ld [hSpriteDataOffset], a
+ ldh [hSpriteDataOffset], a
call GetPointerWithinSpriteStateData1
push hl
ld [hl], $4c
@@ -281,7 +281,7 @@
.moveBlue
ld a, $1
- ld [hSpriteIndex], a
+ ldh [hSpriteIndex], a
call MoveSprite
ld a, $9
@@ -295,12 +295,12 @@
ld a, $fc
ld [wJoyIgnore], a
ld a, $1
- ld [hSpriteIndex], a
+ ldh [hSpriteIndex], a
ld a, SPRITE_FACING_UP
- ld [hSpriteFacingDirection], a
+ ldh [hSpriteFacingDirection], a
call SetSpriteFacingDirectionAndDelay
ld a, $d
- ld [hSpriteIndexOrTextID], a
+ ldh [hSpriteIndexOrTextID], a
call DisplayTextID
ld a, [wRivalStarterBallSpriteIndex]
cp $2
@@ -324,12 +324,12 @@
ld [wd11e], a
call GetMonName
ld a, $1
- ld [hSpriteIndex], a
+ ldh [hSpriteIndex], a
ld a, SPRITE_FACING_UP
- ld [hSpriteFacingDirection], a
+ ldh [hSpriteFacingDirection], a
call SetSpriteFacingDirectionAndDelay
ld a, $e
- ld [hSpriteIndexOrTextID], a
+ ldh [hSpriteIndexOrTextID], a
call DisplayTextID
SetEvent EVENT_GOT_STARTER
xor a
@@ -344,9 +344,9 @@
cp $6
ret nz
ld a, $1
- ld [hSpriteIndex], a
+ ldh [hSpriteIndex], a
xor a ; SPRITE_FACING_DOWN
- ld [hSpriteFacingDirection], a
+ ldh [hSpriteFacingDirection], a
call SetSpriteFacingDirectionAndDelay
ld a, PLAYER_DIR_UP
ld [wPlayerMovingDirection], a
@@ -354,21 +354,21 @@
ld a, MUSIC_MEET_RIVAL
call PlayMusic
ld a, $f
- ld [hSpriteIndexOrTextID], a
+ ldh [hSpriteIndexOrTextID], a
call DisplayTextID
ld a, $1
- ld [hNPCPlayerRelativePosPerspective], a
+ ldh [hNPCPlayerRelativePosPerspective], a
ld a, $1
swap a
- ld [hNPCSpriteOffset], a
+ ldh [hNPCSpriteOffset], a
predef CalcPositionOfPlayerRelativeToNPC
- ld a, [hNPCPlayerYDistance]
+ ldh a, [hNPCPlayerYDistance]
dec a
- ld [hNPCPlayerYDistance], a
+ ldh [hNPCPlayerYDistance], a
predef FindPathToPlayer
ld de, wNPCMovementDirections2
ld a, $1
- ld [hSpriteIndex], a
+ ldh [hSpriteIndex], a
call MoveSprite
ld a, $b
@@ -424,9 +424,9 @@
ld [wSpriteIndex], a
call SetSpritePosition1
ld a, $1
- ld [hSpriteIndex], a
+ ldh [hSpriteIndex], a
xor a ; SPRITE_FACING_DOWN
- ld [hSpriteFacingDirection], a
+ ldh [hSpriteFacingDirection], a
call SetSpriteFacingDirectionAndDelay
predef HealParty
SetEvent EVENT_BATTLED_RIVAL_IN_OAKS_LAB
@@ -439,11 +439,11 @@
ld c, 20
call DelayFrames
ld a, $10
- ld [hSpriteIndexOrTextID], a
+ ldh [hSpriteIndexOrTextID], a
call DisplayTextID
callba Music_RivalAlternateStart
ld a, $1
- ld [hSpriteIndex], a
+ ldh [hSpriteIndex], a
ld de, .RivalExitMovement
call MoveSprite
ld a, [wXCoord]
@@ -508,7 +508,7 @@
OaksLabScript15:
xor a
- ld [hJoyHeld], a
+ ldh [hJoyHeld], a
call EnableAutoTextBoxDrawing
ld a, SFX_STOP_ALL_MUSIC
ld [wNewSoundID], a
@@ -515,7 +515,7 @@
call PlaySound
callba Music_RivalAlternateStart
ld a, $15
- ld [hSpriteIndexOrTextID], a
+ ldh [hSpriteIndexOrTextID], a
call DisplayTextID
call OaksLabScript_1d02b
ld a, HS_OAKS_LAB_RIVAL
@@ -530,7 +530,7 @@
call FillMemory
ld [hl], $ff
ld a, $1
- ld [hSpriteIndex], a
+ ldh [hSpriteIndex], a
ld de, wNPCMovementDirections2
call MoveSprite
@@ -540,14 +540,14 @@
OaksLabScript_1cefd:
ld a, $1
- ld [hSpriteIndex], a
+ ldh [hSpriteIndex], a
ld a, SPRITE_FACING_UP
- ld [hSpriteFacingDirection], a
+ ldh [hSpriteFacingDirection], a
call SetSpriteFacingDirectionAndDelay
ld a, $8
- ld [hSpriteIndex], a
+ ldh [hSpriteIndex], a
xor a ; SPRITE_FACING_DOWN
- ld [hSpriteFacingDirection], a
+ ldh [hSpriteFacingDirection], a
jp SetSpriteFacingDirectionAndDelay
OaksLabScript16:
@@ -560,21 +560,21 @@
ld [wJoyIgnore], a
call OaksLabScript_1cefd
ld a, $16
- ld [hSpriteIndexOrTextID], a
+ ldh [hSpriteIndexOrTextID], a
call DisplayTextID
call DelayFrame
call OaksLabScript_1cefd
ld a, $17
- ld [hSpriteIndexOrTextID], a
+ ldh [hSpriteIndexOrTextID], a
call DisplayTextID
call DelayFrame
call OaksLabScript_1cefd
ld a, $18
- ld [hSpriteIndexOrTextID], a
+ ldh [hSpriteIndexOrTextID], a
call DisplayTextID
call DelayFrame
ld a, $19
- ld [hSpriteIndexOrTextID], a
+ ldh [hSpriteIndexOrTextID], a
call DisplayTextID
call Delay3
ld a, HS_POKEDEX_1
@@ -585,16 +585,16 @@
predef HideObject
call OaksLabScript_1cefd
ld a, $1a
- ld [hSpriteIndexOrTextID], a
+ ldh [hSpriteIndexOrTextID], a
call DisplayTextID
ld a, $1
- ld [hSpriteIndex], a
+ ldh [hSpriteIndex], a
ld a, SPRITE_FACING_RIGHT
- ld [hSpriteFacingDirection], a
+ ldh [hSpriteFacingDirection], a
call SetSpriteFacingDirectionAndDelay
call Delay3
ld a, $1b
- ld [hSpriteIndexOrTextID], a
+ ldh [hSpriteIndexOrTextID], a
call DisplayTextID
SetEvent EVENT_GOT_POKEDEX
SetEvent EVENT_OAK_GOT_PARCEL
@@ -616,7 +616,7 @@
call PlaySound
callba Music_RivalAlternateStart
ld a, $1
- ld [hSpriteIndex], a
+ ldh [hSpriteIndex], a
ld de, wNPCMovementDirections2
call MoveSprite
@@ -672,9 +672,9 @@
OaksLabScript_1d02b:
ld a, $7c
- ld [hSpriteScreenYCoord], a
+ ldh [hSpriteScreenYCoord], a
ld a, $8
- ld [hSpriteMapXCoord], a
+ ldh [hSpriteMapXCoord], a
ld a, [wYCoord]
cp $3
jr nz, .asm_1d045
@@ -703,9 +703,9 @@
.asm_1d066
ld a, $20
.asm_1d068
- ld [hSpriteScreenXCoord], a
+ ldh [hSpriteScreenXCoord], a
ld a, b
- ld [hSpriteMapYCoord], a
+ ldh [hSpriteMapYCoord], a
ld a, $1
ld [wSpriteIndex], a
call SetSpritePosition1
@@ -840,15 +840,15 @@
OaksLabScript_1d157:
ld a, $5
- ld [hSpriteIndex], a
+ ldh [hSpriteIndex], a
ld a, $9
- ld [hSpriteDataOffset], a
+ ldh [hSpriteDataOffset], a
call GetPointerWithinSpriteStateData1
ld [hl], SPRITE_FACING_DOWN
ld a, $1
- ld [hSpriteIndex], a
+ ldh [hSpriteIndex], a
ld a, $9
- ld [hSpriteDataOffset], a
+ ldh [hSpriteDataOffset], a
call GetPointerWithinSpriteStateData1
ld [hl], SPRITE_FACING_RIGHT
ld hl, wd730
@@ -947,9 +947,9 @@
OaksLabScript_1d22d:
ld a, $5
- ld [hSpriteIndex], a
+ ldh [hSpriteIndex], a
ld a, $9
- ld [hSpriteDataOffset], a
+ ldh [hSpriteDataOffset], a
call GetPointerWithinSpriteStateData1
ld [hl], $0
ld hl, OaksLabLastMonText
--- a/scripts/PalletTown.asm
+++ b/scripts/PalletTown.asm
@@ -24,7 +24,7 @@
cp 1 ; is player near north exit?
ret nz
xor a
- ld [hJoyHeld], a
+ ldh [hJoyHeld], a
ld a, PLAYER_DIR_DOWN
ld [wPlayerMovingDirection], a
ld a, SFX_STOP_ALL_MUSIC
@@ -46,7 +46,7 @@
xor a
ld [wcf0d], a
ld a, 1
- ld [hSpriteIndexOrTextID], a
+ ldh [hSpriteIndexOrTextID], a
call DisplayTextID
ld a, $FF
ld [wJoyIgnore], a
@@ -61,18 +61,18 @@
PalletTownScript2:
ld a, 1
- ld [hSpriteIndex], a
+ ldh [hSpriteIndex], a
ld a, SPRITE_FACING_UP
- ld [hSpriteFacingDirection], a
+ ldh [hSpriteFacingDirection], a
call SetSpriteFacingDirectionAndDelay
call Delay3
ld a, 1
ld [wYCoord], a
ld a, 1
- ld [hNPCPlayerRelativePosPerspective], a
+ ldh [hNPCPlayerRelativePosPerspective], a
ld a, 1
swap a
- ld [hNPCSpriteOffset], a
+ ldh [hNPCSpriteOffset], a
predef CalcPositionOfPlayerRelativeToNPC
ld hl, hNPCPlayerYDistance
dec [hl]
@@ -79,7 +79,7 @@
predef FindPathToPlayer ; load Oak’s movement into wNPCMovementDirections2
ld de, wNPCMovementDirections2
ld a, 1 ; oak
- ld [hSpriteIndex], a
+ ldh [hSpriteIndex], a
call MoveSprite
ld a, $FF
ld [wJoyIgnore], a
@@ -100,7 +100,7 @@
ld a, $FC
ld [wJoyIgnore], a
ld a, 1
- ld [hSpriteIndexOrTextID], a
+ ldh [hSpriteIndexOrTextID], a
call DisplayTextID
; set up movement script that causes the player to follow Oak to his lab
ld a, $FF
@@ -111,7 +111,7 @@
ld [wNPCMovementScriptFunctionNum], a
ld a, 1
ld [wNPCMovementScriptPointerTableNum], a
- ld a, [hLoadedROMBank]
+ ldh a, [hLoadedROMBank]
ld [wNPCMovementScriptBank], a
; trigger the next script
--- a/scripts/PewterCity.asm
+++ b/scripts/PewterCity.asm
@@ -29,7 +29,7 @@
ld a, $f0
ld [wJoyIgnore], a
ld a, $5
- ld [hSpriteIndexOrTextID], a
+ ldh [hSpriteIndexOrTextID], a
jp DisplayTextID
CoordsData_19277:
@@ -44,32 +44,32 @@
and a
ret nz
ld a, $3
- ld [hSpriteIndex], a
+ ldh [hSpriteIndex], a
ld a, SPRITE_FACING_UP
- ld [hSpriteFacingDirection], a
+ ldh [hSpriteFacingDirection], a
call SetSpriteFacingDirectionAndDelay
ld a, ($3 << 4) | SPRITE_FACING_UP
- ld [hSpriteImageIndex], a
+ ldh [hSpriteImageIndex], a
call SetSpriteImageIndexAfterSettingFacingDirection
call PlayDefaultMusic
ld hl, wFlags_0xcd60
set 4, [hl]
ld a, $d
- ld [hSpriteIndexOrTextID], a
+ ldh [hSpriteIndexOrTextID], a
call DisplayTextID
ld a, $3c
- ld [hSpriteScreenYCoord], a
+ ldh [hSpriteScreenYCoord], a
ld a, $30
- ld [hSpriteScreenXCoord], a
+ ldh [hSpriteScreenXCoord], a
ld a, $c
- ld [hSpriteMapYCoord], a
+ ldh [hSpriteMapYCoord], a
ld a, $11
- ld [hSpriteMapXCoord], a
+ ldh [hSpriteMapXCoord], a
ld a, $3
ld [wSpriteIndex], a
call SetSpritePosition1
ld a, $3
- ld [hSpriteIndex], a
+ ldh [hSpriteIndex], a
ld de, MovementData_PewterMuseumGuyExit
call MoveSprite
ld a, $2
@@ -112,32 +112,32 @@
and a
ret nz
ld a, $5
- ld [hSpriteIndex], a
+ ldh [hSpriteIndex], a
ld a, SPRITE_FACING_LEFT
- ld [hSpriteFacingDirection], a
+ ldh [hSpriteFacingDirection], a
call SetSpriteFacingDirectionAndDelay
ld a, ($1 << 4) | SPRITE_FACING_LEFT
- ld [hSpriteImageIndex], a
+ ldh [hSpriteImageIndex], a
call SetSpriteImageIndexAfterSettingFacingDirection
call PlayDefaultMusic
ld hl, wFlags_0xcd60
set 4, [hl]
ld a, $e
- ld [hSpriteIndexOrTextID], a
+ ldh [hSpriteIndexOrTextID], a
call DisplayTextID
ld a, $3c
- ld [hSpriteScreenYCoord], a
+ ldh [hSpriteScreenYCoord], a
ld a, $40
- ld [hSpriteScreenXCoord], a
+ ldh [hSpriteScreenXCoord], a
ld a, $16
- ld [hSpriteMapYCoord], a
+ ldh [hSpriteMapYCoord], a
ld a, $10
- ld [hSpriteMapXCoord], a
+ ldh [hSpriteMapXCoord], a
ld a, $5
ld [wSpriteIndex], a
call SetSpritePosition1
ld a, $5
- ld [hSpriteIndex], a
+ ldh [hSpriteIndex], a
ld de, MovementData_PewterGymGuyExit
call MoveSprite
ld a, $5
@@ -215,12 +215,12 @@
ld hl, PewterCityText_193fb
call PrintText
xor a
- ld [hJoyPressed], a
- ld [hJoyHeld], a
+ ldh [hJoyPressed], a
+ ldh [hJoyHeld], a
ld [wNPCMovementScriptFunctionNum], a
ld a, $2
ld [wNPCMovementScriptPointerTableNum], a
- ld a, [hLoadedROMBank]
+ ldh a, [hLoadedROMBank]
ld [wNPCMovementScriptBank], a
ld a, $3
ld [wSpriteIndex], a
@@ -280,11 +280,11 @@
ld hl, PewterCityText_1945d
call PrintText
xor a
- ld [hJoyHeld], a
+ ldh [hJoyHeld], a
ld [wNPCMovementScriptFunctionNum], a
ld a, $3
ld [wNPCMovementScriptPointerTableNum], a
- ld a, [hLoadedROMBank]
+ ldh a, [hLoadedROMBank]
ld [wNPCMovementScriptBank], a
ld a, $5
ld [wSpriteIndex], a
--- a/scripts/PewterGym.asm
+++ b/scripts/PewterGym.asm
@@ -44,7 +44,7 @@
PewterGymScript_5c3df:
ld a, $4
- ld [hSpriteIndexOrTextID], a
+ ldh [hSpriteIndexOrTextID], a
call DisplayTextID
SetEvent EVENT_BEAT_BROCK
lb bc, TM_BIDE, 1
@@ -51,13 +51,13 @@
call GiveItem
jr nc, .BagFull
ld a, $5
- ld [hSpriteIndexOrTextID], a
+ ldh [hSpriteIndexOrTextID], a
call DisplayTextID
SetEvent EVENT_GOT_TM34
jr .gymVictory
.BagFull
ld a, $6
- ld [hSpriteIndexOrTextID], a
+ ldh [hSpriteIndexOrTextID], a
call DisplayTextID
.gymVictory
ld hl, wObtainedBadges
@@ -120,7 +120,7 @@
ld hl, PewterGymText_5c4bc
ld de, PewterGymText_5c4bc
call SaveEndBattleTextPointers
- ld a, [hSpriteIndex]
+ ldh a, [hSpriteIndex]
ld [wSpriteIndex], a
call EngageMapTrainer
call InitBattleEnemyParameters
@@ -127,7 +127,7 @@
ld a, $1
ld [wGymLeaderNo], a
xor a
- ld [hJoyHeld], a
+ ldh [hJoyHeld], a
ld a, $3
ld [wPewterGymCurScript], a
ld [wCurMapScript], a
--- a/scripts/PokemonMansion1F.asm
+++ b/scripts/PokemonMansion1F.asm
@@ -50,9 +50,9 @@
cp SPRITE_FACING_UP
ret nz
xor a
- ld [hJoyHeld], a
+ ldh [hJoyHeld], a
ld a, $4
- ld [hSpriteIndexOrTextID], a
+ ldh [hSpriteIndexOrTextID], a
jp DisplayTextID
PokemonMansion1F_ScriptPointers:
--- a/scripts/PokemonMansion2F.asm
+++ b/scripts/PokemonMansion2F.asm
@@ -46,9 +46,9 @@
cp SPRITE_FACING_UP
ret nz
xor a
- ld [hJoyHeld], a
+ ldh [hJoyHeld], a
ld a, $5
- ld [hSpriteIndexOrTextID], a
+ ldh [hSpriteIndexOrTextID], a
jp DisplayTextID
PokemonMansion2F_ScriptPointers:
--- a/scripts/PokemonMansion3F.asm
+++ b/scripts/PokemonMansion3F.asm
@@ -77,9 +77,9 @@
cp SPRITE_FACING_UP
ret nz
xor a
- ld [hJoyHeld], a
+ ldh [hJoyHeld], a
ld a, $6
- ld [hSpriteIndexOrTextID], a
+ ldh [hSpriteIndexOrTextID], a
jp DisplayTextID
PokemonMansion3F_TextPointers:
--- a/scripts/PokemonMansionB1F.asm
+++ b/scripts/PokemonMansionB1F.asm
@@ -48,9 +48,9 @@
cp SPRITE_FACING_UP
ret nz
xor a
- ld [hJoyHeld], a
+ ldh [hJoyHeld], a
ld a, $9
- ld [hSpriteIndexOrTextID], a
+ ldh [hSpriteIndexOrTextID], a
jp DisplayTextID
PokemonMansionB1F_ScriptPointers:
--- a/scripts/PokemonTower2F.asm
+++ b/scripts/PokemonTower2F.asm
@@ -41,16 +41,16 @@
.asm_60544
ld [wPlayerMovingDirection], a
ld a, $1
- ld [hSpriteIndex], a
+ ldh [hSpriteIndex], a
ld a, b
- ld [hSpriteFacingDirection], a
+ ldh [hSpriteFacingDirection], a
call SetSpriteFacingDirectionAndDelay
ld a, $1
- ld [hSpriteIndexOrTextID], a
+ ldh [hSpriteIndexOrTextID], a
call DisplayTextID
xor a
- ld [hJoyHeld], a
- ld [hJoyPressed], a
+ ldh [hJoyHeld], a
+ ldh [hJoyPressed], a
ret
CoordsData_6055e:
@@ -66,7 +66,7 @@
ld [wJoyIgnore], a
SetEvent EVENT_BEAT_POKEMON_TOWER_RIVAL
ld a, $1
- ld [hSpriteIndexOrTextID], a
+ ldh [hSpriteIndexOrTextID], a
call DisplayTextID
ld de, MovementData_605b2
CheckEvent EVENT_POKEMON_TOWER_RIVAL_ON_LEFT
@@ -74,7 +74,7 @@
ld de, MovementData_605a9
.asm_60589
ld a, $1
- ld [hSpriteIndex], a
+ ldh [hSpriteIndex], a
call MoveSprite
ld a, SFX_STOP_ALL_MUSIC
ld [wNewSoundID], a
--- a/scripts/PokemonTower5F.asm
+++ b/scripts/PokemonTower5F.asm
@@ -24,7 +24,7 @@
CheckAndSetEvent EVENT_IN_PURIFIED_ZONE
ret nz
xor a
- ld [hJoyHeld], a
+ ldh [hJoyHeld], a
ld a, $f0
ld [wJoyIgnore], a
ld hl, wd72e
@@ -35,7 +35,7 @@
call Delay3
call GBFadeInFromWhite
ld a, $7
- ld [hSpriteIndexOrTextID], a
+ ldh [hSpriteIndexOrTextID], a
call DisplayTextID
xor a
ld [wJoyIgnore], a
--- a/scripts/PokemonTower6F.asm
+++ b/scripts/PokemonTower6F.asm
@@ -28,9 +28,9 @@
call ArePlayerCoordsInArray
jp nc, CheckFightingMapTrainers
xor a
- ld [hJoyHeld], a
+ ldh [hJoyHeld], a
ld a, $6
- ld [hSpriteIndexOrTextID], a
+ ldh [hSpriteIndexOrTextID], a
call DisplayTextID
ld a, MAROWAK
ld [wCurOpponent], a
@@ -61,7 +61,7 @@
jr nz, .asm_60b82
SetEvent EVENT_BEAT_GHOST_MAROWAK
ld a, $7
- ld [hSpriteIndexOrTextID], a
+ ldh [hSpriteIndexOrTextID], a
call DisplayTextID
xor a
ld [wJoyIgnore], a
--- a/scripts/PokemonTower7F.asm
+++ b/scripts/PokemonTower7F.asm
@@ -31,7 +31,7 @@
ld a, $f0
ld [wJoyIgnore], a
ld a, [wSpriteIndex]
- ld [hSpriteIndexOrTextID], a
+ ldh [hSpriteIndexOrTextID], a
call DisplayTextID
call PokemonTower7Script_60db6
ld a, $3
@@ -72,7 +72,7 @@
ld a, SPRITE_FACING_UP
ld [wSpritePlayerStateData1FacingDirection], a
ld a, MR_FUJIS_HOUSE
- ld [hWarpDestinationMap], a
+ ldh [hWarpDestinationMap], a
ld a, $1
ld [wDestinationWarpID], a
ld a, LAVENDER_TOWN
@@ -107,7 +107,7 @@
ld d, [hl]
ld e, a
ld a, [wSpriteIndex]
- ld [hSpriteIndex], a
+ ldh [hSpriteIndex], a
jp MoveSprite
.asm_60dde
inc hl
--- a/scripts/RedsHouse2F.asm
+++ b/scripts/RedsHouse2F.asm
@@ -10,7 +10,7 @@
RedsHouse2FScript0:
xor a
- ld [hJoyHeld], a
+ ldh [hJoyHeld], a
ld a, PLAYER_DIR_UP
ld [wPlayerMovingDirection], a
ld a, 1
--- a/scripts/RocketHideoutB4F.asm
+++ b/scripts/RocketHideoutB4F.asm
@@ -52,7 +52,7 @@
ld [wJoyIgnore], a
SetEvent EVENT_BEAT_ROCKET_HIDEOUT_GIOVANNI
ld a, $a
- ld [hSpriteIndexOrTextID], a
+ ldh [hSpriteIndexOrTextID], a
call DisplayTextID
call GBFadeOutToBlack
ld a, HS_ROCKET_HIDEOUT_B4F_GIOVANNI
@@ -125,12 +125,12 @@
ld hl, RocketHideout4Text_4557f
ld de, RocketHideout4Text_4557f
call SaveEndBattleTextPointers
- ld a, [hSpriteIndex]
+ ldh a, [hSpriteIndex]
ld [wSpriteIndex], a
call EngageMapTrainer
call InitBattleEnemyParameters
xor a
- ld [hJoyHeld], a
+ ldh [hJoyHeld], a
ld a, $3
ld [wRocketHideoutB4FCurScript], a
ld [wCurMapScript], a
--- a/scripts/Route11Gate2F.asm
+++ b/scripts/Route11Gate2F.asm
@@ -20,9 +20,9 @@
CheckEvent EVENT_GOT_ITEMFINDER, 1
jr c, .asm_4949b
ld a, 30 ; pokemon needed
- ld [hOaksAideRequirement], a
+ ldh [hOaksAideRequirement], a
ld a, ITEMFINDER ; oak's aide reward
- ld [hOaksAideRewardItem], a
+ ldh [hOaksAideRewardItem], a
ld [wd11e], a
call GetItemName
ld h, d
@@ -31,7 +31,7 @@
ld bc, ITEM_NAME_LENGTH
call CopyData
predef OaksAideScript
- ld a, [hOaksAideResult]
+ ldh a, [hOaksAideResult]
dec a
jr nz, .asm_494a1
SetEvent EVENT_GOT_ITEMFINDER
--- a/scripts/Route12.asm
+++ b/scripts/Route12.asm
@@ -27,7 +27,7 @@
ResetEventReuseHL EVENT_FIGHT_ROUTE12_SNORLAX
jp z, CheckFightingMapTrainers
ld a, $d
- ld [hSpriteIndexOrTextID], a
+ ldh [hSpriteIndexOrTextID], a
call DisplayTextID
ld a, SNORLAX
ld [wCurOpponent], a
@@ -50,7 +50,7 @@
cp $2
jr z, .asm_59664
ld a, $e
- ld [hSpriteIndexOrTextID], a
+ ldh [hSpriteIndexOrTextID], a
call DisplayTextID
.asm_59664
SetEvent EVENT_BEAT_ROUTE12_SNORLAX
--- a/scripts/Route15Gate2F.asm
+++ b/scripts/Route15Gate2F.asm
@@ -10,9 +10,9 @@
CheckEvent EVENT_GOT_EXP_ALL
jr nz, .asm_49683
ld a, 50 ; pokemon needed
- ld [hOaksAideRequirement], a
+ ldh [hOaksAideRequirement], a
ld a, EXP_ALL ; oak's aide reward
- ld [hOaksAideRewardItem], a
+ ldh [hOaksAideRewardItem], a
ld [wd11e], a
call GetItemName
ld hl, wcd6d
@@ -20,7 +20,7 @@
ld bc, ITEM_NAME_LENGTH
call CopyData
predef OaksAideScript
- ld a, [hOaksAideResult]
+ ldh a, [hOaksAideResult]
cp $1
jr nz, .asm_49689
SetEvent EVENT_GOT_EXP_ALL
--- a/scripts/Route16.asm
+++ b/scripts/Route16.asm
@@ -27,7 +27,7 @@
ResetEventReuseHL EVENT_FIGHT_ROUTE16_SNORLAX
jp z, CheckFightingMapTrainers
ld a, $a
- ld [hSpriteIndexOrTextID], a
+ ldh [hSpriteIndexOrTextID], a
call DisplayTextID
ld a, SNORLAX
ld [wCurOpponent], a
@@ -51,7 +51,7 @@
cp $2
jr z, .asm_599a8
ld a, $b
- ld [hSpriteIndexOrTextID], a
+ ldh [hSpriteIndexOrTextID], a
call DisplayTextID
.asm_599a8
SetEvent EVENT_BEAT_ROUTE16_SNORLAX
--- a/scripts/Route16Gate1F.asm
+++ b/scripts/Route16Gate1F.asm
@@ -19,10 +19,10 @@
call ArePlayerCoordsInArray
ret nc
ld a, $3
- ld [hSpriteIndexOrTextID], a
+ ldh [hSpriteIndexOrTextID], a
call DisplayTextID
xor a
- ld [hJoyHeld], a
+ ldh [hJoyHeld], a
ld a, [wCoordIndex]
cp $1
jr z, .asm_4970e
@@ -59,7 +59,7 @@
Route16GateScript2:
ld a, $1
- ld [hSpriteIndexOrTextID], a
+ ldh [hSpriteIndexOrTextID], a
call DisplayTextID
ld a, $1
ld [wSimulatedJoypadStatesIndex], a
--- a/scripts/Route18Gate1F.asm
+++ b/scripts/Route18Gate1F.asm
@@ -19,10 +19,10 @@
call ArePlayerCoordsInArray
ret nc
ld a, $2
- ld [hSpriteIndexOrTextID], a
+ ldh [hSpriteIndexOrTextID], a
call DisplayTextID
xor a
- ld [hJoyHeld], a
+ ldh [hJoyHeld], a
ld a, [wCoordIndex]
cp $1
jr z, .asm_498c6
@@ -59,7 +59,7 @@
Route18GateScript2:
ld a, $1
- ld [hSpriteIndexOrTextID], a
+ ldh [hSpriteIndexOrTextID], a
call DisplayTextID
ld a, $1
ld [wSimulatedJoypadStatesIndex], a
--- a/scripts/Route22.asm
+++ b/scripts/Route22.asm
@@ -44,7 +44,7 @@
.asm_50ef1
call MoveSprite
ld a, SPRITE_FACING_RIGHT
- ld [hSpriteFacingDirection], a
+ ldh [hSpriteFacingDirection], a
jp SetSpriteFacingDirectionAndDelay
Route22RivalMovementData:
@@ -63,7 +63,7 @@
ld a, [wCoordIndex]
ld [wcf0d], a
xor a
- ld [hJoyHeld], a
+ ldh [hJoyHeld], a
ld a, $f0
ld [wJoyIgnore], a
ld a, PLAYER_DIR_LEFT
@@ -96,7 +96,7 @@
ld a, MUSIC_MEET_RIVAL
call PlayMusic
ld a, $1
- ld [hSpriteIndex], a
+ ldh [hSpriteIndex], a
call Route22MoveRivalSprite
ld a, $1
ld [wRoute22CurScript], a
@@ -116,14 +116,14 @@
.asm_50f78
ld a, SPRITE_FACING_RIGHT
.asm_50f7a
- ld [hSpriteFacingDirection], a
+ ldh [hSpriteFacingDirection], a
ld a, $1
- ld [hSpriteIndex], a
+ ldh [hSpriteIndex], a
call SetSpriteFacingDirectionAndDelay
xor a
ld [wJoyIgnore], a
ld a, $1
- ld [hSpriteIndexOrTextID], a
+ ldh [hSpriteIndexOrTextID], a
call DisplayTextID
ld hl, wd72d
set 6, [hl]
@@ -157,15 +157,15 @@
.notDown
ld a, SPRITE_FACING_RIGHT
.done
- ld [hSpriteFacingDirection], a
+ ldh [hSpriteFacingDirection], a
ld a, $1
- ld [hSpriteIndex], a
+ ldh [hSpriteIndex], a
call SetSpriteFacingDirectionAndDelay
ld a, $f0
ld [wJoyIgnore], a
SetEvent EVENT_BEAT_ROUTE22_RIVAL_1ST_BATTLE
ld a, $1
- ld [hSpriteIndexOrTextID], a
+ ldh [hSpriteIndexOrTextID], a
call DisplayTextID
ld a, SFX_STOP_ALL_MUSIC
ld [wNewSoundID], a
@@ -191,7 +191,7 @@
ld de, Route22RivalExitMovementData2
Route22MoveRival1:
ld a, $1
- ld [hSpriteIndex], a
+ ldh [hSpriteIndex], a
jp MoveSprite
Route22RivalExitMovementData1:
@@ -250,7 +250,7 @@
call PlaySound
callba Music_RivalAlternateTempo
ld a, $2
- ld [hSpriteIndex], a
+ ldh [hSpriteIndex], a
call Route22MoveRivalSprite
ld a, $4
ld [wRoute22CurScript], a
@@ -261,7 +261,7 @@
bit 0, a
ret nz
ld a, $2
- ld [hSpriteIndex], a
+ ldh [hSpriteIndex], a
ld a, [wcf0d]
cp $1
jr nz, .asm_510a1
@@ -274,12 +274,12 @@
ld [wPlayerMovingDirection], a
ld a, SPRITE_FACING_RIGHT
.asm_510a8
- ld [hSpriteFacingDirection], a
+ ldh [hSpriteFacingDirection], a
call SetSpriteFacingDirectionAndDelay
xor a
ld [wJoyIgnore], a
ld a, $2
- ld [hSpriteIndexOrTextID], a
+ ldh [hSpriteIndexOrTextID], a
call DisplayTextID
ld hl, wd72d
set 6, [hl]
@@ -305,7 +305,7 @@
cp $ff
jp z, Route22Script_50ece
ld a, $2
- ld [hSpriteIndex], a
+ ldh [hSpriteIndex], a
ld a, [wcf0d]
cp $1
jr nz, .asm_510fb
@@ -318,13 +318,13 @@
ld [wPlayerMovingDirection], a
ld a, SPRITE_FACING_RIGHT
.asm_51102
- ld [hSpriteFacingDirection], a
+ ldh [hSpriteFacingDirection], a
call SetSpriteFacingDirectionAndDelay
ld a, $f0
ld [wJoyIgnore], a
SetEvent EVENT_BEAT_ROUTE22_RIVAL_2ND_BATTLE
ld a, $2
- ld [hSpriteIndexOrTextID], a
+ ldh [hSpriteIndexOrTextID], a
call DisplayTextID
ld a, SFX_STOP_ALL_MUSIC
ld [wNewSoundID], a
@@ -350,7 +350,7 @@
ld de, MovementData_5114d
Route22MoveRival2:
ld a, $2
- ld [hSpriteIndex], a
+ ldh [hSpriteIndex], a
jp MoveSprite
MovementData_5114c:
--- a/scripts/Route22Gate.asm
+++ b/scripts/Route22Gate.asm
@@ -22,9 +22,9 @@
call ArePlayerCoordsInArray
ret nc
xor a
- ld [hJoyHeld], a
+ ldh [hJoyHeld], a
ld a, $1
- ld [hSpriteIndexOrTextID], a
+ ldh [hSpriteIndexOrTextID], a
jp DisplayTextID
Route22GateScriptCoords:
--- a/scripts/Route23.asm
+++ b/scripts/Route23.asm
@@ -45,7 +45,7 @@
ret nc
.asm_51237
ld a, e
- ld [hSpriteIndexOrTextID], a
+ ldh [hSpriteIndexOrTextID], a
ld a, c
ld [wWhichBadge], a
ld b, FLAG_TEST
@@ -57,7 +57,7 @@
call Route23Script_5125d
call DisplayTextID
xor a
- ld [hJoyHeld], a
+ ldh [hJoyHeld], a
ret
YCoordsData_51255:
--- a/scripts/Route24.asm
+++ b/scripts/Route24.asm
@@ -28,9 +28,9 @@
call ArePlayerCoordsInArray
jp nc, CheckFightingMapTrainers
xor a
- ld [hJoyHeld], a
+ ldh [hJoyHeld], a
ld a, $1
- ld [hSpriteIndexOrTextID], a
+ ldh [hSpriteIndexOrTextID], a
call DisplayTextID
CheckAndResetEvent EVENT_NUGGET_REWARD_AVAILABLE
ret z
@@ -66,7 +66,7 @@
ld [wJoyIgnore], a
SetEvent EVENT_BEAT_ROUTE24_ROCKET
ld a, $1
- ld [hSpriteIndexOrTextID], a
+ ldh [hSpriteIndexOrTextID], a
call DisplayTextID
xor a
ld [wJoyIgnore], a
@@ -162,12 +162,12 @@
ld hl, Route24Text_5152b
ld de, Route24Text_5152b
call SaveEndBattleTextPointers
- ld a, [hSpriteIndexOrTextID]
+ ldh a, [hSpriteIndexOrTextID]
ld [wSpriteIndex], a
call EngageMapTrainer
call InitBattleEnemyParameters
xor a
- ld [hJoyHeld], a
+ ldh [hJoyHeld], a
ld a, $3
ld [wRoute24CurScript], a
ld [wCurMapScript], a
--- a/scripts/Route2Gate.asm
+++ b/scripts/Route2Gate.asm
@@ -10,9 +10,9 @@
CheckEvent EVENT_GOT_HM05
jr nz, .asm_5d60d
ld a, 10 ; pokemon needed
- ld [hOaksAideRequirement], a
+ ldh [hOaksAideRequirement], a
ld a, HM_FLASH ; oak's aide reward
- ld [hOaksAideRewardItem], a
+ ldh [hOaksAideRewardItem], a
ld [wd11e], a
call GetItemName
ld hl, wcd6d
@@ -20,7 +20,7 @@
ld bc, ITEM_NAME_LENGTH
call CopyData
predef OaksAideScript
- ld a, [hOaksAideResult]
+ ldh a, [hOaksAideResult]
cp $1
jr nz, .asm_5d613
SetEvent EVENT_GOT_HM05
--- a/scripts/Route5Gate.asm
+++ b/scripts/Route5Gate.asm
@@ -25,13 +25,13 @@
ld a, PLAYER_DIR_LEFT
ld [wPlayerMovingDirection], a
xor a
- ld [hJoyHeld], a
+ ldh [hJoyHeld], a
callba RemoveGuardDrink
- ld a, [hItemToRemoveID]
+ ldh a, [hItemToRemoveID]
and a
jr nz, .asm_1df82
ld a, $2
- ld [hSpriteIndexOrTextID], a
+ ldh [hSpriteIndexOrTextID], a
call DisplayTextID
call Route5GateScript_1df43
ld a, $1
@@ -39,7 +39,7 @@
ret
.asm_1df82
ld a, $3
- ld [hSpriteIndexOrTextID], a
+ ldh [hSpriteIndexOrTextID], a
call DisplayTextID
ld hl, wd728
set 6, [hl]
@@ -74,7 +74,7 @@
bit 6, a
jr nz, .asm_88856
callba RemoveGuardDrink
- ld a, [hItemToRemoveID]
+ ldh a, [hItemToRemoveID]
and a
jr nz, .asm_768a2
ld hl, Route5GateText2
--- a/scripts/Route6Gate.asm
+++ b/scripts/Route6Gate.asm
@@ -19,13 +19,13 @@
ld a, PLAYER_DIR_RIGHT
ld [wPlayerMovingDirection], a
xor a
- ld [hJoyHeld], a
+ ldh [hJoyHeld], a
callba RemoveGuardDrink
- ld a, [hItemToRemoveID]
+ ldh a, [hItemToRemoveID]
and a
jr nz, .asm_1e080
ld a, $2
- ld [hSpriteIndexOrTextID], a
+ ldh [hSpriteIndexOrTextID], a
call DisplayTextID
call Route6GateScript_1e0a1
ld a, $1
@@ -35,7 +35,7 @@
ld hl, wd728
set 6, [hl]
ld a, $3
- ld [hSpriteIndexOrTextID], a
+ ldh [hSpriteIndexOrTextID], a
jp DisplayTextID
CoordsData_1e08c:
--- a/scripts/Route7Gate.asm
+++ b/scripts/Route7Gate.asm
@@ -31,13 +31,13 @@
ld a, PLAYER_DIR_UP
ld [wPlayerMovingDirection], a
xor a
- ld [hJoyHeld], a
+ ldh [hJoyHeld], a
callba RemoveGuardDrink
- ld a, [hItemToRemoveID]
+ ldh a, [hItemToRemoveID]
and a
jr nz, .asm_1e15a
ld a, $2
- ld [hSpriteIndexOrTextID], a
+ ldh [hSpriteIndexOrTextID], a
call DisplayTextID
call Route7GateScript_1e111
ld a, $1
@@ -45,7 +45,7 @@
ret
.asm_1e15a
ld a, $3
- ld [hSpriteIndexOrTextID], a
+ ldh [hSpriteIndexOrTextID], a
call DisplayTextID
ld hl, wd728
set 6, [hl]
--- a/scripts/Route8Gate.asm
+++ b/scripts/Route8Gate.asm
@@ -30,13 +30,13 @@
ld a, PLAYER_DIR_LEFT
ld [wPlayerMovingDirection], a
xor a
- ld [hJoyHeld], a
+ ldh [hJoyHeld], a
callba RemoveGuardDrink
- ld a, [hItemToRemoveID]
+ ldh a, [hItemToRemoveID]
and a
jr nz, .asm_1e220
ld a, $2
- ld [hSpriteIndexOrTextID], a
+ ldh [hSpriteIndexOrTextID], a
call DisplayTextID
call Route8GateScript_1e1d7
ld a, $1
@@ -46,7 +46,7 @@
ld hl, wd728
set 6, [hl]
ld a, $3
- ld [hSpriteIndexOrTextID], a
+ ldh [hSpriteIndexOrTextID], a
jp DisplayTextID
CoordsData_1e22c:
--- a/scripts/SSAnne2F.asm
+++ b/scripts/SSAnne2F.asm
@@ -31,19 +31,19 @@
ld a, MUSIC_MEET_RIVAL
call PlayMusic
ld a, [wCoordIndex]
- ld [hSavedCoordIndex], a
+ ldh [hSavedCoordIndex], a
ld a, HS_SS_ANNE_2F_RIVAL
ld [wMissableObjectIndex], a
predef ShowObject
call Delay3
ld a, $2
- ld [hSpriteIndex], a
+ ldh [hSpriteIndex], a
call SetSpriteMovementBytesToFF
xor a
- ld [hJoyHeld], a
+ ldh [hJoyHeld], a
ld a, $f0
ld [wJoyIgnore], a
- ld a, [hSavedCoordIndex]
+ ldh a, [hSavedCoordIndex]
cp $2
jr nz, .asm_61400
ld de, MovementData_6140c
@@ -81,9 +81,9 @@
.asm_61426
xor a ; SPRITE_FACING_DOWN
.asm_61427
- ld [hSpriteFacingDirection], a
+ ldh [hSpriteFacingDirection], a
ld a, $2
- ld [hSpriteIndex], a
+ ldh [hSpriteIndex], a
jp SetSpriteFacingDirectionAndDelay
SSAnne2Script1:
@@ -94,7 +94,7 @@
xor a
ld [wJoyIgnore], a
ld a, $2
- ld [hSpriteIndexOrTextID], a
+ ldh [hSpriteIndexOrTextID], a
call DisplayTextID
call Delay3
ld a, OPP_SONY2
@@ -129,10 +129,10 @@
ld a, $f0
ld [wJoyIgnore], a
ld a, $3
- ld [hSpriteIndexOrTextID], a
+ ldh [hSpriteIndexOrTextID], a
call DisplayTextID
ld a, $2
- ld [hSpriteIndex], a
+ ldh [hSpriteIndex], a
call SetSpriteMovementBytesToFF
ld a, [wXCoord]
cp $25
@@ -143,7 +143,7 @@
ld de, MovementData_614b7
.asm_6149a
ld a, $2
- ld [hSpriteIndex], a
+ ldh [hSpriteIndex], a
call MoveSprite
ld a, SFX_STOP_ALL_MUSIC
ld [wNewSoundID], a
--- a/scripts/SSAnneKitchen.asm
+++ b/scripts/SSAnneKitchen.asm
@@ -39,7 +39,7 @@
text_asm
ld hl, SSAnne6Text_61807
call PrintText
- ld a, [hRandomAdd]
+ ldh a, [hRandomAdd]
bit 7, a
jr z, .asm_93eb1
ld hl, SSAnne6Text_6180c
--- a/scripts/SafariZoneGate.asm
+++ b/scripts/SafariZoneGate.asm
@@ -18,12 +18,12 @@
call ArePlayerCoordsInArray
ret nc
ld a, $3
- ld [hSpriteIndexOrTextID], a
+ ldh [hSpriteIndexOrTextID], a
call DisplayTextID
ld a, $ff
ld [wJoyIgnore], a
xor a
- ld [hJoyHeld], a
+ ldh [hJoyHeld], a
ld a, SPRITE_FACING_RIGHT
ld [wSpritePlayerStateData1FacingDirection], a
ld a, [wCoordIndex]
@@ -52,11 +52,11 @@
ret nz
.SafariZoneEntranceScript2
xor a
- ld [hJoyHeld], a
+ ldh [hJoyHeld], a
ld [wJoyIgnore], a
call UpdateSprites
ld a, $4
- ld [hSpriteIndexOrTextID], a
+ ldh [hSpriteIndexOrTextID], a
call DisplayTextID
ld a, $ff
ld [wJoyIgnore], a
@@ -81,7 +81,7 @@
ld a, $f0
ld [wJoyIgnore], a
ld a, $6
- ld [hSpriteIndexOrTextID], a
+ ldh [hSpriteIndexOrTextID], a
call DisplayTextID
xor a
ld [wNumSafariBalls], a
@@ -93,7 +93,7 @@
jr .asm_75286
.asm_7527f
ld a, $5
- ld [hSpriteIndexOrTextID], a
+ ldh [hSpriteIndexOrTextID], a
call DisplayTextID
.asm_75286
ret
@@ -153,11 +153,11 @@
and a
jp nz, .PleaseComeAgain
xor a
- ld [hMoney], a
+ ldh [hMoney], a
ld a, $05
- ld [hMoney + 1], a
+ ldh [hMoney + 1], a
ld a, $00
- ld [hMoney + 2], a
+ ldh [hMoney + 2], a
call HasEnoughMoney
jr nc, .success
ld hl, .NotEnoughMoneyText
--- a/scripts/SaffronGym.asm
+++ b/scripts/SaffronGym.asm
@@ -44,7 +44,7 @@
SaffronGymText_5d068:
ld a, $a
- ld [hSpriteIndexOrTextID], a
+ ldh [hSpriteIndexOrTextID], a
call DisplayTextID
SetEvent EVENT_BEAT_SABRINA
lb bc, TM_PSYWAVE, 1
@@ -51,13 +51,13 @@
call GiveItem
jr nc, .BagFull
ld a, $b
- ld [hSpriteIndexOrTextID], a
+ ldh [hSpriteIndexOrTextID], a
call DisplayTextID
SetEvent EVENT_GOT_TM46
jr .gymVictory
.BagFull
ld a, $c
- ld [hSpriteIndexOrTextID], a
+ ldh [hSpriteIndexOrTextID], a
call DisplayTextID
.gymVictory
ld hl, wObtainedBadges
@@ -171,7 +171,7 @@
ld hl, SaffronGymText_5d167
ld de, SaffronGymText_5d167
call SaveEndBattleTextPointers
- ld a, [hSpriteIndex]
+ ldh a, [hSpriteIndex]
ld [wSpriteIndex], a
call EngageMapTrainer
call InitBattleEnemyParameters
--- a/scripts/SilphCo10F.asm
+++ b/scripts/SilphCo10F.asm
@@ -28,7 +28,7 @@
db $FF
SilphCo10Text_5a176:
- ld a, [hUnlockedSilphCoDoors]
+ ldh a, [hUnlockedSilphCoDoors]
and a
ret z
SetEvent EVENT_SILPH_CO_10_UNLOCKED_DOOR
--- a/scripts/SilphCo11F.asm
+++ b/scripts/SilphCo11F.asm
@@ -35,7 +35,7 @@
ld a, [hl]
ld c, a
xor a
- ld [hUnlockedSilphCoDoors], a
+ ldh [hUnlockedSilphCoDoors], a
pop hl
.asm_62143
ld a, [hli]
@@ -60,11 +60,11 @@
ret
.asm_6215f
xor a
- ld [hUnlockedSilphCoDoors], a
+ ldh [hUnlockedSilphCoDoors], a
ret
SilphCo11Script_62163:
- ld a, [hUnlockedSilphCoDoors]
+ ldh a, [hUnlockedSilphCoDoors]
and a
ret z
SetEvent EVENT_SILPH_CO_11_UNLOCKED_DOOR
@@ -171,14 +171,14 @@
ld a, [wCoordIndex]
ld [wcf0d], a
xor a
- ld [hJoyHeld], a
+ ldh [hJoyHeld], a
ld a, $f0
ld [wJoyIgnore], a
ld a, $3
- ld [hSpriteIndexOrTextID], a
+ ldh [hSpriteIndexOrTextID], a
call DisplayTextID
ld a, $3
- ld [hSpriteIndex], a
+ ldh [hSpriteIndex], a
call SetSpriteMovementBytesToFF
ld de, MovementData_62216
call MoveSprite
@@ -199,9 +199,9 @@
SilphCo11Script_6221a:
ld [wPlayerMovingDirection], a
ld a, $3
- ld [hSpriteIndex], a
+ ldh [hSpriteIndex], a
ld a, b
- ld [hSpriteFacingDirection], a
+ ldh [hSpriteFacingDirection], a
jp SetSpriteFacingDirectionAndDelay
SilphCo11Script5:
@@ -222,7 +222,7 @@
ld a, $f0
ld [wJoyIgnore], a
ld a, $6
- ld [hSpriteIndexOrTextID], a
+ ldh [hSpriteIndexOrTextID], a
call DisplayTextID
call GBFadeOutToBlack
call SilphCo11Script_6216d
@@ -239,7 +239,7 @@
bit 0, a
ret nz
ld a, $3
- ld [hSpriteIndex], a
+ ldh [hSpriteIndex], a
call SetSpriteMovementBytesToFF
ld a, [wcf0d]
cp $1
@@ -263,7 +263,7 @@
ld hl, SilphCo10Text_62330
ld de, SilphCo10Text_62330
call SaveEndBattleTextPointers
- ld a, [hSpriteIndex]
+ ldh a, [hSpriteIndex]
ld [wSpriteIndex], a
call EngageMapTrainer
call InitBattleEnemyParameters
--- a/scripts/SilphCo2F.asm
+++ b/scripts/SilphCo2F.asm
@@ -45,7 +45,7 @@
ld a, [hl]
ld c, a
xor a
- ld [hUnlockedSilphCoDoors], a
+ ldh [hUnlockedSilphCoDoors], a
pop hl
.asm_59d4f
ld a, [hli]
@@ -70,12 +70,12 @@
ret
.asm_59d6b
xor a
- ld [hUnlockedSilphCoDoors], a
+ ldh [hUnlockedSilphCoDoors], a
ret
SilphCo2Script_59d6f:
EventFlagAddress hl, EVENT_SILPH_CO_2_UNLOCKED_DOOR1
- ld a, [hUnlockedSilphCoDoors]
+ ldh a, [hUnlockedSilphCoDoors]
and a
ret z
cp $1
--- a/scripts/SilphCo3F.asm
+++ b/scripts/SilphCo3F.asm
@@ -39,7 +39,7 @@
SilphCo3Script_59fad:
EventFlagAddress hl, EVENT_SILPH_CO_3_UNLOCKED_DOOR1
- ld a, [hUnlockedSilphCoDoors]
+ ldh a, [hUnlockedSilphCoDoors]
and a
ret z
cp $1
--- a/scripts/SilphCo4F.asm
+++ b/scripts/SilphCo4F.asm
@@ -45,7 +45,7 @@
ld a, [hl]
ld c, a
xor a
- ld [hUnlockedSilphCoDoors], a
+ ldh [hUnlockedSilphCoDoors], a
pop hl
.asm_19d69
ld a, [hli]
@@ -70,12 +70,12 @@
ret
.asm_19d85
xor a
- ld [hUnlockedSilphCoDoors], a
+ ldh [hUnlockedSilphCoDoors], a
ret
SilphCo4Script_19d89:
EventFlagAddress hl, EVENT_SILPH_CO_4_UNLOCKED_DOOR1
- ld a, [hUnlockedSilphCoDoors]
+ ldh a, [hUnlockedSilphCoDoors]
and a
ret z
cp $1
--- a/scripts/SilphCo5F.asm
+++ b/scripts/SilphCo5F.asm
@@ -49,7 +49,7 @@
SilphCo5Script_19f9e:
EventFlagAddress hl, EVENT_SILPH_CO_5_UNLOCKED_DOOR1
- ld a, [hUnlockedSilphCoDoors]
+ ldh a, [hUnlockedSilphCoDoors]
and a
ret z
cp $1
--- a/scripts/SilphCo6F.asm
+++ b/scripts/SilphCo6F.asm
@@ -28,7 +28,7 @@
db $FF
SilphCo6Script_1a1e6:
- ld a, [hUnlockedSilphCoDoors]
+ ldh a, [hUnlockedSilphCoDoors]
and a
ret z
SetEvent EVENT_SILPH_CO_6_UNLOCKED_DOOR
--- a/scripts/SilphCo7F.asm
+++ b/scripts/SilphCo7F.asm
@@ -55,7 +55,7 @@
ld a, [hl]
ld c, a
xor a
- ld [hUnlockedSilphCoDoors], a
+ ldh [hUnlockedSilphCoDoors], a
pop hl
.asm_51bd4
ld a, [hli]
@@ -80,12 +80,12 @@
ret
.asm_51bf0
xor a
- ld [hUnlockedSilphCoDoors], a
+ ldh [hUnlockedSilphCoDoors], a
ret
SilphCo7Text_51bf4:
EventFlagAddress hl, EVENT_SILPH_CO_7_UNLOCKED_DOOR1
- ld a, [hUnlockedSilphCoDoors]
+ ldh a, [hUnlockedSilphCoDoors]
and a
ret z
cp $1
@@ -125,7 +125,7 @@
call ArePlayerCoordsInArray
jp nc, CheckFightingMapTrainers
xor a
- ld [hJoyHeld], a
+ ldh [hJoyHeld], a
ld a, $f0
ld [wJoyIgnore], a
ld a, PLAYER_DIR_DOWN
@@ -137,10 +137,10 @@
ld a, MUSIC_MEET_RIVAL
call PlayMusic
ld a, $9
- ld [hSpriteIndexOrTextID], a
+ ldh [hSpriteIndexOrTextID], a
call DisplayTextID
ld a, $9
- ld [hSpriteIndex], a
+ ldh [hSpriteIndex], a
call SetSpriteMovementBytesToFF
ld de, MovementData_51c7d
ld a, [wCoordIndex]
@@ -150,7 +150,7 @@
inc de
.asm_51c6c
ld a, $9
- ld [hSpriteIndex], a
+ ldh [hSpriteIndex], a
call MoveSprite
ld a, $3
jp SilphCo7Text_51c10
@@ -174,7 +174,7 @@
xor a
ld [wJoyIgnore], a
ld a, $d
- ld [hSpriteIndexOrTextID], a
+ ldh [hSpriteIndexOrTextID], a
call DisplayTextID
call Delay3
ld hl, wd72d
@@ -212,12 +212,12 @@
ld a, PLAYER_DIR_DOWN
ld [wPlayerMovingDirection], a
ld a, $9
- ld [hSpriteIndex], a
+ ldh [hSpriteIndex], a
ld a, SPRITE_FACING_UP
- ld [hSpriteFacingDirection], a
+ ldh [hSpriteFacingDirection], a
call SetSpriteFacingDirectionAndDelay
ld a, $f
- ld [hSpriteIndexOrTextID], a
+ ldh [hSpriteIndexOrTextID], a
call DisplayTextID
ld a, SFX_STOP_ALL_MUSIC
ld [wNewSoundID], a
@@ -230,7 +230,7 @@
ld de, MovementData_51d1a
.asm_51d0e
ld a, $9
- ld [hSpriteIndex], a
+ ldh [hSpriteIndex], a
call MoveSprite
ld a, $5
jp SilphCo7Text_51c10
--- a/scripts/SilphCo8F.asm
+++ b/scripts/SilphCo8F.asm
@@ -35,7 +35,7 @@
ld a, [hl]
ld c, a
xor a
- ld [hUnlockedSilphCoDoors], a
+ ldh [hUnlockedSilphCoDoors], a
pop hl
.asm_5654d
ld a, [hli]
@@ -60,11 +60,11 @@
ret
.asm_56569
xor a
- ld [hUnlockedSilphCoDoors], a
+ ldh [hUnlockedSilphCoDoors], a
ret
SilphCo8Script_5656d:
- ld a, [hUnlockedSilphCoDoors]
+ ldh a, [hUnlockedSilphCoDoors]
and a
ret z
SetEvent EVENT_SILPH_CO_8_UNLOCKED_DOOR
--- a/scripts/SilphCo9F.asm
+++ b/scripts/SilphCo9F.asm
@@ -65,7 +65,7 @@
ld a, [hl]
ld c, a
xor a
- ld [hUnlockedSilphCoDoors], a
+ ldh [hUnlockedSilphCoDoors], a
pop hl
.asm_5d843
ld a, [hli]
@@ -90,12 +90,12 @@
ret
.asm_5d85f
xor a
- ld [hUnlockedSilphCoDoors], a
+ ldh [hUnlockedSilphCoDoors], a
ret
SilphCo9Script_5d863:
EventFlagAddress hl, EVENT_SILPH_CO_9_UNLOCKED_DOOR1
- ld a, [hUnlockedSilphCoDoors]
+ ldh a, [hUnlockedSilphCoDoors]
and a
ret z
cp $1
--- a/scripts/TradeCenter.asm
+++ b/scripts/TradeCenter.asm
@@ -1,14 +1,14 @@
TradeCenter_Script:
call EnableAutoTextBoxDrawing
- ld a, [hSerialConnectionStatus]
+ ldh a, [hSerialConnectionStatus]
cp USING_INTERNAL_CLOCK
ld a, SPRITE_FACING_LEFT
jr z, .next
ld a, SPRITE_FACING_RIGHT
.next
- ld [hSpriteFacingDirection], a
+ ldh [hSpriteFacingDirection], a
ld a, $1
- ld [hSpriteIndex], a
+ ldh [hSpriteIndex], a
call SetSpriteFacingDirection
ld hl, wd72d
bit 0, [hl]
@@ -21,7 +21,7 @@
ld [hl], a
ld a, SPRITE_FACING_LEFT
ld [wSprite01StateData1FacingDirection], a
- ld a, [hSerialConnectionStatus]
+ ldh a, [hSerialConnectionStatus]
cp USING_INTERNAL_CLOCK
ret z
ld a, $7
--- a/scripts/VermilionCity.asm
+++ b/scripts/VermilionCity.asm
@@ -15,7 +15,7 @@
.setFirstLockTrashCanIndex
call Random
- ld a, [hRandomSub]
+ ldh a, [hRandomSub]
and $e
ld [wFirstLockTrashCanIndex], a
ret
@@ -45,10 +45,10 @@
call ArePlayerCoordsInArray
ret nc
xor a
- ld [hJoyHeld], a
+ ldh [hJoyHeld], a
ld [wcf0d], a
ld a, $3
- ld [hSpriteIndexOrTextID], a
+ ldh [hSpriteIndexOrTextID], a
call DisplayTextID
CheckEvent EVENT_SS_ANNE_LEFT
jr nz, .shipHasDeparted
@@ -98,7 +98,7 @@
ret nz
xor a
ld [wJoyIgnore], a
- ld [hJoyHeld], a
+ ldh [hJoyHeld], a
ld a, $0
ld [wVermilionCityCurScript], a
ret
--- a/scripts/VermilionDock.asm
+++ b/scripts/VermilionDock.asm
@@ -57,12 +57,12 @@
ld a, $14 ; water tile
call FillMemory
ld a, 1
- ld [hAutoBGTransferEnabled], a
+ ldh [hAutoBGTransferEnabled], a
call Delay3
xor a
- ld [hAutoBGTransferEnabled], a
+ ldh [hAutoBGTransferEnabled], a
ld [wSSAnneSmokeDriftAmount], a
- ld [rOBP1], a
+ ldh [rOBP1], a
ld a, 88
ld [wSSAnneSmokeX], a
ld hl, wMapViewVRAMPointer
@@ -104,11 +104,11 @@
dec e
jr nz, .asm_1dbfa
xor a
- ld [rWY], a
- ld [hWY], a
+ ldh [rWY], a
+ ldh [hWY], a
call VermilionDock_EraseSSAnne
ld a, $90
- ld [hWY], a
+ ldh [hWY], a
ld a, $1
ld [wUpdateSpritesEnabled], a
pop hl
@@ -167,13 +167,13 @@
ld h, $0
ld l, $80
.asm_1dc86
- ld a, [rLY]
+ ldh a, [rLY]
cp l
jr nz, .asm_1dc86
ld a, h
- ld [rSCX], a
+ ldh [rSCX], a
.asm_1dc8e
- ld a, [rLY]
+ ldh a, [rLY]
cp h
jr z, .asm_1dc8e
ret
--- a/scripts/VermilionGym.asm
+++ b/scripts/VermilionGym.asm
@@ -63,7 +63,7 @@
VermilionGymReceiveTM24:
ld a, $6
- ld [hSpriteIndexOrTextID], a
+ ldh [hSpriteIndexOrTextID], a
call DisplayTextID
SetEvent EVENT_BEAT_LT_SURGE
lb bc, TM_THUNDERBOLT, 1
@@ -70,13 +70,13 @@
call GiveItem
jr nc, .BagFull
ld a, $7
- ld [hSpriteIndexOrTextID], a
+ ldh [hSpriteIndexOrTextID], a
call DisplayTextID
SetEvent EVENT_GOT_TM24
jr .gymVictory
.BagFull
ld a, $8
- ld [hSpriteIndexOrTextID], a
+ ldh [hSpriteIndexOrTextID], a
call DisplayTextID
.gymVictory
ld hl, wObtainedBadges
@@ -150,7 +150,7 @@
ld hl, ReceivedThunderbadgeText
ld de, ReceivedThunderbadgeText
call SaveEndBattleTextPointers
- ld a, [hSpriteIndex]
+ ldh a, [hSpriteIndex]
ld [wSpriteIndex], a
call EngageMapTrainer
call InitBattleEnemyParameters
@@ -157,7 +157,7 @@
ld a, $3
ld [wGymLeaderNo], a
xor a
- ld [hJoyHeld], a
+ ldh [hJoyHeld], a
ld a, $3 ; set script index to LT Surge post-battle script
ld [wVermilionGymCurScript], a
ld [wCurMapScript], a
--- a/scripts/ViridianCity.asm
+++ b/scripts/ViridianCity.asm
@@ -30,10 +30,10 @@
cp $20
ret nz
ld a, $e
- ld [hSpriteIndexOrTextID], a
+ ldh [hSpriteIndexOrTextID], a
call DisplayTextID
xor a
- ld [hJoyHeld], a
+ ldh [hJoyHeld], a
call ViridianCityScript_190cf
ld a, $3
ld [wViridianCityCurScript], a
@@ -49,10 +49,10 @@
cp $13
ret nz
ld a, $5
- ld [hSpriteIndexOrTextID], a
+ ldh [hSpriteIndexOrTextID], a
call DisplayTextID
xor a
- ld [hJoyHeld], a
+ ldh [hJoyHeld], a
call ViridianCityScript_190cf
ld a, $3
ld [wViridianCityCurScript], a
@@ -60,13 +60,13 @@
ViridianCityScript1:
ld a, [wSprite03StateData1YPixels]
- ld [hSpriteScreenYCoord], a
+ ldh [hSpriteScreenYCoord], a
ld a, [wSprite03StateData1XPixels]
- ld [hSpriteScreenXCoord], a
+ ldh [hSpriteScreenXCoord], a
ld a, [wSprite03StateData2MapY]
- ld [hSpriteMapYCoord], a
+ ldh [hSpriteMapYCoord], a
ld a, [wSprite03StateData2MapX]
- ld [hSpriteMapXCoord], a
+ ldh [hSpriteMapXCoord], a
xor a
ld [wListScrollOffset], a
@@ -82,13 +82,13 @@
ret
ViridianCityScript2:
- ld a, [hSpriteScreenYCoord]
+ ldh a, [hSpriteScreenYCoord]
ld [wSprite03StateData1YPixels], a
- ld a, [hSpriteScreenXCoord]
+ ldh a, [hSpriteScreenXCoord]
ld [wSprite03StateData1XPixels], a
- ld a, [hSpriteMapYCoord]
+ ldh a, [hSpriteMapYCoord]
ld [wSprite03StateData2MapY], a
- ld a, [hSpriteMapXCoord]
+ ldh a, [hSpriteMapXCoord]
ld [wSprite03StateData2MapX], a
call UpdateSprites
call Delay3
@@ -95,7 +95,7 @@
xor a
ld [wJoyIgnore], a
ld a, $f
- ld [hSpriteIndexOrTextID], a
+ ldh [hSpriteIndexOrTextID], a
call DisplayTextID
xor a
ld [wBattleType], a
--- a/scripts/ViridianGym.asm
+++ b/scripts/ViridianGym.asm
@@ -138,7 +138,7 @@
ld [wJoyIgnore], a
ViridianGymScript3_74995:
ld a, $c
- ld [hSpriteIndexOrTextID], a
+ ldh [hSpriteIndexOrTextID], a
call DisplayTextID
SetEvent EVENT_BEAT_VIRIDIAN_GYM_GIOVANNI
lb bc, TM_FISSURE, 1
@@ -145,13 +145,13 @@
call GiveItem
jr nc, .BagFull
ld a, $d
- ld [hSpriteIndexOrTextID], a
+ ldh [hSpriteIndexOrTextID], a
call DisplayTextID
SetEvent EVENT_GOT_TM27
jr .gymVictory
.BagFull
ld a, $e
- ld [hSpriteIndexOrTextID], a
+ ldh [hSpriteIndexOrTextID], a
call DisplayTextID
.gymVictory
ld hl, wObtainedBadges
@@ -289,7 +289,7 @@
ld hl, ViridianGymText_74ad3
ld de, ViridianGymText_74ad3
call SaveEndBattleTextPointers
- ld a, [hSpriteIndex]
+ ldh a, [hSpriteIndex]
ld [wSpriteIndex], a
call EngageMapTrainer
call InitBattleEnemyParameters
--- a/scripts/ViridianMart.asm
+++ b/scripts/ViridianMart.asm
@@ -27,7 +27,7 @@
ViridianMartScript0:
call UpdateSprites
ld a, $4
- ld [hSpriteIndexOrTextID], a
+ ldh [hSpriteIndexOrTextID], a
call DisplayTextID
ld hl, wSimulatedJoypadStatesEnd
ld de, RLEMovement1d4bb
@@ -50,7 +50,7 @@
ret nz
call Delay3
ld a, $5
- ld [hSpriteIndexOrTextID], a
+ ldh [hSpriteIndexOrTextID], a
call DisplayTextID
lb bc, OAKS_PARCEL, 1
call GiveItem
--- a/scripts/WardensHouse.asm
+++ b/scripts/WardensHouse.asm
@@ -32,7 +32,7 @@
ld hl, WardenTeethText1
call PrintText
ld a, GOLD_TEETH
- ld [hItemToRemoveID], a
+ ldh [hItemToRemoveID], a
callba RemoveItemByID
SetEvent EVENT_GAVE_GOLD_TEETH
.asm_60cba
@@ -95,7 +95,7 @@
FuchsiaHouse2Text5:
FuchsiaHouse2Text4:
text_asm
- ld a, [hSpriteIndex]
+ ldh a, [hSpriteIndex]
cp $4
ld hl, FuchsiaHouse2Text_7517b
jr nz, .asm_4c9a2