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

@ -5,7 +5,7 @@ DisplayTextIDInit::
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 @@ DisplayTextIDInit::
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

View file

@ -6,10 +6,10 @@ PKMNLeaguePC:
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 @@ PKMNLeaguePC:
jr nz, .loop
.doneShowingTeams
pop af
ld [hTilesetType], a
ldh [hTilesetType], a
pop af
ld [wUpdateSpritesEnabled], a
pop hl
@ -56,7 +56,7 @@ LeaguePCShowTeam:
push bc
call LeaguePCShowMon
call WaitForTextScrollButtonPress
ld a, [hJoyHeld]
ldh a, [hJoyHeld]
bit 1, a
jr nz, .exit
ld hl, wHallOfFame + HOF_MON

View file

@ -94,11 +94,11 @@ MainMenu:
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 @@ LinkMenu:
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 @@ LinkMenu:
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 @@ StartNewGame:
; 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 @@ CableClubOptionsText:
DisplayContinueGameInfo:
xor a
ld [hAutoBGTransferEnabled], a
ldh [hAutoBGTransferEnabled], a
coord hl, 4, 7
ld b, 8
ld c, 14
@ -362,13 +362,13 @@ DisplayContinueGameInfo:
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 @@ PrintSaveScreenText:
coord hl, 13, 8
call PrintPlayTime
ld a, $1
ld [hAutoBGTransferEnabled], a
ldh [hAutoBGTransferEnabled], a
ld c, 30
jp DelayFrames
@ -465,14 +465,14 @@ DisplayOptionMenu:
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
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

View file

@ -132,7 +132,7 @@ DisplayNamingScreen:
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 @@ ED_TileEnd:
PrintAlphabet:
xor a
ld [hAutoBGTransferEnabled], a
ldh [hAutoBGTransferEnabled], a
ld a, [wAlphabetCase]
and a
ld de, LowerCaseAlphabet
@ -362,7 +362,7 @@ PrintAlphabet:
jr nz, .outerLoop
call PlaceString
ld a, $1
ld [hAutoBGTransferEnabled], a
ldh [hAutoBGTransferEnabled], a
jp Delay3
INCLUDE "data/text/alphabets.asm"

View file

@ -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 @@ RedrawPartyMenu_::
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 @@ RedrawPartyMenu_::
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 @@ RedrawPartyMenu_::
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 @@ RedrawPartyMenu_::
pop af
ld [hl], a
ld a, 1
ld [hAutoBGTransferEnabled], a
ldh [hAutoBGTransferEnabled], a
call Delay3
jp GBPalNormal
.printItemUseMessage

View file

@ -117,10 +117,10 @@ AccessedMyPCText:
; 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 @@ RemoveItemByID::
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

View file

@ -10,7 +10,7 @@ ShowPokedexMenu:
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 @@ ShowPokedexMenu:
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 @@ HandlePokedexSideMenu:
; 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 @@ HandlePokedexListMenu:
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 @@ HandlePokedexListMenu:
dec d
jr nz, .printPokemonLoop
ld a, 01
ld [hAutoBGTransferEnabled], a
ldh [hAutoBGTransferEnabled], a
call Delay3
call GBPalNormal
call HandleMenuInput
@ -400,7 +400,7 @@ ShowPokedexDataInternal:
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 @@ ShowPokedexDataInternal:
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 @@ ShowPokedexDataInternal:
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 @@ ShowPokedexDataInternal:
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 @@ ShowPokedexDataInternal:
ld hl, wd72c
res 1, [hl]
ld a, $77 ; max volume
ld [rNR50], a
ldh [rNR50], a
ret
HeightWeightText:

View file

@ -70,7 +70,7 @@ LoadSAV0:
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 @@ SaveSAVtoSRAM0:
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 @@ CopyBoxToOrFromSRAM:
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 @@ DisplayChangeBoxMenu:
dec a
jr nz, .loop
ld a, 1
ld [hAutoBGTransferEnabled], a
ldh [hAutoBGTransferEnabled], a
ret
ChooseABoxText:

View file

@ -50,7 +50,7 @@ StartMenu_Pokemon::
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,21 +239,21 @@ StartMenu_Pokemon::
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
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 @@ StartMenu_TrainerInfo::
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 @@ StartMenu_TrainerInfo::
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_SaveReset::
StartMenu_Option::
xor a
ld [hAutoBGTransferEnabled], a
ldh [hAutoBGTransferEnabled], a
call ClearScreen
call UpdateSprites
callab DisplayOptionMenu
@ -737,10 +737,10 @@ SwitchPartyMon_InitVarOrSwapData:
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

View file

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

View file

@ -584,7 +584,7 @@ DisplayFieldMoveMonMenu:
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 @@ DisplayFieldMoveMonMenu:
.donePrintingNames
pop hl
ld a, [wFieldMovesLeftmostXCoord]
ld [hFieldMoveMonMenuTopMenuItemX], a
ldh [hFieldMoveMonMenuTopMenuItemX], a
coord hl, 0, 12
ld a, [wFieldMovesLeftmostXCoord]
inc a