Specify the ldh instruction, don't turn ld into ldh

This commit is contained in:
Rangi 2020-07-06 19:03:05 -04:00
parent c480632d54
commit 772fcc7588
219 changed files with 2556 additions and 2556 deletions

View file

@ -6,34 +6,34 @@ ResetStatusAndHalveMoneyOnBlackout::
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

View file

@ -28,7 +28,7 @@ PrintCardKeyText:
call GetCoordsInFrontOfPlayer
push de
tx_pre_id CardKeySuccessText
ld [hSpriteIndexOrTextID], a
ldh [hSpriteIndexOrTextID], a
call PrintPredefTextID
pop de
srl d
@ -55,7 +55,7 @@ PrintCardKeyText:
jp PlaySound
.noCardKey
tx_pre_id CardKeyFailText
ld [hSpriteIndexOrTextID], a
ldh [hSpriteIndexOrTextID], a
jp PrintPredefTextID
SilphCoMapList:

View file

@ -35,7 +35,7 @@ GiveFossilToCinnabarLab::
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 @@ GiveFossilToCinnabarLab::
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 @@ PrintFossilsInBag:
; 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 @@ PrintFossilsInBag:
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

View file

@ -62,7 +62,7 @@ DisplayDiploma::
call Delay3
call GBPalNormal
ld a, $90
ld [rOBP0], a
ldh [rOBP0], a
call WaitForTextScrollButtonPress
ld hl, wd730
res 6, [hl]

View file

@ -67,9 +67,9 @@ HiddenCoins:
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 @@ HiddenCoins:
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

View file

@ -24,7 +24,7 @@ PrintBookshelfText::
pop af
call PrintPredefTextID
xor a
ld [hFFDB], a
ldh [hFFDB], a
ret
.nextBookshelfEntry1
inc hl
@ -33,7 +33,7 @@ PrintBookshelfText::
jr .loop
.noMatch
ld a, $ff
ld [hFFDB], a
ldh [hFFDB], a
jpba PrintCardKeyText
INCLUDE "data/tilesets/bookshelf_tile_ids.asm"

View file

@ -12,14 +12,14 @@ CinnabarGymQuiz::
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,18 +77,18 @@ CinnabarGymGateFlagAction:
CinnabarGymQuiz_1ea92:
call YesNoChoice
ld a, [hGymGateAnswer]
ldh a, [hGymGateAnswer]
ld c, a
ld a, [wCurrentMenuItem]
cp c
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 @@ CinnabarGymQuiz_1ea92:
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 @@ CinnabarGymQuiz_1ea92:
ld a, c
and a
ret nz
ld a, [hGymGateIndex]
ldh a, [hGymGateIndex]
add $2
ld [wOpponentAfterWrongAnswer], a
ret
@ -122,7 +122,7 @@ CinnabarGymQuizCorrectText:
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 @@ UpdateCinnabarGymGateTileBlocks_::
; 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 @@ UpdateCinnabarGymGateTileBlocks_::
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

View file

@ -26,10 +26,10 @@ DisplayMonFrontSpriteInBox:
; 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,12 +41,12 @@ DisplayMonFrontSpriteInBox:
ld de, vChars1 + $310
call LoadMonFrontSprite
ld a, $80
ld [hStartTileID], a
ldh [hStartTileID], a
coord hl, 10, 11
predef AnimateSendingOutMon
call WaitForTextScrollButtonPress
call LoadScreenTilesFromBuffer1
call Delay3
ld a, $90
ld [hWY], a
ldh [hWY], a
ret

View file

@ -37,12 +37,12 @@ SafariZoneGameOver:
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

View file

@ -8,15 +8,15 @@ TownMapText::
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
res 6, [hl]
ld de, TextScriptEnd
push de
ld a, [hLoadedROMBank]
ldh a, [hLoadedROMBank]
push af
jp CloseTextDisplay

View file

@ -56,12 +56,12 @@ GymTrashScript:
; 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

View file

@ -9,16 +9,16 @@ OaksAideScript:
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
.giveItem
ld hl, OaksAideHereYouGoText
call PrintText
ld a, [hOaksAideRewardItem]
ldh a, [hOaksAideRewardItem]
ld b, a
ld c, 1
call GiveItem
@ -42,7 +42,7 @@ OaksAideScript:
call PrintText
ld a, $ff
.done
ld [hOaksAideResult], a
ldh [hOaksAideResult], a
ret
OaksAideHiText:

View file

@ -1,7 +1,7 @@
PickUpItem:
call EnableAutoTextBoxDrawing
ld a, [hSpriteIndexOrTextID]
ldh a, [hSpriteIndexOrTextID]
ld b, a
ld hl, wMissableObjectList
.missableObjectsListLoop
@ -15,10 +15,10 @@ PickUpItem:
.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 @@ PickUpItem:
call GiveItem
jr nc, .BagFull
ld a, [hMissableObjectIndex]
ldh a, [hMissableObjectIndex]
ld [wMissableObjectIndex], a
predef HideObject
ld a, 1

View file

@ -52,7 +52,7 @@ ApplyOutOfBattlePoisonDamage:
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 @@ ApplyOutOfBattlePoisonDamage:
jr nz, .noBlackOut
call EnableAutoTextBoxDrawing
ld a, TEXT_BLACKED_OUT
ld [hSpriteIndexOrTextID], a
ldh [hSpriteIndexOrTextID], a
call DisplayTextID
ld hl, wd72e
set 5, [hl]

View file

@ -3,17 +3,17 @@ DisplayDexRating:
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 @@ DisplayDexRating:
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

View file

@ -77,7 +77,7 @@ DisplayPokemartDialogue_::
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 @@ DisplayPokemartDialogue_::
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

View file

@ -64,7 +64,7 @@ GetPrizeMenuId:
; 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 @@ LoadCoinsToSubtract:
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:

View file

@ -2,7 +2,7 @@ RemoveGuardDrink::
ld hl, GuardDrinksList
.drinkLoop
ld a, [hli]
ld [hItemToRemoveID], a
ldh [hItemToRemoveID], a
and a
ret z
push hl

View file

@ -37,17 +37,17 @@ VendingMachineMenu::
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
jp PrintText
.enoughMoney
call LoadVendingMachineItem
ld a, [hVendingMachineItem]
ldh a, [hVendingMachineItem]
ld b, a
ld c, 1
call GiveItem
@ -121,13 +121,13 @@ LoadVendingMachineItem:
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"