summaryrefslogtreecommitdiff
path: root/home
diff options
context:
space:
mode:
Diffstat (limited to 'home')
-rw-r--r--home/audio.asm14
-rw-r--r--home/overworld.asm112
-rw-r--r--home/pic.asm42
-rw-r--r--home/serial.asm24
-rw-r--r--home/text.asm96
-rw-r--r--home/timer.asm2
-rw-r--r--home/vcopy.asm12
7 files changed, 151 insertions, 151 deletions
diff --git a/home/audio.asm b/home/audio.asm
index 2c46ec7a..7c0c5238 100644
--- a/home/audio.asm
+++ b/home/audio.asm
@@ -1,4 +1,4 @@
-PlayDefaultMusic:: ; 2307 (0:2307)
+PlayDefaultMusic::
call WaitForSoundToFinish
xor a
ld c, a
@@ -6,7 +6,7 @@ PlayDefaultMusic:: ; 2307 (0:2307)
ld [wLastMusicSoundID], a
jr PlayDefaultMusicCommon
-PlayDefaultMusicFadeOutCurrent:: ; 2312 (0:2312)
+PlayDefaultMusicFadeOutCurrent::
; Fade out the current music and then play the default music.
ld c, 10
ld d, 0
@@ -18,7 +18,7 @@ PlayDefaultMusicFadeOutCurrent:: ; 2312 (0:2312)
ld c, 8
ld d, c
-PlayDefaultMusicCommon:: ; 2324 (0:2324)
+PlayDefaultMusicCommon::
ld a, [wWalkBikeSurfState]
and a
jr z, .walking
@@ -66,7 +66,7 @@ PlayDefaultMusicCommon:: ; 2324 (0:2324)
ld [wNewSoundID], a
jp PlaySound
-UpdateMusic6Times:: ; 235f (0:235f)
+UpdateMusic6Times::
; This is called when entering a map, before fading out the current music and
; playing the default music (i.e. the map's music or biking/surfing music).
ld a, [wAudioROMBank]
@@ -101,7 +101,7 @@ UpdateMusic6Times:: ; 235f (0:235f)
jr nz, .loop
ret
-CompareMapMusicBankWithCurrentBank:: ; 2385 (0:2385)
+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.
@@ -128,7 +128,7 @@ CompareMapMusicBankWithCurrentBank:: ; 2385 (0:2385)
scf
ret
-PlayMusic:: ; 23a1 (0:23a1)
+PlayMusic::
ld b, a
ld [wNewSoundID], a
xor a
@@ -139,7 +139,7 @@ PlayMusic:: ; 23a1 (0:23a1)
ld a, b
; plays music specified by a. If value is $ff, music is stopped
-PlaySound:: ; 23b1 (0:23b1)
+PlaySound::
push hl
push de
push bc
diff --git a/home/overworld.asm b/home/overworld.asm
index e4f58d4a..fad9f29d 100644
--- a/home/overworld.asm
+++ b/home/overworld.asm
@@ -348,7 +348,7 @@ OverworldLoopLessDelay::
; 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:: ; 0683 (0:0683)
+NewBattle::
ld a,[wd72d]
bit 4,a
jr nz,.noBattle
@@ -363,7 +363,7 @@ NewBattle:: ; 0683 (0:0683)
ret
; function to make bikes twice as fast as walking
-BikeSpeedup:: ; 06a0 (0:06a0)
+BikeSpeedup::
ld a,[wNPCMovementScriptPointerTableNum]
and a
ret nz
@@ -377,7 +377,7 @@ BikeSpeedup:: ; 06a0 (0:06a0)
jp AdvancePlayerSprite
; check if the player has stepped onto a warp after having not collided
-CheckWarpsNoCollision:: ; 06b4 (0:06b4)
+CheckWarpsNoCollision::
ld a,[wNumberOfWarps]
and a
jp z,CheckMapConnections
@@ -389,7 +389,7 @@ CheckWarpsNoCollision:: ; 06b4 (0:06b4)
ld a,[wXCoord]
ld e,a
ld hl,wWarpEntries
-CheckWarpsNoCollisionLoop:: ; 06cc (0:06cc)
+CheckWarpsNoCollisionLoop::
ld a,[hli] ; check if the warp's Y position matches
cp d
jr nz,CheckWarpsNoCollisionRetry1
@@ -426,7 +426,7 @@ CheckWarpsNoCollisionLoop:: ; 06cc (0:06cc)
jr WarpFound1
; check if the player has stepped onto a warp after having collided
-CheckWarpsCollision:: ; 0706 (0:0706)
+CheckWarpsCollision::
ld a,[wNumberOfWarps]
ld c,a
ld hl,wWarpEntries
@@ -455,20 +455,20 @@ CheckWarpsCollision:: ; 0706 (0:0706)
jr nz,.loop
jp OverworldLoop
-CheckWarpsNoCollisionRetry1:: ; 072f (0:072f)
+CheckWarpsNoCollisionRetry1::
inc hl
-CheckWarpsNoCollisionRetry2:: ; 0730 (0:0730)
+CheckWarpsNoCollisionRetry2::
inc hl
inc hl
jp ContinueCheckWarpsNoCollisionLoop
-WarpFound1:: ; 0735 (0:0735)
+WarpFound1::
ld a,[hli]
ld [wDestinationWarpID],a
ld a,[hli]
ld [hWarpDestinationMap],a
-WarpFound2:: ; 073c (0:073c)
+WarpFound2::
ld a,[wNumberOfWarps]
sub c
ld [wWarpedFromWhichWarp],a ; save ID of used warp
@@ -526,13 +526,13 @@ WarpFound2:: ; 073c (0:073c)
call IgnoreInputForHalfSecond
jp EnterMap
-ContinueCheckWarpsNoCollisionLoop:: ; 07b5 (0:07b5)
+ContinueCheckWarpsNoCollisionLoop::
inc b ; increment warp number
dec c ; decrement number of warps
jp nz,CheckWarpsNoCollisionLoop
; if no matching warp was found
-CheckMapConnections:: ; 07ba (0:07ba)
+CheckMapConnections::
.checkWestMap
ld a,[wXCoord]
cp a,$ff
@@ -670,7 +670,7 @@ CheckMapConnections:: ; 07ba (0:07ba)
jp OverworldLoop
; function to play a sound when changing maps
-PlayMapChangeSound:: ; 08c9 (0:08c9)
+PlayMapChangeSound::
aCoord 8, 8 ; upper left tile of the 4x4 square the player's sprite is standing on
cp a,$0b ; door tile in tileset 0
jr nz,.didNotGoThroughDoor
@@ -685,7 +685,7 @@ PlayMapChangeSound:: ; 08c9 (0:08c9)
ret nz
jp GBFadeOutToBlack
-CheckIfInOutsideMap:: ; 08e1 (0:08e1)
+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)
@@ -699,7 +699,7 @@ CheckIfInOutsideMap:: ; 08e1 (0:08e1)
; "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:: ; 08e9 (0:08e9)
+ExtraWarpCheck::
ld a, [wCurMap]
cp SS_ANNE_3
jr z, .useFunction1
@@ -729,7 +729,7 @@ ExtraWarpCheck:: ; 08e9 (0:08e9)
ld b, BANK(IsWarpTileInFrontOfPlayer)
jp Bankswitch
-MapEntryAfterBattle:: ; 091f (0:091f)
+MapEntryAfterBattle::
callba IsPlayerStandingOnWarp ; for enabling warp testing after collisions
ld a,[wMapPalOffset]
and a
@@ -853,7 +853,7 @@ IsBikeRidingAllowed::
INCLUDE "data/bike_riding_tilesets.asm"
; load the tile pattern data of the current tileset into VRAM
-LoadTilesetTilePatternData:: ; 09e8 (0:09e8)
+LoadTilesetTilePatternData::
ld a,[wTileSetGFXPtr]
ld l,a
ld a,[wTileSetGFXPtr + 1]
@@ -865,7 +865,7 @@ LoadTilesetTilePatternData:: ; 09e8 (0:09e8)
; 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:: ; 09fc (0:09fc)
+LoadTileBlockMap::
; fill C6E8-CBFB with the background tile
ld hl,wOverworldMap
ld a,[wMapBackgroundTile]
@@ -994,7 +994,7 @@ LoadTileBlockMap:: ; 09fc (0:09fc)
.done
ret
-LoadNorthSouthConnectionsTileMap:: ; 0ade (0:0ade)
+LoadNorthSouthConnectionsTileMap::
ld c,MAP_BORDER
.loop
push de
@@ -1026,7 +1026,7 @@ LoadNorthSouthConnectionsTileMap:: ; 0ade (0:0ade)
jr nz,.loop
ret
-LoadEastWestConnectionsTileMap:: ; 0b02 (0:0b02)
+LoadEastWestConnectionsTileMap::
push hl
push de
ld c,MAP_BORDER
@@ -1058,7 +1058,7 @@ LoadEastWestConnectionsTileMap:: ; 0b02 (0:0b02)
; function to check if there is a sign or sprite in front of the player
; if so, it is stored in [hSpriteIndexOrTextID]
; if not, [hSpriteIndexOrTextID] is set to 0
-IsSpriteOrSignInFrontOfPlayer:: ; 0b23 (0:0b23)
+IsSpriteOrSignInFrontOfPlayer::
xor a
ld [hSpriteIndexOrTextID],a
ld a,[wNumSigns]
@@ -1112,9 +1112,9 @@ IsSpriteOrSignInFrontOfPlayer:: ; 0b23 (0:0b23)
; part of the above function, but sometimes its called on its own, when signs are irrelevant
; the caller must zero [hSpriteIndexOrTextID]
-IsSpriteInFrontOfPlayer:: ; 0b6b (0:0b6b)
+IsSpriteInFrontOfPlayer::
ld d,$10 ; talking range in pixels (normal range)
-IsSpriteInFrontOfPlayer2:: ; 0b6d (0:0b6d)
+IsSpriteInFrontOfPlayer2::
lb bc, $3c, $40 ; Y and X position of player sprite
ld a,[wSpriteStateData1 + 9] ; direction the player is facing
.checkIfPlayerFacingUp
@@ -1198,7 +1198,7 @@ IsSpriteInFrontOfPlayer2:: ; 0b6d (0:0b6d)
; 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:: ; 0bd1 (0:0bd1)
+CollisionCheckOnLand::
ld a,[wd736]
bit 6,a ; is the player jumping?
jr nz,.noCollision
@@ -1238,7 +1238,7 @@ CollisionCheckOnLand:: ; 0bd1 (0:0bd1)
; function that checks if the tile in front of the player is passable
; clears carry if it is, sets carry if not
-CheckTilePassable:: ; 0c10 (0:0c10)
+CheckTilePassable::
predef GetTileAndCoordsInFrontOfPlayer ; get tile in front of player
ld a,[wTileInFrontOfPlayer] ; tile in front of player
ld c,a
@@ -1261,7 +1261,7 @@ CheckTilePassable:: ; 0c10 (0:0c10)
; 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:: ; 0c2a (0:0c2a)
+CheckForJumpingAndTilePairCollisions::
push hl
predef GetTileAndCoordsInFrontOfPlayer ; get the tile in front of the player
push de
@@ -1276,11 +1276,11 @@ CheckForJumpingAndTilePairCollisions:: ; 0c2a (0:0c2a)
ret nz
; if not jumping
-CheckForTilePairCollisions2:: ; 0c44 (0:0c44)
+CheckForTilePairCollisions2::
aCoord 8, 9 ; tile the player is on
ld [wTilePlayerStandingOn],a
-CheckForTilePairCollisions:: ; 0c4a (0:0c4a)
+CheckForTilePairCollisions::
ld a,[wTileInFrontOfPlayer]
ld c,a
.tilePairCollisionLoop
@@ -1330,7 +1330,7 @@ CheckForTilePairCollisions:: ; 0c4a (0:0c4a)
; 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:: ; 0c7e (0:0c7e)
+TilePairCollisionsLand::
db CAVERN, $20, $05
db CAVERN, $41, $05
db FOREST, $30, $2E
@@ -1344,14 +1344,14 @@ TilePairCollisionsLand:: ; 0c7e (0:0c7e)
db FOREST, $5F, $2E
db $FF
-TilePairCollisionsWater:: ; 0ca0 (0:0ca0)
+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:: ; 0caa (0:0caa)
+LoadCurrentMapView::
ld a,[H_LOADEDROMBANK]
push af
ld a,[wTileSetBank] ; tile data ROM bank
@@ -1441,7 +1441,7 @@ LoadCurrentMapView:: ; 0caa (0:0caa)
ld [MBC1RomBank],a ; restore previous ROM bank
ret
-AdvancePlayerSprite:: ; 0d27 (0:0d27)
+AdvancePlayerSprite::
ld a,[wSpriteStateData1 + 3] ; delta Y
ld b,a
ld a,[wSpriteStateData1 + 5] ; delta X
@@ -1639,7 +1639,7 @@ AdvancePlayerSprite:: ; 0d27 (0:0d27)
; the following four functions are used to move the pointer to the upper left
; corner of the tile block map in the direction of motion
-MoveTileBlockMapPointerEast:: ; 0e65 (0:0e65)
+MoveTileBlockMapPointerEast::
ld a,[de]
add a,$01
ld [de],a
@@ -1650,7 +1650,7 @@ MoveTileBlockMapPointerEast:: ; 0e65 (0:0e65)
ld [de],a
ret
-MoveTileBlockMapPointerWest:: ; 0e6f (0:0e6f)
+MoveTileBlockMapPointerWest::
ld a,[de]
sub a,$01
ld [de],a
@@ -1661,7 +1661,7 @@ MoveTileBlockMapPointerWest:: ; 0e6f (0:0e6f)
ld [de],a
ret
-MoveTileBlockMapPointerSouth:: ; 0e79 (0:0e79)
+MoveTileBlockMapPointerSouth::
add a,MAP_BORDER * 2
ld b,a
ld a,[de]
@@ -1674,7 +1674,7 @@ MoveTileBlockMapPointerSouth:: ; 0e79 (0:0e79)
ld [de],a
ret
-MoveTileBlockMapPointerNorth:: ; 0e85 (0:0e85)
+MoveTileBlockMapPointerNorth::
add a,MAP_BORDER * 2
ld b,a
ld a,[de]
@@ -1690,7 +1690,7 @@ MoveTileBlockMapPointerNorth:: ; 0e85 (0:0e85)
; 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:: ; 0e91 (0:0e91)
+ScheduleNorthRowRedraw::
coord hl, 0, 0
call CopyToRedrawRowOrColumnSrcTiles
ld a,[wMapViewVRAMPointer]
@@ -1701,7 +1701,7 @@ ScheduleNorthRowRedraw:: ; 0e91 (0:0e91)
ld [hRedrawRowOrColumnMode],a
ret
-CopyToRedrawRowOrColumnSrcTiles:: ; 0ea6 (0:0ea6)
+CopyToRedrawRowOrColumnSrcTiles::
ld de,wRedrawRowOrColumnSrcTiles
ld c,2 * SCREEN_WIDTH
.loop
@@ -1712,7 +1712,7 @@ CopyToRedrawRowOrColumnSrcTiles:: ; 0ea6 (0:0ea6)
jr nz,.loop
ret
-ScheduleSouthRowRedraw:: ; 0eb2 (0:0eb2)
+ScheduleSouthRowRedraw::
coord hl, 0, 16
call CopyToRedrawRowOrColumnSrcTiles
ld a,[wMapViewVRAMPointer]
@@ -1731,7 +1731,7 @@ ScheduleSouthRowRedraw:: ; 0eb2 (0:0eb2)
ld [hRedrawRowOrColumnMode],a
ret
-ScheduleEastColumnRedraw:: ; 0ed3 (0:0ed3)
+ScheduleEastColumnRedraw::
coord hl, 18, 0
call ScheduleColumnRedrawHelper
ld a,[wMapViewVRAMPointer]
@@ -1749,7 +1749,7 @@ ScheduleEastColumnRedraw:: ; 0ed3 (0:0ed3)
ld [hRedrawRowOrColumnMode],a
ret
-ScheduleColumnRedrawHelper:: ; 0ef2 (0:0ef2)
+ScheduleColumnRedrawHelper::
ld de,wRedrawRowOrColumnSrcTiles
ld c,SCREEN_HEIGHT
.loop
@@ -1769,7 +1769,7 @@ ScheduleColumnRedrawHelper:: ; 0ef2 (0:0ef2)
jr nz,.loop
ret
-ScheduleWestColumnRedraw:: ; 0f08 (0:0f08)
+ScheduleWestColumnRedraw::
coord hl, 0, 0
call ScheduleColumnRedrawHelper
ld a,[wMapViewVRAMPointer]
@@ -1782,7 +1782,7 @@ ScheduleWestColumnRedraw:: ; 0f08 (0:0f08)
; function to write the tiles that make up a tile block to memory
; Input: c = tile block ID, hl = destination address
-DrawTileBlock:: ; 0f1d (0:0f1d)
+DrawTileBlock::
push hl
ld a,[wTileSetBlocksPtr] ; pointer to tiles
ld l,a
@@ -1823,7 +1823,7 @@ DrawTileBlock:: ; 0f1d (0:0f1d)
ret
; function to update joypad state and simulate button presses
-JoypadOverworld:: ; 0f4d (0:0f4d)
+JoypadOverworld::
xor a
ld [wSpriteStateData1 + 3],a
ld [wSpriteStateData1 + 5],a
@@ -1893,7 +1893,7 @@ JoypadOverworld:: ; 0f4d (0:0f4d)
; 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:: ; 0fb7 (0:0fb7)
+CollisionCheckOnWater::
ld a,[wd730]
bit 7,a
jp nz,.noCollision ; return and clear carry if button presses are being simulated
@@ -1952,7 +1952,7 @@ CollisionCheckOnWater:: ; 0fb7 (0:0fb7)
jr .stopSurfing ; if it is the boarding platform tile, stop surfing
; function to run the current map's script
-RunMapScript:: ; 101b (0:101b)
+RunMapScript::
push hl
push de
push bc
@@ -1978,21 +1978,21 @@ RunMapScript:: ; 101b (0:101b)
.return
ret
-LoadWalkingPlayerSpriteGraphics:: ; 104d (0:104d)
+LoadWalkingPlayerSpriteGraphics::
ld de,RedSprite
ld hl,vNPCSprites
jr LoadPlayerSpriteGraphicsCommon
-LoadSurfingPlayerSpriteGraphics:: ; 1055 (0:1055)
+LoadSurfingPlayerSpriteGraphics::
ld de,SeelSprite
ld hl,vNPCSprites
jr LoadPlayerSpriteGraphicsCommon
-LoadBikePlayerSpriteGraphics:: ; 105d (0:105d)
+LoadBikePlayerSpriteGraphics::
ld de,RedCyclingSprite
ld hl,vNPCSprites
-LoadPlayerSpriteGraphicsCommon:: ; 1063 (0:1063)
+LoadPlayerSpriteGraphicsCommon::
push de
push hl
lb bc, BANK(RedSprite), $0c
@@ -2010,7 +2010,7 @@ LoadPlayerSpriteGraphicsCommon:: ; 1063 (0:1063)
jp CopyVideoData
; function to load data from the map header
-LoadMapHeader:: ; 107c (0:107c)
+LoadMapHeader::
callba MarkTownVisitedAndLoadMissableObjects
ld a,[wCurMapTileset]
ld [wUnusedD119],a
@@ -2289,7 +2289,7 @@ LoadMapHeader:: ; 107c (0:107c)
; function to copy map connection data from ROM to WRAM
; Input: hl = source, de = destination
-CopyMapConnectionHeader:: ; 1238 (0:1238)
+CopyMapConnectionHeader::
ld c,$0b
.loop
ld a,[hli]
@@ -2300,7 +2300,7 @@ CopyMapConnectionHeader:: ; 1238 (0:1238)
ret
; function to load map data
-LoadMapData:: ; 1241 (0:1241)
+LoadMapData::
ld a,[H_LOADEDROMBANK]
push af
call DisableLCD
@@ -2362,7 +2362,7 @@ LoadMapData:: ; 1241 (0:1241)
; function to switch to the ROM bank that a map is stored in
; Input: a = map number
-SwitchToMapRomBank:: ; 12bc (0:12bc)
+SwitchToMapRomBank::
push hl
push bc
ld c,a
@@ -2381,7 +2381,7 @@ SwitchToMapRomBank:: ; 12bc (0:12bc)
pop hl
ret
-IgnoreInputForHalfSecond: ; 12da (0:12da)
+IgnoreInputForHalfSecond:
ld a, 30
ld [wIgnoreInputCounter], a
ld hl, wd730
@@ -2390,12 +2390,12 @@ IgnoreInputForHalfSecond: ; 12da (0:12da)
ld [hl], a ; set ignore input bit
ret
-ResetUsingStrengthOutOfBattleBit: ; 12e7 (0:12e7)
+ResetUsingStrengthOutOfBattleBit:
ld hl, wd728
res 0, [hl]
ret
-ForceBikeOrSurf:: ; 12ed (0:12ed)
+ForceBikeOrSurf::
ld b, BANK(RedSprite)
ld hl, LoadPlayerSpriteGraphics
call Bankswitch
diff --git a/home/pic.asm b/home/pic.asm
index 4af12117..15ee53ad 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:: ; 24fd (0:24fd)
+UncompressSpriteData::
ld b, a
ld a, [H_LOADEDROMBANK]
push af
@@ -18,7 +18,7 @@ UncompressSpriteData:: ; 24fd (0:24fd)
ret
; initializes necessary data to load a sprite and runs UncompressSpriteDataLoop
-_UncompressSpriteData:: ; 251a (0:251a)
+_UncompressSpriteData::
ld hl, sSpriteBuffer1
ld c, (2*SPRITEBUFFERSIZE) % $100
ld b, (2*SPRITEBUFFERSIZE) / $100
@@ -55,7 +55,7 @@ _UncompressSpriteData:: ; 251a (0:251a)
; 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:: ; 2556 (0:2556)
+UncompressSpriteDataLoop::
ld hl, sSpriteBuffer1
ld a, [wSpriteLoadFlags]
bit 0, a
@@ -145,7 +145,7 @@ UncompressSpriteDataLoop:: ; 2556 (0:2556)
; 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:: ; 25d8 (0:25d8)
+MoveToNextBufferPosition::
ld a, [wSpriteHeight]
ld b, a
ld a, [wSpriteCurPosY]
@@ -206,7 +206,7 @@ MoveToNextBufferPosition:: ; 25d8 (0:25d8)
jp UnpackSprite
; writes 2 bits (from a) to the output buffer (pointed to from wSpriteOutputPtr)
-WriteSpriteBitsToBuffer:: ; 2649 (0:2649)
+WriteSpriteBitsToBuffer::
ld e, a
ld a, [wSpriteOutputBitOffset]
and a
@@ -234,7 +234,7 @@ WriteSpriteBitsToBuffer:: ; 2649 (0:2649)
ret
; reads next bit from input stream and returns it in a
-ReadNextInputBit:: ; 2670 (0:2670)
+ReadNextInputBit::
ld a, [wSpriteInputBitCounter]
dec a
jr nz, .curByteHasMoreBitsToRead
@@ -250,7 +250,7 @@ ReadNextInputBit:: ; 2670 (0:2670)
ret
; reads next byte from input stream and returns it in a
-ReadNextInputByte:: ; 268b (0:268b)
+ReadNextInputByte::
ld a, [wSpriteInputPtr]
ld l, a
ld a, [wSpriteInputPtr+1]
@@ -265,7 +265,7 @@ ReadNextInputByte:: ; 268b (0:268b)
ret
; the nth item is 2^n - 1
-LengthEncodingOffsetList:: ; 269f (0:269f)
+LengthEncodingOffsetList::
dw %0000000000000001
dw %0000000000000011
dw %0000000000000111
@@ -284,7 +284,7 @@ LengthEncodingOffsetList:: ; 269f (0:269f)
dw %1111111111111111
; unpacks the sprite data depending on the unpack mode
-UnpackSprite:: ; 26bf (0:26bf)
+UnpackSprite::
ld a, [wSpriteUnpackMode]
cp $2
jp z, UnpackSpriteMode2
@@ -297,7 +297,7 @@ UnpackSprite:: ; 26bf (0:26bf)
; 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:: ; 26d4 (0:26d4)
+SpriteDifferentialDecode::
xor a
ld [wSpriteCurPosX], a
ld [wSpriteCurPosY], a
@@ -382,7 +382,7 @@ SpriteDifferentialDecode:: ; 26d4 (0:26d4)
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:: ; 276d (0:276d)
+DifferentialDecodeNybble::
srl a ; c=a%2, a/=2
ld c, $0
jr nc, .evenNumber
@@ -424,7 +424,7 @@ DifferentialDecodeNybble:: ; 276d (0:276d)
ld e, a ; update last decoded data
ret
-DecodeNybble0Table:: ; 27a7 (0:27a7)
+DecodeNybble0Table::
dn $0, $1
dn $3, $2
dn $7, $6
@@ -433,7 +433,7 @@ DecodeNybble0Table:: ; 27a7 (0:27a7)
dn $c, $d
dn $8, $9
dn $b, $a
-DecodeNybble1Table:: ; 27af (0:27af)
+DecodeNybble1Table::
dn $f, $e
dn $c, $d
dn $8, $9
@@ -442,7 +442,7 @@ DecodeNybble1Table:: ; 27af (0:27af)
dn $3, $2
dn $7, $6
dn $4, $5
-DecodeNybble0TableFlipped:: ; 27b7 (0:27b7)
+DecodeNybble0TableFlipped::
dn $0, $8
dn $c, $4
dn $e, $6
@@ -451,7 +451,7 @@ DecodeNybble0TableFlipped:: ; 27b7 (0:27b7)
dn $3, $b
dn $1, $9
dn $d, $5
-DecodeNybble1TableFlipped:: ; 27bf (0:27bf)
+DecodeNybble1TableFlipped::
dn $f, $7
dn $3, $b
dn $1, $9
@@ -462,7 +462,7 @@ DecodeNybble1TableFlipped:: ; 27bf (0:27bf)
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:: ; 27c7 (0:27c7)
+XorSpriteChunks::
xor a
ld [wSpriteCurPosX], a
ld [wSpriteCurPosY], a
@@ -527,7 +527,7 @@ XorSpriteChunks:: ; 27c7 (0:27c7)
ret
; reverses the bits in the nybble given in register a
-ReverseNybble:: ; 2837 (0:2837)
+ReverseNybble::
ld de, NybbleReverseTable
add e
ld e, a
@@ -538,7 +538,7 @@ ReverseNybble:: ; 2837 (0:2837)
ret
; resets sprite buffer pointers to buffer 1 and 2, depending on wSpriteLoadFlags
-ResetSpriteBufferPointers:: ; 2841 (0:2841)
+ResetSpriteBufferPointers::
ld a, [wSpriteLoadFlags]
bit 0, a
jr nz, .buffer2Selected
@@ -560,11 +560,11 @@ ResetSpriteBufferPointers:: ; 2841 (0:2841)
ret
; maps each nybble to its reverse
-NybbleReverseTable:: ; 2867 (0:2867)
+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:: ; 2877 (0:2877)
+UnpackSpriteMode2::
call ResetSpriteBufferPointers
ld a, [wSpriteFlipped]
push af
@@ -581,7 +581,7 @@ UnpackSpriteMode2:: ; 2877 (0:2877)
jp XorSpriteChunks
; stores hl into the output pointers
-StoreSpriteOutputPointer:: ; 2897 (0:2897)
+StoreSpriteOutputPointer::
ld a, l
ld [wSpriteOutputPtr], a
ld [wSpriteOutputPtrCached], a
diff --git a/home/serial.asm b/home/serial.asm
index 1f0146d9..7a515118 100644
--- a/home/serial.asm
+++ b/home/serial.asm
@@ -1,4 +1,4 @@
-Serial:: ; 2125 (0:2125)
+Serial::
push af
push bc
push de
@@ -52,7 +52,7 @@ Serial:: ; 2125 (0:2125)
; hl = send data
; de = receive data
; bc = length of data
-Serial_ExchangeBytes:: ; 216f (0:216f)
+Serial_ExchangeBytes::
ld a, 1
ld [hSerialIgnoringInitialData], a
.loop
@@ -86,7 +86,7 @@ Serial_ExchangeBytes:: ; 216f (0:216f)
jr nz, .loop
ret
-Serial_ExchangeByte:: ; 219a (0:219a)
+Serial_ExchangeByte::
xor a
ld [hSerialReceivedNewData], a
ld a, [hSerialConnectionStatus]
@@ -174,14 +174,14 @@ Serial_ExchangeByte:: ; 219a (0:219a)
call DelayFrame
jp Serial_ExchangeByte
-WaitLoop_15Iterations:: ; 2231 (0:2231)
+WaitLoop_15Iterations::
ld a, 15
.waitLoop
dec a
jr nz, .waitLoop
ret
-IsUnknownCounterZero:: ; 2237 (0:2237)
+IsUnknownCounterZero::
push hl
ld hl, wUnknownSerialCounter
ld a, [hli]
@@ -190,7 +190,7 @@ IsUnknownCounterZero:: ; 2237 (0:2237)
ret
; a is always 0 when this is called
-SetUnknownCounterToFFFF:: ; 223f (0:223f)
+SetUnknownCounterToFFFF::
dec a
ld [wUnknownSerialCounter], a
ld [wUnknownSerialCounter + 1], a
@@ -198,7 +198,7 @@ SetUnknownCounterToFFFF:: ; 223f (0:223f)
; 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
@@ -223,13 +223,13 @@ Serial_ExchangeLinkMenuSelection:: ; 2247 (0:2247)
jr nz, .loop
ret
-Serial_PrintWaitingTextAndSyncAndExchangeNybble:: ; 226e (0:226e)
+Serial_PrintWaitingTextAndSyncAndExchangeNybble::
call SaveScreenTilesToBuffer1
callab PrintWaitingText
call Serial_SyncAndExchangeNybble
jp LoadScreenTilesFromBuffer1
-Serial_SyncAndExchangeNybble:: ; 227f (0:227f)
+Serial_SyncAndExchangeNybble::
ld a, $ff
ld [wSerialExchangeNybbleReceiveData], a
.loop1
@@ -269,7 +269,7 @@ Serial_SyncAndExchangeNybble:: ; 227f (0:227f)
ld [wSerialSyncAndExchangeNybbleReceiveData], a
ret
-Serial_ExchangeNybble:: ; 22c3 (0:22c3)
+Serial_ExchangeNybble::
call .doExchange
ld a, [wSerialExchangeNybbleSendData]
add $60
@@ -292,7 +292,7 @@ Serial_ExchangeNybble:: ; 22c3 (0:22c3)
ld [wSerialExchangeNybbleReceiveData], a
ret
-Serial_SendZeroByte:: ; 22ed (0:22ed)
+Serial_SendZeroByte::
xor a
ld [hSerialSendData], a
ld a, [hSerialConnectionStatus]
@@ -302,7 +302,7 @@ Serial_SendZeroByte:: ; 22ed (0:22ed)
ld [rSC], a
ret
-Serial_TryEstablishingExternallyClockedConnection:: ; 22fa (0:22fa)
+Serial_TryEstablishingExternallyClockedConnection::
ld a, ESTABLISH_CONNECTION_WITH_EXTERNAL_CLOCK
ld [rSB], a
xor a
diff --git a/home/text.asm b/home/text.asm
index a9e7cd60..99dedc75 100644
--- a/home/text.asm
+++ b/home/text.asm
@@ -46,9 +46,9 @@ NPlaceChar::
jr nz, .loop
ret
-PlaceString:: ; 1955 (0:1955)
+PlaceString::
push hl
-PlaceNextChar:: ; 1956 (0:1956)
+PlaceNextChar::
ld a,[de]
cp "@"
@@ -123,11 +123,11 @@ PlaceNextChar:: ; 1956 (0:1956)
jp z,Char5A
ld [hli],a
call PrintLetterDelay
-PlaceNextChar_inc:: ; 19e8 (0:19e8)
+PlaceNextChar_inc::
inc de
jp PlaceNextChar
-Char00:: ; 19ec (0:19ec)
+Char00::
ld b,h
ld c,l
pop hl
@@ -184,7 +184,7 @@ Char4A:: ; 1a29 (0:1a29) ; PKMN
ld de,Char4AText
jr FinishDTE
-Char59:: ; 1a2f (0:1a2f)
+Char59::
; depending on whose turn it is, print
; enemy active monster’s name, prefixed with “Enemy ”
; or
@@ -194,13 +194,13 @@ Char59:: ; 1a2f (0:1a2f)
xor 1
jr MonsterNameCharsCommon
-Char5A:: ; 1a35 (0:1a35)
+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
@@ -216,7 +216,7 @@ MonsterNameCharsCommon:: ; 1a37 (0:1a37)
ld l,c
ld de,wEnemyMonNick ; enemy active monster name
-FinishDTE:: ; 1a4b (0:1a4b)
+FinishDTE::
call PlaceString
ld h,b
ld l,c
@@ -224,24 +224,24 @@ FinishDTE:: ; 1a4b (0:1a4b)
inc de
jp PlaceNextChar
-Char5CText:: ; 1a55 (0:1a55)
+Char5CText::
db "TM@"
-Char5DText:: ; 1a58 (0:1a58)
+Char5DText::
db "TRAINER@"
-Char5BText:: ; 1a60 (0:1a60)
+Char5BText::
db "PC@"
-Char5EText:: ; 1a63 (0:1a63)
+Char5EText::
db "ROCKET@"
-Char54Text:: ; 1a6a (0:1a6a)
+Char54Text::
db "POKé@"
-Char56Text:: ; 1a6f (0:1a6f)
+Char56Text::
db "……@"
-Char5AText:: ; 1a72 (0:1a72)
+Char5AText::
db "Enemy @"
-Char4AText:: ; 1a79 (0:1a79)
+Char4AText::
db $E1,$E2,"@" ; PKMN
-Char55:: ; 1a7c (0:1a7c)
+Char55::
push de
ld b,h
ld c,l
@@ -253,38 +253,38 @@ Char55:: ; 1a7c (0:1a7c)
inc de
jp PlaceNextChar
-Char55Text:: ; 1a8c (0:1a8c)
+Char55Text::
; equivalent to Char4B
TX_FAR _Char55Text
db "@"
-Char5F:: ; 1a91 (0:1a91)
+Char5F::
; ends a Pokédex entry
ld [hl],"."
pop hl
ret
-Char58:: ; 1a95 (0:1a95)
+Char58::
ld a,[wLinkState]
cp LINK_STATE_BATTLING
jp z,Next1AA2
ld a,$EE
Coorda 18, 16
-Next1AA2:: ; 1aa2 (0:1aa2)
+Next1AA2::
call ProtectedDelay3
call ManualTextScroll
ld a, " "
Coorda 18, 16
-Char57:: ; 1aad (0:1aad)
+Char57::
pop hl
ld de,Char58Text
dec de
ret
-Char58Text:: ; 1ab3 (0:1ab3)
+Char58Text::
db "@"
-Char51:: ; 1ab4 (0:1ab4)
+Char51::
push de
ld a,$EE
Coorda 18, 16
@@ -299,7 +299,7 @@ Char51:: ; 1ab4 (0:1ab4)
coord hl, 1, 14
jp PlaceNextChar_inc
-Char49:: ; 1ad5 (0:1ad5)
+Char49::
push de
ld a,$EE
Coorda 18, 16
@@ -316,7 +316,7 @@ Char49:: ; 1ad5 (0:1ad5)
push hl
jp PlaceNextChar_inc
-Char4B:: ; 1af8 (0:1af8)
+Char4B::
ld a,$EE
Coorda 18, 16
call ProtectedDelay3
@@ -326,7 +326,7 @@ Char4B:: ; 1af8 (0:1af8)
ld a, " "
Coorda 18, 16
;fall through
-Char4C:: ; 1b0a (0:1b0a)
+Char4C::
push de
call Next1B18
call Next1B18
@@ -334,7 +334,7 @@ Char4C:: ; 1b0a (0:1b0a)
pop de
jp PlaceNextChar_inc
-Next1B18:: ; 1b18 (0:1b18)
+Next1B18::
coord hl, 0, 14
coord de, 0, 13
ld b,60
@@ -361,13 +361,13 @@ Next1B18:: ; 1b18 (0:1b18)
ret
-ProtectedDelay3:: ; 1b3a (0:1b3a)
+ProtectedDelay3::
push bc
call Delay3
pop bc
ret
-TextCommandProcessor:: ; 1b40 (0:1b40)
+TextCommandProcessor::
ld a,[wLetterPrintingDelayFlags]
push af
set 1,a
@@ -380,7 +380,7 @@ TextCommandProcessor:: ; 1b40 (0:1b40)
ld a,b
ld [wUnusedCC3B],a
-NextTextCommand:: ; 1b55 (0:1b55)
+NextTextCommand::
ld a,[hli]
cp a, "@" ; terminator
jr nz,.doTextCommand
@@ -411,7 +411,7 @@ NextTextCommand:: ; 1b55 (0:1b55)
; AAAA = address of upper left corner
; BB = height
; CC = width
-TextCommand04:: ; 1b78 (0:1b78)
+TextCommand04::
pop hl
ld a,[hli]
ld e,a
@@ -430,7 +430,7 @@ TextCommand04:: ; 1b78 (0:1b78)
; place string inline
; 00{string}
-TextCommand00:: ; 1b8a (0:1b8a)
+TextCommand00::
pop hl
ld d,h
ld e,l
@@ -445,7 +445,7 @@ TextCommand00:: ; 1b8a (0:1b8a)
; place string from RAM
; 01AAAA
; AAAA = address of string
-TextCommand01:: ; 1b97 (0:1b97)
+TextCommand01::
pop hl
ld a,[hli]
ld e,a
@@ -464,7 +464,7 @@ TextCommand01:: ; 1b97 (0:1b97)
; BB
; bits 0-4 = length in bytes
; bits 5-7 = unknown flags
-TextCommand02:: ; 1ba5 (0:1ba5)
+TextCommand02::
pop hl
ld a,[hli]
ld e,a
@@ -484,7 +484,7 @@ TextCommand02:: ; 1ba5 (0:1ba5)
; repoint destination address
; 03AAAA
; AAAA = new destination address
-TextCommand03:: ; 1bb7 (0:1bb7)
+TextCommand03::
pop hl
ld a,[hli]
ld [wUnusedCC3A],a
@@ -497,7 +497,7 @@ TextCommand03:: ; 1bb7 (0:1bb7)
; repoint destination to second line of dialogue text box
; 05
; (no arguments)
-TextCommand05:: ; 1bc5 (0:1bc5)
+TextCommand05::
pop hl
coord bc, 1, 16 ; address of second line of dialogue text box
jp NextTextCommand
@@ -505,7 +505,7 @@ TextCommand05:: ; 1bc5 (0:1bc5)
; blink arrow and wait for A or B to be pressed
; 06
; (no arguments)
-TextCommand06:: ; 1bcc (0:1bcc)
+TextCommand06::
ld a,[wLinkState]
cp a,LINK_STATE_BATTLING
jp z,TextCommand0D
@@ -522,7 +522,7 @@ TextCommand06:: ; 1bcc (0:1bcc)
; scroll text up one line
; 07
; (no arguments)
-TextCommand07:: ; 1be7 (0:1be7)
+TextCommand07::
ld a," "
Coorda 18, 16 ; place blank space in lower right corner of dialogue text box
call Next1B18 ; scroll up text
@@ -533,7 +533,7 @@ TextCommand07:: ; 1be7 (0:1be7)
; execute asm inline
; 08{code}
-TextCommand08:: ; 1bf9 (0:1bf9)
+TextCommand08::
pop hl
ld de,NextTextCommand
push de ; return address
@@ -545,7 +545,7 @@ TextCommand08:: ; 1bf9 (0:1bf9)
; BB
; bits 0-3 = how many digits to display
; bits 4-7 = how long the number is in bytes
-TextCommand09:: ; 1bff (0:1bff)
+TextCommand09::
pop hl
ld a,[hli]
ld e,a
@@ -572,7 +572,7 @@ TextCommand09:: ; 1bff (0:1bff)
; wait half a second if the user doesn't hold A or B
; 0A
; (no arguments)
-TextCommand0A:: ; 1c1d (0:1c1d)
+TextCommand0A::
push bc
call Joypad
ld a,[hJoyHeld]
@@ -588,7 +588,7 @@ TextCommand0A:: ; 1c1d (0:1c1d)
; plays sounds
; this actually handles various command ID's, not just 0B
; (no arguments)
-TextCommand0B:: ; 1c31 (0:1c31)
+TextCommand0B::
pop hl
push bc
dec hl
@@ -625,7 +625,7 @@ TextCommand0B:: ; 1c31 (0:1c31)
jp NextTextCommand
; format: text command ID, sound ID or cry ID
-TextCommandSounds:: ; 1c64 (0:1c64)
+TextCommandSounds::
db $0B,SFX_GET_ITEM_1
db $12,SFX_CAUGHT_MON
db $0E,SFX_POKEDEX_RATING
@@ -640,7 +640,7 @@ TextCommandSounds:: ; 1c64 (0:1c64)
; draw ellipses
; 0CAA
; AA = number of ellipses to draw
-TextCommand0C:: ; 1c78 (0:1c78)
+TextCommand0C::
pop hl
ld a,[hli]
ld d,a
@@ -669,7 +669,7 @@ TextCommand0C:: ; 1c78 (0:1c78)
; wait for A or B to be pressed
; 0D
; (no arguments)
-TextCommand0D:: ; 1c9a (0:1c9a)
+TextCommand0D::
push bc
call ManualTextScroll ; wait for A or B to be pressed
pop bc
@@ -680,7 +680,7 @@ TextCommand0D:: ; 1c9a (0:1c9a)
; 17AAAABB
; AAAA = address of text commands
; BB = bank
-TextCommand17:: ; 1ca3 (0:1ca3)
+TextCommand17::
pop hl
ld a,[H_LOADEDROMBANK]
push af
@@ -701,7 +701,7 @@ TextCommand17:: ; 1ca3 (0:1ca3)
ld [MBC1RomBank],a
jp NextTextCommand
-TextCommandJumpTable:: ; 1cc1 (0:1cc1)
+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/vcopy.asm b/home/vcopy.asm
index 69773cfe..b7fb099e 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
@@ -33,7 +33,7 @@ ClearBgMap:: ; 1cf0 (0:1cf0)
jr nz,.loop
ret
-RedrawRowOrColumn:: ; 1d01 (0:1d01)
+RedrawRowOrColumn::
; This function redraws a BG row of height 2 or a BG column of width 2.
; One of its main uses is redrawing the row or column that will be exposed upon
; scrolling the BG when the player takes a step. Redrawing only the exposed
@@ -119,7 +119,7 @@ RedrawRowOrColumn:: ; 1d01 (0:1d01)
; on when talking to sprites, battling, using menus, etc. This is because
; the above function, RedrawRowOrColumn, is used when walking to
; improve efficiency.
-AutoBgMapTransfer:: ; 1d57 (0:1d57)
+AutoBgMapTransfer::
ld a,[H_AUTOBGTRANSFERENABLED]
and a
ret z
@@ -167,7 +167,7 @@ AutoBgMapTransfer:: ; 1d57 (0:1d57)
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
@@ -201,7 +201,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:: ; 1de1 (0:1de1)
+VBlankCopyBgMap::
ld a,[H_VBCOPYBGSRC] ; doubles as enabling byte
and a
ret z