diff options
author | Rangi <remy.oukaour+rangi42@gmail.com> | 2020-06-29 19:35:37 -0400 |
---|---|---|
committer | Rangi <remy.oukaour+rangi42@gmail.com> | 2020-06-29 19:35:37 -0400 |
commit | 534863abe1d7c57707135574ef8bb1094aa5be22 (patch) | |
tree | c395aabf5dd96eed0c6dfefa55ba8d3652defff1 | |
parent | c8346c0bf99aaef85757bae09311661d06d801c4 (diff) |
Identify more labels and constants
-rw-r--r-- | audio/engine.asm | 66 | ||||
-rw-r--r-- | engine/events/pokecenter_pc.asm | 131 | ||||
-rw-r--r-- | engine/gfx/load_font.asm | 4 | ||||
-rw-r--r-- | gfx/font.asm | 4 | ||||
-rw-r--r-- | home/decompress.asm | 2 | ||||
-rw-r--r-- | home/farcall.asm | 5 | ||||
-rw-r--r-- | home/gfx.asm | 12 | ||||
-rw-r--r-- | home/palettes.asm | 2 | ||||
-rw-r--r-- | home/text.asm | 3 |
9 files changed, 116 insertions, 113 deletions
diff --git a/audio/engine.asm b/audio/engine.asm index a2e14eaf..e74d3849 100644 --- a/audio/engine.asm +++ b/audio/engine.asm @@ -247,21 +247,21 @@ UpdateChannels: ldh [rNR10], a .noPitchSweep bit NOTE_REST, [hl] ; rest - jr nz, .ch1rest + jr nz, .ch1_rest bit NOTE_NOISE_SAMPLING, [hl] - jr nz, .asm_e81a2 + jr nz, .ch1_noise_sampling bit NOTE_FREQ_OVERRIDE, [hl] - jr nz, .frequency_override + jr nz, .ch1_frequency_override bit NOTE_VIBRATO_OVERRIDE, [hl] - jr nz, .asm_e8184 - jr .check_duty_override + jr nz, .ch1_vibrato_override + jr .ch1_check_duty_override -.frequency_override +.ch1_frequency_override ld a, [wCurTrackFrequency] ldh [rNR13], a ld a, [wCurTrackFrequency + 1] ldh [rNR14], a -.check_duty_override +.ch1_check_duty_override bit NOTE_DUTY_OVERRIDE, [hl] ret z ld a, [wCurTrackDuty] @@ -272,7 +272,7 @@ UpdateChannels: ldh [rNR11], a ret -.asm_e8184 +.ch1_vibrato_override ld a, [wCurTrackDuty] ld d, a ldh a, [rNR11] @@ -283,7 +283,7 @@ UpdateChannels: ldh [rNR13], a ret -.ch1rest +.ch1_rest ldh a, [rNR52] and %10001110 ; ch1 off ldh [rNR52], a @@ -291,7 +291,7 @@ UpdateChannels: call ClearChannel ret -.asm_e81a2 +.ch1_noise_sampling ld hl, wCurTrackDuty ld a, $3f ; sound length or [hl] @@ -310,11 +310,11 @@ UpdateChannels: ld hl, CHANNEL_NOTE_FLAGS add hl, bc bit NOTE_REST, [hl] ; rest - jr nz, .ch2rest + jr nz, .ch2_rest bit NOTE_NOISE_SAMPLING, [hl] - jr nz, .asm_e8204 + jr nz, .ch2_noise_sampling bit NOTE_VIBRATO_OVERRIDE, [hl] - jr nz, .asm_e81e6 + jr nz, .ch2_vibrato_override bit NOTE_DUTY_OVERRIDE, [hl] ret z ld a, [wCurTrackDuty] @@ -325,14 +325,14 @@ UpdateChannels: ldh [rNR21], a ret -.asm_e81db ; unused +.ch2_frequency_override ; unreferenced ld a, [wCurTrackFrequency] ldh [rNR23], a ld a, [wCurTrackFrequency + 1] ldh [rNR24], a ret -.asm_e81e6 +.ch2_vibrato_override ld a, [wCurTrackDuty] ld d, a ldh a, [rNR21] @@ -343,7 +343,7 @@ UpdateChannels: ldh [rNR23], a ret -.ch2rest +.ch2_rest ldh a, [rNR52] and %10001101 ; ch2 off ldh [rNR52], a @@ -351,7 +351,7 @@ UpdateChannels: call ClearChannel ret -.asm_e8204 +.ch2_noise_sampling ld hl, wCurTrackDuty ld a, $3f ; sound length or [hl] @@ -369,27 +369,27 @@ UpdateChannels: .Channel7: ld hl, CHANNEL_NOTE_FLAGS add hl, bc - bit NOTE_REST, [hl] ; rest - jr nz, .ch3rest + bit NOTE_REST, [hl] + jr nz, .ch3_rest bit NOTE_NOISE_SAMPLING, [hl] - jr nz, .asm_e824d + jr nz, .ch3_noise_sampling bit NOTE_VIBRATO_OVERRIDE, [hl] - jr nz, .asm_e823a + jr nz, .ch3_vibrato_override ret -.asm_e822f ; unused +.ch3_frequency_override ; unreferenced ld a, [wCurTrackFrequency] ldh [rNR33], a ld a, [wCurTrackFrequency + 1] ldh [rNR34], a ret -.asm_e823a +.ch3_vibrato_override ld a, [wCurTrackFrequency] ldh [rNR33], a ret -.ch3rest +.ch3_rest ldh a, [rNR52] and %10001011 ; ch3 off ldh [rNR52], a @@ -397,12 +397,12 @@ UpdateChannels: call ClearChannel ret -.asm_e824d +.ch3_noise_sampling ld a, $3f ; sound length ldh [rNR31], a xor a ldh [rNR30], a - call .asm_e8268 + call .load_wave_pattern ld a, $80 ldh [rNR30], a ld a, [wCurTrackFrequency] @@ -412,7 +412,7 @@ UpdateChannels: ldh [rNR34], a ret -.asm_e8268 +.load_wave_pattern push hl ld a, [wCurTrackVolumeEnvelope] and $f ; only 0-9 are valid @@ -470,18 +470,18 @@ endr .Channel8: ld hl, CHANNEL_NOTE_FLAGS add hl, bc - bit NOTE_REST, [hl] ; rest - jr nz, .ch4rest + bit NOTE_REST, [hl] + jr nz, .ch4_rest bit NOTE_NOISE_SAMPLING, [hl] - jr nz, .asm_e82d4 + jr nz, .ch4_noise_sampling ret -.asm_e82c1 ; unused +.ch4_frequency_override ; unreferenced ld a, [wCurTrackFrequency] ldh [rNR43], a ret -.ch4rest +.ch4_rest ldh a, [rNR52] and %10000111 ; ch4 off ldh [rNR52], a @@ -489,7 +489,7 @@ endr call ClearChannel ret -.asm_e82d4 +.ch4_noise_sampling ld a, $3f ; sound length ldh [rNR41], a ld a, [wCurTrackVolumeEnvelope] diff --git a/engine/events/pokecenter_pc.asm b/engine/events/pokecenter_pc.asm index 8981bcf4..69b0f687 100644 --- a/engine/events/pokecenter_pc.asm +++ b/engine/events/pokecenter_pc.asm @@ -1,3 +1,17 @@ + ; PokemonCenterPC.WhichPC indexes + const_def + const PCPC_BEFORE_POKEDEX ; 0 + const PCPC_BEFORE_HOF ; 1 + const PCPC_POSTGAME ; 2 + + ; PokemonCenterPC.JumpTable indexes + const_def + const PCPCITEM_PLAYERS_PC ; 0 + const PCPCITEM_BILLS_PC ; 1 + const PCPCITEM_OAKS_PC ; 2 + const PCPCITEM_HALL_OF_FAME ; 3 + const PCPCITEM_TURN_OFF ; 4 + PokemonCenterPC: call PC_CheckPartyForPokemon ret c @@ -39,14 +53,8 @@ PokemonCenterPC: dw PlaceNthMenuStrings dw .JumpTable -PCPC_PLAYERS_PC EQU 0 -PCPC_BILLS_PC EQU 1 -PCPC_OAKS_PC EQU 2 -PCPC_HALL_OF_FAME EQU 3 -PCPC_TURN_OFF EQU 4 - .JumpTable: -; entries correspond to PCPC_* constants +; entries correspond to PCPCITEM_* constants dw PlayersPC, .String_PlayersPC dw BillsPC, .String_BillsPC dw OaksPC, .String_OaksPC @@ -60,42 +68,44 @@ PCPC_TURN_OFF EQU 4 .String_TurnOff: db "TURN OFF@" .WhichPC: - ; before Pokédex +; entries correspond to PCPC_* constants + + ; PCPC_BEFORE_POKEDEX db 3 - db PCPC_BILLS_PC - db PCPC_PLAYERS_PC - db PCPC_TURN_OFF + db PCPCITEM_BILLS_PC + db PCPCITEM_PLAYERS_PC + db PCPCITEM_TURN_OFF db -1 ; end - ; before Hall Of Fame + ; PCPC_BEFORE_HOF db 4 - db PCPC_BILLS_PC - db PCPC_PLAYERS_PC - db PCPC_OAKS_PC - db PCPC_TURN_OFF + db PCPCITEM_BILLS_PC + db PCPCITEM_PLAYERS_PC + db PCPCITEM_OAKS_PC + db PCPCITEM_TURN_OFF db -1 ; end - ; postgame + ; PCPC_POSTGAME db 5 - db PCPC_BILLS_PC - db PCPC_PLAYERS_PC - db PCPC_OAKS_PC - db PCPC_HALL_OF_FAME - db PCPC_TURN_OFF + db PCPCITEM_BILLS_PC + db PCPCITEM_PLAYERS_PC + db PCPCITEM_OAKS_PC + db PCPCITEM_HALL_OF_FAME + db PCPCITEM_TURN_OFF db -1 ; end .ChooseWhichPCListToUse: call CheckReceivedDex jr nz, .got_dex - ld a, 0 ; before Pokédex + ld a, PCPC_BEFORE_POKEDEX ret .got_dex ld a, [wHallOfFameCount] and a - ld a, 1 ; before Hall Of Fame + ld a, PCPC_BEFORE_HOF ret z - ld a, 2 ; postgame + ld a, PCPC_POSTGAME ret PC_CheckPartyForPokemon: @@ -113,6 +123,22 @@ PC_CheckPartyForPokemon: text_far _PokecenterPCCantUseText text_end + + ; PlayersPCMenuData.WhichPC indexes + const_def + const PLAYERSPC_NORMAL ; 0 + const PLAYERSPC_HOUSE ; 1 + + ; PlayersPCMenuData.PlayersPCMenuPointers indexes + const_def + const PLAYERSPCITEM_WITHDRAW_ITEM ; 0 + const PLAYERSPCITEM_DEPOSIT_ITEM ; 1 + const PLAYERSPCITEM_TOSS_ITEM ; 2 + const PLAYERSPCITEM_MAIL_BOX ; 3 + const PLAYERSPCITEM_DECORATION ; 4 + const PLAYERSPCITEM_TURN_OFF ; 5 + const PLAYERSPCITEM_LOG_OFF ; 6 + BillsPC: call PC_PlayChoosePCSound ld hl, PokecenterBillsPCText @@ -125,7 +151,7 @@ PlayersPC: call PC_PlayChoosePCSound ld hl, PokecenterPlayersPCText call PC_DisplayText - ld b, $0 + ld b, PLAYERSPC_NORMAL call _PlayersPC and a ret @@ -182,7 +208,7 @@ _PlayersHousePC: call PC_PlayBootSound ld hl, PlayersPCTurnOnText call PC_DisplayText - ld b, $1 + ld b, PLAYERSPC_HOUSE call _PlayersPC and a jr nz, .asm_159d0 @@ -190,12 +216,12 @@ _PlayersHousePC: call ApplyTilemap call UpdateSprites call PC_PlayShutdownSound - ld c, $0 + ld c, FALSE ret .asm_159d0 call ClearBGPalettes - ld c, $1 + ld c, TRUE ret PlayersPCTurnOnText: @@ -241,20 +267,12 @@ PlayersPCMenuData: .PlayersPCMenuData: db STATICMENU_CURSOR | STATICMENU_WRAP ; flags db 0 ; # items? - dw .PlayersPCMenuList1 + dw .WhichPC dw PlaceNthMenuStrings dw .PlayersPCMenuPointers -PLAYERSPC_WITHDRAW_ITEM EQU 0 -PLAYERSPC_DEPOSIT_ITEM EQU 1 -PLAYERSPC_TOSS_ITEM EQU 2 -PLAYERSPC_MAIL_BOX EQU 3 -PLAYERSPC_DECORATION EQU 4 -PLAYERSPC_TURN_OFF EQU 5 -PLAYERSPC_LOG_OFF EQU 6 - .PlayersPCMenuPointers: -; entries correspond to PLAYERSPC_* constants +; entries correspond to PLAYERSPCITEM_* constants dw PlayerWithdrawItemMenu, .WithdrawItem dw PlayerDepositItemMenu, .DepositItem dw PlayerTossItemMenu, .TossItem @@ -271,23 +289,26 @@ PLAYERSPC_LOG_OFF EQU 6 .TurnOff: db "TURN OFF@" .LogOff: db "LOG OFF@" -.PlayersPCMenuList1: +.WhichPC: +; entries correspond to PLAYERSPC_* constants + + ; PLAYERSPC_NORMAL db 5 - db PLAYERSPC_WITHDRAW_ITEM - db PLAYERSPC_DEPOSIT_ITEM - db PLAYERSPC_TOSS_ITEM - db PLAYERSPC_MAIL_BOX - db PLAYERSPC_TURN_OFF + db PLAYERSPCITEM_WITHDRAW_ITEM + db PLAYERSPCITEM_DEPOSIT_ITEM + db PLAYERSPCITEM_TOSS_ITEM + db PLAYERSPCITEM_MAIL_BOX + db PLAYERSPCITEM_TURN_OFF db -1 ; end -.PlayersPCMenuList2: + ; PLAYERSPC_HOUSE db 6 - db PLAYERSPC_WITHDRAW_ITEM - db PLAYERSPC_DEPOSIT_ITEM - db PLAYERSPC_TOSS_ITEM - db PLAYERSPC_MAIL_BOX - db PLAYERSPC_DECORATION - db PLAYERSPC_LOG_OFF + db PLAYERSPCITEM_WITHDRAW_ITEM + db PLAYERSPCITEM_DEPOSIT_ITEM + db PLAYERSPCITEM_TOSS_ITEM + db PLAYERSPCITEM_MAIL_BOX + db PLAYERSPCITEM_DECORATION + db PLAYERSPCITEM_LOG_OFF db -1 ; end PC_DisplayTextWaitMenu: @@ -445,7 +466,7 @@ PlayerDepositItemMenu: .TryDepositItem: ld a, [wSpriteUpdatesEnabled] push af - ld a, $0 + ld a, FALSE ld [wSpriteUpdatesEnabled], a farcall CheckItemMenu ld a, [wItemAttributeParamBuffer] @@ -485,7 +506,7 @@ PlayerDepositItemMenu: ld a, [wItemAttributeParamBuffer] and a jr z, .AskQuantity - ld a, $1 + ld a, 1 ld [wItemQuantityChangeBuffer], a jr .ContinueDeposit @@ -550,7 +571,7 @@ PCItemsJoypad: .loop ld a, [wSpriteUpdatesEnabled] push af - ld a, $0 + ld a, FALSE ld [wSpriteUpdatesEnabled], a ld hl, .PCItemsMenuData call CopyMenuHeader diff --git a/engine/gfx/load_font.asm b/engine/gfx/load_font.asm index 4e732211..f8289ded 100644 --- a/engine/gfx/load_font.asm +++ b/engine/gfx/load_font.asm @@ -5,9 +5,9 @@ _LoadStandardFont:: jp Get1bpp _LoadFontsExtra:: - ld de, FontsExtra_SolidBlackGFX + ld de, FontsExtra_SolidBlackAndUpArrowGFX ld hl, vTiles2 tile "■" ; $60 - lb bc, BANK(FontsExtra_SolidBlackGFX), 2 + lb bc, BANK(FontsExtra_SolidBlackAndUpArrowGFX), 2 call Get1bpp ld de, PokegearPhoneIconGFX ld hl, vTiles2 tile "☎" ; $62 diff --git a/gfx/font.asm b/gfx/font.asm index 4d22efef..b4602fb4 100644 --- a/gfx/font.asm +++ b/gfx/font.asm @@ -45,10 +45,8 @@ INCBIN "gfx/font/unused_bold_font.1bpp" TextboxSpaceGFX: INCBIN "gfx/font/space.1bpp" -FontsExtra_SolidBlackGFX: +FontsExtra_SolidBlackAndUpArrowGFX: INCBIN "gfx/font/black.1bpp" - -FontsExtra2_UpArrowGFX: INCBIN "gfx/font/up_arrow.1bpp" Footprints: diff --git a/home/decompress.asm b/home/decompress.asm index b1e2ba5e..0ac2c0b6 100644 --- a/home/decompress.asm +++ b/home/decompress.asm @@ -14,7 +14,7 @@ FarDecompress:: ret Decompress:: -; Pokemon Gold and Silver use an lz variant for compression. +; Pokemon GSC uses an lz variant (lz3) for compression. ; This is mainly (but not necessarily) used for graphics. ; This function decompresses lz-compressed data from hl to de. diff --git a/home/farcall.asm b/home/farcall.asm index 5416bd7e..31f62916 100644 --- a/home/farcall.asm +++ b/home/farcall.asm @@ -1,19 +1,15 @@ FarCall_hl:: ; Call a:hl. ; Preserves other registers. - ld [wTempBank], a ldh a, [hROMBank] push af ld a, [wTempBank] rst Bankswitch call FarCall_JumpToHL - ; fallthrough -ReturnFarCall:: ; unreferenced ; We want to retain the contents of f. ; To do this, we can pop to bc instead of af. - ld a, b ld [wFarCallBCBuffer], a ld a, c @@ -24,6 +20,7 @@ ReturnFarCall:: ; unreferenced ld a, b rst Bankswitch +; Restore the contents of bc. ld a, [wFarCallBCBuffer] ld b, a ld a, [wFarCallBCBuffer + 1] diff --git a/home/gfx.asm b/home/gfx.asm index 3b2417c8..70e38911 100644 --- a/home/gfx.asm +++ b/home/gfx.asm @@ -203,13 +203,10 @@ Request1bpp:: jr .loop Get2bpp:: +; copy c 2bpp tiles from b:de to hl ldh a, [rLCDC] bit rLCDC_ENABLE, a jp nz, Request2bpp - ; fallthrough - -Copy2bpp: ; unreferenced -; copy c 2bpp tiles from b:de to hl push hl ld h, d @@ -233,13 +230,10 @@ Copy2bpp: ; unreferenced jp FarCopyBytes Get1bpp:: +; copy c 1bpp tiles from b:de to hl ldh a, [rLCDC] bit rLCDC_ENABLE, a jp nz, Request1bpp - ; fallthrough - -Copy1bpp:: ; unreferenced -; copy c 1bpp tiles from b:de to hl push de ld d, h @@ -266,9 +260,7 @@ DuplicateGet2bpp:: ; unreferenced ldh a, [rLCDC] add a jp c, Request2bpp - ; fallthrough -DuplicateCopy2bpp: ; unreferenced push de push hl diff --git a/home/palettes.asm b/home/palettes.asm index 4c98b1df..6eec53ef 100644 --- a/home/palettes.asm +++ b/home/palettes.asm @@ -16,9 +16,7 @@ UpdateCGBPals:: ldh a, [hCGBPalUpdate] and a ret z - ; fallthrough -ForceUpdateCGBPals:: ; unreferenced ld hl, wBGPals2 ; copy 8 pals to bgpd diff --git a/home/text.asm b/home/text.asm index fcde3679..49dc0e5d 100644 --- a/home/text.asm +++ b/home/text.asm @@ -1,9 +1,6 @@ ClearBox:: ; Fill a c*b box at hl with blank tiles. ld a, " " - ; fallthrough - -FillBoxWithByte:: ; unreferenced ld de, SCREEN_WIDTH .row push hl |