diff options
| author | Daniel Harding <33dannye@gmail.com> | 2020-05-20 20:17:30 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-05-20 20:17:30 -0500 |
| commit | 500d99c258145d233af8d14cdb5c6e0200dfc1d8 (patch) | |
| tree | 7dbe7b152dde8a6e9b56664b5b8cdfc0d6be1253 /home | |
| parent | Merge pull request #39 from TiKevin83/master (diff) | |
| parent | Merge remote-tracking branch 'pokered/master' (diff) | |
| download | pokeyellow-500d99c258145d233af8d14cdb5c6e0200dfc1d8.tar.gz pokeyellow-500d99c258145d233af8d14cdb5c6e0200dfc1d8.tar.xz pokeyellow-500d99c258145d233af8d14cdb5c6e0200dfc1d8.zip | |
Merge pull request #50 from dannye/master
merge pokered
Diffstat (limited to 'home')
| -rw-r--r-- | home/audio.asm | 22 | ||||
| -rw-r--r-- | home/copy2.asm | 30 | ||||
| -rw-r--r-- | home/overworld.asm | 21 | ||||
| -rw-r--r-- | home/pic.asm | 4 | ||||
| -rw-r--r-- | home/text.asm | 66 | ||||
| -rw-r--r-- | home/vcopy.asm | 202 |
6 files changed, 174 insertions, 171 deletions
diff --git a/home/audio.asm b/home/audio.asm index 3cd2ffd0..fa7020ee 100644 --- a/home/audio.asm +++ b/home/audio.asm @@ -73,11 +73,11 @@ CheckForNoBikingMusicMap:: ld a, [wCurMap] cp ROUTE_23 jr z, .found - cp VICTORY_ROAD_1 + cp VICTORY_ROAD_1F jr z, .found - cp VICTORY_ROAD_2 + cp VICTORY_ROAD_2F jr z, .found - cp VICTORY_ROAD_3 + cp VICTORY_ROAD_3F jr z, .found cp INDIGO_PLATEAU jr z, .found @@ -140,10 +140,10 @@ PlayMusic:: Func_2223:: xor a - ld [wChannelSoundIDs + CH4], a - ld [wChannelSoundIDs + CH5], a - ld [wChannelSoundIDs + CH6], a - ld [wChannelSoundIDs + CH7], a + ld [wChannelSoundIDs + Ch5], a + ld [wChannelSoundIDs + Ch6], a + ld [wChannelSoundIDs + Ch7], a + ld [wChannelSoundIDs + Ch8], a ld [rNR10], a ret @@ -160,10 +160,10 @@ PlaySound:: and a jr z, .next xor a - ld [wChannelSoundIDs + CH4], a - ld [wChannelSoundIDs + CH5], a - ld [wChannelSoundIDs + CH6], a - ld [wChannelSoundIDs + CH7], a + ld [wChannelSoundIDs + Ch5], a + ld [wChannelSoundIDs + Ch6], a + ld [wChannelSoundIDs + Ch7], a + ld [wChannelSoundIDs + Ch8], a .next ld a, [wAudioFadeOutControl] and a ; has a fade-out length been specified? diff --git a/home/copy2.asm b/home/copy2.asm index ad47c4a0..c14112bb 100644 --- a/home/copy2.asm +++ b/home/copy2.asm @@ -1,30 +1,30 @@ FarCopyDataDouble:: ; Expand bc bytes of 1bpp image data ; from a:de to 2bpp data at hl. - ld [wFarCopyDataSavedROMBank],a - ld a,[H_LOADEDROMBANK] + ld [wFarCopyDataSavedROMBank], a + ld a, [H_LOADEDROMBANK] push af - ld a,[wFarCopyDataSavedROMBank] + ld a, [wFarCopyDataSavedROMBank] call BankswitchCommon - ld a,h ; swap hl and de - ld h,d - ld d,a - ld a,l - ld l,e - ld e,a - ld a,b + ld a, h ; swap hl and de + ld h, d + ld d, a + ld a, l + ld l, e + ld e, a + ld a, b and a - jr z,.eightbitcopyamount - ld a,c + jr z, .eightbitcopyamount + ld a, c and a ; multiple of $100 jr z, .expandloop ; if so, do not increment b because the first instance of dec c results in underflow .eightbitcopyamount inc b .expandloop - ld a,[de] + ld a, [de] inc de - ld [hli],a - ld [hli],a + ld [hli], a + ld [hli], a dec c jr nz, .expandloop dec b diff --git a/home/overworld.asm b/home/overworld.asm index 8b635aa5..8608cbfe 100644 --- a/home/overworld.asm +++ b/home/overworld.asm @@ -3,7 +3,7 @@ EnterMap:: ld a, $ff ld [wJoyIgnore], a call LoadMapData - callba ClearVariablesAfterLoadingMapData + callba ClearVariablesOnEnterMap ld hl, wd72c bit 0, [hl] ; has the player already made 3 steps since the last battle? jr z, .skipGivingThreeStepsOfNoRandomBattles @@ -467,7 +467,7 @@ WarpFound2:: ld [wUnusedD366], a ; not read ld a, [hWarpDestinationMap] ld [wCurMap], a - cp ROCK_TUNNEL_1 + cp ROCK_TUNNEL_1F jr nz, .notRockTunnel ld a, $06 ld [wMapPalOffset], a @@ -699,15 +699,15 @@ CheckIfInOutsideMap:: ; sets carry if the check passes, otherwise clears carry ExtraWarpCheck:: ld a, [wCurMap] - cp SS_ANNE_3 + cp SS_ANNE_3F jr z, .useFunction1 - cp ROCKET_HIDEOUT_1 + cp ROCKET_HIDEOUT_B1F jr z, .useFunction2 - cp ROCKET_HIDEOUT_2 + cp ROCKET_HIDEOUT_B2F jr z, .useFunction2 - cp ROCKET_HIDEOUT_4 + cp ROCKET_HIDEOUT_B4F jr z, .useFunction2 - cp ROCK_TUNNEL_1 + cp ROCK_TUNNEL_1F jr z, .useFunction2 ld a, [wCurMapTileset] and a ; outside tileset (OVERWORLD) @@ -871,7 +871,7 @@ LoadTilesetTilePatternData:: LoadTileBlockMap:: ; fill C6E8-CBFB with the background tile ld hl, wOverworldMap - ld bc, $0514 + ld bc, wOverworldMapEnd - wOverworldMap ld a, [wMapBackgroundTile] ; background tile number call FillMemory ; load tile map of current map (made of tile block IDs) @@ -1254,7 +1254,7 @@ CollisionCheckOnLand:: call CheckTilePassable jr nc, .noCollision .collision - ld a, [wChannelSoundIDs + CH4] + ld a, [wChannelSoundIDs + Ch5] cp SFX_COLLISION ; check if collision sound is already playing jr z, .setCarry ld a, SFX_COLLISION @@ -1708,7 +1708,7 @@ CollisionCheckOnWater:: call IsTilePassable jr nc, .stopSurfing .collision - ld a, [wChannelSoundIDs + CH4] + ld a, [wChannelSoundIDs + Ch5] cp SFX_COLLISION ; check if collision sound is already playing jr z, .setCarry ld a, SFX_COLLISION @@ -1716,7 +1716,6 @@ CollisionCheckOnWater:: .setCarry scf jr .done - .checkIfVermilionDockTileset ld a, [wCurMapTileset] ; tileset cp SHIP_PORT ; Vermilion Dock tileset diff --git a/home/pic.asm b/home/pic.asm index 353d0f58..236efe9d 100644 --- a/home/pic.asm +++ b/home/pic.asm @@ -45,8 +45,8 @@ _UncompressSpriteData:: ld [wSpriteWidth], a call ReadNextInputBit ld [wSpriteLoadFlags], a ; initialite bit1 to 0 and bit0 to the first input bit - ; this will load two chunks of data to sSpriteBuffer1 and sSpriteBuffer2 - ; bit 0 decides in which one the first chunk is placed + ; this will load two chunks of data to sSpriteBuffer1 and sSpriteBuffer2 + ; bit 0 decides in which one the first chunk is placed ; fall through ; uncompresses a chunk from the sprite input data stream (pointed to at wd0da) into sSpriteBuffer1 or sSpriteBuffer2 diff --git a/home/text.asm b/home/text.asm index b3f96315..f78227eb 100644 --- a/home/text.asm +++ b/home/text.asm @@ -1,5 +1,5 @@ TextBoxBorder:: -; Draw a cxb text box at hl. +; Draw a c×b text box at hl. ; top row push hl @@ -11,7 +11,7 @@ TextBoxBorder:: ld [hl], a pop hl - ld de, 20 + ld de, SCREEN_WIDTH add hl, de ; middle rows @@ -24,7 +24,7 @@ TextBoxBorder:: ld [hl], "│" pop hl - ld de, 20 + ld de, SCREEN_WIDTH add hl, de dec b jr nz, .next @@ -257,7 +257,7 @@ Char58:: ; prompt ld a, [wLinkState] cp LINK_STATE_BATTLING jp z, .ok - ld a, $EE + ld a, "▼" Coorda 18, 16 .ok call ProtectedDelay3 @@ -275,7 +275,7 @@ Char58Text:: Char51:: ; para push de - ld a, $EE + ld a, "▼" Coorda 18, 16 call ProtectedDelay3 call ManualTextScroll @@ -297,7 +297,7 @@ Char49:: .Char49 push de - ld a, $EE + ld a, "▼" Coorda 18, 16 call ProtectedDelay3 call ManualTextScroll @@ -313,7 +313,7 @@ Char49:: jp PlaceNextChar_inc Char4B:: - ld a, $EE + ld a, "▼" Coorda 18, 16 call ProtectedDelay3 push de @@ -330,23 +330,27 @@ Char4C:: pop de jp PlaceNextChar_inc +; move both rows of text in the normal text box up one row +; always called twice in a row +; first time, copy the two rows of text to the "in between" rows that are usually emtpy +; second time, copy the bottom row of text into the top row of text ScrollTextUpOneLine:: - coord hl, 0, 14 - coord de, 0, 13 - ld b, 60 -.next + coord hl, 0, 14 ; top row of text + coord de, 0, 13 ; empty line above text + ld b, SCREEN_WIDTH * 3 +.copyText ld a, [hli] ld [de], a inc de dec b - jr nz, .next + jr nz, .copyText coord hl, 1, 16 ld a, " " ld b, SCREEN_WIDTH - 2 -.next2 +.clearText ld [hli], a dec b - jr nz, .next2 + jr nz, .clearText ; wait five frames ld b, 5 @@ -372,22 +376,22 @@ TextCommandProcessor:: xor e ld [wLetterPrintingDelayFlags], a ld a, c - ld [wTextDestinationTileAddrBuffer], a + ld [wTextDest], a ld a, b - ld [wTextDestinationTileAddrBuffer + 1], a + ld [wTextDest + 1], a NextTextCommand:: ld a, [hli] - cp a, "@" ; terminator + cp "@" ; terminator jr nz, .doTextCommand pop af ld [wLetterPrintingDelayFlags], a ret .doTextCommand push hl - cp a, $17 + cp $17 jp z, TextCommand17 - cp a, $0e + cp $0e jp nc, TextCommand0B ; if a != 0x17 and a >= 0xE, go to command 0xB ; if a < 0xE, use a jump table ld hl, TextCommandJumpTable @@ -483,10 +487,10 @@ TextCommand02:: TextCommand03:: pop hl ld a, [hli] - ld [wTextDestinationTileAddrBuffer], a + ld [wTextDest], a ld c, a ld a, [hli] - ld [wTextDestinationTileAddrBuffer + 1], a + ld [wTextDest + 1], a ld b, a jp NextTextCommand @@ -503,9 +507,9 @@ TextCommand05:: ; (no arguments) TextCommand06:: ld a, [wLinkState] - cp a, LINK_STATE_BATTLING + cp LINK_STATE_BATTLING jp z, TextCommand0D - ld a, $ee ; down arrow + ld a, "▼" Coorda 18, 16 ; place down arrow in lower right corner of dialogue text box push bc call ManualTextScroll ; blink arrow and wait for A or B to be pressed @@ -552,10 +556,10 @@ TextCommand09:: ld h, b ld l, c ld b, a - and a, $0f + and $0f ld c, a ld a, b - and a, $f0 + and $f0 swap a set BIT_LEFT_ALIGN, a ld b, a @@ -572,7 +576,7 @@ TextCommand0A:: push bc call Joypad ld a, [hJoyHeld] - and a, A_BUTTON | B_BUTTON + and A_BUTTON | B_BUTTON jr nz, .skipDelay ld c, 30 call DelayFrames @@ -599,11 +603,11 @@ TextCommand0B:: inc hl jr .loop .matchFound - cp a, $14 + cp $14 jr z, .pokemonCry - cp a, $15 + cp $15 jr z, .pokemonCry - cp a, $16 + cp $16 jr z, .pokemonCry ld a, [hl] call PlaySound @@ -644,13 +648,13 @@ TextCommand0C:: ld h, b ld l, c .loop - ld a, $75 ; ellipsis + ld a, "…" ld [hli], a push de call Joypad pop de ld a, [hJoyHeld] ; joypad state - and a, A_BUTTON | B_BUTTON + and A_BUTTON | B_BUTTON jr nz, .skipDelay ; if so, skip the delay ld c, 10 call DelayFrames diff --git a/home/vcopy.asm b/home/vcopy.asm index 2974dfec..bec679c4 100644 --- a/home/vcopy.asm +++ b/home/vcopy.asm @@ -10,27 +10,27 @@ GetRowColAddressBgMap:: srl h rr a or l - ld l,a - ld a,b + ld l, a + ld a, b or h - ld h,a + ld h, a ret ; clears a VRAM background map with blank space tiles ; INPUT: h - high byte of background tile map address in VRAM ClearBgMap:: - ld a," " + ld a, " " jr .next - ld a,l + ld a, l .next - ld de,$400 ; size of VRAM background map - ld l,e + ld de, $400 ; size of VRAM background map + ld l, e .loop - ld [hli],a + ld [hli], a dec e - jr nz,.loop + jr nz, .loop dec d - jr nz,.loop + jr nz, .loop ret ; This function redraws a BG row of height 2 or a BG column of width 2. @@ -40,76 +40,76 @@ ClearBgMap:: ; 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:: - ld a,[hRedrawRowOrColumnMode] + ld a, [hRedrawRowOrColumnMode] and a ret z - ld b,a + ld b, a xor a - ld [hRedrawRowOrColumnMode],a + ld [hRedrawRowOrColumnMode], a dec b - jr nz,.redrawRow + jr nz, .redrawRow .redrawColumn - ld hl,wRedrawRowOrColumnSrcTiles - ld a,[hRedrawRowOrColumnDest] - ld e,a - ld a,[hRedrawRowOrColumnDest + 1] - ld d,a - ld c,SCREEN_HEIGHT + ld hl, wRedrawRowOrColumnSrcTiles + ld a, [hRedrawRowOrColumnDest] + ld e, a + ld a, [hRedrawRowOrColumnDest + 1] + ld d, a + ld c, SCREEN_HEIGHT .loop1 - ld a,[hli] - ld [de],a + ld a, [hli] + ld [de], a inc de - ld a,[hli] - ld [de],a - ld a,BG_MAP_WIDTH - 1 + ld a, [hli] + ld [de], a + ld a, BG_MAP_WIDTH - 1 add e - ld e,a - jr nc,.noCarry + ld e, a + jr nc, .noCarry inc d .noCarry ; the following 4 lines wrap us from bottom to top if necessary - ld a,d - and a,$03 - or a,$98 - ld d,a + ld a, d + and $03 + or $98 + ld d, a dec c - jr nz,.loop1 + jr nz, .loop1 xor a - ld [hRedrawRowOrColumnMode],a + ld [hRedrawRowOrColumnMode], a ret .redrawRow - ld hl,wRedrawRowOrColumnSrcTiles - ld a,[hRedrawRowOrColumnDest] - ld e,a - ld a,[hRedrawRowOrColumnDest + 1] - ld d,a + ld hl, wRedrawRowOrColumnSrcTiles + ld a, [hRedrawRowOrColumnDest] + ld e, a + ld a, [hRedrawRowOrColumnDest + 1] + ld d, a push de call .DrawHalf ; draw upper half pop de - ld a,BG_MAP_WIDTH ; width of VRAM background map + ld a, BG_MAP_WIDTH ; width of VRAM background map add e - ld e,a + ld e, a ; fall through and draw lower half .DrawHalf - ld c,SCREEN_WIDTH / 2 + ld c, SCREEN_WIDTH / 2 .loop2 - ld a,[hli] - ld [de],a + ld a, [hli] + ld [de], a inc de - ld a,[hli] - ld [de],a - ld a,e + ld a, [hli] + ld [de], a + ld a, e inc a ; the following 6 lines wrap us from the right edge to the left edge if necessary - and a,$1f - ld b,a - ld a,e - and a,$e0 + and $1f + ld b, a + ld a, e + and $e0 or b - ld e,a + ld e, a dec c - jr nz,.loop2 + jr nz, .loop2 ret ; This function automatically transfers tile number data from the tile map at @@ -120,48 +120,48 @@ RedrawRowOrColumn:: ; the above function, RedrawRowOrColumn, is used when walking to ; improve efficiency. AutoBgMapTransfer:: - ld a,[H_AUTOBGTRANSFERENABLED] + ld a, [H_AUTOBGTRANSFERENABLED] and a ret z - ld [H_SPTEMP],sp ; save stack pinter - ld a,[H_AUTOBGTRANSFERPORTION] + ld [H_SPTEMP], sp ; save stack pointer + ld a, [H_AUTOBGTRANSFERPORTION] and a - jr z,.transferTopThird + jr z, .transferTopThird dec a - jr z,.transferMiddleThird + jr z, .transferMiddleThird .transferBottomThird coord hl, 0, 12 - ld sp,hl - ld a,[H_AUTOBGTRANSFERDEST + 1] - ld h,a - ld a,[H_AUTOBGTRANSFERDEST] - ld l,a - ld de,(12 * 32) - add hl,de + ld sp, hl + ld a, [H_AUTOBGTRANSFERDEST + 1] + ld h, a + ld a, [H_AUTOBGTRANSFERDEST] + ld l, a + ld de, (12 * 32) + add hl, de xor a ; TRANSFERTOP jr .doTransfer .transferTopThird coord hl, 0, 0 - ld sp,hl - ld a,[H_AUTOBGTRANSFERDEST + 1] - ld h,a - ld a,[H_AUTOBGTRANSFERDEST] - ld l,a - ld a,TRANSFERMIDDLE + ld sp, hl + ld a, [H_AUTOBGTRANSFERDEST + 1] + ld h, a + ld a, [H_AUTOBGTRANSFERDEST] + ld l, a + ld a, TRANSFERMIDDLE jr .doTransfer .transferMiddleThird coord hl, 0, 6 - ld sp,hl - ld a,[H_AUTOBGTRANSFERDEST + 1] - ld h,a - ld a,[H_AUTOBGTRANSFERDEST] - ld l,a - ld de,(6 * 32) - add hl,de - ld a,TRANSFERBOTTOM + ld sp, hl + ld a, [H_AUTOBGTRANSFERDEST + 1] + ld h, a + ld a, [H_AUTOBGTRANSFERDEST] + ld l, a + ld de, (6 * 32) + add hl, de + ld a, TRANSFERBOTTOM .doTransfer - ld [H_AUTOBGTRANSFERPORTION],a ; store next portion - ld b,6 + ld [H_AUTOBGTRANSFERPORTION], a ; store next portion + ld b, 6 TransferBgRows:: ; unrolled loop and using pop for speed @@ -198,23 +198,23 @@ TransferBgRows:: ; Copies [H_VBCOPYBGNUMROWS] rows from H_VBCOPYBGSRC to H_VBCOPYBGDEST. ; If H_VBCOPYBGSRC is XX00, the transfer is disabled. VBlankCopyBgMap:: - ld a,[H_VBCOPYBGSRC] ; doubles as enabling byte + ld a, [H_VBCOPYBGSRC] ; doubles as enabling byte and a ret z - ld [H_SPTEMP],sp ; save stack pointer - ld a,[H_VBCOPYBGSRC] - ld l,a - ld a,[H_VBCOPYBGSRC + 1] - ld h,a - ld sp,hl - ld a,[H_VBCOPYBGDEST] - ld l,a - ld a,[H_VBCOPYBGDEST + 1] - ld h,a - ld a,[H_VBCOPYBGNUMROWS] - ld b,a + ld [H_SPTEMP], sp ; save stack pointer + ld a, [H_VBCOPYBGSRC] + ld l, a + ld a, [H_VBCOPYBGSRC + 1] + ld h, a + ld sp, hl + ld a, [H_VBCOPYBGDEST] + ld l, a + ld a, [H_VBCOPYBGDEST + 1] + ld h, a + ld a, [H_VBCOPYBGNUMROWS] + ld b, a xor a - ld [H_VBCOPYBGSRC],a ; disable transfer so it doesn't continue next V-blank + ld [H_VBCOPYBGSRC], a ; disable transfer so it doesn't continue next V-blank jr TransferBgRows @@ -230,7 +230,7 @@ VBlankCopyDouble:: and a ret z - ld [H_SPTEMP],sp ; save stack pointer + ld [H_SPTEMP], sp ; save stack pointer ld a, [H_VBCOPYDOUBLESRC] ld l, a @@ -273,8 +273,8 @@ VBlankCopyDouble:: dec b jr nz, .loop - ld [H_VBCOPYDOUBLESRC],sp - ld sp,hl ; load destination into sp to save time with ld [$xxxx],sp + ld [H_VBCOPYDOUBLESRC], sp + ld sp, hl ; load destination into sp to save time with ld [$xxxx], sp ld [H_VBCOPYDOUBLEDEST], sp ld a, [H_SPTEMP] @@ -297,7 +297,7 @@ VBlankCopy:: and a ret z - ld [H_SPTEMP],sp + ld [H_SPTEMP], sp ld a, [H_VBCOPYSRC] ld l, a @@ -332,9 +332,9 @@ VBlankCopy:: dec b jr nz, .loop - ld [H_VBCOPYSRC],sp - ld sp,hl - ld [H_VBCOPYDEST],sp + ld [H_VBCOPYSRC], sp + ld sp, hl + ld [H_VBCOPYDEST], sp ld a, [H_SPTEMP] ld l, a |
