diff options
-rw-r--r-- | home.asm | 97 | ||||
-rw-r--r-- | home/audio.asm | 18 | ||||
-rw-r--r-- | home/init.asm | 4 | ||||
-rw-r--r-- | home/overworld.asm | 90 | ||||
-rw-r--r-- | home/pic.asm | 6 | ||||
-rw-r--r-- | home/serial.asm | 42 | ||||
-rw-r--r-- | home/vblank.asm | 2 |
7 files changed, 119 insertions, 140 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 diff --git a/home/audio.asm b/home/audio.asm index 8157e758..cb6f0988 100644 --- a/home/audio.asm +++ b/home/audio.asm @@ -17,6 +17,7 @@ PlayDefaultMusicFadeOutCurrent:: ld [wLastMusicSoundID], a ld c, 8 ld d, c + PlayDefaultMusicCommon:: ld a, [wWalkBikeSurfState] and a @@ -35,7 +36,7 @@ PlayDefaultMusicCommon:: ld b, a ld a, d and a ; should current music be faded out first? - ld a, $1f ; BANK(Music_BikeRiding) + ld a, BANK(Music_BikeRiding) jr nz, .next2 ; Only change the audio ROM bank if the current music isn't going to be faded @@ -87,12 +88,12 @@ CheckForNoBikingMusicMap:: ret UpdateMusic6Times:: - ld c, $6 + ld c, 6 UpdateMusicCTimes:: .loop push bc push hl - callba Audio1_UpdateMusic ; 2:509d + callba Audio1_UpdateMusic pop hl pop bc dec c @@ -165,16 +166,17 @@ PlaySound:: ld [wChannelSoundIDs + CH7], a .next ld a, [wAudioFadeOutControl] - and a + and a ; has a fade-out length been specified? jr z, .noFadeOut ld a, [wNewSoundID] - and a - jr z, .done + and a ; is the new sound ID 0? + jr z, .done ; if so, do nothing xor a ld [wNewSoundID], a ld a, [wLastMusicSoundID] - cp $ff - jr nz, .fadeOut + cp $ff ; has the music been stopped? + jr nz, .fadeOut ; if not, fade out the current music +; If it has been stopped, start playing the new music immediately. xor a ld [wAudioFadeOutControl], a .noFadeOut diff --git a/home/init.asm b/home/init.asm index 6aa14608..da354aa6 100644 --- a/home/init.asm +++ b/home/init.asm @@ -3,6 +3,8 @@ SoftReset:: call GBPalWhiteOut ld c, 32 call DelayFrames + ; fallthrough + Init:: ; Program init. @@ -49,7 +51,7 @@ rLCDC_DEFAULT EQU %11100011 or c jr nz, .loop - call ClearVram ; 1dc6 + call ClearVram ld hl, $ff80 ld bc, $fffe - $ff80 diff --git a/home/overworld.asm b/home/overworld.asm index e323fa49..d76fca98 100644 --- a/home/overworld.asm +++ b/home/overworld.asm @@ -3,7 +3,7 @@ EnterMap:: ld a, $ff ld [wJoyIgnore], a call LoadMapData - callba ClearVariablesAfterLoadingMapData ; 3:407c + callba ClearVariablesAfterLoadingMapData ld hl, wd72c bit 0, [hl] ; has the player already made 3 steps since the last battle? jr z, .skipGivingThreeStepsOfNoRandomBattles @@ -51,7 +51,7 @@ OverworldLoopLessDelay:: and a jp nz, .moveAhead ; if the player sprite has not yet completed the walking animation call JoypadOverworld ; get joypad state (which is possibly simulated) - callba SafariZoneCheck ; 7:6321 + callba SafariZoneCheck ld a, [wSafariZoneGameOver] and a jp nz, WarpFound2 @@ -70,7 +70,6 @@ OverworldLoopLessDelay:: jr z, .notSimulating ld a, [hJoyHeld] jr .checkIfStartIsPressed - .notSimulating ld a, [hJoyPressed] .checkIfStartIsPressed @@ -80,7 +79,6 @@ OverworldLoopLessDelay:: xor a ld [hSpriteIndexOrTextID], a ; start menu text ID jp .displayDialogue - .startButtonNotPressed bit 0, a ; A button jp z, .checkIfDownButtonIsPressed @@ -118,15 +116,6 @@ OverworldLoopLessDelay:: xor a ld [wLinkTimeoutCounter], a jp EnterMap - -; predef LoadSAV -; ld a, [wCurMap] -; ld [wDestinationMap], a -; call SpecialWarpIn -; ld a, [wCurMap] -; call SwitchToMapRomBank ; switch to the ROM bank of the current map -; ld hl, wCurMapTileset -; set 7, [hl] .checkForOpponent ld a, [wCurOpponent] and a @@ -134,12 +123,12 @@ OverworldLoopLessDelay:: jp OverworldLoop .noDirectionButtonsPressed - call UpdateSprites ; 231c + call UpdateSprites ld hl, wFlags_0xcd60 res 2, [hl] xor a ld [wd435], a - ld a, $1 + ld a, 1 ld [wCheckFor180DegreeTurn], a ld a, [wPlayerMovingDirection] ; the direction that was pressed last time and a @@ -179,9 +168,10 @@ OverworldLoopLessDelay:: .checkIfRightButtonIsPressed bit 4, a ; right button jr z, .noDirectionButtonsPressed - ld a, $1 - ld [wSpriteStateData1 + 5], a - ld a, $1 + ld a, 1 + ld [wSpriteStateData1 + 5], a ; delta X + ld a, 1 + .handleDirectionButtonPress ld [wPlayerDirection], a ; new direction ld a, [wd730] @@ -234,6 +224,7 @@ OverworldLoopLessDelay:: .surfing call CollisionCheckOnWater jp c, OverworldLoop + .noCollision ld a, $08 ld [wWalkCounter], a @@ -242,7 +233,8 @@ OverworldLoopLessDelay:: .moveAhead call IsSpinning - call UpdateSprites ; move sprites + call UpdateSprites + .moveAhead2 ld hl, wFlags_0xcd60 res 2, [hl] @@ -338,11 +330,12 @@ NewBattle:: ld a, [wd72e] bit 4, a jr nz, .noBattle - jpba InitBattle ; 3d:5ff2 + jpba InitBattle .noBattle and a ret +; function to make bikes twice as fast as walking DoBikeSpeedup:: ld a, [wWalkBikeSurfState] dec a ; riding a bike? @@ -354,7 +347,7 @@ DoBikeSpeedup:: and a ret nz ld a, [wCurMap] - cp ROUTE_17 ; cycling road + cp ROUTE_17 ; Cycling Road jr nz, .goFaster ld a, [hJoyHeld] and D_UP | D_LEFT | D_RIGHT @@ -444,7 +437,6 @@ CheckWarpsCollision:: ld a, [hl] ld [hWarpDestinationMap], a jr WarpFound2 - .retry1 inc hl .retry2 @@ -502,18 +494,17 @@ WarpFound2:: ld hl, wd732 set 3, [hl] jr .skipMapChangeSound - .notWarpPad call PlayMapChangeSound .skipMapChangeSound ld hl, wd736 res 0, [hl] res 1, [hl] - callab CalculatePikachuSpawnState2 ; 3f:465b + callab CalculatePikachuSpawnState2 jr .done .goBackOutside - callab CalculatePikachuSpawnState3 ; 3f:469a + callab CalculatePikachuSpawnState3 ld a, [wLastMap] ld [wCurMap], a call PlayMapChangeSound @@ -653,14 +644,13 @@ CheckMapConnections:: ld [wCurrentTileBlockMapViewPointer], a ; pointer to upper left corner of current tile block map section ld a, h ld [wCurrentTileBlockMapViewPointer + 1], a -.loadNewMap ; 06ce (0:06ce) -; load the connected map that was entered +.loadNewMap ; load the connected map that was entered ld hl, wPikachuOverworldStateFlags set 4, [hl] ld a, $2 ld [wPikachuSpawnState], a - call LoadMapHeader ; 0dab (0:0dab) - call PlayDefaultMusicFadeOutCurrent ; music + call LoadMapHeader + call PlayDefaultMusicFadeOutCurrent ld b, SET_PAL_OVERWORLD call RunPaletteCommand ; Since the sprite set shouldn't change, this will just update VRAM slots at @@ -680,13 +670,12 @@ PlayMapChangeSound:: cp CEMETERY jr z, .didNotGoThroughDoor aCoord 8, 8 ; upper left tile of the 4x4 square the player's sprite is standing on - cp UNDERGROUND ; door tile in tileset 0 + cp $0b ; door tile in tileset 0 jr nz, .didNotGoThroughDoor - ld a, $ad ; SFX_GO_INSIDE + ld a, SFX_GO_INSIDE jr .playSound - .didNotGoThroughDoor - ld a, $b5 ; SFX_GO_OUTSIDE + ld a, SFX_GO_OUTSIDE .playSound call PlaySound ld a, [wMapPalOffset] @@ -732,7 +721,6 @@ ExtraWarpCheck:: .useFunction1 ld hl, IsPlayerFacingEdgeOfMap jr .doBankswitch - .useFunction2 ld hl, IsWarpTileInFrontOfPlayer .doBankswitch @@ -1267,14 +1255,13 @@ CollisionCheckOnLand:: jr nc, .noCollision .collision ld a, [wChannelSoundIDs + CH4] - cp $b4 ; SFX_COLLISION ; check if collision sound is already playing + cp SFX_COLLISION ; check if collision sound is already playing jr z, .setCarry - ld a, $b4 ; SFX_COLLISION + ld a, SFX_COLLISION call PlaySound ; play collision sound (if it's not already playing) .setCarry scf ret - .noCollision and a ret @@ -1297,8 +1284,7 @@ CheckForJumpingAndTilePairCollisions:: predef GetTileAndCoordsInFrontOfPlayer ; get the tile in front of the player push de push bc - callba HandleLedges ; 6:67f4 - ; check if the player is trying to jump a ledge + callba HandleLedges ; check if the player is trying to jump a ledge pop bc pop de pop hl @@ -1327,7 +1313,6 @@ CheckForTilePairCollisions:: .retry inc hl jr .tilePairCollisionLoop - .tilesetMatches ld a, [wTilePlayerStandingOn] ; tile the player is on ld b, a @@ -1339,14 +1324,12 @@ CheckForTilePairCollisions:: cp b jr z, .currentTileMatchesSecondInPair jr .retry - .currentTileMatchesFirstInPair inc hl ld a, [hl] cp c jr z, .foundMatch jr .tilePairCollisionLoop - .currentTileMatchesSecondInPair dec hl ld a, [hli] @@ -1356,7 +1339,6 @@ CheckForTilePairCollisions:: .foundMatch scf ret - .noMatch and a ret @@ -1480,7 +1462,7 @@ AdvancePlayerSprite:: push af ld a, $FF ld [wUpdateSpritesEnabled], a - ld hl, _AdvancePlayerSprite ; 3c:410c + ld hl, _AdvancePlayerSprite ld b, BANK(_AdvancePlayerSprite) call Bankswitch pop af @@ -1705,13 +1687,7 @@ GetSimulatedInput:: ; function to check the tile ahead to determine if the character should get on land or keep surfing ; sets carry if there is a collision and clears carry otherwise -; It seems that this function has a bug in it, but due to luck, it doesn't -; show up. After detecting a sprite collision, it jumps to the code that -; checks if the next tile is passable instead of just directly jumping to the -; "collision detected" code. However, it doesn't store the next tile in c, -; so the old value of c is used. 2429 is always called before this function, -; and 2429 always sets c to 0xF0. There is no 0xF0 background tile, so it -; is considered impassable and it is detected as a collision. +; This function had a bug in Red/Blue, but it was fixed in Yellow. CollisionCheckOnWater:: ld a, [wd730] bit 7, a @@ -1720,12 +1696,12 @@ CollisionCheckOnWater:: ld d, a ld a, [wSpriteStateData1 + 12] ; the player sprite's collision data (bit field) (set in the sprite movement code) and d ; check if a sprite is in the direction the player is trying to go - jr nz, .collision ; bug? + jr nz, .collision ld hl, TilePairCollisionsWater call CheckForJumpingAndTilePairCollisions jr c, .collision predef GetTileAndCoordsInFrontOfPlayer ; get tile in front of player (puts it in c and [wTileInFrontOfPlayer]) - callab IsNextTileShoreOrWater ; 3:6808 + callab IsNextTileShoreOrWater jr c, .noCollision ld a, [wTileInFrontOfPlayer] ; tile in front of player ld c, a @@ -1733,9 +1709,9 @@ CollisionCheckOnWater:: jr nc, .stopSurfing .collision ld a, [wChannelSoundIDs + CH4] - cp $b4 ; SFX_COLLISION + cp SFX_COLLISION ; check if collision sound is already playing jr z, .setCarry - ld a, $b4 ; SFX_COLLISION + ld a, SFX_COLLISION call PlaySound ; play collision sound (if it's not already playing) .setCarry scf @@ -1815,7 +1791,7 @@ LoadSurfingPlayerSpriteGraphics2:: jr LoadPlayerSpriteGraphicsCommon LoadSurfingPlayerSpriteGraphics:: - ld b, BANK(RedSprite) ; not sure, but probably same bank (5) + ld b, BANK(SeelSprite) ld de, SeelSprite jr LoadPlayerSpriteGraphicsCommon @@ -2150,7 +2126,7 @@ IgnoreInputForHalfSecond: ld [wIgnoreInputCounter], a ld hl, wd730 ld a, [hl] - or %00100110 ; $26 + or %00100110 ld [hl], a ; set ignore input bit ret diff --git a/home/pic.asm b/home/pic.asm index d0645a8c..353d0f58 100644 --- a/home/pic.asm +++ b/home/pic.asm @@ -528,15 +528,15 @@ ReverseNybble:: ld de, NybbleReverseTable add e ld e, a - jr nc, .asm_2735 + jr nc, .noCarry inc d -.asm_2735 +.noCarry ld a, [de] ret ; resets sprite buffer pointers to buffer 1 and 2, depending on wSpriteLoadFlags ResetSpriteBufferPointers:: - ld a, [wSpriteLoadFlags] ; wd0a8 + ld a, [wSpriteLoadFlags] bit 0, a jr nz, .buffer2Selected ld de, sSpriteBuffer1 diff --git a/home/serial.asm b/home/serial.asm index 508148df..5fe7fb81 100644 --- a/home/serial.asm +++ b/home/serial.asm @@ -94,79 +94,79 @@ Serial_ExchangeByte:: ld [hSerialReceivedNewData], a ld a, [hSerialConnectionStatus] cp USING_INTERNAL_CLOCK - jr nz, .asm_2003 + jr nz, .loop ld a, START_TRANSFER_INTERNAL_CLOCK ld [rSC], a -.asm_2003 +.loop ld a, [hSerialReceivedNewData] and a - jr nz, .asm_204d + jr nz, .ok ld a, [hSerialConnectionStatus] cp USING_EXTERNAL_CLOCK - jr nz, .asm_2028 + jr nz, .doNotIncrementUnknownCounter call IsUnknownCounterZero - jr z, .asm_2028 + jr z, .doNotIncrementUnknownCounter call WaitLoop_15Iterations push hl ld hl, wUnknownSerialCounter + 1 inc [hl] - jr nz, .asm_201f + jr nz, .noCarry dec hl inc [hl] -.asm_201f +.noCarry pop hl call IsUnknownCounterZero - jr nz, .asm_2003 + jr nz, .loop jp SetUnknownCounterToFFFF -.asm_2028 +.doNotIncrementUnknownCounter ld a, [rIE] and (1 << SERIAL) | (1 << TIMER) | (1 << LCD_STAT) | (1 << VBLANK) cp (1 << SERIAL) - jr nz, .asm_2003 + jr nz, .loop ld a, [wUnknownSerialCounter2] dec a ld [wUnknownSerialCounter2], a - jr nz, .asm_2003 + jr nz, .loop ld a, [wUnknownSerialCounter2 + 1] dec a ld [wUnknownSerialCounter2 + 1], a - jr nz, .asm_2003 + jr nz, .loop ld a, [hSerialConnectionStatus] cp USING_EXTERNAL_CLOCK - jr z, .asm_204d + jr z, .ok ld a, 255 .waitLoop dec a jr nz, .waitLoop -.asm_204d +.ok xor a ld [hSerialReceivedNewData], a ld a, [rIE] and (1 << SERIAL) | (1 << TIMER) | (1 << LCD_STAT) | (1 << VBLANK) sub (1 << SERIAL) - jr nz, .asm_2060 + jr nz, .skipReloadingUnknownCounter2 ld [wUnknownSerialCounter2], a ld a, $50 ld [wUnknownSerialCounter2 + 1], a -.asm_2060 +.skipReloadingUnknownCounter2 ld a, [hSerialReceiveData] cp SERIAL_NO_DATA_BYTE ret nz call IsUnknownCounterZero - jr z, .asm_207b + jr z, .done push hl ld hl, wUnknownSerialCounter + 1 ld a, [hl] dec a ld [hld], a inc a - jr nz, .asm_2075 + jr nz, .noBorrow dec [hl] -.asm_2075 +.noBorrow pop hl call IsUnknownCounterZero jr z, SetUnknownCounterToFFFF -.asm_207b +.done ld a, [rIE] and (1 << SERIAL) | (1 << TIMER) | (1 << LCD_STAT) | (1 << VBLANK) cp (1 << SERIAL) @@ -228,7 +228,7 @@ Serial_ExchangeLinkMenuSelection:: Serial_PrintWaitingTextAndSyncAndExchangeNybble:: call SaveScreenTilesToBuffer1 - callab PrintWaitingText ; 1:4b89 + callab PrintWaitingText call Serial_SyncAndExchangeNybble jp LoadScreenTilesFromBuffer1 diff --git a/home/vblank.asm b/home/vblank.asm index 9cc8d42f..764e5277 100644 --- a/home/vblank.asm +++ b/home/vblank.asm @@ -55,8 +55,8 @@ VBlank:: jr z, .skipDec dec a ld [H_FRAMECOUNTER], a -.skipDec +.skipDec call FadeOutAudio callbs Music_DoLowHealthAlarm |