summaryrefslogtreecommitdiff
path: root/home.asm
diff options
context:
space:
mode:
Diffstat (limited to 'home.asm')
-rw-r--r--home.asm412
1 files changed, 206 insertions, 206 deletions
diff --git a/home.asm b/home.asm
index 2090e599..0db583a6 100644
--- a/home.asm
+++ b/home.asm
@@ -118,7 +118,7 @@ INCLUDE "data/map_header_pointers.asm"
INCLUDE "home/overworld.asm"
-CheckForUserInterruption:: ; 12f8 (0:12f8)
+CheckForUserInterruption::
; Return carry if Up+Select+B, Start or A are pressed in c frames.
; Used only in the intro and title screen.
call DelayFrame
@@ -148,7 +148,7 @@ CheckForUserInterruption:: ; 12f8 (0:12f8)
; function to load position data for destination warp when switching maps
; INPUT:
; a = ID of destination warp within destination map
-LoadDestinationWarpPosition:: ; 1313 (0:1313)
+LoadDestinationWarpPosition::
ld b,a
ld a,[H_LOADEDROMBANK]
push af
@@ -170,7 +170,7 @@ LoadDestinationWarpPosition:: ; 1313 (0:1313)
ret
-DrawHPBar:: ; 1336 (0:1336)
+DrawHPBar::
; Draw an HP bar d tiles long, and fill it to e pixels.
; If c is nonzero, show at least a sliver regardless.
; The right end of the bar changes with [wHPBarType].
@@ -252,11 +252,11 @@ DrawHPBar:: ; 1336 (0:1336)
; [wcf91] = pokemon ID
; wLoadedMon = base address of pokemon data
; wMonHeader = base address of base stats
-LoadMonData:: ; 1372 (0:1372)
+LoadMonData::
jpab LoadMonData_
-OverwritewMoves:: ; 137a (0:137a)
+OverwritewMoves::
; Write c to [wMoves + b]. Unused.
ld hl, wMoves
ld e, b
@@ -266,11 +266,11 @@ OverwritewMoves:: ; 137a (0:137a)
ld [hl], a
ret
-LoadFlippedFrontSpriteByMonIndex:: ; 1384 (0:1384)
+LoadFlippedFrontSpriteByMonIndex::
ld a, 1
ld [wSpriteFlipped], a
-LoadFrontSpriteByMonIndex:: ; 1389 (0:1389)
+LoadFrontSpriteByMonIndex::
push hl
ld a, [wd11e]
push af
@@ -311,13 +311,13 @@ LoadFrontSpriteByMonIndex:: ; 1389 (0:1389)
ret
-PlayCry:: ; 13d0 (0:13d0)
+PlayCry::
; Play monster a's cry.
call GetCryData
call PlaySound
jp WaitForSoundToFinish
-GetCryData:: ; 13d9 (0:13d9)
+GetCryData::
; Load cry data for monster a.
dec a
ld c, a
@@ -348,7 +348,7 @@ GetCryData:: ; 13d9 (0:13d9)
ret
-DisplayPartyMenu:: ; 13fc (0:13fc)
+DisplayPartyMenu::
ld a,[hTilesetType]
push af
xor a
@@ -359,7 +359,7 @@ DisplayPartyMenu:: ; 13fc (0:13fc)
call DrawPartyMenu
jp HandlePartyMenuInput
-GoBackToPartyMenu:: ; 1411 (0:1411)
+GoBackToPartyMenu::
ld a,[hTilesetType]
push af
xor a
@@ -368,7 +368,7 @@ GoBackToPartyMenu:: ; 1411 (0:1411)
call RedrawPartyMenu
jp HandlePartyMenuInput
-PartyMenuInit:: ; 1420 (0:1420)
+PartyMenuInit::
ld a, 1 ; hardcoded bank
call BankswitchHome
call LoadHpBarAndStatusTilePatterns
@@ -407,7 +407,7 @@ PartyMenuInit:: ; 1420 (0:1420)
ld [hl], a ; old menu item ID
ret
-HandlePartyMenuInput:: ; 145a (0:145a)
+HandlePartyMenuInput::
ld a,1
ld [wMenuWrappingEnabled],a
ld a,$40
@@ -463,14 +463,14 @@ HandlePartyMenuInput:: ; 145a (0:145a)
callba SwitchPartyMon
jr HandlePartyMenuInput
-DrawPartyMenu:: ; 14d4 (0:14d4)
+DrawPartyMenu::
ld hl, DrawPartyMenu_
jr DrawPartyMenuCommon
-RedrawPartyMenu:: ; 14d9 (0:14d9)
+RedrawPartyMenu::
ld hl, RedrawPartyMenu_
-DrawPartyMenuCommon:: ; 14dc (0:14dc)
+DrawPartyMenuCommon::
ld b, BANK(RedrawPartyMenu_)
jp Bankswitch
@@ -478,7 +478,7 @@ DrawPartyMenuCommon:: ; 14dc (0:14dc)
; INPUT:
; de = address of status condition
; hl = destination address
-PrintStatusCondition:: ; 14e1 (0:14e1)
+PrintStatusCondition::
push de
dec de
dec de ; de = address of current HP
@@ -514,7 +514,7 @@ PrintStatusConditionNotFainted: ; 14f6
; INPUT:
; hl = destination address
; [wLoadedMonLevel] = level
-PrintLevel:: ; 150b (0:150b)
+PrintLevel::
ld a,$6e ; ":L" tile ID
ld [hli],a
ld c,2 ; number of digits
@@ -530,19 +530,19 @@ PrintLevel:: ; 150b (0:150b)
; INPUT:
; hl = destination address
; [wLoadedMonLevel] = level
-PrintLevelFull:: ; 151b (0:151b)
+PrintLevelFull::
ld a,$6e ; ":L" tile ID
ld [hli],a
ld c,3 ; number of digits
ld a,[wLoadedMonLevel] ; level
-PrintLevelCommon:: ; 1523 (0:1523)
+PrintLevelCommon::
ld [wd11e],a
ld de,wd11e
ld b,LEFT_ALIGN | 1 ; 1 byte
jp PrintNumber
-GetwMoves:: ; 152e (0:152e)
+GetwMoves::
; Unused. Returns the move at index a from wMoves in a
ld hl,wMoves
ld c,a
@@ -554,7 +554,7 @@ GetwMoves:: ; 152e (0:152e)
; copies the base stat data of a pokemon to wMonHeader
; INPUT:
; [wd0b5] = pokemon ID
-GetMonHeader:: ; 1537 (0:1537)
+GetMonHeader::
ld a,[H_LOADEDROMBANK]
push af
ld a,BANK(BaseStats)
@@ -618,12 +618,12 @@ GetMonHeader:: ; 1537 (0:1537)
ret
; copy party pokemon's name to wcd6d
-GetPartyMonName2:: ; 15b4 (0:15b4)
+GetPartyMonName2::
ld a,[wWhichPokemon] ; index within party
ld hl,wPartyMonNicks
; this is called more often
-GetPartyMonName:: ; 15ba (0:15ba)
+GetPartyMonName::
push hl
push bc
call SkipFixedLengthTextEntries ; add NAME_LENGTH to hl, a times
@@ -649,7 +649,7 @@ GetPartyMonName:: ; 15ba (0:15ba)
; bits 0-4: length of BCD number in bytes
; Note that bits 5 and 7 are modified during execution. The above reflects
; their meaning at the beginning of the functions's execution.
-PrintBCDNumber:: ; 15cd (0:15cd)
+PrintBCDNumber::
ld b,c ; save flags in b
res 7,c
res 6,c
@@ -687,7 +687,7 @@ PrintBCDNumber:: ; 15cd (0:15cd)
.done
ret
-PrintBCDDigit:: ; 1604 (0:1604)
+PrintBCDDigit::
and $f
and a
jr z,.zeroDigit
@@ -717,7 +717,7 @@ PrintBCDDigit:: ; 1604 (0:1604)
; uncompresses the front or back sprite of the specified mon
; assumes the corresponding mon header is already loaded
; hl contains offset to sprite pointer ($b for front or $d for back)
-UncompressMonSprite:: ; 1627 (0:1627)
+UncompressMonSprite::
ld bc,wMonHeader
add hl,bc
ld a,[hli]
@@ -762,7 +762,7 @@ UncompressMonSprite:: ; 1627 (0:1627)
jp UncompressSpriteData
; de: destination location
-LoadMonFrontSprite:: ; 1665 (0:1665)
+LoadMonFrontSprite::
push de
ld hl, wMonHFrontSprite - wMonHeader
call UncompressMonSprite
@@ -776,7 +776,7 @@ LoadMonFrontSprite:: ; 1665 (0:1665)
; calculates alignment parameters to place both sprite chunks in the center of the 7*7 tile sprite buffers
; de: destination location
; a,c: sprite dimensions (in tiles of 8x8 each)
-LoadUncompressedSpriteData:: ; 1672 (0:1672)
+LoadUncompressedSpriteData::
push de
and $f
ld [H_SPRITEWIDTH], a ; each byte contains 8 pixels (in 1bpp), so tiles=bytes for width
@@ -825,7 +825,7 @@ LoadUncompressedSpriteData:: ; 1672 (0:1672)
; 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:: ; 16c2 (0:16c2)
+AlignSpriteDataCentered::
ld a, [H_SPRITEOFFSET]
ld b, $0
ld c, a
@@ -851,7 +851,7 @@ AlignSpriteDataCentered:: ; 16c2 (0:16c2)
ret
; fills the sprite buffer (pointed to in hl) with zeros
-ZeroSpriteBuffer:: ; 16df (0:16df)
+ZeroSpriteBuffer::
ld bc, SPRITEBUFFERSIZE
.nextByteLoop
xor a
@@ -865,7 +865,7 @@ ZeroSpriteBuffer:: ; 16df (0:16df)
; combines the (7*7 tiles, 1bpp) sprite chunks in buffer 0 and 1 into a 2bpp sprite located in buffer 1 through 2
; in the resulting sprite, the rows of the two source sprites are interlaced
; de: output address
-InterlaceMergeSpriteBuffers:: ; 16ea (0:16ea)
+InterlaceMergeSpriteBuffers::
xor a
ld [$4000], a
push de
@@ -924,7 +924,7 @@ INCLUDE "home/timer.asm"
INCLUDE "home/audio.asm"
-UpdateSprites:: ; 2429 (0:2429)
+UpdateSprites::
ld a, [wUpdateSpritesEnabled]
dec a
ret nz
@@ -941,33 +941,33 @@ UpdateSprites:: ; 2429 (0:2429)
INCLUDE "data/mart_inventories.asm"
-TextScriptEndingChar:: ; 24d6 (0:24d6)
+TextScriptEndingChar::
db "@"
-TextScriptEnd:: ; 24d7 (0:24d7)
+TextScriptEnd::
ld hl,TextScriptEndingChar
ret
-ExclamationText:: ; 24db (0:24db)
+ExclamationText::
TX_FAR _ExclamationText
db "@"
-GroundRoseText:: ; 24e0 (0:24e0)
+GroundRoseText::
TX_FAR _GroundRoseText
db "@"
-BoulderText:: ; 24e5 (0:24e5)
+BoulderText::
TX_FAR _BoulderText
db "@"
-MartSignText:: ; 24ea (0:24ea)
+MartSignText::
TX_FAR _MartSignText
db "@"
-PokeCenterSignText:: ; 24ef (0:24ef)
+PokeCenterSignText::
TX_FAR _PokeCenterSignText
db "@"
-PickUpItemText:: ; 24f4 (0:24f4)
+PickUpItemText::
; XXX better label (what does predef $5C do?)
TX_ASM
predef PickUpItem
@@ -977,7 +977,7 @@ PickUpItemText:: ; 24f4 (0:24f4)
INCLUDE "home/pic.asm"
-ResetPlayerSpriteData:: ; 28a6 (0:28a6)
+ResetPlayerSpriteData::
ld hl, wSpriteStateData1
call ResetPlayerSpriteData_ClearSpriteData
ld hl, wSpriteStateData2
@@ -993,12 +993,12 @@ ResetPlayerSpriteData:: ; 28a6 (0:28a6)
ret
; overwrites sprite data with zeroes
-ResetPlayerSpriteData_ClearSpriteData:: ; 28c4 (0:28c4)
+ResetPlayerSpriteData_ClearSpriteData::
ld bc, $10
xor a
jp FillMemory
-FadeOutAudio:: ; 28cb (0:28cb)
+FadeOutAudio::
ld a, [wAudioFadeOutControl]
and a
jr nz, .asm_28dc
@@ -1049,7 +1049,7 @@ FadeOutAudio:: ; 28cb (0:28cb)
; this function is used to display sign messages, sprite dialog, etc.
; INPUT: [hSpriteIndexOrTextID] = sprite ID or text ID
-DisplayTextID:: ; 2920 (0:2920)
+DisplayTextID::
ld a,[H_LOADEDROMBANK]
push af
callba DisplayTextIDInit ; initialization
@@ -1143,20 +1143,20 @@ DisplayTextID:: ; 2920 (0:2920)
and a
jr nz,HoldTextDisplayOpen
-AfterDisplayingTextID:: ; 29d6 (0:29d6)
+AfterDisplayingTextID::
ld a,[wEnteringCableClub]
and a
jr nz,HoldTextDisplayOpen
call WaitForTextScrollButtonPress ; wait for a button press after displaying all the text
; loop to hold the dialogue box open as long as the player keeps holding down the A button
-HoldTextDisplayOpen:: ; 29df (0:29df)
+HoldTextDisplayOpen::
call Joypad
ld a,[hJoyHeld]
bit 0,a ; is the A button being pressed?
jr nz,HoldTextDisplayOpen
-CloseTextDisplay:: ; 29e8 (0:29e8)
+CloseTextDisplay::
ld a,[wCurMap]
call SwitchToMapRomBank
ld a,$90
@@ -1192,7 +1192,7 @@ CloseTextDisplay:: ; 29e8 (0:29e8)
ld [MBC1RomBank],a
jp UpdateSprites
-DisplayPokemartDialogue:: ; 2a2e (0:2a2e)
+DisplayPokemartDialogue::
push hl
ld hl,PokemartGreetingText
call PrintText
@@ -1212,11 +1212,11 @@ DisplayPokemartDialogue:: ; 2a2e (0:2a2e)
ld [MBC1RomBank],a
jp AfterDisplayingTextID
-PokemartGreetingText:: ; 2a55 (0:2a55)
+PokemartGreetingText::
TX_FAR _PokemartGreetingText
db "@"
-LoadItemList:: ; 2a5a (0:2a5a)
+LoadItemList::
ld a,1
ld [wUpdateSpritesEnabled],a
ld a,h
@@ -1232,7 +1232,7 @@ LoadItemList:: ; 2a5a (0:2a5a)
jr nz,.loop
ret
-DisplayPokemonCenterDialogue:: ; 2a72 (0:2a72)
+DisplayPokemonCenterDialogue::
; zeroing these doesn't appear to serve any purpose
xor a
ld [$ff8b],a
@@ -1251,20 +1251,20 @@ DisplayPokemonCenterDialogue:: ; 2a72 (0:2a72)
ld [MBC1RomBank],a
jp AfterDisplayingTextID
-DisplaySafariGameOverText:: ; 2a90 (0:2a90)
+DisplaySafariGameOverText::
callab PrintSafariGameOverText
jp AfterDisplayingTextID
-DisplayPokemonFaintedText:: ; 2a9b (0:2a9b)
+DisplayPokemonFaintedText::
ld hl,PokemonFaintedText
call PrintText
jp AfterDisplayingTextID
-PokemonFaintedText:: ; 2aa4 (0:2aa4)
+PokemonFaintedText::
TX_FAR _PokemonFaintedText
db "@"
-DisplayPlayerBlackedOutText:: ; 2aa9 (0:2aa9)
+DisplayPlayerBlackedOutText::
ld hl,PlayerBlackedOutText
call PrintText
ld a,[wd732]
@@ -1272,16 +1272,16 @@ DisplayPlayerBlackedOutText:: ; 2aa9 (0:2aa9)
ld [wd732],a
jp HoldTextDisplayOpen
-PlayerBlackedOutText:: ; 2aba (0:2aba)
+PlayerBlackedOutText::
TX_FAR _PlayerBlackedOutText
db "@"
-DisplayRepelWoreOffText:: ; 2abf (0:2abf)
+DisplayRepelWoreOffText::
ld hl,RepelWoreOffText
call PrintText
jp AfterDisplayingTextID
-RepelWoreOffText:: ; 2ac8 (0:2ac8)
+RepelWoreOffText::
TX_FAR _RepelWoreOffText
db "@"
@@ -1293,7 +1293,7 @@ INCLUDE "engine/menu/start_menu.asm"
; b = length of string of bytes
; OUTPUT:
; [wNumSetBits] = number of set bits
-CountSetBits:: ; 2b7f (0:2b7f)
+CountSetBits::
ld c,0
.loop
ld a,[hli]
@@ -1314,11 +1314,11 @@ CountSetBits:: ; 2b7f (0:2b7f)
; subtracts the amount the player paid from their money
; sets carry flag if there is enough money and unsets carry flag if not
-SubtractAmountPaidFromMoney:: ; 2b96 (0:2b96)
+SubtractAmountPaidFromMoney::
jpba SubtractAmountPaidFromMoney_
; adds the amount the player sold to their money
-AddAmountSoldToMoney:: ; 2b9e (0:2b9e)
+AddAmountSoldToMoney::
ld de,wPlayerMoney + 2
ld hl,$ffa1 ; total price of items
ld c,3 ; length of money in bytes
@@ -1335,7 +1335,7 @@ AddAmountSoldToMoney:: ; 2b9e (0:2b9e)
; HL = address of inventory (either wNumBagItems or wNumBoxItems)
; [wWhichPokemon] = index (within the inventory) of the item to remove
; [wItemQuantity] = quantity to remove
-RemoveItemFromInventory:: ; 2bbb (0:2bbb)
+RemoveItemFromInventory::
ld a,[H_LOADEDROMBANK]
push af
ld a,BANK(RemoveItemFromInventory_)
@@ -1353,7 +1353,7 @@ RemoveItemFromInventory:: ; 2bbb (0:2bbb)
; [wcf91] = item ID
; [wItemQuantity] = item quantity
; sets carry flag if successful, unsets carry flag if unsuccessful
-AddItemToInventory:: ; 2bcf (0:2bcf)
+AddItemToInventory::
push bc
ld a,[H_LOADEDROMBANK]
push af
@@ -1371,7 +1371,7 @@ AddItemToInventory:: ; 2bcf (0:2bcf)
; INPUT:
; [wListMenuID] = list menu ID
; [wListPointer] = address of the list (2 bytes)
-DisplayListMenuID:: ; 2be6 (0:2be6)
+DisplayListMenuID::
xor a
ld [H_AUTOBGTRANSFERENABLED],a ; disable auto-transfer
ld a,1
@@ -1425,7 +1425,7 @@ DisplayListMenuID:: ; 2be6 (0:2be6)
ld c,10
call DelayFrames
-DisplayListMenuIDLoop:: ; 2c53 (0:2c53)
+DisplayListMenuIDLoop::
xor a
ld [H_AUTOBGTRANSFERENABLED],a ; disable transfer
call PrintListMenuEntries
@@ -1562,7 +1562,7 @@ DisplayListMenuIDLoop:: ; 2c53 (0:2c53)
dec [hl]
jp DisplayListMenuIDLoop
-DisplayChooseQuantityMenu:: ; 2d57 (0:2d57)
+DisplayChooseQuantityMenu::
; text box dimensions/coordinates for just quantity
coord hl, 15, 9
ld b,1 ; height
@@ -1681,13 +1681,13 @@ DisplayChooseQuantityMenu:: ; 2d57 (0:2d57)
ld a,$ff
ret
-InitialQuantityText:: ; 2e30 (0:2e30)
+InitialQuantityText::
db "×01@"
-SpacesBetweenQuantityAndPriceText:: ; 2e34 (0:2e34)
+SpacesBetweenQuantityAndPriceText::
db " @"
-ExitListMenu:: ; 2e3b (0:2e3b)
+ExitListMenu::
ld a,[wCurrentMenuItem]
ld [wChosenMenuItem],a
ld a,CANCELLED_MENU
@@ -1703,7 +1703,7 @@ ExitListMenu:: ; 2e3b (0:2e3b)
scf
ret
-PrintListMenuEntries:: ; 2e5a (0:2e5a)
+PrintListMenuEntries::
coord hl, 5, 3
ld b,9
ld c,14
@@ -1892,10 +1892,10 @@ PrintListMenuEntries:: ; 2e5a (0:2e5a)
ld de,ListMenuCancelText
jp PlaceString
-ListMenuCancelText:: ; 2f97 (0:2f97)
+ListMenuCancelText::
db "CANCEL@"
-GetMonName:: ; 2f9e (0:2f9e)
+GetMonName::
push hl
ld a,[H_LOADEDROMBANK]
push af
@@ -1921,7 +1921,7 @@ GetMonName:: ; 2f9e (0:2f9e)
pop hl
ret
-GetItemName:: ; 2fcf (0:2fcf)
+GetItemName::
; given an item ID at [wd11e], store the name of the item into a string
; starting at wcd6d
push hl
@@ -1946,7 +1946,7 @@ GetItemName:: ; 2fcf (0:2fcf)
pop hl
ret
-GetMachineName:: ; 2ff3 (0:2ff3)
+GetMachineName::
; copies the name of the TM/HM in [wd11e] to wcd6d
push hl
push de
@@ -1999,14 +1999,14 @@ GetMachineName:: ; 2ff3 (0:2ff3)
pop hl
ret
-TechnicalPrefix:: ; 303c (0:303c)
+TechnicalPrefix::
db "TM"
-HiddenPrefix:: ; 303e (0:303e)
+HiddenPrefix::
db "HM"
; sets carry if item is HM, clears carry if item is not HM
; Input: a = item ID
-IsItemHM:: ; 3040 (0:3040)
+IsItemHM::
cp a,HM_01
jr c,.notHM
cp a,TM_01
@@ -2017,16 +2017,16 @@ IsItemHM:: ; 3040 (0:3040)
; sets carry if move is an HM, clears carry if move is not an HM
; Input: a = move ID
-IsMoveHM:: ; 3049 (0:3049)
+IsMoveHM::
ld hl,HMMoves
ld de,1
jp IsInArray
-HMMoves:: ; 3052 (0:3052)
+HMMoves::
db CUT,FLY,SURF,STRENGTH,FLASH
db $ff ; terminator
-GetMoveName:: ; 3058 (0:3058)
+GetMoveName::
push hl
ld a,MOVE_NAME
ld [wNameListType],a
@@ -2040,7 +2040,7 @@ GetMoveName:: ; 3058 (0:3058)
ret
; reloads text box tile patterns, current map view, and tileset tile patterns
-ReloadMapData:: ; 3071 (0:3071)
+ReloadMapData::
ld a,[H_LOADEDROMBANK]
push af
ld a,[wCurMap]
@@ -2056,7 +2056,7 @@ ReloadMapData:: ; 3071 (0:3071)
ret
; reloads tileset tile patterns
-ReloadTilesetTilePatterns:: ; 3090 (0:3090)
+ReloadTilesetTilePatterns::
ld a,[H_LOADEDROMBANK]
push af
ld a,[wCurMap]
@@ -2070,13 +2070,13 @@ ReloadTilesetTilePatterns:: ; 3090 (0:3090)
ret
; shows the town map and lets the player choose a destination to fly to
-ChooseFlyDestination:: ; 30a9 (0:30a9)
+ChooseFlyDestination::
ld hl,wd72e
res 4,[hl]
jpba LoadTownMap_Fly
; causes the text box to close without waiting for a button press after displaying text
-DisableWaitingAfterTextDisplay:: ; 30b6 (0:30b6)
+DisableWaitingAfterTextDisplay::
ld a,$01
ld [wDoNotWaitForButtonPressAfterDisplayingText],a
ret
@@ -2090,7 +2090,7 @@ DisableWaitingAfterTextDisplay:: ; 30b6 (0:30b6)
; 00: unsucessful
; 01: successful
; 02: not able to be used right now, no extra menu displayed (only certain items use this)
-UseItem:: ; 30bc (0:30bc)
+UseItem::
jpba UseItem_
; confirms the item toss and then tosses the item
@@ -2101,7 +2101,7 @@ UseItem:: ; 30bc (0:30bc)
; [wItemQuantity] = quantity to toss
; OUTPUT:
; clears carry flag if the item is tossed, sets carry flag if not
-TossItem:: ; 30c4 (0:30c4)
+TossItem::
ld a,[H_LOADEDROMBANK]
push af
ld a,BANK(TossItem_)
@@ -2121,7 +2121,7 @@ TossItem:: ; 30c4 (0:30c4)
; [wIsKeyItem] = result
; 00: item is not key item
; 01: item is key item
-IsKeyItem:: ; 30d9 (0:30d9)
+IsKeyItem::
push hl
push de
push bc
@@ -2135,7 +2135,7 @@ IsKeyItem:: ; 30d9 (0:30d9)
; INPUT:
; [wTextBoxID] = text box ID
; b, c = y, x cursor position (TWO_OPTION_MENU only)
-DisplayTextBoxID:: ; 30e8 (0:30e8)
+DisplayTextBoxID::
ld a,[H_LOADEDROMBANK]
push af
ld a,BANK(DisplayTextBoxID_)
@@ -2150,7 +2150,7 @@ DisplayTextBoxID:: ; 30e8 (0:30e8)
; not zero if an NPC movement script is running, the player character is
; automatically stepping down from a door, or joypad states are being simulated
-IsPlayerCharacterBeingControlledByGame:: ; 30fd (0:30fd)
+IsPlayerCharacterBeingControlledByGame::
ld a, [wNPCMovementScriptPointerTableNum]
and a
ret nz
@@ -2161,7 +2161,7 @@ IsPlayerCharacterBeingControlledByGame:: ; 30fd (0:30fd)
and $80
ret
-RunNPCMovementScript:: ; 310e (0:310e)
+RunNPCMovementScript::
ld hl, wd736
bit 0, [hl]
res 0, [hl]
@@ -2196,14 +2196,14 @@ RunNPCMovementScript:: ; 310e (0:310e)
.playerStepOutFromDoor
jpba PlayerStepOutFromDoor
-EndNPCMovementScript:: ; 314e (0:314e)
+EndNPCMovementScript::
jpba _EndNPCMovementScript
-EmptyFunc2:: ; 3156 (0:3156)
+EmptyFunc2::
ret
; stores hl in [wTrainerHeaderPtr]
-StoreTrainerHeaderPointer:: ; 3157 (0:3157)
+StoreTrainerHeaderPointer::
ld a, h
ld [wTrainerHeaderPtr], a
ld a, l
@@ -2212,7 +2212,7 @@ StoreTrainerHeaderPointer:: ; 3157 (0:3157)
; executes the current map script from the function pointer array provided in hl.
; a: map script index to execute (unless overridden by [wd733] bit 4)
-ExecuteCurMapScriptInTable:: ; 3160 (0:3160)
+ExecuteCurMapScriptInTable::
push af
push de
call StoreTrainerHeaderPointer
@@ -2231,7 +2231,7 @@ ExecuteCurMapScriptInTable:: ; 3160 (0:3160)
ld a, [wCurMapScript]
ret
-LoadGymLeaderAndCityName:: ; 317f (0:317f)
+LoadGymLeaderAndCityName::
push de
ld de, wGymCityName
ld bc, $11
@@ -2248,7 +2248,7 @@ LoadGymLeaderAndCityName:: ; 317f (0:317f)
; 4 -> before battle text (into hl)
; 6 -> after battle text (into hl)
; 8 -> end battle text (into hl)
-ReadTrainerHeaderInfo:: ; 3193 (0:3193)
+ReadTrainerHeaderInfo::
push de
push af
ld d, $0
@@ -2290,7 +2290,7 @@ ReadTrainerHeaderInfo:: ; 3193 (0:3193)
TrainerFlagAction::
predef_jump FlagActionPredef
-TalkToTrainer:: ; 31cc (0:31cc)
+TalkToTrainer::
call StoreTrainerHeaderPointer
xor a
call ReadTrainerHeaderInfo ; read flag's bit
@@ -2329,7 +2329,7 @@ TalkToTrainer:: ; 31cc (0:31cc)
jp StartTrainerBattle
; checks if any trainers are seeing the player and wanting to fight
-CheckFightingMapTrainers:: ; 3219 (0:3219)
+CheckFightingMapTrainers::
call CheckForEngagingTrainers
ld a, [wSpriteIndex]
cp $ff
@@ -2355,7 +2355,7 @@ CheckFightingMapTrainers:: ; 3219 (0:3219)
ret
; display the before battle text after the enemy trainer has walked up to the player's sprite
-DisplayEnemyTrainerTextAndStartBattle:: ; 324c (0:324c)
+DisplayEnemyTrainerTextAndStartBattle::
ld a, [wd730]
and $1
ret nz ; return if the enemy trainer hasn't finished walking to the player's sprite
@@ -2365,7 +2365,7 @@ DisplayEnemyTrainerTextAndStartBattle:: ; 324c (0:324c)
call DisplayTextID
; fall through
-StartTrainerBattle:: ; 325d (0:325d)
+StartTrainerBattle::
xor a
ld [wJoyIgnore], a
call InitBattleEnemyParameters
@@ -2378,7 +2378,7 @@ StartTrainerBattle:: ; 325d (0:325d)
inc [hl] ; increment map script index (next script function is usually EndTrainerBattle)
ret
-EndTrainerBattle:: ; 3275 (0:3275)
+EndTrainerBattle::
ld hl, wCurrentMapScriptFlags
set 5, [hl]
set 6, [hl]
@@ -2412,7 +2412,7 @@ EndTrainerBattle:: ; 3275 (0:3275)
res 4, [hl]
ret nz
-ResetButtonPressedAndMapScript:: ; 32c1 (0:32c1)
+ResetButtonPressedAndMapScript::
xor a
ld [wJoyIgnore], a
ld [hJoyHeld], a
@@ -2422,11 +2422,11 @@ ResetButtonPressedAndMapScript:: ; 32c1 (0:32c1)
ret
; calls TrainerWalkUpToPlayer
-TrainerWalkUpToPlayer_Bank0:: ; 32cf (0:32cf)
+TrainerWalkUpToPlayer_Bank0::
jpba TrainerWalkUpToPlayer
; sets opponent type and mon set/lvl based on the engaging trainer data
-InitBattleEnemyParameters:: ; 32d7 (0:32d7)
+InitBattleEnemyParameters::
ld a, [wEngagedTrainerClass]
ld [wCurOpponent], a
ld [wEnemyMonOrTrainerClass], a
@@ -2439,25 +2439,25 @@ InitBattleEnemyParameters:: ; 32d7 (0:32d7)
ld [wCurEnemyLVL], a
ret
-GetSpritePosition1:: ; 32ef (0:32ef)
+GetSpritePosition1::
ld hl, _GetSpritePosition1
jr SpritePositionBankswitch
-GetSpritePosition2:: ; 32f4 (0:32f4)
+GetSpritePosition2::
ld hl, _GetSpritePosition2
jr SpritePositionBankswitch
-SetSpritePosition1:: ; 32f9 (0:32f9)
+SetSpritePosition1::
ld hl, _SetSpritePosition1
jr SpritePositionBankswitch
-SetSpritePosition2:: ; 32fe (0:32fe)
+SetSpritePosition2::
ld hl, _SetSpritePosition2
-SpritePositionBankswitch:: ; 3301 (0:3301)
+SpritePositionBankswitch::
ld b, BANK(_GetSpritePosition1) ; BANK(_GetSpritePosition2), BANK(_SetSpritePosition1), BANK(_SetSpritePosition2)
jp Bankswitch ; indirect jump to one of the four functions
-CheckForEngagingTrainers:: ; 3306 (0:3306)
+CheckForEngagingTrainers::
xor a
call ReadTrainerHeaderInfo ; read trainer flag's bit (unused)
ld d, h ; store trainer header address in de
@@ -2505,7 +2505,7 @@ CheckForEngagingTrainers:: ; 3306 (0:3306)
; hl = text if the player wins
; de = text if the player loses
-SaveEndBattleTextPointers:: ; 3354 (0:3354)
+SaveEndBattleTextPointers::
ld a, [H_LOADEDROMBANK]
ld [wEndBattleTextRomBank], a
ld a, h
@@ -2520,7 +2520,7 @@ SaveEndBattleTextPointers:: ; 3354 (0:3354)
; loads data of some trainer on the current map and plays pre-battle music
; [wSpriteIndex]: sprite ID of trainer who is engaged
-EngageMapTrainer:: ; 336a (0:336a)
+EngageMapTrainer::
ld hl, wMapSpriteExtraData
ld d, $0
ld a, [wSpriteIndex]
@@ -2534,7 +2534,7 @@ EngageMapTrainer:: ; 336a (0:336a)
ld [wEnemyMonAttackMod], a
jp PlayTrainerMusic
-PrintEndBattleText:: ; 3381 (0:3381)
+PrintEndBattleText::
push hl
ld hl, wd72d
bit 7, [hl]
@@ -2557,7 +2557,7 @@ PrintEndBattleText:: ; 3381 (0:3381)
callba FreezeEnemyTrainerSprite
jp WaitForSoundToFinish
-GetSavedEndBattleTextPointer:: ; 33b7 (0:33b7)
+GetSavedEndBattleTextPointer::
ld a, [wBattleResult]
and a
; won battle
@@ -2574,7 +2574,7 @@ GetSavedEndBattleTextPointer:: ; 33b7 (0:33b7)
ld l, a
ret
-TrainerEndBattleText:: ; 33cf (0:33cf)
+TrainerEndBattleText::
TX_FAR _TrainerNameText
TX_ASM
call GetSavedEndBattleTextPointer
@@ -2584,7 +2584,7 @@ TrainerEndBattleText:: ; 33cf (0:33cf)
; only engage withe trainer if the player is not already
; engaged with another trainer
; XXX unused?
-CheckIfAlreadyEngaged:: ; 33dd (0:33dd)
+CheckIfAlreadyEngaged::
ld a, [wFlags_0xcd60]
bit 0, a
ret nz
@@ -2592,7 +2592,7 @@ CheckIfAlreadyEngaged:: ; 33dd (0:33dd)
xor a
ret
-PlayTrainerMusic:: ; 33e8 (0:33e8)
+PlayTrainerMusic::
ld a, [wEngagedTrainerClass]
cp OPP_SONY1
ret z
@@ -2643,7 +2643,7 @@ INCLUDE "data/trainer_types.asm"
; and if so, decodes the RLE movement data
; b = player Y
; c = player X
-DecodeArrowMovementRLE:: ; 3442 (0:3442)
+DecodeArrowMovementRLE::
ld a, [hli]
cp $ff
ret z ; no match in the list
@@ -2667,33 +2667,33 @@ DecodeArrowMovementRLE:: ; 3442 (0:3442)
inc hl
jr DecodeArrowMovementRLE
-FuncTX_ItemStoragePC:: ; 3460 (0:3460)
+FuncTX_ItemStoragePC::
call SaveScreenTilesToBuffer2
ld b, BANK(PlayerPC)
ld hl, PlayerPC
jr bankswitchAndContinue
-FuncTX_BillsPC:: ; 346a (0:346a)
+FuncTX_BillsPC::
call SaveScreenTilesToBuffer2
ld b, BANK(BillsPC_)
ld hl, BillsPC_
jr bankswitchAndContinue
-FuncTX_SlotMachine:: ; 3474 (0:3474)
+FuncTX_SlotMachine::
; XXX find a better name for this function
; special_F7
ld b,BANK(CeladonPrizeMenu)
ld hl,CeladonPrizeMenu
-bankswitchAndContinue:: ; 3479 (0:3479)
+bankswitchAndContinue::
call Bankswitch
jp HoldTextDisplayOpen ; continue to main text-engine function
-FuncTX_PokemonCenterPC:: ; 347f (0:347f)
+FuncTX_PokemonCenterPC::
ld b, BANK(ActivatePC)
ld hl, ActivatePC
jr bankswitchAndContinue
-StartSimulatingJoypadStates:: ; 3486 (0:3486)
+StartSimulatingJoypadStates::
xor a
ld [wOverrideSimulatedJoypadStatesMask], a
ld [wSpriteStateData2 + $06], a ; player's sprite movement byte 1
@@ -2701,7 +2701,7 @@ StartSimulatingJoypadStates:: ; 3486 (0:3486)
set 7, [hl]
ret
-IsItemInBag:: ; 3493 (0:3493)
+IsItemInBag::
; given an item_id in b
; set zero flag if item isn't in player's bag
; else reset zero flag
@@ -2711,16 +2711,16 @@ IsItemInBag:: ; 3493 (0:3493)
and a
ret
-DisplayPokedex:: ; 349b (0:349b)
+DisplayPokedex::
ld [wd11e], a
jpba _DisplayPokedex
-SetSpriteFacingDirectionAndDelay:: ; 34a6 (0:34a6)
+SetSpriteFacingDirectionAndDelay::
call SetSpriteFacingDirection
ld c, 6
jp DelayFrames
-SetSpriteFacingDirection:: ; 34ae (0:34ae)
+SetSpriteFacingDirection::
ld a, $9
ld [H_SPRITEDATAOFFSET], a
call GetPointerWithinSpriteStateData1
@@ -2728,7 +2728,7 @@ SetSpriteFacingDirection:: ; 34ae (0:34ae)
ld [hl], a
ret
-SetSpriteImageIndexAfterSettingFacingDirection:: ; 34b9 (0:34b9)
+SetSpriteImageIndexAfterSettingFacingDirection::
ld de, -7
add hl, de
ld [hl], a
@@ -2740,14 +2740,14 @@ SetSpriteImageIndexAfterSettingFacingDirection:: ; 34b9 (0:34b9)
; OUTPUT:
; [wCoordIndex] = if there is match, the matching array index
; sets carry if the coordinates are in the array, clears carry if not
-ArePlayerCoordsInArray:: ; 34bf (0:34bf)
+ArePlayerCoordsInArray::
ld a,[wYCoord]
ld b,a
ld a,[wXCoord]
ld c,a
; fallthrough
-CheckCoords:: ; 34c7 (0:34c7)
+CheckCoords::
xor a
ld [wCoordIndex],a
.loop
@@ -2781,7 +2781,7 @@ CheckCoords:: ; 34c7 (0:34c7)
; OUTPUT:
; [wCoordIndex] = if there is match, the matching array index
; sets carry if the coordinates are in the array, clears carry if not
-CheckBoulderCoords:: ; 34e4 (0:34e4)
+CheckBoulderCoords::
push hl
ld hl, wSpriteStateData2 + $04
ld a, [H_SPRITEINDEX]
@@ -2798,11 +2798,11 @@ CheckBoulderCoords:: ; 34e4 (0:34e4)
pop hl
jp CheckCoords
-GetPointerWithinSpriteStateData1:: ; 34fc (0:34fc)
+GetPointerWithinSpriteStateData1::
ld h, $c1
jr _GetPointerWithinSpriteStateData
-GetPointerWithinSpriteStateData2:: ; 3500 (0:3500)
+GetPointerWithinSpriteStateData2::
ld h, $c2
_GetPointerWithinSpriteStateData:
@@ -2819,7 +2819,7 @@ _GetPointerWithinSpriteStateData:
; the final $ff will be replicated in the output list and a contains the number of bytes written
; de: input list
; hl: output list
-DecodeRLEList:: ; 350c (0:350c)
+DecodeRLEList::
xor a
ld [wRLEByteCount], a ; count written bytes here
.listLoop
@@ -2846,7 +2846,7 @@ DecodeRLEList:: ; 350c (0:350c)
ret
; sets movement byte 1 for sprite [H_SPRITEINDEX] to $FE and byte 2 to [hSpriteMovementByte2]
-SetSpriteMovementBytesToFE:: ; 3533 (0:3533)
+SetSpriteMovementBytesToFE::
push hl
call GetSpriteMovementByte1Pointer
ld [hl], $fe
@@ -2857,7 +2857,7 @@ SetSpriteMovementBytesToFE:: ; 3533 (0:3533)
ret
; sets both movement bytes for sprite [H_SPRITEINDEX] to $FF
-SetSpriteMovementBytesToFF:: ; 3541 (0:3541)
+SetSpriteMovementBytesToFF::
push hl
call GetSpriteMovementByte1Pointer
ld [hl],$FF
@@ -2867,7 +2867,7 @@ SetSpriteMovementBytesToFF:: ; 3541 (0:3541)
ret
; returns the sprite movement byte 1 pointer for sprite [H_SPRITEINDEX] in hl
-GetSpriteMovementByte1Pointer:: ; 354e (0:354e)
+GetSpriteMovementByte1Pointer::
ld h,$C2
ld a,[H_SPRITEINDEX]
swap a
@@ -2876,7 +2876,7 @@ GetSpriteMovementByte1Pointer:: ; 354e (0:354e)
ret
; returns the sprite movement byte 2 pointer for sprite [H_SPRITEINDEX] in hl
-GetSpriteMovementByte2Pointer:: ; 3558 (0:3558)
+GetSpriteMovementByte2Pointer::
push de
ld hl,wMapSpriteData
ld a,[H_SPRITEINDEX]
@@ -2888,7 +2888,7 @@ GetSpriteMovementByte2Pointer:: ; 3558 (0:3558)
pop de
ret
-GetTrainerInformation:: ; 3566 (0:3566)
+GetTrainerInformation::
call GetTrainerName
ld a, [wLinkState]
and a
@@ -2921,7 +2921,7 @@ GetTrainerInformation:: ; 3566 (0:3566)
ld [hl], d
ret
-GetTrainerName:: ; 359e (0:359e)
+GetTrainerName::
jpba GetTrainerName_
@@ -2942,7 +2942,7 @@ HasEnoughCoins::
jp StringCmp
-BankswitchHome:: ; 35bc (0:35bc)
+BankswitchHome::
; switches to bank # in a
; Only use this when in the home bank!
ld [wBankswitchHomeTemp],a
@@ -2953,14 +2953,14 @@ BankswitchHome:: ; 35bc (0:35bc)
ld [MBC1RomBank],a
ret
-BankswitchBack:: ; 35cd (0:35cd)
+BankswitchBack::
; returns from BankswitchHome
ld a,[wBankswitchHomeSavedROMBank]
ld [H_LOADEDROMBANK],a
ld [MBC1RomBank],a
ret
-Bankswitch:: ; 35d6 (0:35d6)
+Bankswitch::
; self-contained bankswitch, use this when not in the home bank
; switches to the bank in b
ld a,[H_LOADEDROMBANK]
@@ -2980,25 +2980,25 @@ Bankswitch:: ; 35d6 (0:35d6)
; displays yes/no choice
; yes -> set carry
-YesNoChoice:: ; 35ec (0:35ec)
+YesNoChoice::
call SaveScreenTilesToBuffer1
call InitYesNoTextBoxParameters
jr DisplayYesNoChoice
-Func_35f4:: ; 35f4 (0:35f4)
+Func_35f4::
ld a, TWO_OPTION_MENU
ld [wTextBoxID], a
call InitYesNoTextBoxParameters
jp DisplayTextBoxID
-InitYesNoTextBoxParameters:: ; 35ff (0:35ff)
+InitYesNoTextBoxParameters::
xor a ; YES_NO_MENU
ld [wTwoOptionMenuID], a
coord hl, 14, 7
ld bc, $80f
ret
-YesNoChoicePokeCenter:: ; 360a (0:360a)
+YesNoChoicePokeCenter::
call SaveScreenTilesToBuffer1
ld a, HEAL_CANCEL_MENU
ld [wTwoOptionMenuID], a
@@ -3006,20 +3006,20 @@ YesNoChoicePokeCenter:: ; 360a (0:360a)
lb bc, 8, 12
jr DisplayYesNoChoice
-Func_361a:: ; 361a (0:361a)
+Func_361a::
call SaveScreenTilesToBuffer1
ld a, WIDE_YES_NO_MENU
ld [wTwoOptionMenuID], a
coord hl, 12, 7
lb bc, 8, 13
-DisplayYesNoChoice:: ; 3628 (0:3628)
+DisplayYesNoChoice::
ld a, TWO_OPTION_MENU
ld [wTextBoxID], a
call DisplayTextBoxID
jp LoadScreenTilesFromBuffer1
; calculates the difference |a-b|, setting carry flag if a<b
-CalcDifference:: ; 3633 (0:3633)
+CalcDifference::
sub b
ret nc
cpl
@@ -3027,11 +3027,11 @@ CalcDifference:: ; 3633 (0:3633)
scf
ret
-MoveSprite:: ; 363a (0:363a)
+MoveSprite::
; move the sprite [H_SPRITEINDEX] with the movement pointed to by de
; actually only copies the movement data to wNPCMovementDirections for later
call SetSpriteMovementBytesToFF
-MoveSprite_:: ; 363d (0:363d)
+MoveSprite_::
push hl
push bc
call GetSpriteMovementByte1Pointer
@@ -3064,7 +3064,7 @@ MoveSprite_:: ; 363d (0:363d)
ret
; divides [hDividend2] by [hDivisor2] and stores the quotient in [hQuotient2]
-DivideBytes:: ; 366b (0:366b)
+DivideBytes::
push hl
ld hl, $ffe7
xor a
@@ -3149,7 +3149,7 @@ FillMemory::
ret
-UncompressSpriteFromDE:: ; 36eb (0:36eb)
+UncompressSpriteFromDE::
; Decompress pic at a:de.
ld hl, wSpriteInputPtr
ld [hl], e
@@ -3158,21 +3158,21 @@ UncompressSpriteFromDE:: ; 36eb (0:36eb)
jp UncompressSpriteData
-SaveScreenTilesToBuffer2:: ; 36f4 (0:36f4)
+SaveScreenTilesToBuffer2::
coord hl, 0, 0
ld de, wTileMapBackup2
ld bc, SCREEN_WIDTH * SCREEN_HEIGHT
call CopyData
ret
-LoadScreenTilesFromBuffer2:: ; 3701 (0:3701)
+LoadScreenTilesFromBuffer2::
call LoadScreenTilesFromBuffer2DisableBGTransfer
ld a, 1
ld [H_AUTOBGTRANSFERENABLED], a
ret
; loads screen tiles stored in wTileMapBackup2 but leaves H_AUTOBGTRANSFERENABLED disabled
-LoadScreenTilesFromBuffer2DisableBGTransfer:: ; 3709 (0:3709)
+LoadScreenTilesFromBuffer2DisableBGTransfer::
xor a
ld [H_AUTOBGTRANSFERENABLED], a
ld hl, wTileMapBackup2
@@ -3181,13 +3181,13 @@ LoadScreenTilesFromBuffer2DisableBGTransfer:: ; 3709 (0:3709)
call CopyData
ret
-SaveScreenTilesToBuffer1:: ; 3719 (0:3719)
+SaveScreenTilesToBuffer1::
coord hl, 0, 0
ld de, wTileMapBackup
ld bc, SCREEN_WIDTH * SCREEN_HEIGHT
jp CopyData
-LoadScreenTilesFromBuffer1:: ; 3725 (0:3725)
+LoadScreenTilesFromBuffer1::
xor a
ld [H_AUTOBGTRANSFERENABLED], a
ld hl, wTileMapBackup
@@ -3198,21 +3198,21 @@ LoadScreenTilesFromBuffer1:: ; 3725 (0:3725)
ld [H_AUTOBGTRANSFERENABLED], a
ret
-DelayFrames:: ; 3739 (0:3739)
+DelayFrames::
; wait n frames, where n is the value in c
call DelayFrame
dec c
jr nz,DelayFrames
ret
-PlaySoundWaitForCurrent:: ; 3740 (0:3740)
+PlaySoundWaitForCurrent::
push af
call WaitForSoundToFinish
pop af
jp PlaySound
; Wait for sound to finish playing
-WaitForSoundToFinish:: ; 3748 (0:3748)
+WaitForSoundToFinish::
ld a, [wLowHealthAlarm]
and $80
ret nz
@@ -3230,7 +3230,7 @@ WaitForSoundToFinish:: ; 3748 (0:3748)
pop hl
ret
-NamePointers:: ; 375d (0:375d)
+NamePointers::
dw MonsterNames
dw MoveNames
dw UnusedNames
@@ -3239,7 +3239,7 @@ NamePointers:: ; 375d (0:375d)
dw wEnemyMonOT ; enemy's OT names list
dw TrainerNames
-GetName:: ; 376b (0:376b)
+GetName::
; arguments:
; [wd0b5] = which name
; [wNameListType] = which list
@@ -3324,7 +3324,7 @@ GetName:: ; 376b (0:376b)
ld [MBC1RomBank],a
ret
-GetItemPrice:: ; 37df (0:37df)
+GetItemPrice::
; Stores item's price as BCD at hItemPrice (3 bytes)
; Input: [wcf91] = item id
ld a, [H_LOADEDROMBANK]
@@ -3370,12 +3370,12 @@ GetItemPrice:: ; 37df (0:37df)
ret
; copies a string from [de] to [wcf4b]
-CopyStringToCF4B:: ; 3826 (0:3826)
+CopyStringToCF4B::
ld hl, wcf4b
; fall through
; copies a string from [de] to [hl]
-CopyString:: ; 3829 (0:3829)
+CopyString::
ld a, [de]
inc de
ld [hli], a
@@ -3398,7 +3398,7 @@ CopyString:: ; 3829 (0:3829)
; report only one button press.
; 3. Same as 2, but report no buttons as pressed if A or B is held down.
; ([hJoy7] == 1, [hJoy6] == 0)
-JoypadLowSensitivity:: ; 3831 (0:3831)
+JoypadLowSensitivity::
call Joypad
ld a,[hJoy7] ; flag
and a ; get all currently pressed buttons or only newly pressed buttons?
@@ -3437,7 +3437,7 @@ JoypadLowSensitivity:: ; 3831 (0:3831)
ld [H_FRAMECOUNTER],a
ret
-WaitForTextScrollButtonPress:: ; 3865 (0:3865)
+WaitForTextScrollButtonPress::
ld a, [H_DOWNARROWBLINKCNT1]
push af
ld a, [H_DOWNARROWBLINKCNT2]
@@ -3468,7 +3468,7 @@ WaitForTextScrollButtonPress:: ; 3865 (0:3865)
ret
; (unless in link battle) waits for A or B being pressed and outputs the scrolling sound effect
-ManualTextScroll:: ; 3898 (0:3898)
+ManualTextScroll::
ld a, [wLinkState]
cp LINK_STATE_BATTLING
jr z, .inLinkBattle
@@ -3486,7 +3486,7 @@ ManualTextScroll:: ; 3898 (0:3898)
; FF99 = multiplier
; OUTPUT
; FF95-FF98 = product
-Multiply:: ; 38ac (0:38ac)
+Multiply::
push hl
push bc
callab _Multiply
@@ -3503,7 +3503,7 @@ Multiply:: ; 38ac (0:38ac)
; OUTPUT
; FF95-FF98 = quotient
; FF99 = remainder
-Divide:: ; 38b9 (0:38b9)
+Divide::
push hl
push de
push bc
@@ -3524,7 +3524,7 @@ Divide:: ; 38b9 (0:38b9)
; This function is used to wait a short period after printing a letter to the
; screen unless the player presses the A/B button or the delay is turned off
; through the [wd730] or [wLetterPrintingDelayFlags] flags.
-PrintLetterDelay:: ; 38d3 (0:38d3)
+PrintLetterDelay::
ld a,[wd730]
bit 6,a
ret nz
@@ -3570,7 +3570,7 @@ PrintLetterDelay:: ; 38d3 (0:38d3)
; Copies [hl, bc) to [de, bc - hl).
; In other words, the source data is from hl up to but not including bc,
; and the destination is de.
-CopyDataUntil:: ; 3913 (0:3913)
+CopyDataUntil::
ld a,[hli]
ld [de],a
inc de
@@ -3586,10 +3586,10 @@ CopyDataUntil:: ; 3913 (0:3913)
; wWhichPokemon determines the pokemon.
; [wRemoveMonFromBox] == 0 specifies the party.
; [wRemoveMonFromBox] != 0 specifies the current box.
-RemovePokemon:: ; 391f (0:391f)
+RemovePokemon::
jpab _RemovePokemon
-AddPartyMon:: ; 3927 (0:3927)
+AddPartyMon::
push hl
push de
push bc
@@ -3600,7 +3600,7 @@ AddPartyMon:: ; 3927 (0:3927)
ret
; calculates all 5 stats of current mon and writes them to [de]
-CalcStats:: ; 3936 (0:3936)
+CalcStats::
ld c, $0
.statsLoop
inc c
@@ -3620,7 +3620,7 @@ CalcStats:: ; 3936 (0:3936)
; c: stat to calc (HP=1,Atk=2,Def=3,Spd=4,Spc=5)
; b: consider stat exp?
; hl: base ptr to stat exp values ([hl + 2*c - 1] and [hl + 2*c])
-CalcStat:: ; 394a (0:394a)
+CalcStat::
push hl
push de
push bc
@@ -3799,7 +3799,7 @@ CalcStat:: ; 394a (0:394a)
pop hl
ret
-AddEnemyMonToPlayerParty:: ; 3a53 (0:3a53)
+AddEnemyMonToPlayerParty::
ld a, [H_LOADEDROMBANK]
push af
ld a, BANK(_AddEnemyMonToPlayerParty)
@@ -3812,7 +3812,7 @@ AddEnemyMonToPlayerParty:: ; 3a53 (0:3a53)
ld [MBC1RomBank], a
ret
-MoveMon:: ; 3a68 (0:3a68)
+MoveMon::
ld a, [H_LOADEDROMBANK]
push af
ld a, BANK(_MoveMon)
@@ -3827,7 +3827,7 @@ MoveMon:: ; 3a68 (0:3a68)
; skips a text entries, each of size NAME_LENGTH (like trainer name, OT name, rival name, ...)
; hl: base pointer, will be incremented by NAME_LENGTH * a
-SkipFixedLengthTextEntries:: ; 3a7d (0:3a7d)
+SkipFixedLengthTextEntries::
and a
ret z
ld bc, NAME_LENGTH
@@ -3837,7 +3837,7 @@ SkipFixedLengthTextEntries:: ; 3a7d (0:3a7d)
jr nz, .skipLoop
ret
-AddNTimes:: ; 3a87 (0:3a87)
+AddNTimes::
; add bc to hl a times
and a
ret z
@@ -3849,7 +3849,7 @@ AddNTimes:: ; 3a87 (0:3a87)
; Compare strings, c bytes in length, at de and hl.
; Often used to compare big endian numbers in battle calculations.
-StringCmp:: ; 3a8e (0:3a8e)
+StringCmp::
ld a,[de]
cp [hl]
ret nz
@@ -3864,7 +3864,7 @@ StringCmp:: ; 3a8e (0:3a8e)
; b = Y coordinate of upper left corner of sprite
; c = X coordinate of upper left corner of sprite
; de = base address of 4 tile number and attribute pairs
-WriteOAMBlock:: ; 3a97 (0:3a97)
+WriteOAMBlock::
ld h,wOAMBuffer / $100
swap a ; multiply by 16
ld l,a
@@ -3896,11 +3896,11 @@ WriteOAMBlock:: ; 3a97 (0:3a97)
ld [hli],a
ret
-HandleMenuInput:: ; 3abe (0:3abe)
+HandleMenuInput::
xor a
ld [wPartyMenuAnimMonEnabled],a
-HandleMenuInput_:: ; 3ac2 (0:3ac2)
+HandleMenuInput_::
ld a,[H_DOWNARROWBLINKCNT1]
push af
ld a,[H_DOWNARROWBLINKCNT2]
@@ -4014,7 +4014,7 @@ HandleMenuInput_:: ; 3ac2 (0:3ac2)
jr z,.checkOtherKeys
jr .checkIfAButtonOrBButtonPressed
-PlaceMenuCursor:: ; 3b7c (0:3b7c)
+PlaceMenuCursor::
ld a,[wTopMenuItemY]
and a ; is the y coordinate 0?
jr z,.adjustForXCoord
@@ -4093,7 +4093,7 @@ PlaceMenuCursor:: ; 3b7c (0:3b7c)
; manipulated. In the case of submenus, this is used to show the location of
; the menu cursor in the parent menu. In the case of swapping items in list,
; this is used to mark the item that was first chosen to be swapped.
-PlaceUnfilledArrowMenuCursor:: ; 3bec (0:3bec)
+PlaceUnfilledArrowMenuCursor::
ld b,a
ld a,[wMenuCursorLocation]
ld l,a
@@ -4104,7 +4104,7 @@ PlaceUnfilledArrowMenuCursor:: ; 3bec (0:3bec)
ret
; Replaces the menu cursor with a blank space.
-EraseMenuCursor:: ; 3bf9 (0:3bf9)
+EraseMenuCursor::
ld a,[wMenuCursorLocation]
ld l,a
ld a,[wMenuCursorLocation + 1]
@@ -4120,7 +4120,7 @@ EraseMenuCursor:: ; 3bf9 (0:3bf9)
; initliazed with a down arrow, this function does nothing.
; That allows this to be called without worrying about if a down arrow should
; be blinking.
-HandleDownArrowBlinkTiming:: ; 3c04 (0:3c04)
+HandleDownArrowBlinkTiming::
ld a,[hl]
ld b,a
ld a,$ee ; down arrow
@@ -4165,20 +4165,20 @@ HandleDownArrowBlinkTiming:: ; 3c04 (0:3c04)
; text boxes by DisplayTextID. Both functions cause DisplayTextID to wait
; for a button press after displaying text (unless [wEnteringCableClub] is set).
-EnableAutoTextBoxDrawing:: ; 3c3c (0:3c3c)
+EnableAutoTextBoxDrawing::
xor a
jr AutoTextBoxDrawingCommon
-DisableAutoTextBoxDrawing:: ; 3c3f (0:3c3f)
+DisableAutoTextBoxDrawing::
ld a,$01
-AutoTextBoxDrawingCommon:: ; 3c41 (0:3c41)
+AutoTextBoxDrawingCommon::
ld [wAutoTextBoxDrawingControl],a
xor a
ld [wDoNotWaitForButtonPressAfterDisplayingText],a ; make DisplayTextID wait for button press
ret
-PrintText:: ; 3c49 (0:3c49)
+PrintText::
; Print text hl at (1, 14).
push hl
ld a,MESSAGE_BOX
@@ -4187,7 +4187,7 @@ PrintText:: ; 3c49 (0:3c49)
call UpdateSprites
call Delay3
pop hl
-PrintText_NoCreatingTextBox:: ; 3c59 (0:3c59)
+PrintText_NoCreatingTextBox::
coord bc, 1, 14
jp TextCommandProcessor
@@ -4462,7 +4462,7 @@ IsInRestOfArray::
ret
-RestoreScreenTilesAndReloadTilePatterns:: ; 3dbe (0:3dbe)
+RestoreScreenTilesAndReloadTilePatterns::
call ClearSprites
ld a, $1
ld [wUpdateSpritesEnabled], a
@@ -4499,9 +4499,9 @@ GBPalWhiteOut::
ret
-RunDefaultPaletteCommand:: ; 3ded (0:3ded)
+RunDefaultPaletteCommand::
ld b,$ff
-RunPaletteCommand:: ; 3def (0:3def)
+RunPaletteCommand::
ld a,[wOnSGB]
and a
ret z
@@ -4524,7 +4524,7 @@ GetHealthBarColor::
; Copy the current map's sprites' tile patterns to VRAM again after they have
; been overwritten by other tile patterns.
-ReloadMapSpriteTilePatterns:: ; 3e08 (0:3e08)
+ReloadMapSpriteTilePatterns::
ld hl, wFontLoaded
ld a, [hl]
push af
@@ -4588,10 +4588,10 @@ Random::
INCLUDE "home/predef.asm"
-UpdateCinnabarGymGateTileBlocks:: ; 3ead (0:3ead)
+UpdateCinnabarGymGateTileBlocks::
jpba UpdateCinnabarGymGateTileBlocks_
-CheckForHiddenObjectOrBookshelfOrCardKeyDoor:: ; 3eb5 (0:3eb5)
+CheckForHiddenObjectOrBookshelfOrCardKeyDoor::
ld a, [H_LOADEDROMBANK]
push af
ld a, [hJoyHeld]
@@ -4628,7 +4628,7 @@ CheckForHiddenObjectOrBookshelfOrCardKeyDoor:: ; 3eb5 (0:3eb5)
ld [H_LOADEDROMBANK], a
ret
-PrintPredefTextID:: ; 3ef5 (0:3ef5)
+PrintPredefTextID::
ld [hSpriteIndexOrTextID], a
ld hl, TextPredefs
call SetMapTextPointer
@@ -4636,7 +4636,7 @@ PrintPredefTextID:: ; 3ef5 (0:3ef5)
set 0, [hl]
call DisplayTextID
-RestoreMapTextPointer:: ; 3f05 (0:3f05)
+RestoreMapTextPointer::
ld hl, wMapTextPtr
ld a, [$ffec]
ld [hli], a
@@ -4644,7 +4644,7 @@ RestoreMapTextPointer:: ; 3f05 (0:3f05)
ld [hl], a
ret
-SetMapTextPointer:: ; 3f0f (0:3f0f)
+SetMapTextPointer::
ld a, [wMapTextPtr]
ld [$ffec], a
ld a, [wMapTextPtr + 1]