ref: 10bb09c4e210ab8d922081a221ce4833b5d50def
parent: 5acb7d8294525c63b9cc5bf66229f6ca2ab9847f
author: yenatch <yenatch@gmail.com>
date: Wed Jan 8 21:59:53 EST 2014
split audio components into audio_red.o and audio_blue.o
--- a/Makefile
+++ b/Makefile
@@ -6,8 +6,13 @@
TEXTQUEUE :=
-RED_OBJS := pokered.o
-BLUE_OBJS := pokeblue.o
+RED_OBJS := \
+pokered.o \
+audio_red.o
+
+BLUE_OBJS := \
+pokeblue.o \
+audio_blue.o
OBJS := $(RED_OBJS) $(BLUE_OBJS)
--- /dev/null
+++ b/audio.asm
@@ -1,0 +1,778 @@
+INCLUDE "globals.asm"
+
+AUDIO_1 EQU $2
+AUDIO_2 EQU $8
+AUDIO_3 EQU $1f
+
+INCLUDE "macros.asm"
+INCLUDE "constants/trainer_constants.asm"
+
+; PC
+INCLUDE "hram.asm"
+INCLUDE "constants/move_constants.asm"
+
+
+
+SECTION "Sound Effect Headers 1", ROMX, BANK[AUDIO_1]
+
+INCLUDE "music/headers/sfxheaders02.asm"
+
+
+SECTION "Music Headers 1", ROMX, BANK[AUDIO_1]
+
+INCLUDE "music/headers/musicheaders02.asm"
+
+
+SECTION "Sound Effects 1", ROMX, BANK[AUDIO_1]
+
+INCLUDE "music/sfx/sfx_02_01.asm"
+INCLUDE "music/sfx/sfx_02_02.asm"
+INCLUDE "music/sfx/sfx_02_03.asm"
+INCLUDE "music/sfx/sfx_02_04.asm"
+INCLUDE "music/sfx/sfx_02_05.asm"
+INCLUDE "music/sfx/sfx_02_06.asm"
+INCLUDE "music/sfx/sfx_02_07.asm"
+INCLUDE "music/sfx/sfx_02_08.asm"
+INCLUDE "music/sfx/sfx_02_09.asm"
+INCLUDE "music/sfx/sfx_02_0a.asm"
+INCLUDE "music/sfx/sfx_02_0b.asm"
+INCLUDE "music/sfx/sfx_02_0c.asm"
+INCLUDE "music/sfx/sfx_02_0d.asm"
+INCLUDE "music/sfx/sfx_02_0e.asm"
+INCLUDE "music/sfx/sfx_02_0f.asm"
+INCLUDE "music/sfx/sfx_02_10.asm"
+INCLUDE "music/sfx/sfx_02_11.asm"
+INCLUDE "music/sfx/sfx_02_12.asm"
+INCLUDE "music/sfx/sfx_02_13.asm"
+
+
+Music2_Channel3DutyPointers: ; 0x8361
+ dw Music2_Channel3Duty0
+ dw Music2_Channel3Duty1
+ dw Music2_Channel3Duty2
+ dw Music2_Channel3Duty3
+ dw Music2_Channel3Duty4
+ dw Music2_Channel3Duty5 ; used in the Lavender Town theme
+ dw SFX_02_3f_Ch1 ; unused
+ dw SFX_02_3f_Ch1 ; unused
+ dw SFX_02_3f_Ch1 ; unused
+
+; these are the definitions for the channel 3 instruments
+; each instrument definition is made up of 32 points (nibbles) that form
+; the graph of the wave
+; the current instrument is copied to $FF30
+Music2_Channel3Duty0: ; 0x8373
+ db $02,$46,$8A,$CE,$FF,$FE,$ED,$DC,$CB,$A9,$87,$65,$44,$33,$22,$11
+
+Music2_Channel3Duty1: ; 0x8383
+ db $02,$46,$8A,$CE,$EF,$FF,$FE,$EE,$DD,$CB,$A9,$87,$65,$43,$22,$11
+
+Music2_Channel3Duty2: ; 0x8393
+ db $13,$69,$BD,$EE,$EE,$FF,$FF,$ED,$DE,$FF,$FF,$EE,$EE,$DB,$96,$31
+
+Music2_Channel3Duty3: ; 0x83a3
+ db $02,$46,$8A,$CD,$EF,$FE,$DE,$FF,$EE,$DC,$BA,$98,$76,$54,$32,$10
+
+Music2_Channel3Duty4: ; 0x83b3
+ db $01,$23,$45,$67,$8A,$CD,$EE,$F7,$7F,$EE,$DC,$A8,$76,$54,$32,$10
+
+; duty 5 reads from sfx data
+Music2_Channel3Duty5: ; 0x83c3
+
+
+INCLUDE "music/sfx/sfx_02_3f.asm"
+INCLUDE "music/sfx/sfx_02_5e.asm"
+INCLUDE "music/sfx/sfx_02_56.asm"
+INCLUDE "music/sfx/sfx_02_57.asm"
+INCLUDE "music/sfx/sfx_02_58.asm"
+INCLUDE "music/sfx/sfx_02_3c.asm"
+INCLUDE "music/sfx/sfx_02_59.asm"
+INCLUDE "music/sfx/sfx_02_5a.asm"
+INCLUDE "music/sfx/sfx_02_5b.asm"
+INCLUDE "music/sfx/sfx_02_5c.asm"
+INCLUDE "music/sfx/sfx_02_40.asm"
+INCLUDE "music/sfx/sfx_02_5d.asm"
+INCLUDE "music/sfx/sfx_02_3d.asm"
+INCLUDE "music/sfx/sfx_02_43.asm"
+INCLUDE "music/sfx/sfx_02_3e.asm"
+INCLUDE "music/sfx/sfx_02_44.asm"
+INCLUDE "music/sfx/sfx_02_45.asm"
+INCLUDE "music/sfx/sfx_02_46.asm"
+INCLUDE "music/sfx/sfx_02_47.asm"
+INCLUDE "music/sfx/sfx_02_48.asm"
+INCLUDE "music/sfx/sfx_02_49.asm"
+INCLUDE "music/sfx/sfx_02_4a.asm"
+INCLUDE "music/sfx/sfx_02_4b.asm"
+INCLUDE "music/sfx/sfx_02_4c.asm"
+INCLUDE "music/sfx/sfx_02_4d.asm"
+INCLUDE "music/sfx/sfx_02_4e.asm"
+INCLUDE "music/sfx/sfx_02_4f.asm"
+INCLUDE "music/sfx/sfx_02_50.asm"
+INCLUDE "music/sfx/sfx_02_51.asm"
+INCLUDE "music/sfx/sfx_02_52.asm"
+INCLUDE "music/sfx/sfx_02_53.asm"
+INCLUDE "music/sfx/sfx_02_54.asm"
+INCLUDE "music/sfx/sfx_02_55.asm"
+INCLUDE "music/sfx/sfx_02_5f.asm"
+INCLUDE "music/sfx/sfx_02_unused.asm"
+INCLUDE "music/sfx/sfx_02_1d.asm"
+INCLUDE "music/sfx/sfx_02_37.asm"
+INCLUDE "music/sfx/sfx_02_38.asm"
+INCLUDE "music/sfx/sfx_02_25.asm"
+INCLUDE "music/sfx/sfx_02_39.asm"
+INCLUDE "music/sfx/sfx_02_17.asm"
+INCLUDE "music/sfx/sfx_02_23.asm"
+INCLUDE "music/sfx/sfx_02_24.asm"
+INCLUDE "music/sfx/sfx_02_14.asm"
+INCLUDE "music/sfx/sfx_02_22.asm"
+INCLUDE "music/sfx/sfx_02_1a.asm"
+INCLUDE "music/sfx/sfx_02_1b.asm"
+INCLUDE "music/sfx/sfx_02_19.asm"
+INCLUDE "music/sfx/sfx_02_1f.asm"
+INCLUDE "music/sfx/sfx_02_20.asm"
+INCLUDE "music/sfx/sfx_02_16.asm"
+INCLUDE "music/sfx/sfx_02_21.asm"
+INCLUDE "music/sfx/sfx_02_15.asm"
+INCLUDE "music/sfx/sfx_02_1e.asm"
+INCLUDE "music/sfx/sfx_02_1c.asm"
+INCLUDE "music/sfx/sfx_02_18.asm"
+INCLUDE "music/sfx/sfx_02_2d.asm"
+INCLUDE "music/sfx/sfx_02_2a.asm"
+INCLUDE "music/sfx/sfx_02_2f.asm"
+INCLUDE "music/sfx/sfx_02_26.asm"
+INCLUDE "music/sfx/sfx_02_27.asm"
+INCLUDE "music/sfx/sfx_02_28.asm"
+INCLUDE "music/sfx/sfx_02_32.asm"
+INCLUDE "music/sfx/sfx_02_29.asm"
+INCLUDE "music/sfx/sfx_02_2b.asm"
+INCLUDE "music/sfx/sfx_02_30.asm"
+INCLUDE "music/sfx/sfx_02_2e.asm"
+INCLUDE "music/sfx/sfx_02_31.asm"
+INCLUDE "music/sfx/sfx_02_2c.asm"
+INCLUDE "music/sfx/sfx_02_33.asm"
+INCLUDE "music/sfx/sfx_02_34.asm"
+INCLUDE "music/sfx/sfx_02_35.asm"
+INCLUDE "music/sfx/sfx_02_36.asm"
+
+
+SECTION "Audio Engine 1", ROMX, BANK[AUDIO_1]
+
+PlayBattleMusic:: ; 0x90c6
+ xor a
+ ld [wMusicHeaderPointer], a
+ ld [$d083], a
+ dec a
+ ld [$c0ee], a
+ call PlaySound ; stop music
+ call DelayFrame
+ ld c, BANK(Music_GymLeaderBattle)
+ ld a, [W_GYMLEADERNO]
+ and a
+ jr z, .notGymLeaderBattle
+ ld a, (Music_GymLeaderBattle - $4000) / 3
+ jr .playSong
+.notGymLeaderBattle
+ ld a, [W_CUROPPONENT]
+ cp $c8
+ jr c, .wildBattle
+ cp SONY3 + $c8
+ jr z, .finalBattle
+ cp LANCE + $c8
+ jr nz, .normalTrainerBattle
+ ld a, (Music_GymLeaderBattle - $4000) / 3 ; lance also plays gym leader theme
+ jr .playSong
+.normalTrainerBattle
+ ld a, (Music_TrainerBattle - $4000) / 3
+ jr .playSong
+.finalBattle
+ ld a, (Music_FinalBattle - $4000) / 3
+ jr .playSong
+.wildBattle
+ ld a, (Music_WildBattle - $4000) / 3
+.playSong
+ jp PlayMusic
+
+
+INCLUDE "audio/engine_1.asm"
+
+
+; an alternate start for MeetRival which has a different first measure
+Music_RivalAlternateStart:: ; 0x9b47
+ ld c, BANK(Music_MeetRival)
+ ld a, (Music_MeetRival - $4000) / 3
+ call PlayMusic
+ ld hl, $c006
+ ld de, Music_MeetRival_branch_b1a2
+ call Music2_OverwriteChannelPointer
+ ld de, Music_MeetRival_branch_b21d
+ call Music2_OverwriteChannelPointer
+ ld de, Music_MeetRival_branch_b2b5
+
+Music2_OverwriteChannelPointer: ; 0x9b60
+ ld a, e
+ ld [hli], a
+ ld a, d
+ ld [hli], a
+ ret
+
+; an alternate tempo for MeetRival which is slightly slower
+Music_RivalAlternateTempo:: ; 0x9b65
+ ld c, BANK(Music_MeetRival)
+ ld a, (Music_MeetRival - $4000) / 3
+ call PlayMusic
+ ld hl, $c006
+ ld de, Music_MeetRival_branch_b119
+ jp Music2_OverwriteChannelPointer
+
+; applies both the alternate start and alternate tempo
+Music_RivalAlternateStartAndTempo:: ; 0x9b75
+ call Music_RivalAlternateStart
+ ld hl, $c006
+ ld de, Music_MeetRival_branch_b19b
+ jp Music2_OverwriteChannelPointer
+
+; an alternate tempo for Cities1 which is used for the Hall of Fame room
+Music_Cities1AlternateTempo:: ; 0x9b81
+ ld a, $a
+ ld [$cfc8], a
+ ld [$cfc9], a
+ ld a, $ff
+ ld [wMusicHeaderPointer], a
+ ld c, $64
+ call DelayFrames
+ ld c, BANK(Music_Cities1)
+ ld a, (Music_Cities1 - $4000) / 3
+ call PlayMusic
+ ld hl, $c006
+ ld de, Music_Cities1_branch_aa6f
+ jp Music2_OverwriteChannelPointer
+
+
+SECTION "Music 1", ROMX, BANK[AUDIO_1]
+
+INCLUDE "music/pkmnhealed.asm"
+INCLUDE "music/routes1.asm"
+INCLUDE "music/routes2.asm"
+INCLUDE "music/routes3.asm"
+INCLUDE "music/routes4.asm"
+INCLUDE "music/indigoplateau.asm"
+INCLUDE "music/pallettown.asm"
+INCLUDE "music/unusedsong.asm"
+INCLUDE "music/cities1.asm"
+INCLUDE "music/sfx/sfx_02_3a.asm"
+INCLUDE "music/museumguy.asm"
+INCLUDE "music/meetprofoak.asm"
+INCLUDE "music/meetrival.asm"
+INCLUDE "music/sfx/sfx_02_41.asm"
+INCLUDE "music/sfx/sfx_02_3b.asm"
+INCLUDE "music/sfx/sfx_02_42.asm"
+INCLUDE "music/ssanne.asm"
+INCLUDE "music/cities2.asm"
+INCLUDE "music/celadon.asm"
+INCLUDE "music/cinnabar.asm"
+INCLUDE "music/vermilion.asm"
+INCLUDE "music/lavender.asm"
+INCLUDE "music/safarizone.asm"
+INCLUDE "music/gym.asm"
+INCLUDE "music/pokecenter.asm"
+
+
+
+SECTION "Sound Effect Headers 2", ROMX, BANK[AUDIO_2]
+
+INCLUDE "music/headers/sfxheaders08.asm"
+
+
+SECTION "Music Headers 2", ROMX, BANK[AUDIO_2]
+
+INCLUDE "music/headers/musicheaders08.asm"
+
+
+SECTION "Sound Effects 2", ROMX, BANK[AUDIO_2]
+
+INCLUDE "music/sfx/sfx_08_01.asm"
+INCLUDE "music/sfx/sfx_08_02.asm"
+INCLUDE "music/sfx/sfx_08_03.asm"
+INCLUDE "music/sfx/sfx_08_04.asm"
+INCLUDE "music/sfx/sfx_08_05.asm"
+INCLUDE "music/sfx/sfx_08_06.asm"
+INCLUDE "music/sfx/sfx_08_07.asm"
+INCLUDE "music/sfx/sfx_08_08.asm"
+INCLUDE "music/sfx/sfx_08_09.asm"
+INCLUDE "music/sfx/sfx_08_0a.asm"
+INCLUDE "music/sfx/sfx_08_0b.asm"
+INCLUDE "music/sfx/sfx_08_0c.asm"
+INCLUDE "music/sfx/sfx_08_0d.asm"
+INCLUDE "music/sfx/sfx_08_0e.asm"
+INCLUDE "music/sfx/sfx_08_0f.asm"
+INCLUDE "music/sfx/sfx_08_10.asm"
+INCLUDE "music/sfx/sfx_08_11.asm"
+INCLUDE "music/sfx/sfx_08_12.asm"
+INCLUDE "music/sfx/sfx_08_13.asm"
+
+
+Music8_Channel3DutyPointers: ; 20361 (8:4361)
+ dw Music8_Channel3Duty0
+ dw Music8_Channel3Duty1
+ dw Music8_Channel3Duty2
+ dw Music8_Channel3Duty3
+ dw Music8_Channel3Duty4
+ dw SFX_08_40_Ch1 ; unused
+ dw SFX_08_40_Ch1 ; unused
+ dw SFX_08_40_Ch1 ; unused
+ dw SFX_08_40_Ch1 ; unused
+
+; these are the definitions for the channel 3 instruments
+; each instrument definition is made up of 32 points (nibbles) that form
+; the graph of the wave
+; the current instrument is copied to $FF30
+Music8_Channel3Duty0: ; 20373 (8:4373)
+ db $02,$46,$8A,$CE,$FF,$FE,$ED,$DC,$CB,$A9,$87,$65,$44,$33,$22,$11
+
+Music8_Channel3Duty1: ; 20383 (8:4383)
+ db $02,$46,$8A,$CE,$EF,$FF,$FE,$EE,$DD,$CB,$A9,$87,$65,$43,$22,$11
+
+Music8_Channel3Duty2: ; 20393 (8:4393)
+ db $13,$69,$BD,$EE,$EE,$FF,$FF,$ED,$DE,$FF,$FF,$EE,$EE,$DB,$96,$31
+
+Music8_Channel3Duty3: ; 203a3 (8:43a3)
+ db $02,$46,$8A,$CD,$EF,$FE,$DE,$FF,$EE,$DC,$BA,$98,$76,$54,$32,$10
+
+Music8_Channel3Duty4: ; 203b3 (8:43b3)
+ db $01,$23,$45,$67,$8A,$CD,$EE,$F7,$7F,$EE,$DC,$A8,$76,$54,$32,$10
+
+
+INCLUDE "music/sfx/sfx_08_40.asm"
+INCLUDE "music/sfx/sfx_08_3f.asm"
+INCLUDE "music/sfx/sfx_08_3c.asm"
+INCLUDE "music/sfx/sfx_08_3d.asm"
+INCLUDE "music/sfx/sfx_08_3e.asm"
+INCLUDE "music/sfx/sfx_08_77.asm"
+INCLUDE "music/sfx/sfx_08_41.asm"
+INCLUDE "music/sfx/sfx_08_42.asm"
+INCLUDE "music/sfx/sfx_08_43.asm"
+INCLUDE "music/sfx/sfx_08_44.asm"
+INCLUDE "music/sfx/sfx_08_45.asm"
+INCLUDE "music/sfx/sfx_08_pokeflute_ch3.asm"
+INCLUDE "music/sfx/sfx_08_47.asm"
+INCLUDE "music/sfx/sfx_08_48.asm"
+INCLUDE "music/sfx/sfx_08_49.asm"
+INCLUDE "music/sfx/sfx_08_4a.asm"
+INCLUDE "music/sfx/sfx_08_4b.asm"
+INCLUDE "music/sfx/sfx_08_4c.asm"
+INCLUDE "music/sfx/sfx_08_4d.asm"
+INCLUDE "music/sfx/sfx_08_4e.asm"
+INCLUDE "music/sfx/sfx_08_4f.asm"
+INCLUDE "music/sfx/sfx_08_50.asm"
+INCLUDE "music/sfx/sfx_08_51.asm"
+INCLUDE "music/sfx/sfx_08_52.asm"
+INCLUDE "music/sfx/sfx_08_53.asm"
+INCLUDE "music/sfx/sfx_08_54.asm"
+INCLUDE "music/sfx/sfx_08_55.asm"
+INCLUDE "music/sfx/sfx_08_56.asm"
+INCLUDE "music/sfx/sfx_08_57.asm"
+INCLUDE "music/sfx/sfx_08_58.asm"
+INCLUDE "music/sfx/sfx_08_59.asm"
+INCLUDE "music/sfx/sfx_08_5a.asm"
+INCLUDE "music/sfx/sfx_08_5b.asm"
+INCLUDE "music/sfx/sfx_08_5c.asm"
+INCLUDE "music/sfx/sfx_08_5d.asm"
+INCLUDE "music/sfx/sfx_08_5e.asm"
+INCLUDE "music/sfx/sfx_08_5f.asm"
+INCLUDE "music/sfx/sfx_08_60.asm"
+INCLUDE "music/sfx/sfx_08_61.asm"
+INCLUDE "music/sfx/sfx_08_62.asm"
+INCLUDE "music/sfx/sfx_08_63.asm"
+INCLUDE "music/sfx/sfx_08_64.asm"
+INCLUDE "music/sfx/sfx_08_65.asm"
+INCLUDE "music/sfx/sfx_08_66.asm"
+INCLUDE "music/sfx/sfx_08_67.asm"
+INCLUDE "music/sfx/sfx_08_68.asm"
+INCLUDE "music/sfx/sfx_08_69.asm"
+INCLUDE "music/sfx/sfx_08_6a.asm"
+INCLUDE "music/sfx/sfx_08_6b.asm"
+INCLUDE "music/sfx/sfx_08_6c.asm"
+INCLUDE "music/sfx/sfx_08_6d.asm"
+INCLUDE "music/sfx/sfx_08_6e.asm"
+INCLUDE "music/sfx/sfx_08_6f.asm"
+INCLUDE "music/sfx/sfx_08_70.asm"
+INCLUDE "music/sfx/sfx_08_71.asm"
+INCLUDE "music/sfx/sfx_08_72.asm"
+INCLUDE "music/sfx/sfx_08_73.asm"
+INCLUDE "music/sfx/sfx_08_74.asm"
+INCLUDE "music/sfx/sfx_08_75.asm"
+INCLUDE "music/sfx/sfx_08_76.asm"
+INCLUDE "music/sfx/sfx_08_unused.asm"
+INCLUDE "music/sfx/sfx_08_1d.asm"
+INCLUDE "music/sfx/sfx_08_37.asm"
+INCLUDE "music/sfx/sfx_08_38.asm"
+INCLUDE "music/sfx/sfx_08_25.asm"
+INCLUDE "music/sfx/sfx_08_39.asm"
+INCLUDE "music/sfx/sfx_08_17.asm"
+INCLUDE "music/sfx/sfx_08_23.asm"
+INCLUDE "music/sfx/sfx_08_24.asm"
+INCLUDE "music/sfx/sfx_08_14.asm"
+INCLUDE "music/sfx/sfx_08_22.asm"
+INCLUDE "music/sfx/sfx_08_1a.asm"
+INCLUDE "music/sfx/sfx_08_1b.asm"
+INCLUDE "music/sfx/sfx_08_19.asm"
+INCLUDE "music/sfx/sfx_08_1f.asm"
+INCLUDE "music/sfx/sfx_08_20.asm"
+INCLUDE "music/sfx/sfx_08_16.asm"
+INCLUDE "music/sfx/sfx_08_21.asm"
+INCLUDE "music/sfx/sfx_08_15.asm"
+INCLUDE "music/sfx/sfx_08_1e.asm"
+INCLUDE "music/sfx/sfx_08_1c.asm"
+INCLUDE "music/sfx/sfx_08_18.asm"
+INCLUDE "music/sfx/sfx_08_2d.asm"
+INCLUDE "music/sfx/sfx_08_2a.asm"
+INCLUDE "music/sfx/sfx_08_2f.asm"
+INCLUDE "music/sfx/sfx_08_26.asm"
+INCLUDE "music/sfx/sfx_08_27.asm"
+INCLUDE "music/sfx/sfx_08_28.asm"
+INCLUDE "music/sfx/sfx_08_32.asm"
+INCLUDE "music/sfx/sfx_08_29.asm"
+INCLUDE "music/sfx/sfx_08_2b.asm"
+INCLUDE "music/sfx/sfx_08_30.asm"
+INCLUDE "music/sfx/sfx_08_2e.asm"
+INCLUDE "music/sfx/sfx_08_31.asm"
+INCLUDE "music/sfx/sfx_08_2c.asm"
+INCLUDE "music/sfx/sfx_08_33.asm"
+INCLUDE "music/sfx/sfx_08_34.asm"
+INCLUDE "music/sfx/sfx_08_35.asm"
+INCLUDE "music/sfx/sfx_08_36.asm"
+
+
+
+SECTION "Audio Engine 2", ROMX, BANK[AUDIO_2]
+
+Func_2136e: ; 2136e (8:536e)
+ ld a, [$d083]
+ cp $ff
+ jr z, .asm_2139b
+ bit 7, a
+ ret z
+ and $7f
+ jr nz, .asm_21383
+ call Func_213a7
+ ld a, $1e
+ jr .asm_21395
+.asm_21383
+ cp $14
+ jr nz, .asm_2138a
+ call Func_213ac
+.asm_2138a
+ ld a, $86
+ ld [$c02a], a
+ ld a, [$d083]
+ and $7f
+ dec a
+.asm_21395
+ set 7, a
+ ld [$d083], a
+ ret
+.asm_2139b
+ xor a
+ ld [$d083], a
+ ld [$c02a], a
+ ld de, Unknown_213c4 ; $53c4
+ jr asm_213af
+
+Func_213a7: ; 213a7 (8:53a7)
+ ld de, Unknown_213bc ; $53bc
+ jr asm_213af
+
+Func_213ac: ; 213ac (8:53ac)
+ ld de, Unknown_213c0 ; $53c0
+asm_213af: ; 213af (8:53af)
+ ld hl, $ff10
+ ld c, $5
+ xor a
+.asm_213b5
+ ld [hli], a
+ ld a, [de]
+ inc de
+ dec c
+ jr nz, .asm_213b5
+ ret
+
+Unknown_213bc: ; 213bc (8:53bc)
+ db $A0,$E2,$50,$87
+
+Unknown_213c0: ; 213c0 (8:53c0)
+ db $B0,$E2,$EE,$86
+
+Unknown_213c4: ; 213c4 (8:53c4)
+ db $00,$00,$00,$80
+
+
+INCLUDE "menu/pc.asm"
+
+INCLUDE "audio/engine_2.asm"
+
+
+Music_PokeFluteInBattle: ; 22306 (8:6306)
+ ld a, (SFX_08_46 - $4000) / 3 ; PokeFlute outside of battle
+ call PlaySoundWaitForCurrent
+ ld hl, $c00e
+ ld de, SFX_08_PokeFlute_Ch1
+ call Music8_OverwriteChannelPointer
+ ld de, SFX_08_PokeFlute_Ch2
+ call Music8_OverwriteChannelPointer
+ ld de, SFX_08_PokeFlute_Ch3
+
+Music8_OverwriteChannelPointer: ; 2231d (8:631d)
+ ld a, e
+ ld [hli], a
+ ld a, d
+ ld [hli], a
+ ret
+
+
+SECTION "Music 2", ROMX, BANK[AUDIO_2]
+
+INCLUDE "music/sfx/sfx_08_pokeflute.asm"
+INCLUDE "music/sfx/sfx_08_unused2.asm"
+INCLUDE "music/gymleaderbattle.asm"
+INCLUDE "music/trainerbattle.asm"
+INCLUDE "music/wildbattle.asm"
+INCLUDE "music/finalbattle.asm"
+INCLUDE "music/sfx/sfx_08_3a.asm"
+INCLUDE "music/sfx/sfx_08_3b.asm"
+INCLUDE "music/sfx/sfx_08_46.asm"
+INCLUDE "music/defeatedtrainer.asm"
+INCLUDE "music/defeatedwildmon.asm"
+INCLUDE "music/defeatedgymleader.asm"
+
+
+
+SECTION "Sound Effect Headers 3", ROMX, BANK[AUDIO_3]
+
+INCLUDE "music/headers/sfxheaders1f.asm"
+
+
+SECTION "Music Headers 3", ROMX, BANK[AUDIO_3]
+
+INCLUDE "music/headers/musicheaders1f.asm"
+
+
+SECTION "Sound Effects 3", ROMX, BANK[AUDIO_3]
+
+INCLUDE "music/sfx/sfx_1f_01.asm"
+INCLUDE "music/sfx/sfx_1f_02.asm"
+INCLUDE "music/sfx/sfx_1f_03.asm"
+INCLUDE "music/sfx/sfx_1f_04.asm"
+INCLUDE "music/sfx/sfx_1f_05.asm"
+INCLUDE "music/sfx/sfx_1f_06.asm"
+INCLUDE "music/sfx/sfx_1f_07.asm"
+INCLUDE "music/sfx/sfx_1f_08.asm"
+INCLUDE "music/sfx/sfx_1f_09.asm"
+INCLUDE "music/sfx/sfx_1f_0a.asm"
+INCLUDE "music/sfx/sfx_1f_0b.asm"
+INCLUDE "music/sfx/sfx_1f_0c.asm"
+INCLUDE "music/sfx/sfx_1f_0d.asm"
+INCLUDE "music/sfx/sfx_1f_0e.asm"
+INCLUDE "music/sfx/sfx_1f_0f.asm"
+INCLUDE "music/sfx/sfx_1f_10.asm"
+INCLUDE "music/sfx/sfx_1f_11.asm"
+INCLUDE "music/sfx/sfx_1f_12.asm"
+INCLUDE "music/sfx/sfx_1f_13.asm"
+
+
+Music1f_Channel3DutyPointers: ; 7c361 (1f:4361)
+ dw Music1f_Channel3Duty0
+ dw Music1f_Channel3Duty1
+ dw Music1f_Channel3Duty2
+ dw Music1f_Channel3Duty3
+ dw Music1f_Channel3Duty4
+ dw Music1f_Channel3Duty5 ; used in the Pokemon Tower theme
+ dw SFX_1f_3f_Ch1 ; unused
+ dw SFX_1f_3f_Ch1 ; unused
+ dw SFX_1f_3f_Ch1 ; unused
+
+; these are the definitions for the channel 3 instruments
+; each instrument definition is made up of 32 points (nibbles) that form
+; the graph of the wave
+; the current instrument is copied to $FF30
+Music1f_Channel3Duty0: ; 7c373 (1f:4373)
+ db $02,$46,$8A,$CE,$FF,$FE,$ED,$DC,$CB,$A9,$87,$65,$44,$33,$22,$11
+
+Music1f_Channel3Duty1: ; 7c383 (1f:4383)
+ db $02,$46,$8A,$CE,$EF,$FF,$FE,$EE,$DD,$CB,$A9,$87,$65,$43,$22,$11
+
+Music1f_Channel3Duty2: ; 7c393 (1f:4393)
+ db $13,$69,$BD,$EE,$EE,$FF,$FF,$ED,$DE,$FF,$FF,$EE,$EE,$DB,$96,$31
+
+Music1f_Channel3Duty3: ; 7c3a3 (1f:43a3)
+ db $02,$46,$8A,$CD,$EF,$FE,$DE,$FF,$EE,$DC,$BA,$98,$76,$54,$32,$10
+
+Music1f_Channel3Duty4: ; 7c3b3 (1f:43b3)
+ db $01,$23,$45,$67,$8A,$CD,$EE,$F7,$7F,$EE,$DC,$A8,$76,$54,$32,$10
+
+; duty 5 reads from sfx data
+Music1f_Channel3Duty5: ; 7c3c3 (1f:43c3)
+
+
+INCLUDE "music/sfx/sfx_1f_3f.asm"
+INCLUDE "music/sfx/sfx_1f_56.asm"
+INCLUDE "music/sfx/sfx_1f_57.asm"
+INCLUDE "music/sfx/sfx_1f_58.asm"
+INCLUDE "music/sfx/sfx_1f_3c.asm"
+INCLUDE "music/sfx/sfx_1f_59.asm"
+INCLUDE "music/sfx/sfx_1f_5a.asm"
+INCLUDE "music/sfx/sfx_1f_5b.asm"
+INCLUDE "music/sfx/sfx_1f_5c.asm"
+INCLUDE "music/sfx/sfx_1f_40.asm"
+IF _RED
+ INCLUDE "music/sfx/sfx_1f_5d.asm"
+ENDC
+IF _BLUE
+ INCLUDE "music/blue/sfx_1f_5d.asm"
+ENDC
+INCLUDE "music/sfx/sfx_1f_3d.asm"
+INCLUDE "music/sfx/sfx_1f_43.asm"
+INCLUDE "music/sfx/sfx_1f_3e.asm"
+INCLUDE "music/sfx/sfx_1f_44.asm"
+INCLUDE "music/sfx/sfx_1f_45.asm"
+INCLUDE "music/sfx/sfx_1f_46.asm"
+INCLUDE "music/sfx/sfx_1f_47.asm"
+INCLUDE "music/sfx/sfx_1f_48.asm"
+INCLUDE "music/sfx/sfx_1f_49.asm"
+INCLUDE "music/sfx/sfx_1f_4a.asm"
+INCLUDE "music/sfx/sfx_1f_4b.asm"
+INCLUDE "music/sfx/sfx_1f_4c.asm"
+INCLUDE "music/sfx/sfx_1f_4d.asm"
+INCLUDE "music/sfx/sfx_1f_4e.asm"
+INCLUDE "music/sfx/sfx_1f_4f.asm"
+INCLUDE "music/sfx/sfx_1f_50.asm"
+INCLUDE "music/sfx/sfx_1f_51.asm"
+INCLUDE "music/sfx/sfx_1f_52.asm"
+INCLUDE "music/sfx/sfx_1f_53.asm"
+INCLUDE "music/sfx/sfx_1f_54.asm"
+INCLUDE "music/sfx/sfx_1f_55.asm"
+INCLUDE "music/sfx/sfx_1f_5e.asm"
+INCLUDE "music/sfx/sfx_1f_5f.asm"
+INCLUDE "music/sfx/sfx_1f_60.asm"
+INCLUDE "music/sfx/sfx_1f_61.asm"
+INCLUDE "music/sfx/sfx_1f_62.asm"
+INCLUDE "music/sfx/sfx_1f_63.asm"
+INCLUDE "music/sfx/sfx_1f_64.asm"
+INCLUDE "music/sfx/sfx_1f_65.asm"
+INCLUDE "music/sfx/sfx_1f_66.asm"
+INCLUDE "music/sfx/sfx_1f_67.asm"
+INCLUDE "music/sfx/sfx_1f_unused.asm"
+INCLUDE "music/sfx/sfx_1f_1d.asm"
+INCLUDE "music/sfx/sfx_1f_37.asm"
+INCLUDE "music/sfx/sfx_1f_38.asm"
+INCLUDE "music/sfx/sfx_1f_25.asm"
+INCLUDE "music/sfx/sfx_1f_39.asm"
+INCLUDE "music/sfx/sfx_1f_17.asm"
+INCLUDE "music/sfx/sfx_1f_23.asm"
+INCLUDE "music/sfx/sfx_1f_24.asm"
+INCLUDE "music/sfx/sfx_1f_14.asm"
+INCLUDE "music/sfx/sfx_1f_22.asm"
+INCLUDE "music/sfx/sfx_1f_1a.asm"
+INCLUDE "music/sfx/sfx_1f_1b.asm"
+INCLUDE "music/sfx/sfx_1f_19.asm"
+INCLUDE "music/sfx/sfx_1f_1f.asm"
+INCLUDE "music/sfx/sfx_1f_20.asm"
+INCLUDE "music/sfx/sfx_1f_16.asm"
+INCLUDE "music/sfx/sfx_1f_21.asm"
+INCLUDE "music/sfx/sfx_1f_15.asm"
+INCLUDE "music/sfx/sfx_1f_1e.asm"
+INCLUDE "music/sfx/sfx_1f_1c.asm"
+INCLUDE "music/sfx/sfx_1f_18.asm"
+INCLUDE "music/sfx/sfx_1f_2d.asm"
+INCLUDE "music/sfx/sfx_1f_2a.asm"
+INCLUDE "music/sfx/sfx_1f_2f.asm"
+INCLUDE "music/sfx/sfx_1f_26.asm"
+INCLUDE "music/sfx/sfx_1f_27.asm"
+INCLUDE "music/sfx/sfx_1f_28.asm"
+INCLUDE "music/sfx/sfx_1f_32.asm"
+INCLUDE "music/sfx/sfx_1f_29.asm"
+INCLUDE "music/sfx/sfx_1f_2b.asm"
+INCLUDE "music/sfx/sfx_1f_30.asm"
+INCLUDE "music/sfx/sfx_1f_2e.asm"
+INCLUDE "music/sfx/sfx_1f_31.asm"
+INCLUDE "music/sfx/sfx_1f_2c.asm"
+INCLUDE "music/sfx/sfx_1f_33.asm"
+INCLUDE "music/sfx/sfx_1f_34.asm"
+INCLUDE "music/sfx/sfx_1f_35.asm"
+INCLUDE "music/sfx/sfx_1f_36.asm"
+
+
+SECTION "Audio Engine 3", ROMX, BANK[AUDIO_3]
+
+Func_7d13b:: ; 7d13b (1f:513b)
+ ld a, [$FF00+$dc]
+ ld c, $0
+ ld hl, OwnedMonValues
+.getSfxPointer
+ cp [hl]
+ jr c, .gotSfxPointer
+ inc c
+ inc hl
+ jr .getSfxPointer
+.gotSfxPointer
+ push bc
+ ld a, $ff
+ ld [$c0ee], a
+ call PlaySoundWaitForCurrent
+ pop bc
+ ld b, $0
+ ld hl, PokedexRatingSfxPointers
+ add hl, bc
+ add hl, bc
+ ld a, [hli]
+ ld c, [hl]
+ call PlayMusic
+ jp Func_2307
+
+PokedexRatingSfxPointers: ; 7d162 (1f:5162)
+ db (SFX_1f_51 - $4000) / 3
+ db BANK(SFX_1f_51)
+ db (SFX_02_41 - $4000) / 3
+ db BANK(SFX_02_41)
+ db (SFX_02_3a - $4000) / 3
+ db BANK(SFX_02_3a)
+ db (SFX_08_46 - $4000) / 3
+ db BANK(SFX_08_46)
+ db (SFX_08_3a - $4000) / 3
+ db BANK(SFX_08_3a)
+ db (SFX_02_42 - $4000) / 3
+ db BANK(SFX_02_42)
+ db (SFX_02_3b - $4000) / 3
+ db BANK(SFX_02_3b)
+
+OwnedMonValues: ; 7d170 (1f:5170)
+ db 10, 40, 60, 90, 120, 150, $ff
+
+
+INCLUDE "audio/engine_3.asm"
+
+
+SECTION "Music 3", ROMX, BANK[AUDIO_3]
+
+INCLUDE "music/bikeriding.asm"
+INCLUDE "music/dungeon1.asm"
+INCLUDE "music/gamecorner.asm"
+INCLUDE "music/titlescreen.asm"
+INCLUDE "music/sfx/sfx_1f_3a.asm"
+INCLUDE "music/dungeon2.asm"
+INCLUDE "music/dungeon3.asm"
+INCLUDE "music/cinnabarmansion.asm"
+INCLUDE "music/sfx/sfx_1f_41.asm"
+INCLUDE "music/sfx/sfx_1f_3b.asm"
+INCLUDE "music/sfx/sfx_1f_42.asm"
+INCLUDE "music/oakslab.asm"
+INCLUDE "music/pokemontower.asm"
+INCLUDE "music/silphco.asm"
+INCLUDE "music/meeteviltrainer.asm"
+INCLUDE "music/meetfemaletrainer.asm"
+INCLUDE "music/meetmaletrainer.asm"
+INCLUDE "music/introbattle.asm"
+INCLUDE "music/surfing.asm"
+INCLUDE "music/jigglypuffsong.asm"
+INCLUDE "music/halloffame.asm"
+INCLUDE "music/credits.asm"
+
--- /dev/null
+++ b/audio_blue.asm
@@ -1,0 +1,2 @@
+INCLUDE "blue.asm"
+INCLUDE "audio.asm"
--- /dev/null
+++ b/audio_red.asm
@@ -1,0 +1,2 @@
+INCLUDE "red.asm"
+INCLUDE "audio.asm"
--- a/main.asm
+++ b/main.asm
@@ -18319,253 +18319,7 @@
ld [$cc3c], a
ret
-SECTION "bank2",ROMX,BANK[$2]
-INCLUDE "music/headers/sfxheaders02.asm"
-INCLUDE "music/headers/musicheaders02.asm"
-
-INCLUDE "music/sfx/sfx_02_01.asm"
-INCLUDE "music/sfx/sfx_02_02.asm"
-INCLUDE "music/sfx/sfx_02_03.asm"
-INCLUDE "music/sfx/sfx_02_04.asm"
-INCLUDE "music/sfx/sfx_02_05.asm"
-INCLUDE "music/sfx/sfx_02_06.asm"
-INCLUDE "music/sfx/sfx_02_07.asm"
-INCLUDE "music/sfx/sfx_02_08.asm"
-INCLUDE "music/sfx/sfx_02_09.asm"
-INCLUDE "music/sfx/sfx_02_0a.asm"
-INCLUDE "music/sfx/sfx_02_0b.asm"
-INCLUDE "music/sfx/sfx_02_0c.asm"
-INCLUDE "music/sfx/sfx_02_0d.asm"
-INCLUDE "music/sfx/sfx_02_0e.asm"
-INCLUDE "music/sfx/sfx_02_0f.asm"
-INCLUDE "music/sfx/sfx_02_10.asm"
-INCLUDE "music/sfx/sfx_02_11.asm"
-INCLUDE "music/sfx/sfx_02_12.asm"
-INCLUDE "music/sfx/sfx_02_13.asm"
-
-Music2_Channel3DutyPointers: ; 0x8361
- dw Music2_Channel3Duty0
- dw Music2_Channel3Duty1
- dw Music2_Channel3Duty2
- dw Music2_Channel3Duty3
- dw Music2_Channel3Duty4
- dw Music2_Channel3Duty5 ; used in the Lavender Town theme
- dw SFX_02_3f_Ch1 ; unused
- dw SFX_02_3f_Ch1 ; unused
- dw SFX_02_3f_Ch1 ; unused
-
-; these are the definitions for the channel 3 instruments
-; each instrument definition is made up of 32 points (nibbles) that form
-; the graph of the wave
-; the current instrument is copied to $FF30
-Music2_Channel3Duty0: ; 0x8373
- db $02,$46,$8A,$CE,$FF,$FE,$ED,$DC,$CB,$A9,$87,$65,$44,$33,$22,$11
-
-Music2_Channel3Duty1: ; 0x8383
- db $02,$46,$8A,$CE,$EF,$FF,$FE,$EE,$DD,$CB,$A9,$87,$65,$43,$22,$11
-
-Music2_Channel3Duty2: ; 0x8393
- db $13,$69,$BD,$EE,$EE,$FF,$FF,$ED,$DE,$FF,$FF,$EE,$EE,$DB,$96,$31
-
-Music2_Channel3Duty3: ; 0x83a3
- db $02,$46,$8A,$CD,$EF,$FE,$DE,$FF,$EE,$DC,$BA,$98,$76,$54,$32,$10
-
-Music2_Channel3Duty4: ; 0x83b3
- db $01,$23,$45,$67,$8A,$CD,$EE,$F7,$7F,$EE,$DC,$A8,$76,$54,$32,$10
-
-; duty 5 reads from sfx data
-Music2_Channel3Duty5: ; 0x83c3
-INCLUDE "music/sfx/sfx_02_3f.asm"
-INCLUDE "music/sfx/sfx_02_5e.asm"
-INCLUDE "music/sfx/sfx_02_56.asm"
-INCLUDE "music/sfx/sfx_02_57.asm"
-INCLUDE "music/sfx/sfx_02_58.asm"
-INCLUDE "music/sfx/sfx_02_3c.asm"
-INCLUDE "music/sfx/sfx_02_59.asm"
-INCLUDE "music/sfx/sfx_02_5a.asm"
-INCLUDE "music/sfx/sfx_02_5b.asm"
-INCLUDE "music/sfx/sfx_02_5c.asm"
-INCLUDE "music/sfx/sfx_02_40.asm"
-INCLUDE "music/sfx/sfx_02_5d.asm"
-INCLUDE "music/sfx/sfx_02_3d.asm"
-INCLUDE "music/sfx/sfx_02_43.asm"
-INCLUDE "music/sfx/sfx_02_3e.asm"
-INCLUDE "music/sfx/sfx_02_44.asm"
-INCLUDE "music/sfx/sfx_02_45.asm"
-INCLUDE "music/sfx/sfx_02_46.asm"
-INCLUDE "music/sfx/sfx_02_47.asm"
-INCLUDE "music/sfx/sfx_02_48.asm"
-INCLUDE "music/sfx/sfx_02_49.asm"
-INCLUDE "music/sfx/sfx_02_4a.asm"
-INCLUDE "music/sfx/sfx_02_4b.asm"
-INCLUDE "music/sfx/sfx_02_4c.asm"
-INCLUDE "music/sfx/sfx_02_4d.asm"
-INCLUDE "music/sfx/sfx_02_4e.asm"
-INCLUDE "music/sfx/sfx_02_4f.asm"
-INCLUDE "music/sfx/sfx_02_50.asm"
-INCLUDE "music/sfx/sfx_02_51.asm"
-INCLUDE "music/sfx/sfx_02_52.asm"
-INCLUDE "music/sfx/sfx_02_53.asm"
-INCLUDE "music/sfx/sfx_02_54.asm"
-INCLUDE "music/sfx/sfx_02_55.asm"
-INCLUDE "music/sfx/sfx_02_5f.asm"
-INCLUDE "music/sfx/sfx_02_unused.asm"
-INCLUDE "music/sfx/sfx_02_1d.asm"
-INCLUDE "music/sfx/sfx_02_37.asm"
-INCLUDE "music/sfx/sfx_02_38.asm"
-INCLUDE "music/sfx/sfx_02_25.asm"
-INCLUDE "music/sfx/sfx_02_39.asm"
-INCLUDE "music/sfx/sfx_02_17.asm"
-INCLUDE "music/sfx/sfx_02_23.asm"
-INCLUDE "music/sfx/sfx_02_24.asm"
-INCLUDE "music/sfx/sfx_02_14.asm"
-INCLUDE "music/sfx/sfx_02_22.asm"
-INCLUDE "music/sfx/sfx_02_1a.asm"
-INCLUDE "music/sfx/sfx_02_1b.asm"
-INCLUDE "music/sfx/sfx_02_19.asm"
-INCLUDE "music/sfx/sfx_02_1f.asm"
-INCLUDE "music/sfx/sfx_02_20.asm"
-INCLUDE "music/sfx/sfx_02_16.asm"
-INCLUDE "music/sfx/sfx_02_21.asm"
-INCLUDE "music/sfx/sfx_02_15.asm"
-INCLUDE "music/sfx/sfx_02_1e.asm"
-INCLUDE "music/sfx/sfx_02_1c.asm"
-INCLUDE "music/sfx/sfx_02_18.asm"
-INCLUDE "music/sfx/sfx_02_2d.asm"
-INCLUDE "music/sfx/sfx_02_2a.asm"
-INCLUDE "music/sfx/sfx_02_2f.asm"
-INCLUDE "music/sfx/sfx_02_26.asm"
-INCLUDE "music/sfx/sfx_02_27.asm"
-INCLUDE "music/sfx/sfx_02_28.asm"
-INCLUDE "music/sfx/sfx_02_32.asm"
-INCLUDE "music/sfx/sfx_02_29.asm"
-INCLUDE "music/sfx/sfx_02_2b.asm"
-INCLUDE "music/sfx/sfx_02_30.asm"
-INCLUDE "music/sfx/sfx_02_2e.asm"
-INCLUDE "music/sfx/sfx_02_31.asm"
-INCLUDE "music/sfx/sfx_02_2c.asm"
-INCLUDE "music/sfx/sfx_02_33.asm"
-INCLUDE "music/sfx/sfx_02_34.asm"
-INCLUDE "music/sfx/sfx_02_35.asm"
-INCLUDE "music/sfx/sfx_02_36.asm"
-
-PlayBattleMusic: ; 0x90c6
- xor a
- ld [wMusicHeaderPointer], a
- ld [$d083], a
- dec a
- ld [$c0ee], a
- call PlaySound ; stop music
- call DelayFrame
- ld c, BANK(Music_GymLeaderBattle)
- ld a, [W_GYMLEADERNO]
- and a
- jr z, .notGymLeaderBattle
- ld a, (Music_GymLeaderBattle - $4000) / 3
- jr .playSong
-.notGymLeaderBattle
- ld a, [W_CUROPPONENT]
- cp $c8
- jr c, .wildBattle
- cp SONY3 + $c8
- jr z, .finalBattle
- cp LANCE + $c8
- jr nz, .normalTrainerBattle
- ld a, (Music_GymLeaderBattle - $4000) / 3 ; lance also plays gym leader theme
- jr .playSong
-.normalTrainerBattle
- ld a, (Music_TrainerBattle - $4000) / 3
- jr .playSong
-.finalBattle
- ld a, (Music_FinalBattle - $4000) / 3
- jr .playSong
-.wildBattle
- ld a, (Music_WildBattle - $4000) / 3
-.playSong
- jp PlayMusic
-
-
-INCLUDE "audio/engine_1.asm"
-
-
-; an alternate start for MeetRival which has a different first measure
-Music_RivalAlternateStart: ; 0x9b47
- ld c, BANK(Music_MeetRival)
- ld a, (Music_MeetRival - $4000) / 3
- call PlayMusic
- ld hl, $c006
- ld de, Music_MeetRival_branch_b1a2
- call Music2_OverwriteChannelPointer
- ld de, Music_MeetRival_branch_b21d
- call Music2_OverwriteChannelPointer
- ld de, Music_MeetRival_branch_b2b5
-
-Music2_OverwriteChannelPointer: ; 0x9b60
- ld a, e
- ld [hli], a
- ld a, d
- ld [hli], a
- ret
-
-; an alternate tempo for MeetRival which is slightly slower
-Music_RivalAlternateTempo: ; 0x9b65
- ld c, BANK(Music_MeetRival)
- ld a, (Music_MeetRival - $4000) / 3
- call PlayMusic
- ld hl, $c006
- ld de, Music_MeetRival_branch_b119
- jp Music2_OverwriteChannelPointer
-
-; applies both the alternate start and alternate tempo
-Music_RivalAlternateStartAndTempo: ; 0x9b75
- call Music_RivalAlternateStart
- ld hl, $c006
- ld de, Music_MeetRival_branch_b19b
- jp Music2_OverwriteChannelPointer
-
-; an alternate tempo for Cities1 which is used for the Hall of Fame room
-Music_Cities1AlternateTempo: ; 0x9b81
- ld a, $a
- ld [$cfc8], a
- ld [$cfc9], a
- ld a, $ff
- ld [wMusicHeaderPointer], a
- ld c, $64
- call DelayFrames
- ld c, BANK(Music_Cities1)
- ld a, (Music_Cities1 - $4000) / 3
- call PlayMusic
- ld hl, $c006
- ld de, Music_Cities1_branch_aa6f
- jp Music2_OverwriteChannelPointer
-
-INCLUDE "music/pkmnhealed.asm"
-INCLUDE "music/routes1.asm"
-INCLUDE "music/routes2.asm"
-INCLUDE "music/routes3.asm"
-INCLUDE "music/routes4.asm"
-INCLUDE "music/indigoplateau.asm"
-INCLUDE "music/pallettown.asm"
-INCLUDE "music/unusedsong.asm"
-INCLUDE "music/cities1.asm"
-INCLUDE "music/sfx/sfx_02_3a.asm"
-INCLUDE "music/museumguy.asm"
-INCLUDE "music/meetprofoak.asm"
-INCLUDE "music/meetrival.asm"
-INCLUDE "music/sfx/sfx_02_41.asm"
-INCLUDE "music/sfx/sfx_02_3b.asm"
-INCLUDE "music/sfx/sfx_02_42.asm"
-INCLUDE "music/ssanne.asm"
-INCLUDE "music/cities2.asm"
-INCLUDE "music/celadon.asm"
-INCLUDE "music/cinnabar.asm"
-INCLUDE "music/vermilion.asm"
-INCLUDE "music/lavender.asm"
-INCLUDE "music/safarizone.asm"
-INCLUDE "music/gym.asm"
-INCLUDE "music/pokecenter.asm"
-
SECTION "bank3",ROMX,BANK[$3]
_GetJoypadState: ; c000 (3:4000)
@@ -42832,841 +42586,8 @@
TX_FAR _OakLabEmailText
db "@"
-SECTION "bank8",ROMX,BANK[$8]
-INCLUDE "music/headers/sfxheaders08.asm"
-INCLUDE "music/headers/musicheaders08.asm"
-INCLUDE "music/sfx/sfx_08_01.asm"
-INCLUDE "music/sfx/sfx_08_02.asm"
-INCLUDE "music/sfx/sfx_08_03.asm"
-INCLUDE "music/sfx/sfx_08_04.asm"
-INCLUDE "music/sfx/sfx_08_05.asm"
-INCLUDE "music/sfx/sfx_08_06.asm"
-INCLUDE "music/sfx/sfx_08_07.asm"
-INCLUDE "music/sfx/sfx_08_08.asm"
-INCLUDE "music/sfx/sfx_08_09.asm"
-INCLUDE "music/sfx/sfx_08_0a.asm"
-INCLUDE "music/sfx/sfx_08_0b.asm"
-INCLUDE "music/sfx/sfx_08_0c.asm"
-INCLUDE "music/sfx/sfx_08_0d.asm"
-INCLUDE "music/sfx/sfx_08_0e.asm"
-INCLUDE "music/sfx/sfx_08_0f.asm"
-INCLUDE "music/sfx/sfx_08_10.asm"
-INCLUDE "music/sfx/sfx_08_11.asm"
-INCLUDE "music/sfx/sfx_08_12.asm"
-INCLUDE "music/sfx/sfx_08_13.asm"
-
-Music8_Channel3DutyPointers: ; 20361 (8:4361)
- dw Music8_Channel3Duty0
- dw Music8_Channel3Duty1
- dw Music8_Channel3Duty2
- dw Music8_Channel3Duty3
- dw Music8_Channel3Duty4
- dw SFX_08_40_Ch1 ; unused
- dw SFX_08_40_Ch1 ; unused
- dw SFX_08_40_Ch1 ; unused
- dw SFX_08_40_Ch1 ; unused
-
-; these are the definitions for the channel 3 instruments
-; each instrument definition is made up of 32 points (nibbles) that form
-; the graph of the wave
-; the current instrument is copied to $FF30
-Music8_Channel3Duty0: ; 20373 (8:4373)
- db $02,$46,$8A,$CE,$FF,$FE,$ED,$DC,$CB,$A9,$87,$65,$44,$33,$22,$11
-
-Music8_Channel3Duty1: ; 20383 (8:4383)
- db $02,$46,$8A,$CE,$EF,$FF,$FE,$EE,$DD,$CB,$A9,$87,$65,$43,$22,$11
-
-Music8_Channel3Duty2: ; 20393 (8:4393)
- db $13,$69,$BD,$EE,$EE,$FF,$FF,$ED,$DE,$FF,$FF,$EE,$EE,$DB,$96,$31
-
-Music8_Channel3Duty3: ; 203a3 (8:43a3)
- db $02,$46,$8A,$CD,$EF,$FE,$DE,$FF,$EE,$DC,$BA,$98,$76,$54,$32,$10
-
-Music8_Channel3Duty4: ; 203b3 (8:43b3)
- db $01,$23,$45,$67,$8A,$CD,$EE,$F7,$7F,$EE,$DC,$A8,$76,$54,$32,$10
-
-INCLUDE "music/sfx/sfx_08_40.asm"
-INCLUDE "music/sfx/sfx_08_3f.asm"
-INCLUDE "music/sfx/sfx_08_3c.asm"
-INCLUDE "music/sfx/sfx_08_3d.asm"
-INCLUDE "music/sfx/sfx_08_3e.asm"
-INCLUDE "music/sfx/sfx_08_77.asm"
-INCLUDE "music/sfx/sfx_08_41.asm"
-INCLUDE "music/sfx/sfx_08_42.asm"
-INCLUDE "music/sfx/sfx_08_43.asm"
-INCLUDE "music/sfx/sfx_08_44.asm"
-INCLUDE "music/sfx/sfx_08_45.asm"
-INCLUDE "music/sfx/sfx_08_pokeflute_ch3.asm"
-INCLUDE "music/sfx/sfx_08_47.asm"
-INCLUDE "music/sfx/sfx_08_48.asm"
-INCLUDE "music/sfx/sfx_08_49.asm"
-INCLUDE "music/sfx/sfx_08_4a.asm"
-INCLUDE "music/sfx/sfx_08_4b.asm"
-INCLUDE "music/sfx/sfx_08_4c.asm"
-INCLUDE "music/sfx/sfx_08_4d.asm"
-INCLUDE "music/sfx/sfx_08_4e.asm"
-INCLUDE "music/sfx/sfx_08_4f.asm"
-INCLUDE "music/sfx/sfx_08_50.asm"
-INCLUDE "music/sfx/sfx_08_51.asm"
-INCLUDE "music/sfx/sfx_08_52.asm"
-INCLUDE "music/sfx/sfx_08_53.asm"
-INCLUDE "music/sfx/sfx_08_54.asm"
-INCLUDE "music/sfx/sfx_08_55.asm"
-INCLUDE "music/sfx/sfx_08_56.asm"
-INCLUDE "music/sfx/sfx_08_57.asm"
-INCLUDE "music/sfx/sfx_08_58.asm"
-INCLUDE "music/sfx/sfx_08_59.asm"
-INCLUDE "music/sfx/sfx_08_5a.asm"
-INCLUDE "music/sfx/sfx_08_5b.asm"
-INCLUDE "music/sfx/sfx_08_5c.asm"
-INCLUDE "music/sfx/sfx_08_5d.asm"
-INCLUDE "music/sfx/sfx_08_5e.asm"
-INCLUDE "music/sfx/sfx_08_5f.asm"
-INCLUDE "music/sfx/sfx_08_60.asm"
-INCLUDE "music/sfx/sfx_08_61.asm"
-INCLUDE "music/sfx/sfx_08_62.asm"
-INCLUDE "music/sfx/sfx_08_63.asm"
-INCLUDE "music/sfx/sfx_08_64.asm"
-INCLUDE "music/sfx/sfx_08_65.asm"
-INCLUDE "music/sfx/sfx_08_66.asm"
-INCLUDE "music/sfx/sfx_08_67.asm"
-INCLUDE "music/sfx/sfx_08_68.asm"
-INCLUDE "music/sfx/sfx_08_69.asm"
-INCLUDE "music/sfx/sfx_08_6a.asm"
-INCLUDE "music/sfx/sfx_08_6b.asm"
-INCLUDE "music/sfx/sfx_08_6c.asm"
-INCLUDE "music/sfx/sfx_08_6d.asm"
-INCLUDE "music/sfx/sfx_08_6e.asm"
-INCLUDE "music/sfx/sfx_08_6f.asm"
-INCLUDE "music/sfx/sfx_08_70.asm"
-INCLUDE "music/sfx/sfx_08_71.asm"
-INCLUDE "music/sfx/sfx_08_72.asm"
-INCLUDE "music/sfx/sfx_08_73.asm"
-INCLUDE "music/sfx/sfx_08_74.asm"
-INCLUDE "music/sfx/sfx_08_75.asm"
-INCLUDE "music/sfx/sfx_08_76.asm"
-INCLUDE "music/sfx/sfx_08_unused.asm"
-INCLUDE "music/sfx/sfx_08_1d.asm"
-INCLUDE "music/sfx/sfx_08_37.asm"
-INCLUDE "music/sfx/sfx_08_38.asm"
-INCLUDE "music/sfx/sfx_08_25.asm"
-INCLUDE "music/sfx/sfx_08_39.asm"
-INCLUDE "music/sfx/sfx_08_17.asm"
-INCLUDE "music/sfx/sfx_08_23.asm"
-INCLUDE "music/sfx/sfx_08_24.asm"
-INCLUDE "music/sfx/sfx_08_14.asm"
-INCLUDE "music/sfx/sfx_08_22.asm"
-INCLUDE "music/sfx/sfx_08_1a.asm"
-INCLUDE "music/sfx/sfx_08_1b.asm"
-INCLUDE "music/sfx/sfx_08_19.asm"
-INCLUDE "music/sfx/sfx_08_1f.asm"
-INCLUDE "music/sfx/sfx_08_20.asm"
-INCLUDE "music/sfx/sfx_08_16.asm"
-INCLUDE "music/sfx/sfx_08_21.asm"
-INCLUDE "music/sfx/sfx_08_15.asm"
-INCLUDE "music/sfx/sfx_08_1e.asm"
-INCLUDE "music/sfx/sfx_08_1c.asm"
-INCLUDE "music/sfx/sfx_08_18.asm"
-INCLUDE "music/sfx/sfx_08_2d.asm"
-INCLUDE "music/sfx/sfx_08_2a.asm"
-INCLUDE "music/sfx/sfx_08_2f.asm"
-INCLUDE "music/sfx/sfx_08_26.asm"
-INCLUDE "music/sfx/sfx_08_27.asm"
-INCLUDE "music/sfx/sfx_08_28.asm"
-INCLUDE "music/sfx/sfx_08_32.asm"
-INCLUDE "music/sfx/sfx_08_29.asm"
-INCLUDE "music/sfx/sfx_08_2b.asm"
-INCLUDE "music/sfx/sfx_08_30.asm"
-INCLUDE "music/sfx/sfx_08_2e.asm"
-INCLUDE "music/sfx/sfx_08_31.asm"
-INCLUDE "music/sfx/sfx_08_2c.asm"
-INCLUDE "music/sfx/sfx_08_33.asm"
-INCLUDE "music/sfx/sfx_08_34.asm"
-INCLUDE "music/sfx/sfx_08_35.asm"
-INCLUDE "music/sfx/sfx_08_36.asm"
-
-Func_2136e: ; 2136e (8:536e)
- ld a, [$d083]
- cp $ff
- jr z, .asm_2139b
- bit 7, a
- ret z
- and $7f
- jr nz, .asm_21383
- call Func_213a7
- ld a, $1e
- jr .asm_21395
-.asm_21383
- cp $14
- jr nz, .asm_2138a
- call Func_213ac
-.asm_2138a
- ld a, $86
- ld [$c02a], a
- ld a, [$d083]
- and $7f
- dec a
-.asm_21395
- set 7, a
- ld [$d083], a
- ret
-.asm_2139b
- xor a
- ld [$d083], a
- ld [$c02a], a
- ld de, Unknown_213c4 ; $53c4
- jr asm_213af
-
-Func_213a7: ; 213a7 (8:53a7)
- ld de, Unknown_213bc ; $53bc
- jr asm_213af
-
-Func_213ac: ; 213ac (8:53ac)
- ld de, Unknown_213c0 ; $53c0
-asm_213af: ; 213af (8:53af)
- ld hl, $ff10
- ld c, $5
- xor a
-.asm_213b5
- ld [hli], a
- ld a, [de]
- inc de
- dec c
- jr nz, .asm_213b5
- ret
-
-Unknown_213bc: ; 213bc (8:53bc)
- db $A0,$E2,$50,$87
-
-Unknown_213c0: ; 213c0 (8:53c0)
- db $B0,$E2,$EE,$86
-
-Unknown_213c4: ; 213c4 (8:53c4)
- db $00,$00,$00,$80
-
-Func_213c8: ; 213c8 (8:53c8)
- xor a
- ld [H_AUTOBGTRANSFERENABLED], a ; $FF00+$ba
- call SaveScreenTilesToBuffer2
- ld a, [$d5a2]
- and a
- jr nz, .asm_213f3
- ld a, [$d74b]
- bit 5, a
- jr z, .asm_213ea
- ld a, [$d5a2]
- and a
- jr nz, .asm_213f3
- ld hl, wTileMap
- ld b, $8
- ld c, $e
- jr .asm_213fa
-.asm_213ea
- ld hl, wTileMap
- ld b, $6
- ld c, $e
- jr .asm_213fa
-.asm_213f3
- ld hl, wTileMap
- ld b, $a
- ld c, $e
-.asm_213fa
- call TextBoxBorder
- call UpdateSprites
- ld a, $3
- ld [wMaxMenuItem], a ; $cc28
- ld a, [$d7f1]
- bit 0, a
- jr nz, .asm_21414
- FuncCoord 2, 2 ; $c3ca
- ld hl, Coord
- ld de, SomeonesPCText ; $548b
- jr .asm_2141a
-.asm_21414
- FuncCoord 2, 2 ; $c3ca
- ld hl, Coord
- ld de, BillsPCText ; $5497
-.asm_2141a
- call PlaceString
- FuncCoord 2, 4 ; $c3f2
- ld hl, Coord
- ld de, W_PLAYERNAME ; $d158
- call PlaceString
- ld l, c
- ld h, b
- ld de, PlayersPCText ; $54a0
- call PlaceString
- ld a, [$d74b]
- bit 5, a
- jr z, .asm_21462
- FuncCoord 2, 6 ; $c41a
- ld hl, Coord
- ld de, OaksPCText ; $54a5
- call PlaceString
- ld a, [$d5a2]
- and a
- jr z, .asm_2145a
- ld a, $4
- ld [wMaxMenuItem], a ; $cc28
- FuncCoord 2, 8 ; $c442
- ld hl, Coord
- ld de, PKMNLeaguePCText ; $54b2
- call PlaceString
- FuncCoord 2, 10 ; $c46a
- ld hl, Coord
- ld de, LogOffPCText ; $54ba
- jr .asm_2146d
-.asm_2145a
- FuncCoord 2, 8 ; $c442
- ld hl, Coord
- ld de, LogOffPCText ; $54ba
- jr .asm_2146d
-.asm_21462
- ld a, $2
- ld [wMaxMenuItem], a ; $cc28
- FuncCoord 2, 6 ; $c41a
- ld hl, Coord
- ld de, LogOffPCText ; $54ba
-.asm_2146d
- call PlaceString
- ld a, $3
- ld [wMenuWatchedKeys], a ; $cc29
- ld a, $2
- ld [wTopMenuItemY], a ; $cc24
- ld a, $1
- ld [wTopMenuItemX], a ; $cc25
- xor a
- ld [wCurrentMenuItem], a ; $cc26
- ld [wLastMenuItem], a ; $cc2a
- ld a, $1
- ld [H_AUTOBGTRANSFERENABLED], a ; $FF00+$ba
- ret
-
-SomeonesPCText: ; 2148b (8:548b)
- db "SOMEONE's PC@"
-
-BillsPCText: ; 21497 (8:5497)
- db "BILL's PC@"
-
-PlayersPCText: ; 214a0 (8:54a0)
- db "'s PC@"
-
-OaksPCText: ; 214a5 (8:54a5)
- db "PROF.OAK's PC@"
-
-PKMNLeaguePCText: ; 214b2 (8:54b2)
- db $4a,"LEAGUE@"
-
-LogOffPCText: ; 214ba (8:54ba)
- db "LOG OFF@"
-
-Func_214c2: ; 214c2 (8:54c2)
-BillsPC_: ; 0x214c2
- ld hl, $d730
- set 6, [hl]
- xor a
- ld [$ccd3], a
- inc a ; MONSTER_NAME
- ld [W_LISTTYPE], a
- call LoadHpBarAndStatusTilePatterns
- ld a, [wListScrollOffset] ; $cc36
- push af
- ld a, [wFlags_0xcd60]
- bit 3, a
- jr nz, BillsPCMenu
- ld a, $99
- call PlaySound
- ld hl, SwitchOnText
- call PrintText
-
-Func_214e8: ; 214e8 (8:54e8)
-BillsPCMenu:
- ld a, [$ccd3]
- ld [wCurrentMenuItem], a ; $cc26
- ld hl, $9780
- ld de, PokeballTileGraphics ; $697e
- ld bc, (BANK(PokeballTileGraphics) << 8) + $01
- call CopyVideoData
- call LoadScreenTilesFromBuffer2DisableBGTransfer
- ld hl, wTileMap
- ld b, $a
- ld c, $c
- call TextBoxBorder
- FuncCoord 2, 2 ; $c3ca
- ld hl, Coord
- ld de, BillsPCMenuText ; $56e1
- call PlaceString
- ld hl, wTopMenuItemY ; $cc24
- ld a, $2
- ld [hli], a
- dec a
- ld [hli], a
- inc hl
- inc hl
- ld a, $4
- ld [hli], a
- ld a, $3
- ld [hli], a
- xor a
- ld [hli], a
- ld [hli], a
- ld hl, wListScrollOffset ; $cc36
- ld [hli], a
- ld [hl], a
- ld [wPlayerMonNumber], a ; $cc2f
- ld hl, WhatText
- call PrintText
- FuncCoord 9, 14 ; $c4c1
- ld hl, Coord
- ld b, $2
- ld c, $9
- call TextBoxBorder
- ld a, [$d5a0]
- and $7f
- cp $9
- jr c, .asm_2154f
- sub $9
- FuncCoord 17, 16 ; $c4f1
- ld hl, Coord
- ld [hl], $f7
- add $f6
- jr .asm_21551
-.asm_2154f
- add $f7
-.asm_21551
- FuncCoord 18, 16 ; $c4f2
- ld [Coord], a
- FuncCoord 10, 16 ; $c4ea
- ld hl, Coord
- ld de, BoxNoPCText ; $5713
- call PlaceString
- ld a, $1
- ld [H_AUTOBGTRANSFERENABLED], a ; $FF00+$ba
- call Delay3
- call HandleMenuInput
- bit 1, a
- jp nz, Func_21588 ; b button
- call PlaceUnfilledArrowMenuCursor
- ld a, [wCurrentMenuItem] ; $cc26
- ld [$ccd3], a
- and a
- jp z, Func_21618 ; withdraw
- cp $1
- jp z, Func_215ac ; deposit
- cp $2
- jp z, Func_21673 ; release
- cp $3
- jp z, Func_216b3 ; change box
-
-Func_21588: ; 21588 (8:5588)
- ld a, [wFlags_0xcd60]
- bit 3, a
- jr nz, .asm_2159a
- call LoadTextBoxTilePatterns
- ld a, $9a
- call PlaySound
- call WaitForSoundToFinish
-.asm_2159a
- ld hl, wFlags_0xcd60
- res 5, [hl]
- call LoadScreenTilesFromBuffer2
- pop af
- ld [wListScrollOffset], a ; $cc36
- ld hl, $d730
- res 6, [hl]
- ret
-
-Func_215ac: ; 215ac (8:55ac)
-BillsPCDeposit:
- ld a, [W_NUMINPARTY] ; $d163
- dec a
- jr nz, .asm_215bb
- ld hl, CantDepositLastMonText
- call PrintText
- jp BillsPCMenu
-.asm_215bb
- ld a, [W_NUMINBOX] ; $da80
- cp $14
- jr nz, .asm_215cb
- ld hl, BoxFullText ; $5802
- call PrintText
- jp BillsPCMenu
-.asm_215cb
- ld hl, W_NUMINPARTY ; $d163
- call Func_216be
- jp c, BillsPCMenu
- call Func_2174b
- jp nc, BillsPCMenu
- ld a, [$cf91]
- call GetCryData
- call PlaySoundWaitForCurrent
- ld a, $1
- ld [$cf95], a
- call Func_3a68
- xor a
- ld [$cf95], a
- call RemovePokemon
- call WaitForSoundToFinish
- ld hl, wWhichTrade ; $cd3d
- ld a, [$d5a0]
- and $7f
- cp $9
- jr c, .asm_2160a
- sub $9
- ld [hl], $f7
- inc hl
- add $f6
- jr .asm_2160c
-.asm_2160a
- add $f7
-.asm_2160c
- ld [hli], a
- ld [hl], $50
- ld hl, MonWasStoredText ; $57f8
- call PrintText
- jp BillsPCMenu
-
-Func_21618: ; 21618 (8:5618)
- ld a, [W_NUMINBOX] ; $da80
- and a
- jr nz, .asm_21627
- ld hl, NoMonText ; $580c
- call PrintText
- jp Func_214e8
-.asm_21627
- ld a, [W_NUMINPARTY] ; $d163
- cp $6
- jr nz, .asm_21637
- ld hl, CantTakeMonText ; $5811
- call PrintText
- jp Func_214e8
-.asm_21637
- ld hl, W_NUMINBOX ; $da80
- call Func_216be
- jp c, Func_214e8
- call Func_2174b
- jp nc, Func_214e8
- ld a, [wWhichPokemon] ; $cf92
- ld hl, $de06
- call GetPartyMonName
- ld a, [$cf91]
- call GetCryData
- call PlaySoundWaitForCurrent
- xor a
- ld [$cf95], a
- call Func_3a68
- ld a, $1
- ld [$cf95], a
- call RemovePokemon
- call WaitForSoundToFinish
- ld hl, MonIsTakenOutText ; $5807
- call PrintText
- jp Func_214e8
-
-Func_21673: ; 21673 (8:5673)
- ld a, [W_NUMINBOX] ; $da80
- and a
- jr nz, .asm_21682
- ld hl, NoMonText ; $580c
- call PrintText
- jp Func_214e8
-.asm_21682
- ld hl, W_NUMINBOX ; $da80
- call Func_216be
- jp c, Func_214e8
- ld hl, OnceReleasedText ; $581b
- call PrintText
- call YesNoChoice
- ld a, [wCurrentMenuItem] ; $cc26
- and a
- jr nz, .asm_21682
- inc a
- ld [$cf95], a
- call RemovePokemon
- call WaitForSoundToFinish
- ld a, [$cf91]
- call PlayCry
- ld hl, MonWasReleasedText ; $5820
- call PrintText
- jp Func_214e8
-
-Func_216b3: ; 216b3 (8:56b3)
- ld b, BANK(Func_738a1)
- ld hl, Func_738a1
- call Bankswitch ; indirect jump to Func_738a1 (738a1 (1c:78a1))
- jp Func_214e8
-
-Func_216be: ; 216be (8:56be)
- ld a, l
- ld [$cf8b], a
- ld a, h
- ld [$cf8c], a
- xor a
- ld [$cf93], a
- ld [wListMenuID], a ; $cf94
- inc a ; MONSTER_NAME
- ld [W_LISTTYPE], a
- ld a, [$cc2b]
- ld [wCurrentMenuItem], a ; $cc26
- call DisplayListMenuID
- ld a, [wCurrentMenuItem] ; $cc26
- ld [$cc2b], a
- ret
-
-BillsPCMenuText: ; 216e1 (8:56e1)
- db "WITHDRAW ",$4a,$4e,"DEPOSIT ",$4a,$4e,"RELEASE ",$4a,$4e,"CHANGE BOX",$4e,"SEE YA!@"
-
-BoxNoPCText: ; 21713 (8:5713)
- db "BOX No.@"
-
-Func_2171b: ; 2171b (8:571b)
- ld hl, $d173
- ld bc, $002c
- jr .asm_21729 ; 0x21721 $6
- ld hl, $da9e
- ld bc, $0021
-.asm_21729
- ld a, [$cf92]
- call AddNTimes
- ld b, $4
-.asm_21731
- ld a, [hli]
- push hl
- push bc
- ld hl, HMMoveArray ; $5745
- ld de, $0001
- call IsInArray
- pop bc
- pop hl
- ret c
- dec b
- jr nz, .asm_21731 ; 0x21741 $ee
- and a
- ret
-
-HMMoveArray: ; 21745 (8:5745)
- db CUT
- db FLY
- db SURF
- db STRENGTH
- db FLASH
- db $ff
-
-Func_2174b: ; 2174b (8:574b)
- FuncCoord 9, 10 ; $c471
- ld hl, Coord
- ld b, $6
- ld c, $9
- call TextBoxBorder
- ld a, [$ccd3]
- and a
- ld de, DepositPCText ; $57cb
- jr nz, .asm_21761
- ld de, WithdrawPCText ; $57d3
-.asm_21761
- FuncCoord 11, 12 ; $c49b
- ld hl, Coord
- call PlaceString
- FuncCoord 11, 14 ; $c4c3
- ld hl, Coord
- ld de, StatsCancelPCText ; $57dc
- call PlaceString
- ld hl, wTopMenuItemY ; $cc24
- ld a, $c
- ld [hli], a
- ld a, $a
- ld [hli], a
- xor a
- ld [hli], a
- inc hl
- ld a, $2
- ld [hli], a
- ld a, $3
- ld [hli], a
- xor a
- ld [hl], a
- ld hl, wListScrollOffset ; $cc36
- ld [hli], a
- ld [hl], a
- ld [wPlayerMonNumber], a ; $cc2f
- ld [$cc2b], a
-.asm_2178f
- call HandleMenuInput
- bit 1, a
- jr nz, .asm_2179f
- ld a, [wCurrentMenuItem] ; $cc26
- and a
- jr z, .asm_217a1
- dec a
- jr z, .asm_217a3
-.asm_2179f
- and a
- ret
-.asm_217a1
- scf
- ret
-.asm_217a3
- call SaveScreenTilesToBuffer1
- ld a, [$ccd3]
- and a
- ld a, $0
- jr nz, .asm_217b0
- ld a, $2
-.asm_217b0
- ld [$cc49], a
- ld a, $36
- call Predef ; indirect jump to StatusScreen (12953 (4:6953))
- ld a, $37
- call Predef ; indirect jump to StatusScreen2 (12b57 (4:6b57))
- call LoadScreenTilesFromBuffer1
- call ReloadTilesetTilePatterns
- call GoPAL_SET_CF1C
- call LoadGBPal
- jr .asm_2178f
-
-DepositPCText: ; 217cb (8:57cb)
- db "DEPOSIT@"
-
-WithdrawPCText: ; 217d3 (8:57d3)
- db "WITHDRAW@"
-
-StatsCancelPCText: ; 217dc (8:57dc)
- db "STATS",$4e,"CANCEL@"
-
-SwitchOnText: ; 0x217e9
- TX_FAR _SwitchOnText
- db "@"
-
-WhatText: ; 0x217ee
- TX_FAR _WhatText
- db "@"
-
-DepositWhichMonText: ; 0x217f3
- TX_FAR _DepositWhichMonText
- db "@"
-
-MonWasStoredText: ; 0x217f8
- TX_FAR _MonWasStoredText
- db "@"
-
-CantDepositLastMonText: ; 0x217fd
- TX_FAR _CantDepositLastMonText
- db "@"
-
-BoxFullText: ; 0x21802
- TX_FAR _BoxFullText
- db "@"
-
-MonIsTakenOutText: ; 0x21807
- TX_FAR _MonIsTakenOutText
- db "@"
-
-NoMonText: ; 0x2180c
- TX_FAR _NoMonText
- db "@"
-
-CantTakeMonText: ; 0x21811
- TX_FAR _CantTakeMonText
- db "@"
-
-ReleaseWhichMonText: ; 0x21816
- TX_FAR _ReleaseWhichMonText
- db "@"
-
-OnceReleasedText: ; 0x2181b
- TX_FAR _OnceReleasedText
- db "@"
-
-MonWasReleasedText: ; 0x21820
- TX_FAR _MonWasReleasedText
- db "@"
-
-Func_21825: ; 5824 (8:5825)
- ld a, [$ff00+$aa]
- cp $1
- ret z
- ld a, [$c109]
- cp $c
- ret nz
- ld a, [$d35e]
- cp $ef
- ld a, $2
- jr z, .asm_2183a
- inc a
-.asm_2183a
- ld [$d12b], a
- call EnableAutoTextBoxDrawing
- ld a, $22
- jp Func_3ef5
-
-Func_21845: ; 5845 (8:5845)
- ld a, [$ff00+$aa]
- cp $2
- ret z
- ld a, [$c109]
- cp $8
- ret nz
- ld a, [$d35e]
- cp $ef
- ld a, $2
- jr z, .asm_2185a
- inc a
-.asm_2185a
- ld [$d12b], a
- call EnableAutoTextBoxDrawing
- ld a, $22
- jp Func_3ef5
-
-UnnamedText_21865: ; 21865 (8:5865)
- TX_FAR _UnnamedText_21865
- db "@"
-
- ld a, [$c109]
- cp $4
- ret nz
- call EnableAutoTextBoxDrawing
- ld a, $23
- jp Func_3ef5
-
-Unknown_21878: ; 21878 (8:5878)
- db $FD
-
-
-INCLUDE "audio/engine_2.asm"
-
-
-Music_PokeFluteInBattle: ; 22306 (8:6306)
- ld a, (SFX_08_46 - $4000) / 3 ; PokeFlute outside of battle
- call PlaySoundWaitForCurrent
- ld hl, $c00e
- ld de, SFX_08_PokeFlute_Ch1
- call Music8_OverwriteChannelPointer
- ld de, SFX_08_PokeFlute_Ch2
- call Music8_OverwriteChannelPointer
- ld de, SFX_08_PokeFlute_Ch3
-
-Music8_OverwriteChannelPointer: ; 2231d (8:631d)
- ld a, e
- ld [hli], a
- ld a, d
- ld [hli], a
- ret
-
-INCLUDE "music/sfx/sfx_08_pokeflute.asm"
-INCLUDE "music/sfx/sfx_08_unused2.asm"
-INCLUDE "music/gymleaderbattle.asm"
-INCLUDE "music/trainerbattle.asm"
-INCLUDE "music/wildbattle.asm"
-INCLUDE "music/finalbattle.asm"
-INCLUDE "music/sfx/sfx_08_3a.asm"
-INCLUDE "music/sfx/sfx_08_3b.asm"
-INCLUDE "music/sfx/sfx_08_46.asm"
-INCLUDE "music/defeatedtrainer.asm"
-INCLUDE "music/defeatedwildmon.asm"
-INCLUDE "music/defeatedgymleader.asm"
-
SECTION "bank9",ROMX,BANK[$9]
RhydonPicFront: ; 24000 (9:4000)
@@ -79370,6 +78291,7 @@
IndigoPlateauBlocks: ; 5094a (14:494a)
INCBIN "maps/indigoplateau.blk"
+GLOBAL SaffronCity_h
SaffronCity_h: ; 0x509a4 to 0x509dc (56 bytes) (id=10)
db $00 ; tileset
db SAFFRON_CITY_HEIGHT, SAFFRON_CITY_WIDTH ; dimensions (y, x)
@@ -116897,220 +115819,6 @@
db $21, $12, $42, $25, $24
db $22, $52, $24, $34, $42
-SECTION "bank1F",ROMX,BANK[$1F]
-
-INCLUDE "music/headers/sfxheaders1f.asm"
-INCLUDE "music/headers/musicheaders1f.asm"
-
-INCLUDE "music/sfx/sfx_1f_01.asm"
-INCLUDE "music/sfx/sfx_1f_02.asm"
-INCLUDE "music/sfx/sfx_1f_03.asm"
-INCLUDE "music/sfx/sfx_1f_04.asm"
-INCLUDE "music/sfx/sfx_1f_05.asm"
-INCLUDE "music/sfx/sfx_1f_06.asm"
-INCLUDE "music/sfx/sfx_1f_07.asm"
-INCLUDE "music/sfx/sfx_1f_08.asm"
-INCLUDE "music/sfx/sfx_1f_09.asm"
-INCLUDE "music/sfx/sfx_1f_0a.asm"
-INCLUDE "music/sfx/sfx_1f_0b.asm"
-INCLUDE "music/sfx/sfx_1f_0c.asm"
-INCLUDE "music/sfx/sfx_1f_0d.asm"
-INCLUDE "music/sfx/sfx_1f_0e.asm"
-INCLUDE "music/sfx/sfx_1f_0f.asm"
-INCLUDE "music/sfx/sfx_1f_10.asm"
-INCLUDE "music/sfx/sfx_1f_11.asm"
-INCLUDE "music/sfx/sfx_1f_12.asm"
-INCLUDE "music/sfx/sfx_1f_13.asm"
-
-Music1f_Channel3DutyPointers: ; 7c361 (1f:4361)
- dw Music1f_Channel3Duty0
- dw Music1f_Channel3Duty1
- dw Music1f_Channel3Duty2
- dw Music1f_Channel3Duty3
- dw Music1f_Channel3Duty4
- dw Music1f_Channel3Duty5 ; used in the Pokemon Tower theme
- dw SFX_1f_3f_Ch1 ; unused
- dw SFX_1f_3f_Ch1 ; unused
- dw SFX_1f_3f_Ch1 ; unused
-
-; these are the definitions for the channel 3 instruments
-; each instrument definition is made up of 32 points (nibbles) that form
-; the graph of the wave
-; the current instrument is copied to $FF30
-Music1f_Channel3Duty0: ; 7c373 (1f:4373)
- db $02,$46,$8A,$CE,$FF,$FE,$ED,$DC,$CB,$A9,$87,$65,$44,$33,$22,$11
-
-Music1f_Channel3Duty1: ; 7c383 (1f:4383)
- db $02,$46,$8A,$CE,$EF,$FF,$FE,$EE,$DD,$CB,$A9,$87,$65,$43,$22,$11
-
-Music1f_Channel3Duty2: ; 7c393 (1f:4393)
- db $13,$69,$BD,$EE,$EE,$FF,$FF,$ED,$DE,$FF,$FF,$EE,$EE,$DB,$96,$31
-
-Music1f_Channel3Duty3: ; 7c3a3 (1f:43a3)
- db $02,$46,$8A,$CD,$EF,$FE,$DE,$FF,$EE,$DC,$BA,$98,$76,$54,$32,$10
-
-Music1f_Channel3Duty4: ; 7c3b3 (1f:43b3)
- db $01,$23,$45,$67,$8A,$CD,$EE,$F7,$7F,$EE,$DC,$A8,$76,$54,$32,$10
-
-; duty 5 reads from sfx data
-Music1f_Channel3Duty5: ; 7c3c3 (1f:43c3)
-INCLUDE "music/sfx/sfx_1f_3f.asm"
-INCLUDE "music/sfx/sfx_1f_56.asm"
-INCLUDE "music/sfx/sfx_1f_57.asm"
-INCLUDE "music/sfx/sfx_1f_58.asm"
-INCLUDE "music/sfx/sfx_1f_3c.asm"
-INCLUDE "music/sfx/sfx_1f_59.asm"
-INCLUDE "music/sfx/sfx_1f_5a.asm"
-INCLUDE "music/sfx/sfx_1f_5b.asm"
-INCLUDE "music/sfx/sfx_1f_5c.asm"
-INCLUDE "music/sfx/sfx_1f_40.asm"
-IF _RED
- INCLUDE "music/sfx/sfx_1f_5d.asm"
-ENDC
-IF _BLUE
- INCLUDE "music/blue/sfx_1f_5d.asm"
-ENDC
-INCLUDE "music/sfx/sfx_1f_3d.asm"
-INCLUDE "music/sfx/sfx_1f_43.asm"
-INCLUDE "music/sfx/sfx_1f_3e.asm"
-INCLUDE "music/sfx/sfx_1f_44.asm"
-INCLUDE "music/sfx/sfx_1f_45.asm"
-INCLUDE "music/sfx/sfx_1f_46.asm"
-INCLUDE "music/sfx/sfx_1f_47.asm"
-INCLUDE "music/sfx/sfx_1f_48.asm"
-INCLUDE "music/sfx/sfx_1f_49.asm"
-INCLUDE "music/sfx/sfx_1f_4a.asm"
-INCLUDE "music/sfx/sfx_1f_4b.asm"
-INCLUDE "music/sfx/sfx_1f_4c.asm"
-INCLUDE "music/sfx/sfx_1f_4d.asm"
-INCLUDE "music/sfx/sfx_1f_4e.asm"
-INCLUDE "music/sfx/sfx_1f_4f.asm"
-INCLUDE "music/sfx/sfx_1f_50.asm"
-INCLUDE "music/sfx/sfx_1f_51.asm"
-INCLUDE "music/sfx/sfx_1f_52.asm"
-INCLUDE "music/sfx/sfx_1f_53.asm"
-INCLUDE "music/sfx/sfx_1f_54.asm"
-INCLUDE "music/sfx/sfx_1f_55.asm"
-INCLUDE "music/sfx/sfx_1f_5e.asm"
-INCLUDE "music/sfx/sfx_1f_5f.asm"
-INCLUDE "music/sfx/sfx_1f_60.asm"
-INCLUDE "music/sfx/sfx_1f_61.asm"
-INCLUDE "music/sfx/sfx_1f_62.asm"
-INCLUDE "music/sfx/sfx_1f_63.asm"
-INCLUDE "music/sfx/sfx_1f_64.asm"
-INCLUDE "music/sfx/sfx_1f_65.asm"
-INCLUDE "music/sfx/sfx_1f_66.asm"
-INCLUDE "music/sfx/sfx_1f_67.asm"
-INCLUDE "music/sfx/sfx_1f_unused.asm"
-INCLUDE "music/sfx/sfx_1f_1d.asm"
-INCLUDE "music/sfx/sfx_1f_37.asm"
-INCLUDE "music/sfx/sfx_1f_38.asm"
-INCLUDE "music/sfx/sfx_1f_25.asm"
-INCLUDE "music/sfx/sfx_1f_39.asm"
-INCLUDE "music/sfx/sfx_1f_17.asm"
-INCLUDE "music/sfx/sfx_1f_23.asm"
-INCLUDE "music/sfx/sfx_1f_24.asm"
-INCLUDE "music/sfx/sfx_1f_14.asm"
-INCLUDE "music/sfx/sfx_1f_22.asm"
-INCLUDE "music/sfx/sfx_1f_1a.asm"
-INCLUDE "music/sfx/sfx_1f_1b.asm"
-INCLUDE "music/sfx/sfx_1f_19.asm"
-INCLUDE "music/sfx/sfx_1f_1f.asm"
-INCLUDE "music/sfx/sfx_1f_20.asm"
-INCLUDE "music/sfx/sfx_1f_16.asm"
-INCLUDE "music/sfx/sfx_1f_21.asm"
-INCLUDE "music/sfx/sfx_1f_15.asm"
-INCLUDE "music/sfx/sfx_1f_1e.asm"
-INCLUDE "music/sfx/sfx_1f_1c.asm"
-INCLUDE "music/sfx/sfx_1f_18.asm"
-INCLUDE "music/sfx/sfx_1f_2d.asm"
-INCLUDE "music/sfx/sfx_1f_2a.asm"
-INCLUDE "music/sfx/sfx_1f_2f.asm"
-INCLUDE "music/sfx/sfx_1f_26.asm"
-INCLUDE "music/sfx/sfx_1f_27.asm"
-INCLUDE "music/sfx/sfx_1f_28.asm"
-INCLUDE "music/sfx/sfx_1f_32.asm"
-INCLUDE "music/sfx/sfx_1f_29.asm"
-INCLUDE "music/sfx/sfx_1f_2b.asm"
-INCLUDE "music/sfx/sfx_1f_30.asm"
-INCLUDE "music/sfx/sfx_1f_2e.asm"
-INCLUDE "music/sfx/sfx_1f_31.asm"
-INCLUDE "music/sfx/sfx_1f_2c.asm"
-INCLUDE "music/sfx/sfx_1f_33.asm"
-INCLUDE "music/sfx/sfx_1f_34.asm"
-INCLUDE "music/sfx/sfx_1f_35.asm"
-INCLUDE "music/sfx/sfx_1f_36.asm"
-
-Func_7d13b: ; 7d13b (1f:513b)
- ld a, [$FF00+$dc]
- ld c, $0
- ld hl, OwnedMonValues
-.getSfxPointer
- cp [hl]
- jr c, .gotSfxPointer
- inc c
- inc hl
- jr .getSfxPointer
-.gotSfxPointer
- push bc
- ld a, $ff
- ld [$c0ee], a
- call PlaySoundWaitForCurrent
- pop bc
- ld b, $0
- ld hl, PokedexRatingSfxPointers
- add hl, bc
- add hl, bc
- ld a, [hli]
- ld c, [hl]
- call PlayMusic
- jp Func_2307
-
-PokedexRatingSfxPointers: ; 7d162 (1f:5162)
- db (SFX_1f_51 - $4000) / 3
- db BANK(SFX_1f_51)
- db (SFX_02_41 - $4000) / 3
- db BANK(SFX_02_41)
- db (SFX_02_3a - $4000) / 3
- db BANK(SFX_02_3a)
- db (SFX_08_46 - $4000) / 3
- db BANK(SFX_08_46)
- db (SFX_08_3a - $4000) / 3
- db BANK(SFX_08_3a)
- db (SFX_02_42 - $4000) / 3
- db BANK(SFX_02_42)
- db (SFX_02_3b - $4000) / 3
- db BANK(SFX_02_3b)
-
-OwnedMonValues: ; 7d170 (1f:5170)
- db 10, 40, 60, 90, 120, 150, $ff
-
-
-INCLUDE "audio/engine_3.asm"
-
-
-INCLUDE "music/bikeriding.asm"
-INCLUDE "music/dungeon1.asm"
-INCLUDE "music/gamecorner.asm"
-INCLUDE "music/titlescreen.asm"
-INCLUDE "music/sfx/sfx_1f_3a.asm"
-INCLUDE "music/dungeon2.asm"
-INCLUDE "music/dungeon3.asm"
-INCLUDE "music/cinnabarmansion.asm"
-INCLUDE "music/sfx/sfx_1f_41.asm"
-INCLUDE "music/sfx/sfx_1f_3b.asm"
-INCLUDE "music/sfx/sfx_1f_42.asm"
-INCLUDE "music/oakslab.asm"
-INCLUDE "music/pokemontower.asm"
-INCLUDE "music/silphco.asm"
-INCLUDE "music/meeteviltrainer.asm"
-INCLUDE "music/meetfemaletrainer.asm"
-INCLUDE "music/meetmaletrainer.asm"
-INCLUDE "music/introbattle.asm"
-INCLUDE "music/surfing.asm"
-INCLUDE "music/jigglypuffsong.asm"
-INCLUDE "music/halloffame.asm"
-INCLUDE "music/credits.asm"
SECTION "bank20",ROMX,BANK[$20]
--- /dev/null
+++ b/menu/pc.asm
@@ -1,0 +1,588 @@
+
+Func_213c8: ; 213c8 (8:53c8)
+ xor a
+ ld [H_AUTOBGTRANSFERENABLED], a ; $FF00+$ba
+ call SaveScreenTilesToBuffer2
+ ld a, [$d5a2]
+ and a
+ jr nz, .asm_213f3
+ ld a, [$d74b]
+ bit 5, a
+ jr z, .asm_213ea
+ ld a, [$d5a2]
+ and a
+ jr nz, .asm_213f3
+ ld hl, wTileMap
+ ld b, $8
+ ld c, $e
+ jr .asm_213fa
+.asm_213ea
+ ld hl, wTileMap
+ ld b, $6
+ ld c, $e
+ jr .asm_213fa
+.asm_213f3
+ ld hl, wTileMap
+ ld b, $a
+ ld c, $e
+.asm_213fa
+ call TextBoxBorder
+ call UpdateSprites
+ ld a, $3
+ ld [wMaxMenuItem], a ; $cc28
+ ld a, [$d7f1]
+ bit 0, a
+ jr nz, .asm_21414
+ FuncCoord 2, 2 ; $c3ca
+ ld hl, Coord
+ ld de, SomeonesPCText ; $548b
+ jr .asm_2141a
+.asm_21414
+ FuncCoord 2, 2 ; $c3ca
+ ld hl, Coord
+ ld de, BillsPCText ; $5497
+.asm_2141a
+ call PlaceString
+ FuncCoord 2, 4 ; $c3f2
+ ld hl, Coord
+ ld de, W_PLAYERNAME ; $d158
+ call PlaceString
+ ld l, c
+ ld h, b
+ ld de, PlayersPCText ; $54a0
+ call PlaceString
+ ld a, [$d74b]
+ bit 5, a
+ jr z, .asm_21462
+ FuncCoord 2, 6 ; $c41a
+ ld hl, Coord
+ ld de, OaksPCText ; $54a5
+ call PlaceString
+ ld a, [$d5a2]
+ and a
+ jr z, .asm_2145a
+ ld a, $4
+ ld [wMaxMenuItem], a ; $cc28
+ FuncCoord 2, 8 ; $c442
+ ld hl, Coord
+ ld de, PKMNLeaguePCText ; $54b2
+ call PlaceString
+ FuncCoord 2, 10 ; $c46a
+ ld hl, Coord
+ ld de, LogOffPCText ; $54ba
+ jr .asm_2146d
+.asm_2145a
+ FuncCoord 2, 8 ; $c442
+ ld hl, Coord
+ ld de, LogOffPCText ; $54ba
+ jr .asm_2146d
+.asm_21462
+ ld a, $2
+ ld [wMaxMenuItem], a ; $cc28
+ FuncCoord 2, 6 ; $c41a
+ ld hl, Coord
+ ld de, LogOffPCText ; $54ba
+.asm_2146d
+ call PlaceString
+ ld a, $3
+ ld [wMenuWatchedKeys], a ; $cc29
+ ld a, $2
+ ld [wTopMenuItemY], a ; $cc24
+ ld a, $1
+ ld [wTopMenuItemX], a ; $cc25
+ xor a
+ ld [wCurrentMenuItem], a ; $cc26
+ ld [wLastMenuItem], a ; $cc2a
+ ld a, $1
+ ld [H_AUTOBGTRANSFERENABLED], a ; $FF00+$ba
+ ret
+
+SomeonesPCText: ; 2148b (8:548b)
+ db "SOMEONE's PC@"
+
+BillsPCText: ; 21497 (8:5497)
+ db "BILL's PC@"
+
+PlayersPCText: ; 214a0 (8:54a0)
+ db "'s PC@"
+
+OaksPCText: ; 214a5 (8:54a5)
+ db "PROF.OAK's PC@"
+
+PKMNLeaguePCText: ; 214b2 (8:54b2)
+ db $4a,"LEAGUE@"
+
+LogOffPCText: ; 214ba (8:54ba)
+ db "LOG OFF@"
+
+Func_214c2: ; 214c2 (8:54c2)
+BillsPC_: ; 0x214c2
+ ld hl, $d730
+ set 6, [hl]
+ xor a
+ ld [$ccd3], a
+ inc a ; MONSTER_NAME
+ ld [W_LISTTYPE], a
+ call LoadHpBarAndStatusTilePatterns
+ ld a, [wListScrollOffset] ; $cc36
+ push af
+ ld a, [wFlags_0xcd60]
+ bit 3, a
+ jr nz, BillsPCMenu
+ ld a, $99
+ call PlaySound
+ ld hl, SwitchOnText
+ call PrintText
+
+Func_214e8: ; 214e8 (8:54e8)
+BillsPCMenu:
+ ld a, [$ccd3]
+ ld [wCurrentMenuItem], a ; $cc26
+ ld hl, $9780
+ ld de, PokeballTileGraphics ; $697e
+ ld bc, (BANK(PokeballTileGraphics) << 8) + $01
+ call CopyVideoData
+ call LoadScreenTilesFromBuffer2DisableBGTransfer
+ ld hl, wTileMap
+ ld b, $a
+ ld c, $c
+ call TextBoxBorder
+ FuncCoord 2, 2 ; $c3ca
+ ld hl, Coord
+ ld de, BillsPCMenuText ; $56e1
+ call PlaceString
+ ld hl, wTopMenuItemY ; $cc24
+ ld a, $2
+ ld [hli], a
+ dec a
+ ld [hli], a
+ inc hl
+ inc hl
+ ld a, $4
+ ld [hli], a
+ ld a, $3
+ ld [hli], a
+ xor a
+ ld [hli], a
+ ld [hli], a
+ ld hl, wListScrollOffset ; $cc36
+ ld [hli], a
+ ld [hl], a
+ ld [wPlayerMonNumber], a ; $cc2f
+ ld hl, WhatText
+ call PrintText
+ FuncCoord 9, 14 ; $c4c1
+ ld hl, Coord
+ ld b, $2
+ ld c, $9
+ call TextBoxBorder
+ ld a, [$d5a0]
+ and $7f
+ cp $9
+ jr c, .asm_2154f
+ sub $9
+ FuncCoord 17, 16 ; $c4f1
+ ld hl, Coord
+ ld [hl], $f7
+ add $f6
+ jr .asm_21551
+.asm_2154f
+ add $f7
+.asm_21551
+ FuncCoord 18, 16 ; $c4f2
+ ld [Coord], a
+ FuncCoord 10, 16 ; $c4ea
+ ld hl, Coord
+ ld de, BoxNoPCText ; $5713
+ call PlaceString
+ ld a, $1
+ ld [H_AUTOBGTRANSFERENABLED], a ; $FF00+$ba
+ call Delay3
+ call HandleMenuInput
+ bit 1, a
+ jp nz, Func_21588 ; b button
+ call PlaceUnfilledArrowMenuCursor
+ ld a, [wCurrentMenuItem] ; $cc26
+ ld [$ccd3], a
+ and a
+ jp z, Func_21618 ; withdraw
+ cp $1
+ jp z, Func_215ac ; deposit
+ cp $2
+ jp z, Func_21673 ; release
+ cp $3
+ jp z, Func_216b3 ; change box
+
+Func_21588: ; 21588 (8:5588)
+ ld a, [wFlags_0xcd60]
+ bit 3, a
+ jr nz, .asm_2159a
+ call LoadTextBoxTilePatterns
+ ld a, $9a
+ call PlaySound
+ call WaitForSoundToFinish
+.asm_2159a
+ ld hl, wFlags_0xcd60
+ res 5, [hl]
+ call LoadScreenTilesFromBuffer2
+ pop af
+ ld [wListScrollOffset], a ; $cc36
+ ld hl, $d730
+ res 6, [hl]
+ ret
+
+Func_215ac: ; 215ac (8:55ac)
+BillsPCDeposit:
+ ld a, [W_NUMINPARTY] ; $d163
+ dec a
+ jr nz, .asm_215bb
+ ld hl, CantDepositLastMonText
+ call PrintText
+ jp BillsPCMenu
+.asm_215bb
+ ld a, [W_NUMINBOX] ; $da80
+ cp $14
+ jr nz, .asm_215cb
+ ld hl, BoxFullText ; $5802
+ call PrintText
+ jp BillsPCMenu
+.asm_215cb
+ ld hl, W_NUMINPARTY ; $d163
+ call Func_216be
+ jp c, BillsPCMenu
+ call Func_2174b
+ jp nc, BillsPCMenu
+ ld a, [$cf91]
+ call GetCryData
+ call PlaySoundWaitForCurrent
+ ld a, $1
+ ld [$cf95], a
+ call Func_3a68
+ xor a
+ ld [$cf95], a
+ call RemovePokemon
+ call WaitForSoundToFinish
+ ld hl, wWhichTrade ; $cd3d
+ ld a, [$d5a0]
+ and $7f
+ cp $9
+ jr c, .asm_2160a
+ sub $9
+ ld [hl], $f7
+ inc hl
+ add $f6
+ jr .asm_2160c
+.asm_2160a
+ add $f7
+.asm_2160c
+ ld [hli], a
+ ld [hl], $50
+ ld hl, MonWasStoredText ; $57f8
+ call PrintText
+ jp BillsPCMenu
+
+Func_21618: ; 21618 (8:5618)
+ ld a, [W_NUMINBOX] ; $da80
+ and a
+ jr nz, .asm_21627
+ ld hl, NoMonText ; $580c
+ call PrintText
+ jp Func_214e8
+.asm_21627
+ ld a, [W_NUMINPARTY] ; $d163
+ cp $6
+ jr nz, .asm_21637
+ ld hl, CantTakeMonText ; $5811
+ call PrintText
+ jp Func_214e8
+.asm_21637
+ ld hl, W_NUMINBOX ; $da80
+ call Func_216be
+ jp c, Func_214e8
+ call Func_2174b
+ jp nc, Func_214e8
+ ld a, [wWhichPokemon] ; $cf92
+ ld hl, $de06
+ call GetPartyMonName
+ ld a, [$cf91]
+ call GetCryData
+ call PlaySoundWaitForCurrent
+ xor a
+ ld [$cf95], a
+ call Func_3a68
+ ld a, $1
+ ld [$cf95], a
+ call RemovePokemon
+ call WaitForSoundToFinish
+ ld hl, MonIsTakenOutText ; $5807
+ call PrintText
+ jp Func_214e8
+
+Func_21673: ; 21673 (8:5673)
+ ld a, [W_NUMINBOX] ; $da80
+ and a
+ jr nz, .asm_21682
+ ld hl, NoMonText ; $580c
+ call PrintText
+ jp Func_214e8
+.asm_21682
+ ld hl, W_NUMINBOX ; $da80
+ call Func_216be
+ jp c, Func_214e8
+ ld hl, OnceReleasedText ; $581b
+ call PrintText
+ call YesNoChoice
+ ld a, [wCurrentMenuItem] ; $cc26
+ and a
+ jr nz, .asm_21682
+ inc a
+ ld [$cf95], a
+ call RemovePokemon
+ call WaitForSoundToFinish
+ ld a, [$cf91]
+ call PlayCry
+ ld hl, MonWasReleasedText ; $5820
+ call PrintText
+ jp Func_214e8
+
+Func_216b3: ; 216b3 (8:56b3)
+ ld b, BANK(Func_738a1)
+ ld hl, Func_738a1
+ call Bankswitch ; indirect jump to Func_738a1 (738a1 (1c:78a1))
+ jp Func_214e8
+
+Func_216be: ; 216be (8:56be)
+ ld a, l
+ ld [$cf8b], a
+ ld a, h
+ ld [$cf8c], a
+ xor a
+ ld [$cf93], a
+ ld [wListMenuID], a ; $cf94
+ inc a ; MONSTER_NAME
+ ld [W_LISTTYPE], a
+ ld a, [$cc2b]
+ ld [wCurrentMenuItem], a ; $cc26
+ call DisplayListMenuID
+ ld a, [wCurrentMenuItem] ; $cc26
+ ld [$cc2b], a
+ ret
+
+BillsPCMenuText: ; 216e1 (8:56e1)
+ db "WITHDRAW ",$4a,$4e,"DEPOSIT ",$4a,$4e,"RELEASE ",$4a,$4e,"CHANGE BOX",$4e,"SEE YA!@"
+
+BoxNoPCText: ; 21713 (8:5713)
+ db "BOX No.@"
+
+Func_2171b: ; 2171b (8:571b)
+ ld hl, $d173
+ ld bc, $002c
+ jr .asm_21729 ; 0x21721 $6
+ ld hl, $da9e
+ ld bc, $0021
+.asm_21729
+ ld a, [$cf92]
+ call AddNTimes
+ ld b, $4
+.asm_21731
+ ld a, [hli]
+ push hl
+ push bc
+ ld hl, HMMoveArray ; $5745
+ ld de, $0001
+ call IsInArray
+ pop bc
+ pop hl
+ ret c
+ dec b
+ jr nz, .asm_21731 ; 0x21741 $ee
+ and a
+ ret
+
+HMMoveArray: ; 21745 (8:5745)
+ db CUT
+ db FLY
+ db SURF
+ db STRENGTH
+ db FLASH
+ db $ff
+
+Func_2174b: ; 2174b (8:574b)
+ FuncCoord 9, 10 ; $c471
+ ld hl, Coord
+ ld b, $6
+ ld c, $9
+ call TextBoxBorder
+ ld a, [$ccd3]
+ and a
+ ld de, DepositPCText ; $57cb
+ jr nz, .asm_21761
+ ld de, WithdrawPCText ; $57d3
+.asm_21761
+ FuncCoord 11, 12 ; $c49b
+ ld hl, Coord
+ call PlaceString
+ FuncCoord 11, 14 ; $c4c3
+ ld hl, Coord
+ ld de, StatsCancelPCText ; $57dc
+ call PlaceString
+ ld hl, wTopMenuItemY ; $cc24
+ ld a, $c
+ ld [hli], a
+ ld a, $a
+ ld [hli], a
+ xor a
+ ld [hli], a
+ inc hl
+ ld a, $2
+ ld [hli], a
+ ld a, $3
+ ld [hli], a
+ xor a
+ ld [hl], a
+ ld hl, wListScrollOffset ; $cc36
+ ld [hli], a
+ ld [hl], a
+ ld [wPlayerMonNumber], a ; $cc2f
+ ld [$cc2b], a
+.asm_2178f
+ call HandleMenuInput
+ bit 1, a
+ jr nz, .asm_2179f
+ ld a, [wCurrentMenuItem] ; $cc26
+ and a
+ jr z, .asm_217a1
+ dec a
+ jr z, .asm_217a3
+.asm_2179f
+ and a
+ ret
+.asm_217a1
+ scf
+ ret
+.asm_217a3
+ call SaveScreenTilesToBuffer1
+ ld a, [$ccd3]
+ and a
+ ld a, $0
+ jr nz, .asm_217b0
+ ld a, $2
+.asm_217b0
+ ld [$cc49], a
+ ld a, $36
+ call Predef ; indirect jump to StatusScreen (12953 (4:6953))
+ ld a, $37
+ call Predef ; indirect jump to StatusScreen2 (12b57 (4:6b57))
+ call LoadScreenTilesFromBuffer1
+ call ReloadTilesetTilePatterns
+ call GoPAL_SET_CF1C
+ call LoadGBPal
+ jr .asm_2178f
+
+DepositPCText: ; 217cb (8:57cb)
+ db "DEPOSIT@"
+
+WithdrawPCText: ; 217d3 (8:57d3)
+ db "WITHDRAW@"
+
+StatsCancelPCText: ; 217dc (8:57dc)
+ db "STATS",$4e,"CANCEL@"
+
+SwitchOnText: ; 0x217e9
+ TX_FAR _SwitchOnText
+ db "@"
+
+WhatText: ; 0x217ee
+ TX_FAR _WhatText
+ db "@"
+
+DepositWhichMonText: ; 0x217f3
+ TX_FAR _DepositWhichMonText
+ db "@"
+
+MonWasStoredText: ; 0x217f8
+ TX_FAR _MonWasStoredText
+ db "@"
+
+CantDepositLastMonText: ; 0x217fd
+ TX_FAR _CantDepositLastMonText
+ db "@"
+
+BoxFullText: ; 0x21802
+ TX_FAR _BoxFullText
+ db "@"
+
+MonIsTakenOutText: ; 0x21807
+ TX_FAR _MonIsTakenOutText
+ db "@"
+
+NoMonText: ; 0x2180c
+ TX_FAR _NoMonText
+ db "@"
+
+CantTakeMonText: ; 0x21811
+ TX_FAR _CantTakeMonText
+ db "@"
+
+ReleaseWhichMonText: ; 0x21816
+ TX_FAR _ReleaseWhichMonText
+ db "@"
+
+OnceReleasedText: ; 0x2181b
+ TX_FAR _OnceReleasedText
+ db "@"
+
+MonWasReleasedText: ; 0x21820
+ TX_FAR _MonWasReleasedText
+ db "@"
+
+Func_21825: ; 5824 (8:5825)
+ ld a, [$ff00+$aa]
+ cp $1
+ ret z
+ ld a, [$c109]
+ cp $c
+ ret nz
+ ld a, [$d35e]
+ cp $ef
+ ld a, $2
+ jr z, .asm_2183a
+ inc a
+.asm_2183a
+ ld [$d12b], a
+ call EnableAutoTextBoxDrawing
+ ld a, $22
+ jp Func_3ef5
+
+Func_21845: ; 5845 (8:5845)
+ ld a, [$ff00+$aa]
+ cp $2
+ ret z
+ ld a, [$c109]
+ cp $8
+ ret nz
+ ld a, [$d35e]
+ cp $ef
+ ld a, $2
+ jr z, .asm_2185a
+ inc a
+.asm_2185a
+ ld [$d12b], a
+ call EnableAutoTextBoxDrawing
+ ld a, $22
+ jp Func_3ef5
+
+UnnamedText_21865: ; 21865 (8:5865)
+ TX_FAR _UnnamedText_21865
+ db "@"
+
+ ld a, [$c109]
+ cp $4
+ ret nz
+ call EnableAutoTextBoxDrawing
+ ld a, $23
+ jp Func_3ef5
+
+Unknown_21878: ; 21878 (8:5878)
+ db $FD
+