diff options
| author | YamaArashi <shadow962@live.com> | 2016-06-11 17:48:24 -0700 |
|---|---|---|
| committer | YamaArashi <shadow962@live.com> | 2016-06-11 17:50:20 -0700 |
| commit | 7e112672b436afee27f1a5a0d6e7a5964e7829b2 (patch) | |
| tree | 9176ffc5b6384a48eb32ea8f33ac97d1d67f6865 /home | |
| parent | Merge branch 'master' of github.com:pret/pokeyellow (diff) | |
| download | pokeyellow-7e112672b436afee27f1a5a0d6e7a5964e7829b2.tar.gz pokeyellow-7e112672b436afee27f1a5a0d6e7a5964e7829b2.tar.xz pokeyellow-7e112672b436afee27f1a5a0d6e7a5964e7829b2.zip | |
remove address comments
Diffstat (limited to 'home')
| -rw-r--r-- | home/audio.asm | 30 | ||||
| -rw-r--r-- | home/copy.asm | 8 | ||||
| -rw-r--r-- | home/copy2.asm | 16 | ||||
| -rw-r--r-- | home/fade.asm | 10 | ||||
| -rw-r--r-- | home/init.asm | 6 | ||||
| -rw-r--r-- | home/lcdc.asm | 2 | ||||
| -rw-r--r-- | home/overworld.asm | 170 | ||||
| -rw-r--r-- | home/pic.asm | 42 | ||||
| -rwxr-xr-x | home/pikachu.asm | 22 | ||||
| -rw-r--r-- | home/play_time.asm | 4 | ||||
| -rw-r--r-- | home/predef.asm | 4 | ||||
| -rw-r--r-- | home/serial.asm | 28 | ||||
| -rw-r--r-- | home/text.asm | 94 | ||||
| -rw-r--r-- | home/timer.asm | 2 | ||||
| -rw-r--r-- | home/vblank.asm | 4 | ||||
| -rw-r--r-- | home/vcopy.asm | 18 |
16 files changed, 230 insertions, 230 deletions
diff --git a/home/audio.asm b/home/audio.asm index f71aa3d0..8157e758 100644 --- a/home/audio.asm +++ b/home/audio.asm @@ -1,4 +1,4 @@ -PlayDefaultMusic:: ; 216b (0:216b) +PlayDefaultMusic:: call WaitForSoundToFinish xor a ld c, a @@ -6,7 +6,7 @@ PlayDefaultMusic:: ; 216b (0:216b) ld [wLastMusicSoundID], a jr PlayDefaultMusicCommon -PlayDefaultMusicFadeOutCurrent:: ; 2176 (0:2176) +PlayDefaultMusicFadeOutCurrent:: ; Fade out the current music and then play the default music. ld c, 10 ld d, 0 @@ -17,7 +17,7 @@ PlayDefaultMusicFadeOutCurrent:: ; 2176 (0:2176) ld [wLastMusicSoundID], a ld c, 8 ld d, c -PlayDefaultMusicCommon:: ; 2118 (0:2118) +PlayDefaultMusicCommon:: ld a, [wWalkBikeSurfState] and a jr z, .walking @@ -67,7 +67,7 @@ PlayDefaultMusicCommon:: ; 2118 (0:2118) ld [wNewSoundID], a jp PlaySound -CheckForNoBikingMusicMap:: ; 21c8 (0:21c8) +CheckForNoBikingMusicMap:: ; probably used to not change music upon getting on bike ld a, [wCurMap] cp ROUTE_23 @@ -86,7 +86,7 @@ CheckForNoBikingMusicMap:: ; 21c8 (0:21c8) scf ret -UpdateMusic6Times:: ; 21e3 (0:21e3) +UpdateMusic6Times:: ld c, $6 UpdateMusicCTimes:: .loop @@ -99,7 +99,7 @@ UpdateMusicCTimes:: jr nz, .loop ret -CompareMapMusicBankWithCurrentBank:: ; 21f5 (0:21f5) +CompareMapMusicBankWithCurrentBank:: ; Compares the map music's audio ROM bank with the current audio ROM bank ; and updates the audio ROM bank variables. ; Returns whether the banks are different in carry. @@ -126,7 +126,7 @@ CompareMapMusicBankWithCurrentBank:: ; 21f5 (0:21f5) scf ret -PlayMusic:: ; 2211 (0:2211) +PlayMusic:: ld b, a ld [wNewSoundID], a xor a @@ -137,7 +137,7 @@ PlayMusic:: ; 2211 (0:2211) ld a, b jr PlaySound -Func_2223:: ; 2223 (0:2223) +Func_2223:: xor a ld [wChannelSoundIDs + CH4], a ld [wChannelSoundIDs + CH5], a @@ -146,11 +146,11 @@ Func_2223:: ; 2223 (0:2223) ld [rNR10], a ret -StopAllMusic:: ; 2233 (0:2233) +StopAllMusic:: ld a, $FF ld [wNewSoundID], a ; plays music specified by a. If value is $ff, music is stopped -PlaySound:: ; 2238 (0:2238) +PlaySound:: push hl push de push bc @@ -197,7 +197,7 @@ PlaySound:: ; 2238 (0:2238) pop hl ret -GetNextMusicByte:: ; 2288 (0:2288) +GetNextMusicByte:: ld a, [H_LOADEDROMBANK] push af ld a, [wAudioROMBank] @@ -223,7 +223,7 @@ GetNextMusicByte:: ; 2288 (0:2288) ld a, e ret -InitMusicVariables:: ; 22aa (0:22aa) +InitMusicVariables:: push hl push de push bc @@ -233,7 +233,7 @@ InitMusicVariables:: ; 22aa (0:22aa) pop hl ret -InitSFXVariables:: ; 22c0 (0:22c0) +InitSFXVariables:: push hl push de push bc @@ -243,7 +243,7 @@ InitSFXVariables:: ; 22c0 (0:22c0) pop hl ret -StopAllAudio:: ; 22d6 (0:22d6) +StopAllAudio:: push hl push de push bc @@ -253,7 +253,7 @@ StopAllAudio:: ; 22d6 (0:22d6) pop hl ret -DetermineAudioFunction:: ; 22ec (0:22ec) +DetermineAudioFunction:: ld a, [H_LOADEDROMBANK] push af ld a, [wAudioROMBank] diff --git a/home/copy.asm b/home/copy.asm index d073f54c..4f1d5017 100644 --- a/home/copy.asm +++ b/home/copy.asm @@ -1,4 +1,4 @@ -FarCopyData:: ; 009d (0:009d) +FarCopyData:: ; Copy bc bytes from a:hl to de. ld [wFarCopyDataSavedROMBank], a ld a, [H_LOADEDROMBANK] @@ -10,7 +10,7 @@ FarCopyData:: ; 009d (0:009d) call BankswitchCommon ret -CopyData:: ; 00b1 (0:00b1) +CopyData:: ; Copy bc bytes from hl to de. ld a,b and a @@ -33,7 +33,7 @@ CopyData:: ; 00b1 (0:00b1) jr nz, .copybytes ret -CopyVideoDataAlternate:: ; 00c8 (0:00c8) +CopyVideoDataAlternate:: ld a, [rLCDC] bit 7,a ; LCD enabled? jp nz, CopyVideoData ; if yes, then copy video data @@ -53,7 +53,7 @@ CopyVideoDataAlternate:: ; 00c8 (0:00c8) pop af jp FarCopyData -CopyVideoDataDoubleAlternate:: ; 00e3 (0:00e3) +CopyVideoDataDoubleAlternate:: ld a, [rLCDC] bit 7,a ; LCD enabled? jp nz, CopyVideoDataDouble ; if yes, then copy video data diff --git a/home/copy2.asm b/home/copy2.asm index 07eeb6b2..ad47c4a0 100644 --- a/home/copy2.asm +++ b/home/copy2.asm @@ -1,4 +1,4 @@ -FarCopyDataDouble:: ; 15d4 (0:15d4) +FarCopyDataDouble:: ; Expand bc bytes of 1bpp image data ; from a:de to 2bpp data at hl. ld [wFarCopyDataSavedROMBank],a @@ -33,7 +33,7 @@ FarCopyDataDouble:: ; 15d4 (0:15d4) call BankswitchCommon ret -CopyVideoData:: ; 15fe (0:15fe) +CopyVideoData:: ; Wait for the next VBlank, then copy c 2bpp ; tiles from b:de to hl, 8 tiles at a time. ; This takes c/8 frames. @@ -82,7 +82,7 @@ CopyVideoData:: ; 15fe (0:15fe) ld c, a jr .loop -CopyVideoDataDouble:: ; 1636 (0:1636) +CopyVideoDataDouble:: ; Wait for the next VBlank, then copy c 1bpp ; tiles from b:de to hl, 8 tiles at a time. ; This takes c/8 frames. @@ -129,7 +129,7 @@ CopyVideoDataDouble:: ; 1636 (0:1636) ld c, a jr .loop -FillMemory:: ; 166e (0:166e) +FillMemory:: push af ld a,b and a @@ -149,7 +149,7 @@ FillMemory:: ; 166e (0:166e) jr nz, .loop ret -GetFarByte:: ; 1681 (0:1681) +GetFarByte:: ; get a byte from a:hl ; and return it in a push bc @@ -165,7 +165,7 @@ GetFarByte:: ; 1681 (0:1681) pop bc ret -ClearScreenArea:: ; 1692 (0:1692) +ClearScreenArea:: ; Clear tilemap area cxb at hl. ld a, " " ; blank tile ld de, 20 ; screen width @@ -183,7 +183,7 @@ ClearScreenArea:: ; 1692 (0:1692) jr nz, .y ret -CopyScreenTileBufferToVRAM:: ; 16a4 (0:16a4) +CopyScreenTileBufferToVRAM:: ; Copy wTileMap to the BG Map starting at b * $100. ; This is done in thirds of 6 rows, so it takes 3 frames. @@ -218,7 +218,7 @@ CopyScreenTileBufferToVRAM:: ; 16a4 (0:16a4) ld [H_VBCOPYBGSRC], a ret -ClearScreen:: ; 16dd (0:16dd) +ClearScreen:: ; Clear wTileMap, then wait ; for the bg map to update. ld bc, 20 * 18 diff --git a/home/fade.asm b/home/fade.asm index 7ac2e1c2..1259f92b 100644 --- a/home/fade.asm +++ b/home/fade.asm @@ -1,6 +1,6 @@ ; These routines manage gradual fading ; (e.g., entering a doorway) -LoadGBPal:: ; 1e6f (0:1e6f) +LoadGBPal:: ld a, [wMapPalOffset] ; tells if wCurMap is dark (requires HM5_FLASH?) ld b, a ld hl, FadePal4 @@ -21,16 +21,16 @@ LoadGBPal:: ; 1e6f (0:1e6f) call UpdateGBCPal_OBP1 ret -GBFadeInFromBlack:: ; 1e8f (0:1e8f) +GBFadeInFromBlack:: ld hl, FadePal1 ld b, 4 jr GBFadeIncCommon -GBFadeOutToWhite:: ; 1e96 (0:1e96) +GBFadeOutToWhite:: ld hl, FadePal6 ld b, 3 -GBFadeIncCommon: ; 1e9b (0:1e9b) +GBFadeIncCommon: ld a, [hli] ld [rBGP], a ld a, [hli] @@ -46,7 +46,7 @@ GBFadeIncCommon: ; 1e9b (0:1e9b) jr nz, GBFadeIncCommon ret -GBFadeOutToBlack:: ; 1eb6 (0:1eb6) +GBFadeOutToBlack:: ld hl, FadePal4 + 2 ld b, 4 jr GBFadeDecCommon diff --git a/home/init.asm b/home/init.asm index ad602a99..6aa14608 100644 --- a/home/init.asm +++ b/home/init.asm @@ -1,9 +1,9 @@ -SoftReset:: ; 1d08 (0:1d08) +SoftReset:: call StopAllSounds call GBPalWhiteOut ld c, 32 call DelayFrames -Init:: ; 1d10 (0:1d10) +Init:: ; Program init. rLCDC_DEFAULT EQU %11100011 @@ -118,7 +118,7 @@ rLCDC_DEFAULT EQU %11100011 jp SetDefaultNamesBeforeTitlescreen -ClearVram: ; 1dc6 (0:1dc6) +ClearVram: ld hl, $8000 ld bc, $2000 xor a diff --git a/home/lcdc.asm b/home/lcdc.asm index f94cdb19..6172dd0d 100644 --- a/home/lcdc.asm +++ b/home/lcdc.asm @@ -1,4 +1,4 @@ -LCDC:: ; 15ac (0:15ac) +LCDC:: push af ld a, [hLCDCPointer] ; doubles as enabling byte and a diff --git a/home/overworld.asm b/home/overworld.asm index 484e19c3..0b2f527f 100644 --- a/home/overworld.asm +++ b/home/overworld.asm @@ -1,4 +1,4 @@ -EnterMap:: ; 01d7 (0:01d7) +EnterMap:: ; Load a new map. ld a, $ff ld [wJoyIgnore], a @@ -40,9 +40,9 @@ EnterMap:: ; 01d7 (0:01d7) xor a ld [wJoyIgnore], a -OverworldLoop:: ; 0242 (0:0242) +OverworldLoop:: call DelayFrame -OverworldLoopLessDelay:: ; 0245 (0:0245) +OverworldLoopLessDelay:: call DelayFrame call IsSurfingPikachuInParty call LoadGBPal @@ -303,7 +303,7 @@ OverworldLoopLessDelay:: ; 0245 (0:0245) call DelayFrames jp EnterMap -StepCountCheck:: ; 0457 (0:0457) +StepCountCheck:: ld a, [wd730] bit 7, a jr nz, .doneStepCounting ; if button presses are being simulated, don't count steps @@ -321,7 +321,7 @@ StepCountCheck:: ; 0457 (0:0457) .doneStepCounting ret -AllPokemonFainted:: ; 0475 (0:0475) +AllPokemonFainted:: ld a, $ff ld [wIsInBattle], a call RunMapScript @@ -329,7 +329,7 @@ AllPokemonFainted:: ; 0475 (0:0475) ; function to determine if there will be a battle and execute it (either a trainer battle or wild battle) ; sets carry if a battle occurred and unsets carry if not -NewBattle:: ; 0480 (0:0480) +NewBattle:: ld a, [wd72d] bit 4, a jr nz, .noBattle @@ -343,7 +343,7 @@ NewBattle:: ; 0480 (0:0480) and a ret -DoBikeSpeedup:: ; 049d (0:049d) +DoBikeSpeedup:: ld a, [wWalkBikeSurfState] dec a ; riding a bike? ret nz @@ -364,7 +364,7 @@ DoBikeSpeedup:: ; 049d (0:049d) ret ; check if the player has stepped onto a warp after having not collided -CheckWarpsNoCollision:: ; 04bd (0:04bd) +CheckWarpsNoCollision:: ld a, [wNumberOfWarps] and a jp z, CheckMapConnections @@ -376,7 +376,7 @@ CheckWarpsNoCollision:: ; 04bd (0:04bd) ld a, [wXCoord] ld e, a ld hl, wWarpEntries -CheckWarpsNoCollisionLoop:: ; 04d5 (0:04d5) +CheckWarpsNoCollisionLoop:: ld a, [hli] ; check if the warp's Y position matches cp d jr nz, CheckWarpsNoCollisionRetry1 @@ -412,19 +412,19 @@ CheckWarpsNoCollisionLoop:: ; 04d5 (0:04d5) jr z, CheckWarpsNoCollisionRetry2 ; if directional buttons aren't being pressed, do not pass through the warp jr WarpFound1 -CheckWarpsNoCollisionRetry1:: ; 050f (0:050f) +CheckWarpsNoCollisionRetry1:: inc hl -CheckWarpsNoCollisionRetry2:: ; 0510 (0:0510) +CheckWarpsNoCollisionRetry2:: inc hl inc hl -ContinueCheckWarpsNoCollisionLoop:: ; 0512 (0:0512) +ContinueCheckWarpsNoCollisionLoop:: inc b ; increment warp number dec c ; decrement number of warps jp nz, CheckWarpsNoCollisionLoop jp CheckMapConnections ; check if the player has stepped onto a warp after having collided -CheckWarpsCollision:: ; 051a (0:051a) +CheckWarpsCollision:: ld a, [wNumberOfWarps] ld c, a ld hl, wWarpEntries @@ -454,13 +454,13 @@ CheckWarpsCollision:: ; 051a (0:051a) jr nz, .loop jp OverworldLoop -WarpFound1:: ; 0543 (0:0543) +WarpFound1:: ld a, [hli] ld [wDestinationWarpID], a ld a, [hli] ld [hWarpDestinationMap], a -WarpFound2:: ; 054a (0:054a) +WarpFound2:: ld a, [wNumberOfWarps] sub c ld [wWarpedFromWhichWarp], a ; save ID of used warp @@ -526,7 +526,7 @@ WarpFound2:: ; 054a (0:054a) jp EnterMap ; if no matching warp was found -CheckMapConnections:: ; 05db (0:05db) +CheckMapConnections:: .checkWestMap ld a, [wXCoord] cp $ff @@ -673,7 +673,7 @@ CheckMapConnections:: ; 05db (0:05db) jp OverworldLoop ; function to play a sound when changing maps -PlayMapChangeSound:: ; 06ef (0:06ef) +PlayMapChangeSound:: ld a, [wCurMapTileset] cp FACILITY jr z, .didNotGoThroughDoor @@ -694,7 +694,7 @@ PlayMapChangeSound:: ; 06ef (0:06ef) ret nz jp GBFadeOutToBlack -CheckIfInOutsideMap:: ; 0712 (0:0712) +CheckIfInOutsideMap:: ; If the player is in an outside map (a town or route), set the z flag ld a, [wCurMapTileset] and a ; most towns/routes have tileset 0 (OVERWORLD) @@ -708,7 +708,7 @@ CheckIfInOutsideMap:: ; 0712 (0:0712) ; "function 1" passes when the player is at the edge of the map and is facing towards the outside of the map ; "function 2" passes when the the tile in front of the player is among a certain set ; sets carry if the check passes, otherwise clears carry -ExtraWarpCheck:: ; 071a (0:071a) +ExtraWarpCheck:: ld a, [wCurMap] cp SS_ANNE_3 jr z, .useFunction1 @@ -739,14 +739,14 @@ ExtraWarpCheck:: ; 071a (0:071a) ld b, BANK(IsWarpTileInFrontOfPlayer) jp Bankswitch -MapEntryAfterBattle:: ; 0750 (0:0750) +MapEntryAfterBattle:: callba IsPlayerStandingOnWarp ; for enabling warp testing after collisions ld a, [wMapPalOffset] and a jp z, GBFadeInFromWhite jp LoadGBPal -HandleBlackOut:: ; 0762 (0:0762) +HandleBlackOut:: ; For when all the player's pokemon faint. ; Does not print the "blacked out" message. @@ -761,7 +761,7 @@ HandleBlackOut:: ; 0762 (0:0762) call PlayDefaultMusicFadeOutCurrent jp SpecialEnterMap -StopMusic:: ; 0788 (0:0788) +StopMusic:: ld [wAudioFadeOutControl], a call StopAllMusic .wait @@ -770,7 +770,7 @@ StopMusic:: ; 0788 (0:0788) jr nz, .wait jp StopAllSounds -HandleFlyWarpOrDungeonWarp:: ; 0794 (0:0794) +HandleFlyWarpOrDungeonWarp:: call UpdateSprites call Delay3 xor a @@ -785,10 +785,10 @@ HandleFlyWarpOrDungeonWarp:: ; 0794 (0:0794) callbs SpecialWarpIn jp SpecialEnterMap -LeaveMapAnim:: ; 07bc (0:07bc) +LeaveMapAnim:: jpba _LeaveMapAnim -Func_07c4:: ; 07c4 (0:07c4) +Func_07c4:: ld a, [wWalkBikeSurfState] and a ret z @@ -800,7 +800,7 @@ Func_07c4:: ; 07c4 (0:07c4) call PlayDefaultMusic ret -LoadPlayerSpriteGraphics:: ; 07d7 (0:07d7) +LoadPlayerSpriteGraphics:: ; Load sprite graphics based on whether the player is standing, biking, or surfing. ; 0: standing @@ -838,7 +838,7 @@ LoadPlayerSpriteGraphics:: ; 07d7 (0:07d7) jp z, LoadSurfingPlayerSpriteGraphics2 jp LoadWalkingPlayerSpriteGraphics -IsBikeRidingAllowed:: ; 0805 (0:0805) +IsBikeRidingAllowed:: ; The bike can be used on Route 23 and Indigo Plateau, ; or maps with tilesets in BikeRidingTilesets. ; Return carry if biking is allowed. @@ -868,7 +868,7 @@ IsBikeRidingAllowed:: ; 0805 (0:0805) INCLUDE "data/bike_riding_tilesets.asm" ; load the tile pattern data of the current tileset into VRAM -LoadTilesetTilePatternData:: ; 0828 (0:0828) +LoadTilesetTilePatternData:: ld a, [wTilesetGFXPtr] ld l, a ld a, [wTilesetGFXPtr + 1] @@ -880,7 +880,7 @@ LoadTilesetTilePatternData:: ; 0828 (0:0828) ; this loads the current maps complete tile map (which references blocks, not individual tiles) to C6E8 ; it can also load partial tile maps of connected maps into a border of length 3 around the current map -LoadTileBlockMap:: ; 083c (0:083c) +LoadTileBlockMap:: ; fill C6E8-CBFB with the background tile ld hl, wOverworldMap ld bc, $0514 @@ -1002,7 +1002,7 @@ LoadTileBlockMap:: ; 083c (0:083c) .done ret -LoadNorthSouthConnectionsTileMap:: ; 0919 (0:0919) +LoadNorthSouthConnectionsTileMap:: ld c, MAP_BORDER .loop push de @@ -1034,7 +1034,7 @@ LoadNorthSouthConnectionsTileMap:: ; 0919 (0:0919) jr nz, .loop ret -LoadEastWestConnectionsTileMap:: ; 093d (0:093d) +LoadEastWestConnectionsTileMap:: push hl push de ld c, MAP_BORDER @@ -1065,7 +1065,7 @@ LoadEastWestConnectionsTileMap:: ; 093d (0:093d) ; function to check if there is a sign or sprite in front of the player ; if so, carry is set. otherwise, carry is cleared -IsSpriteOrSignInFrontOfPlayer:: ; 095e (0:095e) +IsSpriteOrSignInFrontOfPlayer:: xor a ld [hSpriteIndexOrTextID], a ld a, [wNumSigns] @@ -1089,9 +1089,9 @@ IsSpriteOrSignInFrontOfPlayer:: ; 095e (0:095e) jr nz, .counterTilesLoop ; sets carry flag if a sprite is in front of the player, resets if not -IsSpriteInFrontOfPlayer:: ; 0983 (0:0983) +IsSpriteInFrontOfPlayer:: ld d, $10 ; talking range in pixels (normal range) -IsSpriteInFrontOfPlayer2:: ; 0985 (0:0985) +IsSpriteInFrontOfPlayer2:: lb bc, $3c, $40 ; Y and X position of player sprite ld a, [wPlayerFacingDirection] ; direction the player is facing .checkIfPlayerFacingUp @@ -1182,7 +1182,7 @@ IsSpriteInFrontOfPlayer2:: ; 0985 (0:0985) scf ret -SignLoop:: ; 09f2 (0:09f2) +SignLoop:: ; search if a player is facing a sign ld hl, wSignCoords ; start of sign coordinates ld a, [wNumSigns] ; number of signs in the map @@ -1223,7 +1223,7 @@ SignLoop:: ; 09f2 (0:09f2) ; function to check if the player will jump down a ledge and check if the tile ahead is passable (when not surfing) ; sets the carry flag if there is a collision, and unsets it if there isn't a collision -CollisionCheckOnLand:: ; 0a1c (0:0a1c) +CollisionCheckOnLand:: ld a, [wd736] bit 6, a ; is the player jumping? jr nz, .noCollision @@ -1281,7 +1281,7 @@ CollisionCheckOnLand:: ; 0a1c (0:0a1c) ; function that checks if the tile in front of the player is passable ; clears carry if it is, sets carry if not -CheckTilePassable:: ; 0a79 (0:0a79) +CheckTilePassable:: predef GetTileAndCoordsInFrontOfPlayer ; get tile in front of player ld a, [wTileInFrontOfPlayer] ; tile in front of player ld c, a @@ -1292,7 +1292,7 @@ CheckTilePassable:: ; 0a79 (0:0a79) ; and check for collisions that only occur between certain pairs of tiles ; Input: hl - address of directional collision data ; sets carry if there is a collision and unsets carry if not -CheckForJumpingAndTilePairCollisions:: ; 0a86 (0:0a86) +CheckForJumpingAndTilePairCollisions:: push hl predef GetTileAndCoordsInFrontOfPlayer ; get the tile in front of the player push de @@ -1308,11 +1308,11 @@ CheckForJumpingAndTilePairCollisions:: ; 0a86 (0:0a86) ret nz ; if not jumping -CheckForTilePairCollisions2:: ; 0aa0 (0:0aa0) +CheckForTilePairCollisions2:: aCoord 8, 9 ; tile the player is on ld [wTilePlayerStandingOn], a -CheckForTilePairCollisions:: ; 0aa6 (0:0aa6) +CheckForTilePairCollisions:: ld a, [wTileInFrontOfPlayer] ld c, a .tilePairCollisionLoop @@ -1366,7 +1366,7 @@ CheckForTilePairCollisions:: ; 0aa6 (0:0aa6) ; these entries indicate that the player may not cross between tile 1 and tile 2 ; it's mainly used to simulate differences in elevation -TilePairCollisionsLand:: ; 0ada (0:0ada) +TilePairCollisionsLand:: db CAVERN, $20, $05 db CAVERN, $41, $05 db FOREST, $30, $2E @@ -1380,14 +1380,14 @@ TilePairCollisionsLand:: ; 0ada (0:0ada) db FOREST, $5F, $2E db $FF -TilePairCollisionsWater:: ; 0afc (0:0afc) +TilePairCollisionsWater:: db FOREST, $14, $2E db FOREST, $48, $2E db CAVERN, $14, $05 db $FF ; this builds a tile map from the tile block map based on the current X/Y coordinates of the player's character -LoadCurrentMapView:: ; 0b06 (0:0b06) +LoadCurrentMapView:: ld a, [H_LOADEDROMBANK] push af ld a, [wTilesetBank] ; tile data ROM bank @@ -1475,7 +1475,7 @@ LoadCurrentMapView:: ; 0b06 (0:0b06) call BankswitchCommon ; restore previous ROM bank ret -AdvancePlayerSprite:: ; 0b7f (0:0b7f) +AdvancePlayerSprite:: ld a, [wUpdateSpritesEnabled] push af ld a, $FF @@ -1490,7 +1490,7 @@ AdvancePlayerSprite:: ; 0b7f (0:0b7f) ; the following 6 functions are used to tell the V-blank handler to redraw ; the portion of the map that was newly exposed due to the player's movement -ScheduleNorthRowRedraw:: ; 0b95 (0:0b95) +ScheduleNorthRowRedraw:: coord hl, 0, 0 call CopyToRedrawRowOrColumnSrcTiles ld a, [wMapViewVRAMPointer] @@ -1501,7 +1501,7 @@ ScheduleNorthRowRedraw:: ; 0b95 (0:0b95) ld [hRedrawRowOrColumnMode], a ret -CopyToRedrawRowOrColumnSrcTiles:: ; 0baa (0:0baa) +CopyToRedrawRowOrColumnSrcTiles:: ld de, wRedrawRowOrColumnSrcTiles ld c, 2 * SCREEN_WIDTH .loop @@ -1512,7 +1512,7 @@ CopyToRedrawRowOrColumnSrcTiles:: ; 0baa (0:0baa) jr nz, .loop ret -ScheduleSouthRowRedraw:: ; 0bb6 (0:0bb6) +ScheduleSouthRowRedraw:: coord hl, 0, 16 call CopyToRedrawRowOrColumnSrcTiles ld a, [wMapViewVRAMPointer] @@ -1531,7 +1531,7 @@ ScheduleSouthRowRedraw:: ; 0bb6 (0:0bb6) ld [hRedrawRowOrColumnMode], a ret -ScheduleEastColumnRedraw:: ; 0bd6 (0:0bd7) +ScheduleEastColumnRedraw:: coord hl, 18, 0 call ScheduleColumnRedrawHelper ld a, [wMapViewVRAMPointer] @@ -1549,7 +1549,7 @@ ScheduleEastColumnRedraw:: ; 0bd6 (0:0bd7) ld [hRedrawRowOrColumnMode], a ret -ScheduleColumnRedrawHelper:: ; 0bf6 (0:0bf6) +ScheduleColumnRedrawHelper:: ld de, wRedrawRowOrColumnSrcTiles ld c, SCREEN_HEIGHT .loop @@ -1569,7 +1569,7 @@ ScheduleColumnRedrawHelper:: ; 0bf6 (0:0bf6) jr nz, .loop ret -ScheduleWestColumnRedraw:: ; 0c0c (0:0c0c) +ScheduleWestColumnRedraw:: coord hl, 0, 0 call ScheduleColumnRedrawHelper ld a, [wMapViewVRAMPointer] @@ -1582,7 +1582,7 @@ ScheduleWestColumnRedraw:: ; 0c0c (0:0c0c) ; function to write the tiles that make up a tile block to memory ; Input: c = tile block ID, hl = destination address -DrawTileBlock:: ; 0c21 (0:0c21) +DrawTileBlock:: push hl ld a, [wTileSetBlocksPtr] ; pointer to tiles ld l, a @@ -1623,7 +1623,7 @@ DrawTileBlock:: ; 0c21 (0:0c21) ret ; function to update joypad state and simulate button presses -JoypadOverworld:: ; 0c51 (0:0c51) +JoypadOverworld:: xor a ld [wSpriteStateData1 + 3], a ld [wSpriteStateData1 + 5], a @@ -1633,7 +1633,7 @@ JoypadOverworld:: ; 0c51 (0:0c51) call AreInputsSimulated ret -ForceBikeDown:: ; 0c65 (0:0c65) +ForceBikeDown:: ld a, [wFlags_D733] bit 3, a ; check if a trainer wants a challenge ret nz @@ -1647,7 +1647,7 @@ ForceBikeDown:: ; 0c65 (0:0c65) ld [hJoyHeld], a ; on the cycling road, if there isn't a trainer and the player isn't pressing buttons, simulate a down press ret -AreInputsSimulated:: ; 0c7b (0:0c7b) +AreInputsSimulated:: ld a, [wd730] bit 7, a ret z @@ -1682,7 +1682,7 @@ AreInputsSimulated:: ; 0c7b (0:0c7b) res 7, [hl] ret -GetSimulatedInput:: ; 0cb3 (0:0cb3) +GetSimulatedInput:: ld hl, wSimulatedJoypadStatesIndex dec [hl] ld a, [hl] @@ -1712,7 +1712,7 @@ GetSimulatedInput:: ; 0cb3 (0:0cb3) ; 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. -CollisionCheckOnWater:: ; 0cca (0:0cca) +CollisionCheckOnWater:: ld a, [wd730] bit 7, a jp nz, .noCollision ; return and clear carry if button presses are being simulated @@ -1763,7 +1763,7 @@ CollisionCheckOnWater:: ; 0cca (0:0cca) ret ; function to run the current map's script -RunMapScript:: ; 0d2c (0:0d2c) +RunMapScript:: push hl push de push bc @@ -1789,7 +1789,7 @@ RunMapScript:: ; 0d2c (0:0d2c) .return ret -LoadWalkingPlayerSpriteGraphics:: ; 0d5e (0:0d5e) +LoadWalkingPlayerSpriteGraphics:: ; new sprite copy stuff xor a ld [wd473], a @@ -1797,7 +1797,7 @@ LoadWalkingPlayerSpriteGraphics:: ; 0d5e (0:0d5e) ld de, RedSprite ; $4180 jr LoadPlayerSpriteGraphicsCommon -LoadSurfingPlayerSpriteGraphics2:: ; 0d69 (0:0d69) +LoadSurfingPlayerSpriteGraphics2:: ld a, [wd473] and a jr z, .asm_0d75 @@ -1814,15 +1814,15 @@ LoadSurfingPlayerSpriteGraphics2:: ; 0d69 (0:0d69) ld de, SurfingPikachuSprite ; 3f:6def jr LoadPlayerSpriteGraphicsCommon -LoadSurfingPlayerSpriteGraphics:: ; 0d83 (0:0d83) +LoadSurfingPlayerSpriteGraphics:: ld b, BANK(RedSprite) ; not sure, but probably same bank (5) ld de, SeelSprite jr LoadPlayerSpriteGraphicsCommon -LoadBikePlayerSpriteGraphics:: ; 0d8a (0:0d8a) +LoadBikePlayerSpriteGraphics:: ld b, BANK(RedCyclingSprite) ld de, RedCyclingSprite -LoadPlayerSpriteGraphicsCommon:: ; 0d8f (0:0d8f) +LoadPlayerSpriteGraphicsCommon:: ld hl, vNPCSprites push de push hl @@ -1843,7 +1843,7 @@ LoadPlayerSpriteGraphicsCommon:: ; 0d8f (0:0d8f) jp CopyVideoData ; function to load data from the map header -LoadMapHeader:: ; 0dab (0:0dab) +LoadMapHeader:: callba MarkTownVisitedAndLoadMissableObjects jr asm_0dbd @@ -1975,7 +1975,7 @@ asm_0dbd ; function to copy map connection data from ROM to WRAM ; Input: hl = source, de = destination -CopyMapConnectionHeader:: ; 0eaa (0:0eaa) +CopyMapConnectionHeader:: ld c, $0b .loop ld a, [hli] @@ -1985,7 +1985,7 @@ CopyMapConnectionHeader:: ; 0eaa (0:0eaa) jr nz, .loop ret -CopySignData:: ; 0eb3 (0:0eb3) +CopySignData:: ld de, wSignCoords ; start of sign coords ld bc, wSignTextIDs ; start of sign text ids ld a, [wNumSigns] ; number of signs @@ -2006,7 +2006,7 @@ CopySignData:: ; 0eb3 (0:0eb3) ret ; function to load map data -LoadMapData:: ; 1241 (0:1241) +LoadMapData:: ld a, [H_LOADEDROMBANK] push af call DisableLCD @@ -2035,13 +2035,13 @@ LoadMapData:: ; 1241 (0:1241) call BankswitchCommon ret -LoadScreenRelatedData:: ; 0f0c (0:0f0c) +LoadScreenRelatedData:: call LoadTileBlockMap call LoadTilesetTilePatternData call LoadCurrentMapView ret -ReloadMapAfterSurfingMinigame:: ; 0f16 (0:0f16) +ReloadMapAfterSurfingMinigame:: ld a, [H_LOADEDROMBANK] push af call DisableLCD @@ -2058,7 +2058,7 @@ ReloadMapAfterSurfingMinigame:: ; 0f16 (0:0f16) call BankswitchCommon jr asm_0f4d -ReloadMapAfterPrinter:: ; 0f3d (0:0f3d) +ReloadMapAfterPrinter:: ld a, [H_LOADEDROMBANK] push af ld a, [wCurMap] @@ -2066,11 +2066,11 @@ ReloadMapAfterPrinter:: ; 0f3d (0:0f3d) call LoadTileBlockMap pop af call BankswitchCommon -asm_0f4d: ; 0f4d (0:0f4d) +asm_0f4d: jpab SetMapSpecificScriptFlagsOnMapReload ret ; useless? -ResetMapVariables:: ; 0f56 (0:0f56) +ResetMapVariables:: ld a, $98 ld [wMapViewVRAMPointer + 1], a xor a @@ -2083,10 +2083,10 @@ ResetMapVariables:: ; 0f56 (0:0f56) ld [wWalkBikeSurfStateCopy], a ret -CopyMapViewToVRAM:: ; 0f70 (0:0f70) +CopyMapViewToVRAM:: ; copy current map view to VRAM ld de, vBGMap0 -CopyMapViewToVRAM2: ; 0f73 (0:0f73) +CopyMapViewToVRAM2: ld hl, wTileMap ld b, 18 .vramCopyLoop @@ -2109,7 +2109,7 @@ CopyMapViewToVRAM2: ; 0f73 (0:0f73) ; function to switch to the ROM bank that a map is stored in ; Input: a = map number -SwitchToMapRomBank:: ; 0f8b (0:0f8b) +SwitchToMapRomBank:: push hl push bc ld c, a @@ -2127,7 +2127,7 @@ SwitchToMapRomBank:: ; 0f8b (0:0f8b) pop hl ret -GetMapHeaderPointer:: ; 0fa7 (0:0fa7) +GetMapHeaderPointer:: ld a, [H_LOADEDROMBANK] push af switchbank MapHeaderPointers ; 3f:41f2 @@ -2145,7 +2145,7 @@ GetMapHeaderPointer:: ; 0fa7 (0:0fa7) pop af jp BankswitchCommon -IgnoreInputForHalfSecond: ; 0fc3 (0:0fc3) +IgnoreInputForHalfSecond: ld a, 30 ld [wIgnoreInputCounter], a ld hl, wd730 @@ -2154,12 +2154,12 @@ IgnoreInputForHalfSecond: ; 0fc3 (0:0fc3) ld [hl], a ; set ignore input bit ret -ResetUsingStrengthOutOfBattleBit: ; 0fd0 (0:0fd0) +ResetUsingStrengthOutOfBattleBit: ld hl, wd728 res 0, [hl] ret -ForceBikeOrSurf:: ; 0fd6 (0:0fd6) +ForceBikeOrSurf:: ld b, BANK(RedSprite) ld hl, LoadPlayerSpriteGraphics call Bankswitch @@ -2167,23 +2167,23 @@ ForceBikeOrSurf:: ; 0fd6 (0:0fd6) ; Handle the player jumping down ; a ledge in the overworld. -HandleMidJump:: ; 0fe1 (0:0fe1) +HandleMidJump:: ld a, [wd736] bit 6, a ; jumping down a ledge? ret z callba _HandleMidJump ret -IsSpinning:: ; 0ff0 (0:0ff0) +IsSpinning:: ld a, [wd736] bit 7, a ret z ; no spinning jpba LoadSpinnerArrowTiles ; spin while moving -Func_0ffe:: ; 0ffe (0:0ffe) +Func_0ffe:: jpab IsPlayerTalkingToPikachu -InitSprites:: ; 1006 (0:1006) +InitSprites:: ld a, [hli] ld [wNumSprites], a ; save the number of sprites push hl @@ -2237,7 +2237,7 @@ InitSprites:: ; 1006 (0:1006) jr nz, .loadSpriteLoop ret -ZeroSpriteStateData:: ; 1050 (0:1050) +ZeroSpriteStateData:: ; zero C110-C1EF and C210-C2EF ; C1F0-C1FF and C2F0-C2FF is used for Pikachu ld hl, wSpriteStateData1 + $10 @@ -2252,7 +2252,7 @@ ZeroSpriteStateData:: ; 1050 (0:1050) jr nz, .loop ret -DisableRegularSprites:: ; 1060 (0:1060) +DisableRegularSprites:: ; initialize all C100-C1FF sprite entries to disabled (other than player's and pikachu) ld hl, wSpriteStateData1 + 1 * $10 + 2 ld de, $10 @@ -2264,7 +2264,7 @@ DisableRegularSprites:: ; 1060 (0:1060) jr nz, .loop ret -LoadSprite:: ; 106f (0:106f) +LoadSprite:: push hl ld b, $0 ld hl, wMapSpriteData diff --git a/home/pic.asm b/home/pic.asm index 37abaecd..d0645a8c 100644 --- a/home/pic.asm +++ b/home/pic.asm @@ -1,6 +1,6 @@ ; bankswitches and runs _UncompressSpriteData ; bank is given in a, sprite input stream is pointed to in wSpriteInputPtr -UncompressSpriteData:: ; 23f8 (0:23f8) +UncompressSpriteData:: ld b, a ld a, [H_LOADEDROMBANK] push af @@ -15,7 +15,7 @@ UncompressSpriteData:: ; 23f8 (0:23f8) ret ; initializes necessary data to load a sprite and runs UncompressSpriteDataLoop -_UncompressSpriteData:: ; 2410 (0:2410) +_UncompressSpriteData:: ld hl, sSpriteBuffer1 ld c, (2*SPRITEBUFFERSIZE) % $100 ld b, (2*SPRITEBUFFERSIZE) / $100 @@ -52,7 +52,7 @@ _UncompressSpriteData:: ; 2410 (0:2410) ; uncompresses a chunk from the sprite input data stream (pointed to at wd0da) into sSpriteBuffer1 or sSpriteBuffer2 ; each chunk is a 1bpp sprite. A 2bpp sprite consist of two chunks which are merged afterwards ; note that this is an endless loop which is terminated during a call to MoveToNextBufferPosition by manipulating the stack -UncompressSpriteDataLoop:: ; 244c (0:244c) +UncompressSpriteDataLoop:: ld hl, sSpriteBuffer1 ld a, [wSpriteLoadFlags] bit 0, a @@ -142,7 +142,7 @@ UncompressSpriteDataLoop:: ; 244c (0:244c) ; moves output pointer to next position ; also cancels the calling function if the all output is done (by removing the return pointer from stack) ; and calls postprocessing functions according to the unpack mode -MoveToNextBufferPosition:: ; 24ce (0:24ce) +MoveToNextBufferPosition:: ld a, [wSpriteHeight] ld b, a ld a, [wSpriteCurPosY] @@ -203,7 +203,7 @@ MoveToNextBufferPosition:: ; 24ce (0:24ce) jp UnpackSprite ; writes 2 bits (from a) to the output buffer (pointed to from wSpriteOutputPtr) -WriteSpriteBitsToBuffer:: ; 253f (0:253f) +WriteSpriteBitsToBuffer:: ld e, a ld a, [wSpriteOutputBitOffset] and a @@ -231,7 +231,7 @@ WriteSpriteBitsToBuffer:: ; 253f (0:253f) ret ; reads next bit from input stream and returns it in a -ReadNextInputBit:: ; 2566 (0:2566) +ReadNextInputBit:: ld a, [wSpriteInputBitCounter] dec a jr nz, .curByteHasMoreBitsToRead @@ -247,7 +247,7 @@ ReadNextInputBit:: ; 2566 (0:2566) ret ; reads next byte from input stream and returns it in a -ReadNextInputByte:: ; 2581 (0:2581) +ReadNextInputByte:: ld a, [wSpriteInputPtr] ld l, a ld a, [wSpriteInputPtr+1] @@ -262,7 +262,7 @@ ReadNextInputByte:: ; 2581 (0:2581) ret ; the nth item is 2^n - 1 -LengthEncodingOffsetList:: ; 2595 (0:2595) +LengthEncodingOffsetList:: dw %0000000000000001 dw %0000000000000011 dw %0000000000000111 @@ -281,7 +281,7 @@ LengthEncodingOffsetList:: ; 2595 (0:2595) dw %1111111111111111 ; unpacks the sprite data depending on the unpack mode -UnpackSprite:: ; 25b5 (0:25b5) +UnpackSprite:: ld a, [wSpriteUnpackMode] cp $2 jp z, UnpackSpriteMode2 @@ -294,7 +294,7 @@ UnpackSprite:: ; 25b5 (0:25b5) ; decodes differential encoded sprite data ; input bit value 0 preserves the current bit value and input bit value 1 toggles it (starting from initial value 0). -SpriteDifferentialDecode:: ; 25ca (0:25ca) +SpriteDifferentialDecode:: xor a ld [wSpriteCurPosX], a ld [wSpriteCurPosY], a @@ -379,7 +379,7 @@ SpriteDifferentialDecode:: ; 25ca (0:25ca) ret ; decodes the nybble stored in a. Last decoded data is assumed to be in e (needed to determine if initial value is 0 or 1) -DifferentialDecodeNybble:: ; 2663 (0:2663) +DifferentialDecodeNybble:: srl a ; c=a%2, a/=2 ld c, $0 jr nc, .evenNumber @@ -421,7 +421,7 @@ DifferentialDecodeNybble:: ; 2663 (0:2663) ld e, a ; update last decoded data ret -DecodeNybble0Table:: ; 269d (0:269d) +DecodeNybble0Table:: dn $0, $1 dn $3, $2 dn $7, $6 @@ -430,7 +430,7 @@ DecodeNybble0Table:: ; 269d (0:269d) dn $c, $d dn $8, $9 dn $b, $a -DecodeNybble1Table:: ; 26a5 (0:26a5) +DecodeNybble1Table:: dn $f, $e dn $c, $d dn $8, $9 @@ -439,7 +439,7 @@ DecodeNybble1Table:: ; 26a5 (0:26a5) dn $3, $2 dn $7, $6 dn $4, $5 -DecodeNybble0TableFlipped:: ; 26ad (0:26ad) +DecodeNybble0TableFlipped:: dn $0, $8 dn $c, $4 dn $e, $6 @@ -448,7 +448,7 @@ DecodeNybble0TableFlipped:: ; 26ad (0:26ad) dn $3, $b dn $1, $9 dn $d, $5 -DecodeNybble1TableFlipped:: ; 26b5 (0:26b5) +DecodeNybble1TableFlipped:: dn $f, $7 dn $3, $b dn $1, $9 @@ -459,7 +459,7 @@ DecodeNybble1TableFlipped:: ; 26b5 (0:26b5) dn $2, $a ; combines the two loaded chunks with xor (the chunk loaded second is the destination). The source chunk is differeintial decoded beforehand. -XorSpriteChunks:: ; 26bd (0:26bd) +XorSpriteChunks:: xor a ld [wSpriteCurPosX], a ld [wSpriteCurPosY], a @@ -524,7 +524,7 @@ XorSpriteChunks:: ; 26bd (0:26bd) ret ; reverses the bits in the nybble given in register a -ReverseNybble:: ; 272d (0:272d) +ReverseNybble:: ld de, NybbleReverseTable add e ld e, a @@ -535,7 +535,7 @@ ReverseNybble:: ; 272d (0:272d) ret ; resets sprite buffer pointers to buffer 1 and 2, depending on wSpriteLoadFlags -ResetSpriteBufferPointers:: ; 2737 (0:2737) +ResetSpriteBufferPointers:: ld a, [wSpriteLoadFlags] ; wd0a8 bit 0, a jr nz, .buffer2Selected @@ -557,11 +557,11 @@ ResetSpriteBufferPointers:: ; 2737 (0:2737) ret ; maps each nybble to its reverse -NybbleReverseTable:: ; 275d (0:275d) +NybbleReverseTable:: db $0, $8, $4, $c, $2, $a, $6 ,$e, $1, $9, $5, $d, $3, $b, $7 ,$f ; combines the two loaded chunks with xor (the chunk loaded second is the destination). Both chunks are differeintial decoded beforehand. -UnpackSpriteMode2:: ; 276d (0:276d) +UnpackSpriteMode2:: call ResetSpriteBufferPointers ld a, [wSpriteFlipped] push af @@ -578,7 +578,7 @@ UnpackSpriteMode2:: ; 276d (0:276d) jp XorSpriteChunks ; stores hl into the output pointers -StoreSpriteOutputPointer:: ; 278d (0:278d) +StoreSpriteOutputPointer:: ld a, l ld [wSpriteOutputPtr], a ld [wSpriteOutputPtrCached], a diff --git a/home/pikachu.asm b/home/pikachu.asm index c2521208..d16e95db 100755 --- a/home/pikachu.asm +++ b/home/pikachu.asm @@ -1,4 +1,4 @@ -Func_1510:: ; 1510 (0:1510) +Func_1510:: push hl ld hl, wPikachuOverworldStateFlags set 7, [hl] @@ -7,21 +7,21 @@ Func_1510:: ; 1510 (0:1510) pop hl ret -Func_151d:: ; 151d (0:151d) +Func_151d:: push hl ld hl, wPikachuOverworldStateFlags res 7, [hl] pop hl ret -EnablePikachuOverworldSpriteDrawing:: ; 1525 (0:1525) +EnablePikachuOverworldSpriteDrawing:: push hl ld hl, wPikachuOverworldStateFlags res 3, [hl] pop hl ret -DisablePikachuOverworldSpriteDrawing:: ; 152d (0:152d) +DisablePikachuOverworldSpriteDrawing:: push hl ld hl, wPikachuOverworldStateFlags set 3, [hl] @@ -30,28 +30,28 @@ DisablePikachuOverworldSpriteDrawing:: ; 152d (0:152d) pop hl ret -DisablePikachuFollowingPlayer:: ; 153a (0:153a) +DisablePikachuFollowingPlayer:: push hl ld hl, wPikachuOverworldStateFlags set 1, [hl] pop hl ret -EnablePikachuFollowingPlayer:: ; 1542 (0:1542) +EnablePikachuFollowingPlayer:: push hl ld hl, wPikachuOverworldStateFlags res 1, [hl] pop hl ret -CheckPikachuFollowingPlayer:: ; 154a (0:154a) +CheckPikachuFollowingPlayer:: push hl ld hl, wPikachuOverworldStateFlags bit 1, [hl] pop hl ret -SpawnPikachu:: ; 1552 (0:1552) +SpawnPikachu:: ld a, [hl] dec a swap a @@ -59,7 +59,7 @@ SpawnPikachu:: ; 1552 (0:1552) homecall SpawnPikachu_ ; 3f:46d5 ret -Pikachu_IsInArray:: ; 1568 (0:1568) +Pikachu_IsInArray:: ld b, $0 ld c, a .loop @@ -80,7 +80,7 @@ Pikachu_IsInArray:: ; 1568 (0:1568) and a ret -GetPikachuMovementScriptByte:: ; 157c (0:157c) +GetPikachuMovementScriptByte:: push hl push bc ld a, [H_LOADEDROMBANK] @@ -104,7 +104,7 @@ GetPikachuMovementScriptByte:: ; 157c (0:157c) pop hl ret -ApplyPikachuMovementData:: ; 159b (0:159b) +ApplyPikachuMovementData:: ld a, [H_LOADEDROMBANK] ld b, a push af diff --git a/home/play_time.asm b/home/play_time.asm index 8044d15c..47b2a690 100644 --- a/home/play_time.asm +++ b/home/play_time.asm @@ -1,4 +1,4 @@ -TrackPlayTime: ; 1ef5 (0:1ef5) +TrackPlayTime: call CountDownIgnoreInputBitReset ld hl, wd47a bit 0, [hl] @@ -46,7 +46,7 @@ TrackPlayTime: ; 1ef5 (0:1ef5) ld [wPlayTimeMaxed], a ret -CountDownIgnoreInputBitReset: ; 1f54 (0:1f54) +CountDownIgnoreInputBitReset: ld a, [wIgnoreInputCounter] and a jr nz, .asm_1f5e diff --git a/home/predef.asm b/home/predef.asm index 5d879ddc..c55760d7 100644 --- a/home/predef.asm +++ b/home/predef.asm @@ -1,4 +1,4 @@ -Predef:: ; 3eb4 (0:3eb4) +Predef:: ; Call predefined function a. ; To preserve other registers, have the ; destination call GetPredefRegisters. @@ -30,7 +30,7 @@ Predef:: ; 3eb4 (0:3eb4) call BankswitchCommon ret -GetPredefRegisters:: ; 3ed7 (0:3ed7) +GetPredefRegisters:: ; Restore the contents of register pairs ; when GetPredefPointer was called. ld a, [wPredefRegisters + 0] diff --git a/home/serial.asm b/home/serial.asm index c8c7cbe9..508148df 100644 --- a/home/serial.asm +++ b/home/serial.asm @@ -1,4 +1,4 @@ -Serial:: ; 1f78 (0:1f78) +Serial:: push af push bc push de @@ -55,7 +55,7 @@ Serial:: ; 1f78 (0:1f78) ; hl = send data ; de = receive data ; bc = length of data -Serial_ExchangeBytes:: ; 216f (0:216f) +Serial_ExchangeBytes:: ld a, 1 ld [hSerialIgnoringInitialData], a .loop @@ -89,7 +89,7 @@ Serial_ExchangeBytes:: ; 216f (0:216f) jr nz, .loop ret -Serial_ExchangeByte:: ; 1ff6 (0:1ff6) +Serial_ExchangeByte:: xor a ld [hSerialReceivedNewData], a ld a, [hSerialConnectionStatus] @@ -177,14 +177,14 @@ Serial_ExchangeByte:: ; 1ff6 (0:1ff6) call DelayFrame jp Serial_ExchangeByte -WaitLoop_15Iterations:: ; 208d (0:208d) +WaitLoop_15Iterations:: ld a, 15 .waitLoop dec a jr nz, .waitLoop ret -IsUnknownCounterZero:: ; 2093 (0:2093) +IsUnknownCounterZero:: push hl ld hl, wUnknownSerialCounter ld a, [hli] @@ -193,7 +193,7 @@ IsUnknownCounterZero:: ; 2093 (0:2093) ret ; a is always 0 when this is called -SetUnknownCounterToFFFF:: ; 209b (0:209b) +SetUnknownCounterToFFFF:: dec a ld [wUnknownSerialCounter], a ld [wUnknownSerialCounter + 1], a @@ -201,7 +201,7 @@ SetUnknownCounterToFFFF:: ; 209b (0:209b) ; This is used to exchange the button press and selected menu item on the link menu. ; The data is sent thrice and read twice to increase reliability. -Serial_ExchangeLinkMenuSelection:: ; 2247 (0:2247) +Serial_ExchangeLinkMenuSelection:: ld hl, wLinkMenuSelectionSendBuffer ld de, wLinkMenuSelectionReceiveBuffer ld c, 2 ; number of bytes to save @@ -226,13 +226,13 @@ Serial_ExchangeLinkMenuSelection:: ; 2247 (0:2247) jr nz, .loop ret -Serial_PrintWaitingTextAndSyncAndExchangeNybble:: ; 20ca (0:20ca) +Serial_PrintWaitingTextAndSyncAndExchangeNybble:: call SaveScreenTilesToBuffer1 callab PrintWaitingText ; 1:4b89 call Serial_SyncAndExchangeNybble jp LoadScreenTilesFromBuffer1 -Serial_SyncAndExchangeNybble:: ; 20db (0:20db) +Serial_SyncAndExchangeNybble:: ld a, $ff ld [wSerialExchangeNybbleReceiveData], a .loop1 @@ -272,7 +272,7 @@ Serial_SyncAndExchangeNybble:: ; 20db (0:20db) ld [wSerialSyncAndExchangeNybbleReceiveData], a ret -Serial_ExchangeNybble:: ; 211f (0:211f) +Serial_ExchangeNybble:: call .doExchange ld a, [wSerialExchangeNybbleSendData] add $60 @@ -295,7 +295,7 @@ Serial_ExchangeNybble:: ; 211f (0:211f) ld [wSerialExchangeNybbleReceiveData], a ret -Serial_SendZeroByte:: ; 2149 (0:2149) +Serial_SendZeroByte:: xor a ld [hSerialSendData], a ld a, [hSerialConnectionStatus] @@ -305,7 +305,7 @@ Serial_SendZeroByte:: ; 2149 (0:2149) ld [rSC], a ret -Serial_TryEstablishingExternallyClockedConnection:: ; 22fa (0:22fa) +Serial_TryEstablishingExternallyClockedConnection:: ld a, ESTABLISH_CONNECTION_WITH_EXTERNAL_CLOCK ld [rSB], a xor a @@ -314,10 +314,10 @@ Serial_TryEstablishingExternallyClockedConnection:: ; 22fa (0:22fa) ld [rSC], a ret -PrinterSerial__:: ; 2162 (0:2162) +PrinterSerial__:: call PrinterSerial pop hl pop de pop bc pop af - reti
\ No newline at end of file + reti diff --git a/home/text.asm b/home/text.asm index 15fe3177..43c1631a 100644 --- a/home/text.asm +++ b/home/text.asm @@ -1,4 +1,4 @@ -TextBoxBorder:: ; 16f0 (0:16f0) +TextBoxBorder:: ; Draw a cxb text box at hl. ; top row @@ -37,7 +37,7 @@ TextBoxBorder:: ; 16f0 (0:16f0) ld [hl], "┘" ret -NPlaceChar:: ; 171d (0:171d) +NPlaceChar:: ; Place char a c times. ld d, c .loop @@ -46,9 +46,9 @@ NPlaceChar:: ; 171d (0:171d) jr nz, .loop ret -PlaceString:: ; 1723 (0:1723) +PlaceString:: push hl -PlaceNextChar:: ; 1724 (0:1724) +PlaceNextChar:: ld a, [de] cp "@" @@ -58,7 +58,7 @@ PlaceNextChar:: ; 1724 (0:1724) pop hl ret -Char4ETest:: ; 172d (0:172d) +Char4ETest:: cp $4E ; next jr nz, .next ld bc, 2 * SCREEN_WIDTH @@ -113,11 +113,11 @@ endm ld [hli], a call PrintLetterDelay -PlaceNextChar_inc:: ; 17b6 (0:17b6) +PlaceNextChar_inc:: inc de jp PlaceNextChar -Char00:: ; 17ba (0:17ba) +Char00:: ld b, h ld c, l pop hl @@ -174,7 +174,7 @@ Char4A:: ; 17f7 (0:17f7) ; PKMN ld de, Char4AText jr FinishDTE -Char59:: ; 17fb (0:17fb) +Char59:: ; depending on whose turn it is, print ; enemy active monster’s name, prefixed with “Enemy ” ; or @@ -184,13 +184,13 @@ Char59:: ; 17fb (0:17fb) xor 1 jr MonsterNameCharsCommon -Char5A:: ; 1803 (0:1803) +Char5A:: ; depending on whose turn it is, print ; player active monster’s name ; or ; enemy active monster’s name, prefixed with “Enemy ” ld a, [H_WHOSETURN] -MonsterNameCharsCommon:: ; 1a37 (0:1a37) +MonsterNameCharsCommon:: push de and a jr nz, .Enemy @@ -205,7 +205,7 @@ MonsterNameCharsCommon:: ; 1a37 (0:1a37) ld l, c ld de, wEnemyMonNick ; enemy active monster name -FinishDTE:: ; 1819 (0:1819) +FinishDTE:: call PlaceString ld h, b ld l, c @@ -213,24 +213,24 @@ FinishDTE:: ; 1819 (0:1819) inc de jp PlaceNextChar -Char5CText:: ; 1823 (0:1823) +Char5CText:: db "TM@" -Char5DText:: ; 1826 (0:1826) +Char5DText:: db "TRAINER@" -Char5BText:: ; 182e (0:182e) +Char5BText:: db "PC@" -Char5EText:: ; 1831 (0:1830) +Char5EText:: db "ROCKET@" -Char54Text:: ; 1838 (0:1838) +Char54Text:: db "POKé@" -Char56Text:: ; 183d (0:183d) +Char56Text:: db "……@" -Char5AText:: ; 1840 (0:1840) +Char5AText:: db "Enemy @" -Char4AText:: ; 1847 (0:1847) +Char4AText:: db $E1, $E2, "@" ; PKMN -Char55:: ; 184a (0:184a) +Char55:: push de ld b, h ld c, l @@ -242,12 +242,12 @@ Char55:: ; 184a (0:184a) inc de jp PlaceNextChar -Char55Text:: ; 185a (0:185a) +Char55Text:: ; equivalent to Char4B TX_FAR _Char55Text ; a0c73 (28:4c73) db "@" -Char5F:: ; 185f (0:185f) +Char5F:: ; ends a Pokédex entry ld [hl], "." pop hl @@ -270,7 +270,7 @@ Char57:: ; 1aad (0:1aad) done dec de ret -Char58Text:: ; 1881 (0:1881) +Char58Text:: db "@" Char51:: ; 1882 (0:1882) para @@ -288,7 +288,7 @@ Char51:: ; 1882 (0:1882) para coord hl, 1, 14 jp PlaceNextChar_inc -Char49:: ; 18a3 (0:18a3) +Char49:: ld a, [hFlags_0xFFFA] bit 3, a jr z, .Char49 @@ -312,7 +312,7 @@ Char49:: ; 18a3 (0:18a3) push hl jp PlaceNextChar_inc -Char4B:: ; 18d1 (0:18d1) +Char4B:: ld a, $EE Coorda 18, 16 call ProtectedDelay3 @@ -322,7 +322,7 @@ Char4B:: ; 18d1 (0:18d1) ld a, " " Coorda 18, 16 ;fall through -Char4C:: ; 18e3 (0:18e3) +Char4C:: push de call ScrollTextUpOneLine ; 18f1 call ScrollTextUpOneLine @@ -330,7 +330,7 @@ Char4C:: ; 18e3 (0:18e3) pop de jp PlaceNextChar_inc -ScrollTextUpOneLine:: ; 18f1 (0:18f1) +ScrollTextUpOneLine:: coord hl, 0, 14 coord de, 0, 13 ld b, 60 @@ -357,13 +357,13 @@ ScrollTextUpOneLine:: ; 18f1 (0:18f1) ret -ProtectedDelay3:: ; 1913 (0:1913) +ProtectedDelay3:: push bc call Delay3 pop bc ret -TextCommandProcessor:: ; 1919 (0:1919) +TextCommandProcessor:: ld a, [wLetterPrintingDelayFlags] push af set 1, a @@ -376,7 +376,7 @@ TextCommandProcessor:: ; 1919 (0:1919) ld a, b ld [wTextDestinationTileAddrBuffer + 1], a -NextTextCommand:: ; 192e (0:192e) +NextTextCommand:: ld a, [hli] cp a, "@" ; terminator jr nz, .doTextCommand @@ -407,7 +407,7 @@ NextTextCommand:: ; 192e (0:192e) ; AAAA = address of upper left corner ; BB = height ; CC = width -TextCommand04:: ; 1951 (0:1951) +TextCommand04:: pop hl ld a, [hli] ld e, a @@ -426,7 +426,7 @@ TextCommand04:: ; 1951 (0:1951) ; place string inline ; 00{string} -TextCommand00:: ; 1963 (0:1963) +TextCommand00:: pop hl ld d, h ld e, l @@ -441,7 +441,7 @@ TextCommand00:: ; 1963 (0:1963) ; place string from RAM ; 01AAAA ; AAAA = address of string -TextCommand01:: ; 1970 (0:1970) +TextCommand01:: pop hl ld a, [hli] ld e, a @@ -460,7 +460,7 @@ TextCommand01:: ; 1970 (0:1970) ; BB ; bits 0-4 = length in bytes ; bits 5-7 = unknown flags -TextCommand02:: ; 197e (0:197e) +TextCommand02:: pop hl ld a, [hli] ld e, a @@ -480,7 +480,7 @@ TextCommand02:: ; 197e (0:197e) ; repoint destination address ; 03AAAA ; AAAA = new destination address -TextCommand03:: ; 1990 (0:1990) +TextCommand03:: pop hl ld a, [hli] ld [wTextDestinationTileAddrBuffer], a @@ -493,7 +493,7 @@ TextCommand03:: ; 1990 (0:1990) ; repoint destination to second line of dialogue text box ; 05 ; (no arguments) -TextCommand05:: ; 199e (0:199e) +TextCommand05:: pop hl coord bc, 1, 16 ; address of second line of dialogue text box jp NextTextCommand @@ -501,7 +501,7 @@ TextCommand05:: ; 199e (0:199e) ; blink arrow and wait for A or B to be pressed ; 06 ; (no arguments) -TextCommand06:: ; 19a5 (0:19a5) +TextCommand06:: ld a, [wLinkState] cp a, LINK_STATE_BATTLING jp z, TextCommand0D @@ -518,7 +518,7 @@ TextCommand06:: ; 19a5 (0:19a5) ; scroll text up one line ; 07 ; (no arguments) -TextCommand07:: ; 19c0 (0:19c0) +TextCommand07:: ld a, " " Coorda 18, 16 ; place blank space in lower right corner of dialogue text box call ScrollTextUpOneLine ; scroll up text @@ -529,7 +529,7 @@ TextCommand07:: ; 19c0 (0:19c0) ; execute asm inline ; 08{code} -TextCommand08:: ; 19d2 (0:19d2) +TextCommand08:: pop hl ld de, NextTextCommand push de ; return address @@ -541,7 +541,7 @@ TextCommand08:: ; 19d2 (0:19d2) ; BB ; bits 0-3 = how many digits to display ; bits 4-7 = how long the number is in bytes -TextCommand09:: ; 19d8 (0:19d8) +TextCommand09:: pop hl ld a, [hli] ld e, a @@ -568,7 +568,7 @@ TextCommand09:: ; 19d8 (0:19d8) ; wait half a second if the user doesn't hold A or B ; 0A ; (no arguments) -TextCommand0A:: ; 19f6 (0:19f6) +TextCommand0A:: push bc call Joypad ld a, [hJoyHeld] @@ -584,7 +584,7 @@ TextCommand0A:: ; 19f6 (0:19f6) ; plays sounds ; this actually handles various command ID's, not just 0B ; (no arguments) -TextCommand0B:: ; 1a0a (0:1a0a) +TextCommand0B:: pop hl push bc dec hl @@ -621,7 +621,7 @@ TextCommand0B:: ; 1a0a (0:1a0a) jp NextTextCommand ; format: text command ID, sound ID or cry ID -TextCommandSounds:: ; 1a3d (0:1a3d) +TextCommandSounds:: db $0B, SFX_GET_ITEM_1 db $12, SFX_TURN_OFF_PC db $0E, SFX_POKEDEX_RATING @@ -636,7 +636,7 @@ TextCommandSounds:: ; 1a3d (0:1a3d) ; draw ellipses ; 0CAA ; AA = number of ellipses to draw -TextCommand0C:: ; 1a51 (0:1a51) +TextCommand0C:: pop hl ld a, [hli] ld d, a @@ -665,7 +665,7 @@ TextCommand0C:: ; 1a51 (0:1a51) ; wait for A or B to be pressed ; 0D ; (no arguments) -TextCommand0D:: ; 1a73 (0:1a73) +TextCommand0D:: push bc call ManualTextScroll ; wait for A or B to be pressed pop bc @@ -676,7 +676,7 @@ TextCommand0D:: ; 1a73 (0:1a73) ; 17AAAABB ; AAAA = address of text commands ; BB = bank -TextCommand17:: ; 1a7c (0:1a7c) +TextCommand17:: pop hl ld a, [H_LOADEDROMBANK] push af @@ -697,7 +697,7 @@ TextCommand17:: ; 1a7c (0:1a7c) ld [MBC1RomBank], a jp NextTextCommand -TextCommandJumpTable:: ; 1a9a (0:1a9a) +TextCommandJumpTable:: dw TextCommand00 dw TextCommand01 dw TextCommand02 diff --git a/home/timer.asm b/home/timer.asm index 8578df1a..05e307bd 100644 --- a/home/timer.asm +++ b/home/timer.asm @@ -1,3 +1,3 @@ ; timer interrupt is apparently not invoked anyway -Timer:: ; 2306 (0:2306) +Timer:: reti diff --git a/home/vblank.asm b/home/vblank.asm index 24159a4c..9cc8d42f 100644 --- a/home/vblank.asm +++ b/home/vblank.asm @@ -1,4 +1,4 @@ -VBlank:: ; 1de5 (0:1de5) +VBlank:: push af push bc @@ -78,7 +78,7 @@ VBlank:: ; 1de5 (0:1de5) reti -DelayFrame:: ; 1e64 (0:1e64) +DelayFrame:: ; Wait for the next vblank interrupt. ; As a bonus, this saves battery. diff --git a/home/vcopy.asm b/home/vcopy.asm index 464faf51..2974dfec 100644 --- a/home/vcopy.asm +++ b/home/vcopy.asm @@ -1,7 +1,7 @@ ; this function seems to be used only once ; it store the address of a row and column of the VRAM background map in hl ; INPUT: h - row, l - column, b - high byte of background tile map address in VRAM -GetRowColAddressBgMap:: ; 1cdd (0:1cdd) +GetRowColAddressBgMap:: xor a srl h rr a @@ -18,7 +18,7 @@ GetRowColAddressBgMap:: ; 1cdd (0:1cdd) ; clears a VRAM background map with blank space tiles ; INPUT: h - high byte of background tile map address in VRAM -ClearBgMap:: ; 1cf0 (0:1cf0) +ClearBgMap:: ld a," " jr .next ld a,l @@ -39,7 +39,7 @@ ClearBgMap:: ; 1cf0 (0:1cf0) ; row or column is more efficient than redrawing the entire screen. ; However, this function is also called repeatedly to redraw the whole screen ; when necessary. It is also used in trade animation and elevator code. -RedrawRowOrColumn:: ; 1ada (0:1ada) +RedrawRowOrColumn:: ld a,[hRedrawRowOrColumnMode] and a ret z @@ -119,7 +119,7 @@ RedrawRowOrColumn:: ; 1ada (0:1ada) ; on when talking to sprites, battling, using menus, etc. This is because ; the above function, RedrawRowOrColumn, is used when walking to ; improve efficiency. -AutoBgMapTransfer:: ; 1b30 (0:1b30) +AutoBgMapTransfer:: ld a,[H_AUTOBGTRANSFERENABLED] and a ret z @@ -163,7 +163,7 @@ AutoBgMapTransfer:: ; 1b30 (0:1b30) ld [H_AUTOBGTRANSFERPORTION],a ; store next portion ld b,6 -TransferBgRows:: ; 1d9e (0:1d9e) +TransferBgRows:: ; unrolled loop and using pop for speed rept 20 / 2 - 1 @@ -197,7 +197,7 @@ TransferBgRows:: ; 1d9e (0:1d9e) ; Copies [H_VBCOPYBGNUMROWS] rows from H_VBCOPYBGSRC to H_VBCOPYBGDEST. ; If H_VBCOPYBGSRC is XX00, the transfer is disabled. -VBlankCopyBgMap:: ; 1bb5 (0:1bb5) +VBlankCopyBgMap:: ld a,[H_VBCOPYBGSRC] ; doubles as enabling byte and a ret z @@ -218,7 +218,7 @@ VBlankCopyBgMap:: ; 1bb5 (0:1bb5) jr TransferBgRows -VBlankCopyDouble:: ; 1bd1 (0:1bd1) +VBlankCopyDouble:: ; Copy [H_VBCOPYDOUBLESIZE] 1bpp tiles ; from H_VBCOPYDOUBLESRC to H_VBCOPYDOUBLEDEST. @@ -286,7 +286,7 @@ VBlankCopyDouble:: ; 1bd1 (0:1bd1) ret -VBlankCopy:: ; 1c21 (0:1c21) +VBlankCopy:: ; Copy [H_VBCOPYSIZE] 2bpp tiles (or 16 * [H_VBCOPYSIZE] tile map entries) ; from H_VBCOPYSRC to H_VBCOPYDEST. @@ -345,7 +345,7 @@ VBlankCopy:: ; 1c21 (0:1c21) ret -UpdateMovingBgTiles:: ; 1c75 (0:1c75) +UpdateMovingBgTiles:: ; Animate water and flower ; tiles in the overworld. |
