diff options
Diffstat (limited to 'home.asm')
-rw-r--r-- | home.asm | 97 |
1 files changed, 48 insertions, 49 deletions
@@ -87,7 +87,7 @@ INCLUDE "home/copy.asm" SECTION "Entry", ROM0 [$100] nop - jp Start ; 01ab + jp Start SECTION "Header", ROM0 [$104] @@ -154,7 +154,7 @@ Start:: xor a jr .ok .gbc - ld a, $1 + ld a, 1 .ok ld [hGBC], a jp Init @@ -300,7 +300,7 @@ DrawHPBar:: ; OUTPUT: ; [wcf91] = pokemon ID ; wLoadedMon = base address of pokemon data -; W_MONHDEXNUM = base address of base stats +; wMonHeader = base address of base stats LoadMonData:: jpab LoadMonData_ @@ -523,7 +523,7 @@ HandlePartyMenuInput:: bit 1, b ; was the B button pressed? jr z, .handleSwap ; if not, handle swapping the pokemon .cancelSwap ; if the B button was pressed - callba ErasePartyMenuCursors ; 4:5e98 + callba ErasePartyMenuCursors xor a ld [wMenuItemToSwap], a ld [wPartyMenuTypeOrMessageID], a @@ -532,7 +532,7 @@ HandlePartyMenuInput:: .handleSwap ld a, [wCurrentMenuItem] ld [wWhichPokemon], a - callba SwitchPartyMon ; 4:61c5 + callba SwitchPartyMon jp HandlePartyMenuInput PartyMenuText_12cc:: @@ -540,11 +540,11 @@ PartyMenuText_12cc:: db "@" DrawPartyMenu:: - ld hl, DrawPartyMenu_ ; 4:5875 + ld hl, DrawPartyMenu_ jr DrawPartyMenuCommon RedrawPartyMenu:: - ld hl, RedrawPartyMenu_ ; 4:5886 + ld hl, RedrawPartyMenu_ DrawPartyMenuCommon:: ld b, BANK(RedrawPartyMenu_) @@ -648,11 +648,11 @@ GetMonHeader:: predef IndexToPokedex ; convert pokemon ID in [wd11e] to pokedex number ld a, [wd11e] dec a - ld bc, 28 + ld bc, MonBaseStatsEnd - MonBaseStats ld hl, BaseStats call AddNTimes ld de, wMonHeader - ld bc, 28 + ld bc, MonBaseStatsEnd - MonBaseStats call CopyData jr .done .specialID @@ -816,7 +816,7 @@ UncompressMonSprite:: jr c, .GotBank ld a, BANK(VictreebelPicFront) .GotBank - jp UncompressSpriteData ; 23f8 + jp UncompressSpriteData ; de: destination location LoadMonFrontSprite:: @@ -879,7 +879,7 @@ LoadUncompressedSpriteData:: call AlignSpriteDataCentered ; copy and align buffer 2 to 1 (containing the LSB of the 2bpp sprite) call PrepareRTCDataAndDisableSRAM pop de - jp InterlaceMergeSpriteBuffers ; 14c7 + jp InterlaceMergeSpriteBuffers ; 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 @@ -1064,21 +1064,20 @@ ResetPlayerSpriteData:: ResetPlayerSpriteData_ClearSpriteData:: ld bc, $10 xor a - call FillMemory ; XXX why replaced with call + ret? + call FillMemory ret - ;jp FillMemory FadeOutAudio:: ld a, [wAudioFadeOutControl] - and a - jr nz, .asm_27d3 + and a ; currently fading out audio? + jr nz, .fadingOut ld a, [wd72c] bit 1, a ret nz ld a, $77 ld [rNR50], a ret -.asm_27d3 +.fadingOut ld a, [wAudioFadeOutCounter] and a jr z, .counterReachedZero @@ -1089,8 +1088,8 @@ FadeOutAudio:: ld a, [wAudioFadeOutCounterReloadValue] ld [wAudioFadeOutCounter], a ld a, [rNR50] - and a - jr z, .asm_27fa + and a ; has the volume reached 0? + jr z, .fadeOutComplete ld b, a and $f dec a @@ -1103,7 +1102,7 @@ FadeOutAudio:: or c ld [rNR50], a ret -.asm_27fa +.fadeOutComplete ld a, [wAudioFadeOutControl] ld b, a xor a @@ -1143,7 +1142,7 @@ DisplayTextID:: ld [wSpriteIndex], a and a jp z, DisplayStartMenu - cp TEXT_PIKACHU_ANIM ; new yellow asm + cp TEXT_PIKACHU_ANIM jp z, DisplayPikachuEmotion cp TEXT_SAFARI_GAME_OVER jp z, DisplaySafariGameOverText @@ -1204,7 +1203,7 @@ DisplayTextID:: callba VendingMachineMenu ; jump banks to vending machine routine jr AfterDisplayingTextID .notVendingMachine - cp $f7 ; slot machine + cp $f7 ; prize menu jp z, FuncTX_GameCornerPrizeMenu cp $f6 ; cable connection NPC in Pokemon Center jr nz, .notSpecialCase @@ -1269,7 +1268,7 @@ DisplayPokemartDialogue:: inc hl call LoadItemList ld a, PRICEDITEMLISTMENU - ld [wListMenuID], a ; selects between subtypes of menus + ld [wListMenuID], a homecall DisplayPokemartDialogue_ jp AfterDisplayingTextID @@ -1393,9 +1392,9 @@ AddAmountSoldToMoney:: ld a, MONEY_BOX ld [wTextBoxID], a call DisplayTextBoxID ; redraw money text box - ld a, $b2 ; SFX_PURCHASE - call PlaySoundWaitForCurrent ; play sound - jp WaitForSoundToFinish ; wait until sound is done playing + ld a, SFX_PURCHASE + call PlaySoundWaitForCurrent + jp WaitForSoundToFinish ; function to remove an item (in varying quantities) from the player's bag or PC box ; INPUT: @@ -1432,7 +1431,7 @@ DisplayListMenuID:: ld a, $01 ; hardcoded bank jr .bankswitch .specialBattleType ; Old Man battle - ld a, $f ; BANK(DisplayBattleMenu) + ld a, BANK(DisplayBattleMenu) .bankswitch call BankswitchHome ld hl, wd730 @@ -1793,7 +1792,7 @@ PrintListMenuEntries:: ld a, [wListMenuID] and a jr z, .pokemonPCMenu - cp $01 + cp MOVESLISTMENU jr z, .movesMenu .itemMenu call GetItemName @@ -1946,12 +1945,12 @@ GetMonName:: push hl ld a, [H_LOADEDROMBANK] push af - ld a, BANK(MonsterNames) ; 3a + ld a, BANK(MonsterNames) ld [H_LOADEDROMBANK], a ld [MBC1RomBank], a ld a, [wd11e] dec a - ld hl, MonsterNames ; 4000 + ld hl, MonsterNames ld c, 10 ld b, 0 call AddNTimes @@ -2206,6 +2205,7 @@ IsKeyItem:: ; function to draw various text boxes ; INPUT: ; [wTextBoxID] = text box ID +; b, c = y, x cursor position (TWO_OPTION_MENU only) DisplayTextBoxID:: homecall_sf DisplayTextBoxID_ ret @@ -3209,12 +3209,13 @@ YesNoChoicePokeCenter:: lb bc, 8, 12 jr DisplayYesNoChoice -Func_361d:: +WideYesNoChoice:: ; unused call SaveScreenTilesToBuffer1 ld a, WIDE_YES_NO_MENU ld [wTwoOptionMenuID], a coord hl, 12, 7 lb bc, 8, 13 + DisplayYesNoChoice:: ld a, TWO_OPTION_MENU ld [wTextBoxID], a @@ -3352,7 +3353,7 @@ SaveScreenTilesToBuffer2:: LoadScreenTilesFromBuffer2:: call LoadScreenTilesFromBuffer2DisableBGTransfer - ld a, $1 + ld a, 1 ld [H_AUTOBGTRANSFERENABLED], a ret @@ -3378,7 +3379,7 @@ LoadScreenTilesFromBuffer1:: coord de, 0, 0 ld bc, SCREEN_WIDTH * SCREEN_HEIGHT call CopyData - ld a, $1 + ld a, 1 ld [H_AUTOBGTRANSFERENABLED], a ret @@ -3515,9 +3516,9 @@ GetItemPrice:: ld a, [wListMenuID] cp MOVESLISTMENU ld a, BANK(ItemPrices) - jr nz, .asm_37e0 + jr nz, .ok ld a, $f ; hardcoded Bank -.asm_37e0 +.ok call BankswitchCommon ld hl, wItemPrices ld a, [hli] @@ -3527,10 +3528,10 @@ GetItemPrice:: cp HM_01 jr nc, .getTMPrice ld bc, $3 -.asm_37f3 +.loop add hl, bc dec a - jr nz, .asm_37f3 + jr nz, .loop dec hl ld a, [hld] ld [hItemPrice + 2], a @@ -3538,10 +3539,10 @@ GetItemPrice:: ld [hItemPrice + 1], a ld a, [hl] ld [hItemPrice], a - jr .asm_380b + jr .done .getTMPrice callbs GetMachinePrice -.asm_380b +.done ld de, hItemPrice pop af call BankswitchCommon @@ -3631,7 +3632,7 @@ WaitForTextScrollButtonPress:: jr z, .skipAnimation push de push bc - callab TownMapSpriteBlinkingAnimation ; 1c:5753 + callab TownMapSpriteBlinkingAnimation pop bc pop de .skipAnimation @@ -3656,7 +3657,7 @@ ManualTextScroll:: jr z, .inLinkBattle call WaitForTextScrollButtonPress call WaitForSoundToFinish - ld a, $90 ; SFX_PRESS_AB + ld a, SFX_PRESS_AB jp PlaySound .inLinkBattle ld c, 65 @@ -3672,7 +3673,7 @@ ManualTextScroll:: Multiply:: push hl push bc - callab _Multiply ; 3d:660e + callab _Multiply pop bc pop hl ret @@ -4040,7 +4041,7 @@ WriteOAMBlock:: add c ld c, a ; lower right -.writeOneEntry ; 3aa0 (0:3aa0) +.writeOneEntry ld [hl], b ; Y coordinate inc hl ld [hl], c ; X coordinate @@ -4076,7 +4077,7 @@ HandleMenuInputPokemonSelection:: ld a, [wPartyMenuAnimMonEnabled] and a ; is it a pokemon selection menu? jr z, .getJoypadState - callba AnimatePartyMon ; shake mini sprite of selected pokemon (1c:578c) + callba AnimatePartyMon ; shake mini sprite of selected pokemon .getJoypadState pop hl call JoypadLowSensitivity @@ -4156,8 +4157,8 @@ HandleMenuInputPokemonSelection:: bit 5, [hl] pop hl jr nz, .skipPlayingSound - ld a, $90 ; SFX_PRESS_AB - call PlaySound ; play sound + ld a, SFX_PRESS_AB + call PlaySound .skipPlayingSound pop af ld [H_DOWNARROWBLINKCNT2], a @@ -4740,7 +4741,7 @@ GivePokemon:: ld [wCurEnemyLVL], a xor a ; PLAYER_PARTY_DATA ld [wMonDataLocation], a - jpba _GivePokemon ; 3d:66fa + jpba _GivePokemon Random:: ; Return a random number in a. @@ -4835,7 +4836,7 @@ CheckForHiddenObjectOrBookshelfOrCardKeyDoor:: ret PrintPredefTextID:: - ld [hSpriteIndexOrTextID], a ; $ff8c + ld [hSpriteIndexOrTextID], a ld hl, TextPredefs call SetMapTextPointer ld hl, wTextPredefFlag @@ -4934,5 +4935,3 @@ const_value = 1 add_tx_pre BookOrSculptureText ; 42 add_tx_pre ElevatorText ; 43 add_tx_pre PokemonStuffText ; 44 - - ; dr $3f67, $4000 |