diff options
-rw-r--r-- | audio/engine_2.asm | 1659 | ||||
-rw-r--r-- | audio/sfx/pokeflute_ch1_ch2.asm | 4 | ||||
-rw-r--r-- | audio/sfx/swap_2.asm | 11 | ||||
-rw-r--r-- | constants.asm | 1 | ||||
-rw-r--r-- | constants/tx_pre_constants.asm | 70 | ||||
-rw-r--r-- | engine/menu/bills_pc.asm | 162 | ||||
-rw-r--r-- | home/audio.asm | 10 | ||||
-rw-r--r-- | macros.asm | 6 | ||||
-rwxr-xr-x | yellow/audio.asm | 226 | ||||
-rwxr-xr-x | yellow/main.asm | 40 |
10 files changed, 619 insertions, 1570 deletions
diff --git a/audio/engine_2.asm b/audio/engine_2.asm index e70a305f..e2f12bdc 100644 --- a/audio/engine_2.asm +++ b/audio/engine_2.asm @@ -1,1341 +1,214 @@ -; The second of three duplicated sound engines. - -Audio2_UpdateMusic:: ; 21879 (8:5879) - ld c, CH0 -.loop - ld b, $0 - ld hl, wChannelSoundIDs - add hl, bc - ld a, [hl] - and a - jr z, .nextChannel - ld a, c - cp CH4 - jr nc, .applyAffects ; if sfx channel - ld a, [wMuteAudioAndPauseMusic] - and a - jr z, .applyAffects - bit 7, a - jr nz, .nextChannel - set 7, a - ld [wMuteAudioAndPauseMusic], a - xor a - ld [rNR51], a - ld [rNR30], a - ld a, $80 - ld [rNR30], a - jr .nextChannel -.applyAffects - call Audio2_ApplyMusicAffects -.nextChannel - ld a, c - inc c - cp CH7 - jr nz, .loop - ret +Audio2_PlaySound:: ; 218bb (8:58bb) + ld [wSoundID], a + ld a, [wSoundID] + cp $ff + jp z, Audio2_2193c + cp $e9 + jp z, Audio2_218db + jp c, Audio2_218db + cp $fe + jr z, .asm_218d5 + jp nc, Audio2_218db +.asm_218d5 + call Func_22aa + jp Audio2_21940 -; this routine checks flags for music effects currently applied -; to the channel and calls certain functions based on flags. -; known flags for wChannelFlags1: -; 0: toggleperfectpitch has been used -; 1: call has been used -; 3: a toggle used only by this routine for vibrato -; 4: pitchbend flag -; 6: dutycycle flag -Audio2_ApplyMusicAffects: ; 218ae (8:58ae) - ld b, $0 - ld hl, wChannelNoteDelayCounters ; delay until next note - add hl, bc +Audio2_218db: ; 218db (8:58db) + ld l, a + ld e, a + ld h, $0 + ld d, h + add hl, hl + add hl, de + ld de, SFX_Headers_2 + add hl, de + ld a, h + ld [wSfxHeaderPointer], a + ld a, l + ld [wSfxHeaderPointer + 1], a ld a, [hl] - cp $1 ; if the delay is 1, play next note - jp z, Audio2_PlayNextNote - dec a ; otherwise, decrease the delay timer - ld [hl], a + and $c0 + rlca + rlca + ld c, a +.asm_218f4 + ld d, c ld a, c - cp CH4 - jr nc, .startChecks ; if a sfx channel - ld hl, wChannelSoundIDs + CH4 - add hl, bc - ld a, [hl] - and a - jr z, .startChecks - ret -.startChecks - ld hl, wChannelFlags1 - add hl, bc - bit 6, [hl] ; dutycycle - jr z, .checkForExecuteMusic - call Audio2_ApplyDutyCycle -.checkForExecuteMusic + add a + add c + ld c, a ld b, $0 - ld hl, wChannelFlags2 - add hl, bc - bit 0, [hl] - jr nz, .checkForPitchBend - ld hl, wChannelFlags1 - add hl, bc - bit 2, [hl] - jr nz, .disablePitchBendVibrato -.checkForPitchBend - ld hl, wChannelFlags1 - add hl, bc - bit 4, [hl] ; pitchbend - jr z, .checkVibratoDelay - jp Audio2_ApplyPitchBend -.checkVibratoDelay - ld hl, wChannelVibratoDelayCounters ; vibrato delay - add hl, bc - ld a, [hl] - and a ; check if delay is over - jr z, .checkForVibrato - dec [hl] ; otherwise, dec delay -.disablePitchBendVibrato - ret -.checkForVibrato - ld hl, wChannelVibratoExtents ; vibrato rate - add hl, bc - ld a, [hl] - and a - jr nz, .vibrato - ret ; no vibrato -.vibrato - ld d, a - ld hl, wChannelVibratoRates + ld a, [wSfxHeaderPointer] + ld h, a + ld a, [wSfxHeaderPointer + 1] + ld l, a add hl, bc + ld c, d ld a, [hl] and $f - and a - jr z, .vibratoAlreadyDone - dec [hl] ; apply vibrato pitch change - ret -.vibratoAlreadyDone + ld e, a + ld d, $0 + ld hl, wChannelSoundIDs + add hl, de ld a, [hl] - swap [hl] - or [hl] - ld [hl], a ; reset the vibrato value and start again - ld hl, wChannelFrequencyLowBytes - add hl, bc - ld e, [hl] ; get note pitch - ld hl, wChannelFlags1 - add hl, bc - bit 3, [hl] ; this is the only code that sets/resets bit three so - jr z, .unset ; it continuously alternates which path it takes - res 3, [hl] - ld a, d - and $f - ld d, a + and a + jr z, .asm_21930 ld a, e - sub d - jr nc, .noCarry - ld a, $0 -.noCarry - jr .done -.unset - set 3, [hl] - ld a, d - and $f0 - swap a - add e - jr nc, .done - ld a, $ff -.done - ld d, a - ld b, $3 - call Audio2_21ff7 - ld [hl], d + cp $7 + jr nz, .asm_21927 + ld a, [wSoundID] + cp $14 + jr nc, .asm_21920 ret - -; this routine executes all music commands that take up no time, -; like tempo changes, duty changes etc. and doesn't return -; until the first note is reached -Audio2_PlayNextNote: ; 21946 (8:5946) - ld hl, wChannelVibratoDelayCounterReloadValues - add hl, bc +.asm_21920 ld a, [hl] - ld hl, wChannelVibratoDelayCounters - add hl, bc - ld [hl], a - ld hl, wChannelFlags1 - add hl, bc - res 4, [hl] - res 5, [hl] - ld a, c - cp CH4 - jr nz, .beginChecks - ld a, [wLowHealthAlarm] ;low health alarm enabled? - bit 7, a - ret nz -.beginChecks - call Audio2_endchannel + cp $14 + jr z, .asm_21930 + jr c, .asm_21930 +.asm_21927 + ld a, [wSoundID] + cp [hl] + jr z, .asm_21930 + jr c, .asm_21930 ret - -Audio2_endchannel: ; 21967 (8:5967) - call Audio2_GetNextMusicByte - ld d, a - cp $ff ; is this command an endchannel? - jp nz, Audio2_callchannel ; no - ld b, $0 ; yes - ld hl, wChannelFlags1 - add hl, bc - bit 1, [hl] - jr nz, .returnFromCall +.asm_21930 + call Func_22c0 ld a, c - cp CH3 - jr nc, .noiseOrSfxChannel - jr .asm_219c0 -.noiseOrSfxChannel - res 2, [hl] - ld hl, wChannelFlags2 - add hl, bc - res 0, [hl] - cp CH6 - jr nz, .notSfxChannel3 - ld a, $0 - ld [rNR30], a - ld a, $80 - ld [rNR30], a -.notSfxChannel3 - jr nz, .asm_219a3 - ld a, [wDisableChannelOutputWhenSfxEnds] and a - jr z, .asm_219a3 - xor a - ld [wDisableChannelOutputWhenSfxEnds], a - jr .asm_219c0 -.asm_219a3 - jr .asm_219c9 -.returnFromCall - res 1, [hl] - ld d, $0 - ld a, c - add a - ld e, a - ld hl, wChannelCommandPointers - add hl, de - push hl ; store current channel address - ld hl, wChannelReturnAddresses - add hl, de - ld e, l - ld d, h - pop hl - ld a, [de] - ld [hli], a - inc de - ld a, [de] - ld [hl], a ; loads channel address to return to - jp Audio2_endchannel -.asm_219c0 - ld hl, Unknown_222de - add hl, bc - ld a, [rNR51] - and [hl] - ld [rNR51], a -.asm_219c9 - ld a, [wChannelSoundIDs + CH4] - cp $14 - jr nc, .asm_219d2 - jr .asm_219ef -.asm_219d2 - ld a, [wChannelSoundIDs + CH4] - cp $86 - jr z, .asm_219ef - jr c, .asm_219dd - jr .asm_219ef -.asm_219dd - ld a, c - cp CH4 - jr z, .asm_219e6 - call Audio2_21e6d - ret c -.asm_219e6 - ld a, [wSavedVolume] - ld [rNR50], a - xor a - ld [wSavedVolume], a -.asm_219ef - ld hl, wChannelSoundIDs - add hl, bc - ld [hl], b + jp z, Audio2_21940 + dec c + jp .asm_218f4 + +Audio2_2193c: ; 2193c (8:593c) + call Func_22d6 ret -Audio2_callchannel: ; 219f5 (8:59f5) - cp $fd ; is this command a callchannel? - jp nz, Audio2_loopchannel ; no - call Audio2_GetNextMusicByte ; yes - push af - call Audio2_GetNextMusicByte - ld d, a - pop af - ld e, a - push de ; store pointer - ld d, $0 - ld a, c - add a +Audio2_21940: ; 21940 (8:5940) + ld a, [wSoundID] + ld l, a ld e, a - ld hl, wChannelCommandPointers + ld h, $0 + ld d, h + add hl, hl add hl, de - push hl - ld hl, wChannelReturnAddresses + ld de, SFX_Headers_2 add hl, de ld e, l ld d, h - pop hl - ld a, [hli] - ld [de], a - inc de - ld a, [hld] - ld [de], a ; copy current channel address - pop de - ld [hl], e - inc hl - ld [hl], d ; overwrite current address with pointer - ld b, $0 - ld hl, wChannelFlags1 - add hl, bc - set 1, [hl] ; set the call flag - jp Audio2_endchannel - -Audio2_loopchannel: ; 21a2a (8:5a2a) - cp $fe ; is this command a loopchannel? - jp nz, Audio2_notetype ; no - call Audio2_GetNextMusicByte ; yes - ld e, a - and a - jr z, .infiniteLoop - ld b, $0 - ld hl, wChannelLoopCounters - add hl, bc - ld a, [hl] - cp e - jr nz, .loopAgain - ld a, $1 ; if no more loops to make, - ld [hl], a - call Audio2_GetNextMusicByte ; skip pointer - call Audio2_GetNextMusicByte - jp Audio2_endchannel -.loopAgain ; inc loop count - inc a - ld [hl], a - ; fall through -.infiniteLoop ; overwrite current address with pointer - call Audio2_GetNextMusicByte - push af - call Audio2_GetNextMusicByte - ld b, a - ld d, $0 - ld a, c - add a - ld e, a ld hl, wChannelCommandPointers - add hl, de - pop af - ld [hli], a - ld [hl], b - jp Audio2_endchannel - -Audio2_notetype: ; 21a65 (8:5a65) - and $f0 - cp $d0 ; is this command a notetype? - jp nz, Audio2_toggleperfectpitch ; no - ld a, d ; yes - and $f - ld b, $0 - ld hl, wChannelNoteSpeeds - add hl, bc - ld [hl], a ; store low nibble as speed - ld a, c - cp CH3 - jr z, .noiseChannel ; noise channel has 0 params - call Audio2_GetNextMusicByte - ld d, a - ld a, c - cp CH2 - jr z, .musicChannel3 - cp CH6 - jr nz, .notChannel3 - ld hl, wSfxWaveInstrument - jr .sfxChannel3 -.musicChannel3 - ld hl, wMusicWaveInstrument -.sfxChannel3 - ld a, d - and $f - ld [hl], a ; store low nibble of param as duty - ld a, d - and $30 - sla a - ld d, a - ; fall through - - ; if channel 3, store high nibble as volume - ; else, store volume (high nibble) and fade (low nibble) -.notChannel3 - ld b, $0 - ld hl, wChannelVolumes - add hl, bc - ld [hl], d -.noiseChannel - jp Audio2_endchannel - -Audio2_toggleperfectpitch: ; 21aa4 (8:5aa4) - ld a, d - cp $e8 ; is this command a toggleperfectpitch? - jr nz, Audio2_vibrato ; no - ld b, $0 ; yes - ld hl, wChannelFlags1 - add hl, bc - ld a, [hl] - xor $1 - ld [hl], a ; flip bit 0 of wChannelFlags1 - jp Audio2_endchannel - -Audio2_vibrato: ; 21ab6 (8:5ab6) - cp $ea ; is this command a vibrato? - jr nz, Audio2_pitchbend ; no - call Audio2_GetNextMusicByte ; yes - ld b, $0 - ld hl, wChannelVibratoDelayCounters - add hl, bc - ld [hl], a ; store delay - ld hl, wChannelVibratoDelayCounterReloadValues - add hl, bc - ld [hl], a ; store delay - call Audio2_GetNextMusicByte - ld d, a - and $f0 - swap a - ld b, $0 - ld hl, wChannelVibratoExtents - add hl, bc - srl a - ld e, a - adc b - swap a - or e - ld [hl], a ; store rate as both high and low nibbles - ld a, d - and $f - ld d, a - ld hl, wChannelVibratoRates - add hl, bc - swap a - or d - ld [hl], a ; store depth as both high and low nibbles - jp Audio2_endchannel - -Audio2_pitchbend: ; 21aee (8:5aee) - cp $eb ; is this command a pitchbend? - jr nz, Audio2_duty ; no - call Audio2_GetNextMusicByte ; yes - ld b, $0 - ld hl, wChannelPitchBendLengthModifiers - add hl, bc - ld [hl], a ; store first param - call Audio2_GetNextMusicByte - ld d, a - and $f0 - swap a - ld b, a - ld a, d - and $f - call Audio2_22017 - ld b, $0 - ld hl, wChannelPitchBendTargetFrequencyHighBytes - add hl, bc - ld [hl], d ; store unknown part of second param - ld hl, wChannelPitchBendTargetFrequencyLowBytes - add hl, bc - ld [hl], e ; store unknown part of second param - ld b, $0 - ld hl, wChannelFlags1 - add hl, bc - set 4, [hl] ; set pitchbend flag - call Audio2_GetNextMusicByte - ld d, a - jp Audio2_notelength - -Audio2_duty: ; 21b26 (8:5b26) - cp $ec ; is this command a duty? - jr nz, Audio2_tempo ; no - call Audio2_GetNextMusicByte ; yes - rrca - rrca - and $c0 - ld b, $0 - ld hl, wChannelDuties - add hl, bc - ld [hl], a ; store duty - jp Audio2_endchannel - -Audio2_tempo: ; 21b3b (8:5b3b) - cp $ed ; is this command a tempo? - jr nz, Audio2_stereopanning ; no - ld a, c ; yes - cp CH4 - jr nc, .sfxChannel - call Audio2_GetNextMusicByte - ld [wMusicTempo], a ; store first param - call Audio2_GetNextMusicByte - ld [wMusicTempo + 1], a ; store second param - xor a - ld [wChannelNoteDelayCountersFractionalPart], a ; clear RAM - ld [wChannelNoteDelayCountersFractionalPart + 1], a - ld [wChannelNoteDelayCountersFractionalPart + 2], a - ld [wChannelNoteDelayCountersFractionalPart + 3], a - jr .musicChannelDone -.sfxChannel - call Audio2_GetNextMusicByte - ld [wSfxTempo], a ; store first param - call Audio2_GetNextMusicByte - ld [wSfxTempo + 1], a ; store second param - xor a - ld [wChannelNoteDelayCountersFractionalPart + 4], a ; clear RAM - ld [wChannelNoteDelayCountersFractionalPart + 5], a - ld [wChannelNoteDelayCountersFractionalPart + 6], a - ld [wChannelNoteDelayCountersFractionalPart + 7], a -.musicChannelDone - jp Audio2_endchannel - -Audio2_stereopanning: ; 21b7b (8:5b7b) - cp $ee ; is this command a stereopanning? - jr nz, Audio2_unknownmusic0xef ; no - call Audio2_GetNextMusicByte ; yes - ld [wStereoPanning], a ; store panning - jp Audio2_endchannel - -; this appears to never be used -Audio2_unknownmusic0xef: ; 21b88 (8:5b88) - cp $ef ; is this command an unknownmusic0xef? - jr nz, Audio2_dutycycle ; no - call Audio2_GetNextMusicByte ; yes - push bc - call Audio2_PlaySound - pop bc - ld a, [wDisableChannelOutputWhenSfxEnds] - and a - jr nz, .skip - ld a, [wChannelSoundIDs + CH7] - ld [wDisableChannelOutputWhenSfxEnds], a - xor a - ld [wChannelSoundIDs + CH7], a -.skip - jp Audio2_endchannel - -Audio2_dutycycle: ; 21ba7 (8:5ba7) - cp $fc ; is this command a dutycycle? - jr nz, Audio2_volume ; no - call Audio2_GetNextMusicByte ; yes - ld b, $0 - ld hl, wChannelDutyCycles - add hl, bc - ld [hl], a ; store full cycle - and $c0 - ld hl, wChannelDuties - add hl, bc - ld [hl], a ; store first duty - ld hl, wChannelFlags1 - add hl, bc - set 6, [hl] ; set dutycycle flag - jp Audio2_endchannel - -Audio2_volume: ; 21bc5 (8:5bc5) - cp $f0 ; is this command a volume? - jr nz, Audio2_executemusic ; no - call Audio2_GetNextMusicByte ; yes - ld [rNR50], a ; store volume - jp Audio2_endchannel - -Audio2_executemusic: ; 21bd1 (8:5bd1) - cp $f8 ; is this command an executemusic? - jr nz, Audio2_octave ; no - ld b, $0 ; yes - ld hl, wChannelFlags2 - add hl, bc - set 0, [hl] - jp Audio2_endchannel - -Audio2_octave: ; 21be0 (8:5be0) - and $f0 - cp $e0 ; is this command an octave? - jr nz, Audio2_unknownsfx0x20 ; no - ld hl, wChannelOctaves ; yes - ld b, $0 - add hl, bc - ld a, d - and $f - ld [hl], a ; store low nibble as octave - jp Audio2_endchannel - -Audio2_unknownsfx0x20: ; 21bf3 - cp $20 ; is this command an unknownsfx0x20? - jr nz, Audio2_unknownsfx0x10 ; no - ld a, c - cp CH3 ; is this a noise or sfx channel? - jr c, Audio2_unknownsfx0x10 ; no - ld b, $0 - ld hl, wChannelFlags2 - add hl, bc - bit 0, [hl] - jr nz, Audio2_unknownsfx0x10 ; no - call Audio2_notelength - ld d, a - ld b, $0 - ld hl, wChannelDuties - add hl, bc - ld a, [hl] - or d - ld d, a - ld b, $1 - call Audio2_21ff7 - ld [hl], d - call Audio2_GetNextMusicByte - ld d, a - ld b, $2 - call Audio2_21ff7 - ld [hl], d - call Audio2_GetNextMusicByte - ld e, a - ld a, c - cp CH7 - ld a, $0 - jr z, .sfxNoiseChannel ; only two params for noise channel - push de - call Audio2_GetNextMusicByte - pop de -.sfxNoiseChannel - ld d, a - push de - call Audio2_21daa - call Audio2_21d79 - pop de - call Audio2_21dcc - ret - -Audio2_unknownsfx0x10: ; 21c40 (8:5c40) - ld a, c - cp CH4 - jr c, Audio2_note ; if not a sfx - ld a, d - cp $10 ; is this command a unknownsfx0x10? - jr nz, Audio2_note ; no - ld b, $0 - ld hl, wChannelFlags2 - add hl, bc - bit 0, [hl] - jr nz, Audio2_note ; no - call Audio2_GetNextMusicByte ; yes - ld [rNR10], a - jp Audio2_endchannel - -Audio2_note: ; 21c5c (8:5c5c) - ld a, c - cp CH3 - jr nz, Audio2_notelength ; if not noise channel - ld a, d - and $f0 - cp $b0 ; is this command a dnote? - jr z, Audio2_dnote ; yes - jr nc, Audio2_notelength ; no - swap a + ld a, [de] ; get channel number ld b, a - ld a, d - and $f - ld d, a + rlca + rlca + and $3 + ld c, a ld a, b - push de - push bc - jr asm_21c7e - -Audio2_dnote: ; 21c76 (8:5c76) - ld a, d and $f + ld b, c + inc b + inc de + ld c, $0 +.asm_21962 + cp c + jr z, .asm_2196a + inc c + inc hl + inc hl + jr .asm_21962 +.asm_2196a push af + push hl push bc - call Audio2_GetNextMusicByte ; get dnote instrument -asm_21c7e - ld d, a - ld a, [wDisableChannelOutputWhenSfxEnds] - and a - jr nz, .asm_21c89 - ld a, d - call Audio2_PlaySound -.asm_21c89 - pop bc - pop de - -Audio2_notelength: ; 21c8b (8:5c8b) - ld a, d - push af - and $f - inc a ld b, $0 - ld e, a ; store note length (in 16ths) - ld d, b - ld hl, wChannelNoteSpeeds - add hl, bc - ld a, [hl] - ld l, b - call Audio2_22006 - ld a, c - cp CH4 - jr nc, .sfxChannel - ld a, [wMusicTempo] - ld d, a - ld a, [wMusicTempo + 1] - ld e, a - jr .skip -.sfxChannel - ld d, $1 - ld e, $0 - cp CH7 - jr z, .skip ; if noise channel - call Audio2_21e2f - ld a, [wSfxTempo] - ld d, a - ld a, [wSfxTempo + 1] - ld e, a -.skip - ld a, l - ld b, $0 - ld hl, wChannelNoteDelayCountersFractionalPart - add hl, bc - ld l, [hl] - call Audio2_22006 - ld e, l - ld d, h - ld hl, wChannelNoteDelayCountersFractionalPart - add hl, bc - ld [hl], e - ld a, d - ld hl, wChannelNoteDelayCounters - add hl, bc - ld [hl], a - ld hl, wChannelFlags2 - add hl, bc - bit 0, [hl] - jr nz, Audio2_notepitch + ld c, a + cp $3 + jr c, .asm_2197a ld hl, wChannelFlags1 add hl, bc - bit 2, [hl] - jr z, Audio2_notepitch + set 2, [hl] +.asm_2197a + pop bc pop hl - ret - -Audio2_notepitch: ; 21ce9 (8:5ce9) + ld a, [de] ; get channel pointer + ld [hli], a + inc de + ld a, [de] + ld [hli], a + inc de pop af - and $f0 - cp $c0 ; compare to rest - jr nz, .notRest - ld a, c - cp CH4 - jr nc, .sfxChannel - ld hl, wChannelSoundIDs + CH4 - add hl, bc - ld a, [hl] - and a - jr nz, .done - ; fall through -.sfxChannel - ld a, c - cp CH2 - jr z, .musicChannel3 - cp CH6 - jr nz, .notSfxChannel3 -.musicChannel3 + push hl + push bc ld b, $0 - ld hl, Unknown_222de + ld c, a + ld hl, wChannelSoundIDs add hl, bc - ld a, [rNR51] - and [hl] - ld [rNR51], a - jr .done -.notSfxChannel3 - ld b, $2 - call Audio2_21ff7 - ld a, $8 - ld [hli], a - inc hl - ld a, $80 + ld a, [wSoundID] ld [hl], a -.done - ret -.notRest - swap a - ld b, $0 - ld hl, wChannelOctaves - add hl, bc - ld b, [hl] - call Audio2_22017 - ld b, $0 - ld hl, wChannelFlags1 - add hl, bc - bit 4, [hl] - jr z, .asm_21d39 - call Audio2_21f4e -.asm_21d39 - push de - ld a, c - cp CH4 - jr nc, .skip ; if sfx channel - ld hl, wChannelSoundIDs + CH4 - ld d, $0 - ld e, a - add hl, de - ld a, [hl] - and a - jr nz, .asm_21d4c - jr .skip -.asm_21d4c - pop de - ret -.skip - ld b, $0 - ld hl, wChannelVolumes - add hl, bc - ld d, [hl] - ld b, $2 - call Audio2_21ff7 - ld [hl], d - call Audio2_21daa - call Audio2_21d79 - pop de - ld b, $0 - ld hl, wChannelFlags1 - add hl, bc - bit 0, [hl] ; has toggleperfectpitch been used? - jr z, .skip2 - inc e ; if yes, increment the pitch by 1 - jr nc, .skip2 - inc d -.skip2 - ld hl, wChannelFrequencyLowBytes - add hl, bc - ld [hl], e - call Audio2_21dcc - ret - -Audio2_21d79: ; 21d79 (8:5d79) - ld b, $0 - ld hl, Unknown_222e6 - add hl, bc - ld a, [rNR51] - or [hl] - ld d, a - ld a, c - cp CH7 - jr z, .sfxNoiseChannel - cp CH4 - jr nc, .skip ; if sfx channel - ld hl, wChannelSoundIDs + CH4 - add hl, bc - ld a, [hl] + pop bc + pop hl + inc c + dec b + ld a, b and a - jr nz, .skip -.sfxNoiseChannel - ld a, [wStereoPanning] - ld hl, Unknown_222e6 - add hl, bc - and [hl] - ld d, a - ld a, [rNR51] - ld hl, Unknown_222de - add hl, bc - and [hl] - or d - ld d, a -.skip - ld a, d - ld [rNR51], a - ret - -Audio2_21daa: ; 21daa (8:5daa) - ld b, $0 - ld hl, wChannelNoteDelayCounters - add hl, bc - ld d, [hl] - ld a, c - cp CH2 - jr z, .channel3 ; if music channel 3 - cp CH6 - jr z, .channel3 ; if sfx channel 3 - ld a, d - and $3f - ld d, a - ld hl, wChannelDuties - add hl, bc - ld a, [hl] - or d - ld d, a -.channel3 - ld b, $1 - call Audio2_21ff7 - ld [hl], d - ret - -Audio2_21dcc: ; 21dcc (8:5dcc) - ld a, c - cp CH2 - jr z, .channel3 - cp CH6 - jr nz, .notSfxChannel3 - ; fall through -.channel3 - push de - ld de, wMusicWaveInstrument - cp CH2 - jr z, .musicChannel3 - ld de, wSfxWaveInstrument -.musicChannel3 - ld a, [de] - add a - ld d, $0 - ld e, a - ld hl, Audio2_WavePointers - add hl, de - ld e, [hl] - inc hl - ld d, [hl] - ld hl, $ff30 - ld b, $f - ld a, $0 - ld [rNR30], a -.loop ld a, [de] inc de + jr nz, .asm_21962 + ld a, [wSoundID] + cp $14 + jr nc, .asm_219a3 + jr .asm_219cd +.asm_219a3 + ld a, [wSoundID] + cp $86 + jr z, .asm_219cd + jr c, .asm_219ae + jr .asm_219cd +.asm_219ae + ld hl, wChannelSoundIDs + CH4 + ld [hli], a + ld [hli], a ld [hli], a - ld a, b - dec b - and a - jr nz, .loop - ld a, $80 - ld [rNR30], a - pop de -.notSfxChannel3 - ld a, d - or $80 - and $c7 - ld d, a - ld b, $3 - call Audio2_21ff7 - ld [hl], e - inc hl - ld [hl], d - ld a, c - cp CH4 - jr c, .musicChannel - call Audio2_21e56 -.musicChannel - ret - -Audio2_21e19: ; 21e19 (8:5e19) - ld a, c - cp CH4 - jr nz, .asm_21e2e - ld a, [wLowHealthAlarm] - bit 7, a - jr z, .asm_21e2e - xor a - ld [wFrequencyModifier], a - ld a, $80 - ld [wTempoModifier], a -.asm_21e2e - ret - -Audio2_21e2f: ; 21e2f (8:5e2f) - call Audio2_21e8b - jr c, .asm_21e39 - call Audio2_21e9f - jr nc, .asm_21e4c -.asm_21e39 - ld d, $0 - ld a, [wTempoModifier] - add $80 - jr nc, .asm_21e43 - inc d -.asm_21e43 - ld [wSfxTempo + 1], a - ld a, d - ld [wSfxTempo], a - jr .asm_21e55 -.asm_21e4c - xor a - ld [wSfxTempo + 1], a - ld a, $1 - ld [wSfxTempo], a -.asm_21e55 - ret - -Audio2_21e56: ; 21e56 (8:5e56) - call Audio2_21e8b - jr c, .asm_21e60 - call Audio2_21e9f - jr nc, .asm_21e6c -.asm_21e60 - ld a, [wFrequencyModifier] - add e - jr nc, .asm_21e67 - inc d -.asm_21e67 - dec hl - ld e, a - ld [hl], e - inc hl - ld [hl], d -.asm_21e6c - ret - -Audio2_21e6d: ; 21e6d (8:5e6d) - call Audio2_21e8b - jr nc, .asm_21e88 - ld hl, wChannelCommandPointers - ld e, c - ld d, $0 - sla e - rl d - add hl, de - ld a, [hl] - sub $1 ld [hl], a + ld hl, wChannelCommandPointers + CH6 * 2 ; sfx noise channel pointer + ld de, Noise2_endchannel + ld [hl], e inc hl - ld a, [hl] - sbc $0 - ld [hl], a - scf - ret -.asm_21e88 - scf - ccf - ret - -Audio2_21e8b: ; 21e8b (8:5e8b) - ld a, [wChannelSoundIDs + CH4] - cp $14 - jr nc, .asm_21e94 - jr .asm_21e9a -.asm_21e94 - cp $86 - jr z, .asm_21e9a - jr c, .asm_21e9d -.asm_21e9a - scf - ccf - ret -.asm_21e9d - scf + ld [hl], d ; overwrite pointer to point to endchannel + ld a, [wSavedVolume] + and a + jr nz, .asm_219cd + ld a, [rNR50] + ld [wSavedVolume], a + ld a, $77 + ld [rNR50], a +.asm_219cd ret -Audio2_21e9f: ; 21e9f (8:5e9f) - ld a, [wChannelSoundIDs + CH7] - ld b, a - ld a, [wChannelSoundIDs + CH4] - or b - cp $9d - jr nc, .asm_21ead - jr .asm_21eb3 -.asm_21ead - cp $ea - jr z, .asm_21eb3 - jr c, .asm_21eb6 -.asm_21eb3 - scf - ccf - ret -.asm_21eb6 - scf - ret +Noise2_endchannel: ; 222d5 (8:62d5) + endchannel -Audio2_ApplyPitchBend: ; 21eb8 (8:5eb8) - ld hl, wChannelFlags1 - add hl, bc - bit 5, [hl] - jp nz, .asm_21eff - ld hl, wChannelPitchBendCurrentFrequencyLowBytes - add hl, bc - ld e, [hl] - ld hl, wChannelPitchBendCurrentFrequencyHighBytes - add hl, bc - ld d, [hl] - ld hl, wChannelPitchBendFrequencySteps - add hl, bc - ld l, [hl] - ld h, b - add hl, de - ld d, h - ld e, l - ld hl, wChannelPitchBendCurrentFrequencyFractionalPart - add hl, bc - push hl - ld hl, wChannelPitchBendFrequencyStepsFractionalPart - add hl, bc - ld a, [hl] - pop hl - add [hl] - ld [hl], a - ld a, $0 - adc e - ld e, a - ld a, $0 - adc d - ld d, a - ld hl, wChannelPitchBendTargetFrequencyHighBytes - add hl, bc - ld a, [hl] - cp d - jp c, .asm_21f45 - jr nz, .asm_21f32 - ld hl, wChannelPitchBendTargetFrequencyLowBytes - add hl, bc - ld a, [hl] - cp e - jp c, .asm_21f45 - jr .asm_21f32 -.asm_21eff - ld hl, wChannelPitchBendCurrentFrequencyLowBytes - add hl, bc - ld a, [hl] - ld hl, wChannelPitchBendCurrentFrequencyHighBytes - add hl, bc - ld d, [hl] - ld hl, wChannelPitchBendFrequencySteps - add hl, bc - ld e, [hl] - sub e - ld e, a - ld a, d - sbc b - ld d, a - ld hl, wChannelPitchBendFrequencyStepsFractionalPart - add hl, bc - ld a, [hl] - add a - ld [hl], a - ld a, e - sbc b - ld e, a - ld a, d - sbc b - ld d, a - ld hl, wChannelPitchBendTargetFrequencyHighBytes - add hl, bc - ld a, d - cp [hl] - jr c, .asm_21f45 - jr nz, .asm_21f32 - ld hl, wChannelPitchBendTargetFrequencyLowBytes - add hl, bc - ld a, e - cp [hl] - jr c, .asm_21f45 -.asm_21f32 - ld hl, wChannelPitchBendCurrentFrequencyLowBytes - add hl, bc - ld [hl], e - ld hl, wChannelPitchBendCurrentFrequencyHighBytes - add hl, bc - ld [hl], d - ld b, $3 - call Audio2_21ff7 +Music_PokeFluteInBattle:: ; 219cf (8:59cf) + ; begin playing the "caught mon" sound effect + ld a, SFX_CAUGHT_MON + call PlaySoundWaitForCurrent + ; then immediately overwrtie the channel pointers + ld hl, wChannelCommandPointers + CH4 * 2 + ld de, SFX_08_PokeFlute_Ch1 + call Audio2_OverwriteChannelPointer + ld de, SFX_08_PokeFlute_Ch2 + call Audio2_OverwriteChannelPointer + ld de, SFX_08_PokeFlute_Ch3 + +Audio2_OverwriteChannelPointer: ; 219e6 (8:59e6) ld a, e ld [hli], a - ld [hl], d - ret -.asm_21f45 - ld hl, wChannelFlags1 - add hl, bc - res 4, [hl] - res 5, [hl] - ret - -Audio2_21f4e: ; 21f4e (8:5f4e) - ld hl, wChannelPitchBendCurrentFrequencyHighBytes - add hl, bc - ld [hl], d - ld hl, wChannelPitchBendCurrentFrequencyLowBytes - add hl, bc - ld [hl], e - ld hl, wChannelNoteDelayCounters - add hl, bc - ld a, [hl] - ld hl, wChannelPitchBendLengthModifiers - add hl, bc - sub [hl] - jr nc, .asm_21f66 - ld a, $1 -.asm_21f66 - ld [hl], a - ld hl, wChannelPitchBendTargetFrequencyLowBytes - add hl, bc - ld a, e - sub [hl] - ld e, a - ld a, d - sbc b - ld hl, wChannelPitchBendTargetFrequencyHighBytes - add hl, bc - sub [hl] - jr c, .asm_21f82 - ld d, a - ld b, $0 - ld hl, wChannelFlags1 - add hl, bc - set 5, [hl] - jr .asm_21fa5 -.asm_21f82 - ld hl, wChannelPitchBendCurrentFrequencyHighBytes - add hl, bc - ld d, [hl] - ld hl, wChannelPitchBendCurrentFrequencyLowBytes - add hl, bc - ld e, [hl] - ld hl, wChannelPitchBendTargetFrequencyLowBytes - add hl, bc - ld a, [hl] - sub e - ld e, a ld a, d - sbc b - ld d, a - ld hl, wChannelPitchBendTargetFrequencyHighBytes - add hl, bc - ld a, [hl] - sub d - ld d, a - ld b, $0 - ld hl, wChannelFlags1 - add hl, bc - res 5, [hl] -.asm_21fa5 - ld hl, wChannelPitchBendLengthModifiers - add hl, bc -.asm_21fa9 - inc b - ld a, e - sub [hl] - ld e, a - jr nc, .asm_21fa9 - ld a, d - and a - jr z, .asm_21fb7 - dec a - ld d, a - jr .asm_21fa9 -.asm_21fb7 - ld a, e - add [hl] - ld d, b - ld b, $0 - ld hl, wChannelPitchBendFrequencySteps - add hl, bc - ld [hl], d - ld hl, wChannelPitchBendFrequencyStepsFractionalPart - add hl, bc - ld [hl], a - ld hl, wChannelPitchBendCurrentFrequencyFractionalPart - add hl, bc - ld [hl], a - ret - -Audio2_ApplyDutyCycle: ; 21fcc (8:5fcc) - ld b, $0 - ld hl, wChannelDutyCycles - add hl, bc - ld a, [hl] - rlca - rlca - ld [hl], a - and $c0 - ld d, a - ld b, $1 - call Audio2_21ff7 - ld a, [hl] - and $3f - or d - ld [hl], a - ret - -Audio2_GetNextMusicByte: ; 21fe4 (8:5fe4) - ld d, $0 - ld a, c - add a - ld e, a - ld hl, wChannelCommandPointers - add hl, de - ld a, [hli] - ld e, a - ld a, [hld] - ld d, a - ld a, [de] ; get next music command - inc de - ld [hl], e ; store address of next command - inc hl - ld [hl], d - ret - -Audio2_21ff7: ; 21ff7 (8:5ff7) - ld a, c - ld hl, Unknown_222d6 - add l - jr nc, .noCarry - inc h -.noCarry - ld l, a - ld a, [hl] - add b - ld l, a - ld h, $ff - ret - -Audio2_22006: ; 22006 (8:6006) - ld h, $0 -.loop - srl a - jr nc, .noCarry - add hl, de -.noCarry - sla e - rl d - and a - jr z, .done - jr .loop -.done - ret - -Audio2_22017: ; 22017 (8:6017) - ld h, $0 - ld l, a - add hl, hl - ld d, h - ld e, l - ld hl, Audio2_Pitches - add hl, de - ld e, [hl] - inc hl - ld d, [hl] - ld a, b -.loop - cp CH7 - jr z, .done - sra d - rr e - inc a - jr .loop -.done - ld a, $8 - add d - ld d, a + ld [hli], a ret -Audio2_PlaySound:: ; 22035 (8:6035) - ld [wSoundID], a - cp $ff - jp z, Audio2_221f3 - cp $e9 - jp z, Audio2_2210d - jp c, Audio2_2210d - cp $fe - jr z, .asm_2204c - jp nc, Audio2_2210d -.asm_2204c +INCLUDE "audio/sfx/pokeflute_ch1_ch2.asm" + +Audio2_219f8:: ; 219f8 (8:59f8) xor a ld [wUnusedC000], a ld [wDisableChannelOutputWhenSfxEnds], a @@ -1406,67 +279,9 @@ Audio2_PlaySound:: ; 22035 (8:6035) ld [rNR30], a ld a, $77 ld [rNR50], a - jp Audio2_2224e - -Audio2_2210d: ; 2210d (8:610d) - ld l, a - ld e, a - ld h, $0 - ld d, h - add hl, hl - add hl, de - ld de, SFX_Headers_2 - add hl, de - ld a, h - ld [wSfxHeaderPointer], a - ld a, l - ld [wSfxHeaderPointer + 1], a - ld a, [hl] - and $c0 - rlca - rlca - ld c, a -.asm_22126 - ld d, c - ld a, c - add a - add c - ld c, a - ld b, $0 - ld a, [wSfxHeaderPointer] - ld h, a - ld a, [wSfxHeaderPointer + 1] - ld l, a - add hl, bc - ld c, d - ld a, [hl] - and $f - ld e, a - ld d, $0 - ld hl, wChannelSoundIDs - add hl, de - ld a, [hl] - and a - jr z, .asm_22162 - ld a, e - cp $7 - jr nz, .asm_22159 - ld a, [wSoundID] - cp $14 - jr nc, .asm_22152 ret -.asm_22152 - ld a, [hl] - cp $14 - jr z, .asm_22162 - jr c, .asm_22162 -.asm_22159 - ld a, [wSoundID] - cp [hl] - jr z, .asm_22162 - jr c, .asm_22162 - ret -.asm_22162 + +Audio2_21ab7:: ; 21ab7 (8:5ab7) xor a push de ld h, d @@ -1549,17 +364,12 @@ Audio2_2210d: ; 2210d (8:610d) ld [hl], a ld a, e cp $4 - jr nz, .asm_221ea + ret nz ld a, $8 ld [rNR10], a -.asm_221ea - ld a, c - and a - jp z, Audio2_2224e - dec c - jp .asm_22126 + ret -Audio2_221f3: ; 221f3 (8:61f3) +Audio2_21b3f:: ; 21b3f (8:5b3f) ld a, $80 ld [rNR52], a ld [rNR30], a @@ -1585,7 +395,7 @@ Audio2_221f3: ; 221f3 (8:61f3) ld [wSfxTempo + 1], a ld [wMusicWaveInstrument], a ld [wSfxWaveInstrument], a - ld d, $a0 + ld d, $b0 ld hl, wChannelCommandPointers call FillAudioRAM2 ld a, $1 @@ -1597,138 +407,11 @@ Audio2_221f3: ; 221f3 (8:61f3) ld a, $ff ld [wStereoPanning], a ret - -; fills d bytes at hl with a -FillAudioRAM2: ; 22248 (8:6248) + +FillAudioRAM2: ; 21b94 (8:5b94) ld b, d .loop ld [hli], a dec b jr nz, .loop - ret - -Audio2_2224e: ; 2224e (8:624e) - ld a, [wSoundID] - ld l, a - ld e, a - ld h, $0 - ld d, h - add hl, hl - add hl, de - ld de, SFX_Headers_2 - add hl, de - ld e, l - ld d, h - ld hl, wChannelCommandPointers - ld a, [de] ; get channel number - ld b, a - rlca - rlca - and $3 - ld c, a - ld a, b - and $f - ld b, c - inc b - inc de - ld c, $0 -.asm_22270 - cp c - jr z, .asm_22278 - inc c - inc hl - inc hl - jr .asm_22270 -.asm_22278 - push hl - push bc - push af - ld b, $0 - ld c, a - ld hl, wChannelSoundIDs - add hl, bc - ld a, [wSoundID] - ld [hl], a - pop af - cp $3 - jr c, .asm_22291 - ld hl, wChannelFlags1 - add hl, bc - set 2, [hl] -.asm_22291 - pop bc - pop hl - ld a, [de] ; get channel pointer - ld [hli], a - inc de - ld a, [de] - ld [hli], a - inc de - inc c - dec b - ld a, b - and a - ld a, [de] - inc de - jr nz, .asm_22270 - ld a, [wSoundID] - cp $14 - jr nc, .asm_222aa - jr .asm_222d4 -.asm_222aa - ld a, [wSoundID] - cp $86 - jr z, .asm_222d4 - jr c, .asm_222b5 - jr .asm_222d4 -.asm_222b5 - ld hl, wChannelSoundIDs + CH4 - ld [hli], a - ld [hli], a - ld [hli], a - ld [hl], a - ld hl, wChannelCommandPointers + CH6 * 2 ; sfx noise channel pointer - ld de, Noise2_endchannel - ld [hl], e - inc hl - ld [hl], d ; overwrite pointer to point to endchannel - ld a, [wSavedVolume] - and a - jr nz, .asm_222d4 - ld a, [rNR50] - ld [wSavedVolume], a - ld a, $77 - ld [rNR50], a -.asm_222d4 - ret - -Noise2_endchannel: ; 222d5 (8:62d5) - endchannel - -Unknown_222d6: ; 222d6 (8:62d6) - db $10, $15, $1A, $1F ; channels 0-3 - db $10, $15, $1A, $1F ; channels 4-7 - -Unknown_222de: ; 222de (8:62de) - db $EE, $DD, $BB, $77 ; channels 0-3 - db $EE, $DD, $BB, $77 ; channels 4-7 - -Unknown_222e6: ; 222e6 (8:62e6) - db $11, $22, $44, $88 ; channels 0-3 - db $11, $22, $44, $88 ; channels 4-7 - -Audio2_Pitches: ; 222ee (8:62ee) - dw $F82C ; C_ - dw $F89D ; C# - dw $F907 ; D_ - dw $F96B ; D# - dw $F9CA ; E_ - dw $FA23 ; F_ - dw $FA77 ; F# - dw $FAC7 ; G_ - dw $FB12 ; G# - dw $FB58 ; A_ - dw $FB9B ; A# - dw $FBDA ; B_ - - + ret
\ No newline at end of file diff --git a/audio/sfx/pokeflute_ch1_ch2.asm b/audio/sfx/pokeflute_ch1_ch2.asm index 4ccf89d8..d912b168 100644 --- a/audio/sfx/pokeflute_ch1_ch2.asm +++ b/audio/sfx/pokeflute_ch1_ch2.asm @@ -1,8 +1,8 @@ -SFX_08_PokeFlute_Ch1: ; 22322 (8:6322) +SFX_08_PokeFlute_Ch1: ; 219eb (8:59eb) tempo 256 -SFX_08_PokeFlute_Ch2: ; 22325 (8:6325) +SFX_08_PokeFlute_Ch2: ; 219ee (8:59ee) executemusic notetype 8, 0, 0 rest 5 diff --git a/audio/sfx/swap_2.asm b/audio/sfx/swap_2.asm new file mode 100644 index 00000000..200536ec --- /dev/null +++ b/audio/sfx/swap_2.asm @@ -0,0 +1,11 @@ +SFX_Swap_2_Ch1: ; 20439 (2:4439) + duty 2 + unknownsfx0x20 8, 225, 64, 7 + endchannel + + +SFX_Swap_2_Ch2: ; 20440 (2:4440) + duty 2 + unknownsfx0x20 2, 8, 0, 0 + unknownsfx0x20 8, 177, 65, 7 + endchannel
\ No newline at end of file diff --git a/constants.asm b/constants.asm index 761d5886..7fa691b5 100644 --- a/constants.asm +++ b/constants.asm @@ -31,3 +31,4 @@ INCLUDE "constants/music_constants.asm" INCLUDE "constants/tilesets.asm" INCLUDE "constants/starter_mons.asm" INCLUDE "constants/predef_constants.asm" +INCLUDE "constants/tx_pre_constants.asm"
\ No newline at end of file diff --git a/constants/tx_pre_constants.asm b/constants/tx_pre_constants.asm new file mode 100644 index 00000000..84ed3584 --- /dev/null +++ b/constants/tx_pre_constants.asm @@ -0,0 +1,70 @@ +const_value = 1 + + tx_pre_const CardKeySuccessText ; 01 + tx_pre_const CardKeyFailText ; 02 + tx_pre_const RedBedroomPCText ; 03 + tx_pre_const RedBedroomSNESText ; 04 + tx_pre_const PushStartText ; 05 + tx_pre_const SaveOptionText ; 06 + tx_pre_const StrengthsAndWeaknessesText ; 07 + tx_pre_const OakLabEmailText ; 08 + tx_pre_const AerodactylFossilText ; 09 + tx_pre_const Route15UpstairsBinocularsText ; 0A + tx_pre_const KabutopsFossilText ; 0B + tx_pre_const GymStatueText1 ; 0C + tx_pre_const GymStatueText2 ; 0D + tx_pre_const BookcaseText ; 0E + tx_pre_const ViridianCityPokecenterBenchGuyText ; 0F + tx_pre_const PewterCityPokecenterBenchGuyText ; 10 + tx_pre_const CeruleanCityPokecenterBenchGuyText ; 11 + tx_pre_const LavenderCityPokecenterBenchGuyText ; 12 + tx_pre_const VermilionCityPokecenterBenchGuyText ; 13 + tx_pre_const CeladonCityPokecenterBenchGuyText ; 14 + tx_pre_const CeladonCityHotelText ; 15 + tx_pre_const FuchsiaCityPokecenterBenchGuyText ; 16 + tx_pre_const CinnabarIslandPokecenterBenchGuyText ; 17 + tx_pre_const SaffronCityPokecenterBenchGuyText ; 18 + tx_pre_const MtMoonPokecenterBenchGuyText ; 19 + tx_pre_const RockTunnelPokecenterBenchGuyText ; 1A + tx_pre_const UnusedBenchGuyText1 ; 1B XXX unused + tx_pre_const UnusedBenchGuyText2 ; 1C XXX unused + tx_pre_const UnusedBenchGuyText3 ; 1D XXX unused + tx_pre_const UnusedPredefText ; 1E XXX unused + tx_pre_const PokemonCenterPCText ; 1F + tx_pre_const ViridianSchoolNotebook ; 20 + tx_pre_const ViridianSchoolBlackboard ; 21 + tx_pre_const FakeTextPredef22 + tx_pre_const FakeTextPredef23 + tx_pre_const JustAMomentText ; 22 + tx_pre_const OpenBillsPCText ; 23 + tx_pre_const FoundHiddenItemText ; 24 + tx_pre_const HiddenItemBagFullText ; 25 XXX unused + tx_pre_const VermilionGymTrashText ; 26 + tx_pre_const IndigoPlateauHQText ; 27 + tx_pre_const GameCornerOutOfOrderText ; 28 + tx_pre_const GameCornerOutToLunchText ; 29 + tx_pre_const GameCornerSomeonesKeysText ; 2A + tx_pre_const FoundHiddenCoinsText ; 2B + tx_pre_const DroppedHiddenCoinsText ; 2C + tx_pre_const BillsHouseMonitorText ; 2D + tx_pre_const BillsHouseInitiatedText ; 2E + tx_pre_const BillsHousePokemonList ; 2F + tx_pre_const MagazinesText ; 30 + tx_pre_const CinnabarGymQuiz ; 31 + tx_pre_const GameCornerNoCoinsText ; 32 + tx_pre_const GameCornerCoinCaseText ; 33 + tx_pre_const LinkCableHelp ; 34 + tx_pre_const TMNotebook ; 35 + tx_pre_const FightingDojoText ; 36 + tx_pre_const FightingDojoText_52a10 ; 37 + tx_pre_const FightingDojoText_52a1d ; 38 + tx_pre_const NewBicycleText ; 39 + tx_pre_const IndigoPlateauStatues ; 3A + tx_pre_const VermilionGymTrashSuccesText1 ; 3B + tx_pre_const VermilionGymTrashSuccesText2 ; 3C XXX unused + tx_pre_const VermilionGymTrashSuccesText3 ; 3D + tx_pre_const VermilionGymTrashFailText ; 3E + tx_pre_const TownMapText ; 3F + tx_pre_const BookOrSculptureText ; 40 + tx_pre_const ElevatorText ; 41 + tx_pre_const PokemonStuffText ; 42
\ No newline at end of file diff --git a/engine/menu/bills_pc.asm b/engine/menu/bills_pc.asm index 87595a09..4ee107cd 100644 --- a/engine/menu/bills_pc.asm +++ b/engine/menu/bills_pc.asm @@ -1,34 +1,33 @@ -DisplayPCMainMenu:: ; 213c8 (8:53c8) +DisplayPCMainMenu:: ; 213c8 (8:5378) xor a ld [H_AUTOBGTRANSFERENABLED], a call SaveScreenTilesToBuffer2 ld a, [wNumHoFTeams] and a jr nz, .leaguePCAvailable - CheckEvent EVENT_GOT_POKEDEX + ld a, [wd74b] + bit 5, a jr z, .noOaksPC ld a, [wNumHoFTeams] and a jr nz, .leaguePCAvailable coord hl, 0, 0 - ld b, 8 - ld c, 14 + lb bc, 8, 14 jr .next .noOaksPC coord hl, 0, 0 - ld b, 6 - ld c, 14 + lb bc, 6, 14 jr .next .leaguePCAvailable coord hl, 0, 0 - ld b, 10 - ld c, 14 + lb bc, 10, 14 .next call TextBoxBorder call UpdateSprites ld a, 3 ld [wMaxMenuItem], a - CheckEvent EVENT_MET_BILL + ld a, [wd7f1] + bit 0, a jr nz, .metBill coord hl, 2, 2 ld de, SomeonesPCText @@ -45,7 +44,8 @@ DisplayPCMainMenu:: ; 213c8 (8:53c8) ld h, b ld de, PlayersPCText call PlaceString - CheckEvent EVENT_GOT_POKEDEX + ld a, [wd74b] + bit 5, a jr z, .noOaksPC2 coord hl, 2, 6 ld de, OaksPCText @@ -92,7 +92,7 @@ OaksPCText: db "PROF.OAK's PC@" PKMNLeaguePCText: db $4a, "LEAGUE@" LogOffPCText: db "LOG OFF@" -BillsPC_:: ; 0x214c2 +BillsPC_:: ; 2146f (8:546f) ld hl, wd730 set 6, [hl] xor a @@ -111,7 +111,7 @@ BillsPC_:: ; 0x214c2 ld hl, SwitchOnText call PrintText -BillsPCMenu: ; 214e8 (8:54e8) +BillsPCMenu: ; 21495 (8:5495) ld a, [wParentMenuItem] ld [wCurrentMenuItem], a ld hl, vChars2 + $780 @@ -119,10 +119,13 @@ BillsPCMenu: ; 214e8 (8:54e8) lb bc, BANK(PokeballTileGraphics), $01 call CopyVideoData call LoadScreenTilesFromBuffer2DisableBGTransfer + coord hl, 0, 12 + lb bc, 4, 18 + call TextBoxBorder coord hl, 0, 0 - ld b, 10 - ld c, 12 + lb bc, 12, 12 call TextBoxBorder + call UpdateSprites coord hl, 2, 2 ld de, BillsPCMenuText call PlaceString @@ -133,7 +136,7 @@ BillsPCMenu: ; 214e8 (8:54e8) ld [hli], a ; wTopMenuItemX inc hl inc hl - ld a, 4 + ld a, 5 ld [hli], a ; wMaxMenuItem ld a, A_BUTTON | B_BUTTON ld [hli], a ; wMenuWatchedKeys @@ -144,11 +147,8 @@ BillsPCMenu: ; 214e8 (8:54e8) ld [hli], a ; wListScrollOffset ld [hl], a ; wMenuWatchMovingOutOfBounds ld [wPlayerMonNumber], a - ld hl, WhatText - call PrintText coord hl, 9, 14 - ld b, 2 - ld c, 9 + lb bc, 2, 9 call TextBoxBorder ld a, [wCurrentBoxNum] and $7f @@ -184,8 +184,10 @@ BillsPCMenu: ; 214e8 (8:54e8) jp z, BillsPCRelease ; release cp $3 jp z, BillsPCChangeBox ; change box - -ExitBillsPC: ; 21588 (8:5588) + cp $4 + jp z, BillsPCPrintBox + +ExitBillsPC: ; 2153e (8:553e) ld a, [wFlags_0xcd60] bit 3, a ; accessing Bill's PC through another PC? jr nz, .next @@ -204,7 +206,11 @@ ExitBillsPC: ; 21588 (8:5588) res 6, [hl] ret -BillsPCDeposit: ; 215ac (8:55ac) +BillsPCPrintBox: ; 21562 (8:5562) + callab Func_e8d35 + jp BillsPCMenu + +BillsPCDeposit: ; 2156d (8:556d) ld a, [wPartyCount] dec a jr nz, .partyLargeEnough @@ -222,11 +228,29 @@ BillsPCDeposit: ; 215ac (8:55ac) ld hl, wPartyCount call DisplayMonListMenu jp c, BillsPCMenu + callab Func_fce18 + jr nc, .asm_215ad + call Func_154a + jr z, .asm_215ad + ld hl, SleepingPikachuText2 + call PrintText + jp BillsPCMenu +.asm_215ad call DisplayDepositWithdrawMenu jp nc, BillsPCMenu + callab Func_fce18 + jr nc, .asm_215c9 + ld e, $1b + callab Func_f0000 + jr .asm_215cf +.asm_215c9 ld a, [wcf91] - call GetCryData - call PlaySoundWaitForCurrent + call PlayCry +.asm_215cf + ld hl, Func_f430a + ld b, BANK(Func_f430a) + ld d, $7 + call Bankswitch ld a, PARTY_TO_BOX ld [wMoveMonType], a call MoveMon @@ -253,7 +277,11 @@ BillsPCDeposit: ; 215ac (8:55ac) call PrintText jp BillsPCMenu -BillsPCWithdraw: ; 21618 (8:5618) +SleepingPikachuText2: ; 2160e (8:560e) + TX_FAR _SleepingPikachuText2 + db "@" + +BillsPCWithdraw: ; 21613 (8:5613) ld a, [W_NUMINBOX] and a jr nz, .boxNotEmpty @@ -276,9 +304,15 @@ BillsPCWithdraw: ; 21618 (8:5618) ld a, [wWhichPokemon] ld hl, wBoxMonNicks call GetPartyMonName + callab Func_fce0d + jr nc, .asm_21660 + ld e, $22 + callab Func_f0000 + jr .asm_21666 +.asm_21660 ld a, [wcf91] - call GetCryData - call PlaySoundWaitForCurrent + call PlayCry +.asm_21666 xor a ; BOX_TO_PARTY ld [wMoveMonType], a call MoveMon @@ -290,7 +324,7 @@ BillsPCWithdraw: ; 21618 (8:5618) call PrintText jp BillsPCMenu -BillsPCRelease: ; 21673 (8:5673) +BillsPCRelease: ; 21690 (8:5690) ld a, [W_NUMINBOX] and a jr nz, .loop @@ -301,6 +335,8 @@ BillsPCRelease: ; 21673 (8:5673) ld hl, W_NUMINBOX call DisplayMonListMenu jp c, BillsPCMenu + callab Func_fce0d + jr c, .asm_216cb ld hl, OnceReleasedText call PrintText call YesNoChoice @@ -317,11 +353,21 @@ BillsPCRelease: ; 21673 (8:5673) call PrintText jp BillsPCMenu -BillsPCChangeBox: ; 216b3 (8:56b3) +.asm_216cb + ld a, [wWhichPokemon] + ld hl, wBoxMonNicks + call GetPartyMonName + ld e, $27 + callab Func_f0000 + ld hl, PikachuUnhappyText + call PrintText + jp BillsPCMenu + +BillsPCChangeBox: ; 216e7 (8:56e7) callba ChangeBox jp BillsPCMenu -DisplayMonListMenu: ; 216be (8:56be) +DisplayMonListMenu: ; 216f2 (8:56f2) ld a, l ld [wListPointer], a ld a, h @@ -338,7 +384,7 @@ DisplayMonListMenu: ; 216be (8:56be) ld [wPartyAndBillsPCSavedMenuItem], a ret -BillsPCMenuText: ; 216e1 (8:56e1) +BillsPCMenuText: ; 21715 (8:5715) db "WITHDRAW ", $4a next "DEPOSIT ", $4a next "RELEASE ", $4a @@ -347,10 +393,10 @@ BillsPCMenuText: ; 216e1 (8:56e1) next "SEE YA!" db "@" -BoxNoPCText: ; 21713 (8:5713) +BoxNoPCText: ; 21751 (8:5751) db "BOX No.@" -KnowsHMMove:: ; 2171b (8:571b) +KnowsHMMove:: ; 21759 (8:5759) ; returns whether mon with party index [wWhichPokemon] knows an HM move ld hl, wPartyMon1Moves ld bc, wPartyMon2 - wPartyMon1 @@ -377,18 +423,17 @@ KnowsHMMove:: ; 2171b (8:571b) and a ret -HMMoveArray: ; 21745 (8:5745) +HMMoveArray: ; 21783 (8:5783) db CUT db FLY db SURF db STRENGTH db FLASH - db -1 + db $ff -DisplayDepositWithdrawMenu: ; 2174b (8:574b) +DisplayDepositWithdrawMenu: ; 21789 (8:5789) coord hl, 9, 10 - ld b, 6 - ld c, 9 + lb bc, 6, 9 call TextBoxBorder ld a, [wParentMenuItem] and a ; was the Deposit or Withdraw item selected in the parent menu? @@ -458,55 +503,59 @@ StatsCancelPCText: db "STATS" next "CANCEL@" -SwitchOnText: ; 0x217e9 +SwitchOnText: ; 21826 (8:5826) TX_FAR _SwitchOnText db "@" -WhatText: ; 0x217ee +WhatText: ; 2182b (8:582b) TX_FAR _WhatText db "@" -DepositWhichMonText: ; 0x217f3 +DepositWhichMonText: ; 21830 (8:5830) TX_FAR _DepositWhichMonText db "@" -MonWasStoredText: ; 0x217f8 +MonWasStoredText: ; 21835 (8:5835) TX_FAR _MonWasStoredText db "@" -CantDepositLastMonText: ; 0x217fd +CantDepositLastMonText: ; 2183a (8:583a) TX_FAR _CantDepositLastMonText db "@" -BoxFullText: ; 0x21802 +BoxFullText: ; 2183f (8:583f) TX_FAR _BoxFullText db "@" -MonIsTakenOutText: ; 0x21807 +MonIsTakenOutText: ; 21844 (8:5844) TX_FAR _MonIsTakenOutText db "@" -NoMonText: ; 0x2180c +NoMonText: ; 21849 (8:5849) TX_FAR _NoMonText db "@" -CantTakeMonText: ; 0x21811 +CantTakeMonText: ; 2184e (8:584e) TX_FAR _CantTakeMonText db "@" -ReleaseWhichMonText: ; 0x21816 - TX_FAR _ReleaseWhichMonText +PikachuUnhappyText: ; 21853 (8:5853) + TX_FAR _PikachuUnhappyText db "@" -OnceReleasedText: ; 0x2181b +ReleaseWhichMonText: ; 21858 (8:5858) + TX_FAR _ReleaseWhichMonText + db "@" + +OnceReleasedText: ; 2185d (8:585d) TX_FAR _OnceReleasedText db "@" -MonWasReleasedText: ; 0x21820 +MonWasReleasedText: ; 21862 (8:5862) TX_FAR _MonWasReleasedText db "@" -CableClubLeftGameboy:: ; 5824 (8:5825) +CableClubLeftGameboy:: ; 21867 (8:5867) ld a, [hSerialConnectionStatus] cp USING_EXTERNAL_CLOCK ret z @@ -523,7 +572,7 @@ CableClubLeftGameboy:: ; 5824 (8:5825) call EnableAutoTextBoxDrawing tx_pre_jump JustAMomentText -CableClubRightGameboy:: ; 5845 (8:5845) +CableClubRightGameboy:: ; 21887 (8:5887) ld a, [hSerialConnectionStatus] cp USING_INTERNAL_CLOCK ret z @@ -540,7 +589,7 @@ CableClubRightGameboy:: ; 5845 (8:5845) call EnableAutoTextBoxDrawing tx_pre_jump JustAMomentText -JustAMomentText:: ; 21865 (8:5865) +JustAMomentText:: ; 218a7 (8:58a7) TX_FAR _JustAMomentText db "@" @@ -550,6 +599,5 @@ JustAMomentText:: ; 21865 (8:5865) call EnableAutoTextBoxDrawing tx_pre_jump OpenBillsPCText -OpenBillsPCText:: ; 21878 (8:5878) - db $FD ; FuncTX_BillsPC - +OpenBillsPCText:: ; 218ba (8:58ba) + db $FD ; FuncTX_BillsPC
\ No newline at end of file diff --git a/home/audio.asm b/home/audio.asm index c118652a..004ac32a 100644 --- a/home/audio.asm +++ b/home/audio.asm @@ -253,7 +253,7 @@ Func_22aa:: ; 22aa (0:22aa) push hl push de push bc - homecall Func_219f8 ; 8:59f8 + homecall Audio2_219f8 ; 8:59f8 pop bc pop de pop hl @@ -263,7 +263,7 @@ Func_22c0:: ; 22c0 (0:22c0) push hl push de push bc - homecall Func_21ab7 ; 8:5ab7 + homecall Audio2_21ab7 ; 8:5ab7 pop bc pop de pop hl @@ -273,7 +273,7 @@ Func_22d6:: ; 22d6 (0:22d6) push hl push de push bc - homecall Func_21b3f + homecall Audio2_21b3f pop bc pop de pop hl @@ -291,11 +291,11 @@ Func_22ec:: ; 22ec (0:22ec) call Audio1_PlaySound jr .done .checkForBank08 - cp BANK(Func_218bb) + cp BANK(Audio2_PlaySound) jr nz, .checkForBank1F .bank08 ld a, b - call Func_218bb + call Audio2_PlaySound jr .done .checkForBank1F cp BANK(Func_7d10d) @@ -281,12 +281,16 @@ predef_const: MACRO const \1Predef ENDM +tx_pre_const: MACRO + const \1_id + ENDM + add_tx_pre: MACRO \1_id:: dw \1 ENDM tx_pre_id: MACRO - ld a, (\1_id - TextPredefs) / 2 + 1 + ld a, \1_id ; - TextPredefs) / 2 + 1 ENDM tx_pre: MACRO diff --git a/yellow/audio.asm b/yellow/audio.asm index 97f28491..3313f764 100755 --- a/yellow/audio.asm +++ b/yellow/audio.asm @@ -3,13 +3,20 @@ AUDIO_2 EQU $8 AUDIO_3 EQU $1f INCLUDE "constants.asm" +INCLUDE "charmap.asm" SECTION "Sound Effect Headers 1", ROMX, BANK[AUDIO_1] INCLUDE "audio/headers/sfxheaders1.asm" +SECTION "Sound Effect Headers 2", ROMX, BANK[AUDIO_2] +INCLUDE "audio/headers/sfxheaders2.asm" + SECTION "Music Headers 1", ROMX, BANK[AUDIO_1] INCLUDE "audio/headers/musicheaders1.asm" +SECTION "Music Headers 2", ROMX, BANK[AUDIO_2] +INCLUDE "audio/headers/musicheaders2.asm" + SECTION "Sound Effects 1", ROMX, BANK[AUDIO_1] INCLUDE "audio/sfx/snare1_1.asm" @@ -106,6 +113,130 @@ INCLUDE "audio/sfx/cry20_1.asm" INCLUDE "audio/sfx/cry21_1.asm" INCLUDE "audio/sfx/cry22_1.asm" +SECTION "Sound Effects 2", ROMX, BANK[AUDIO_2] + +INCLUDE "audio/sfx/snare1_2.asm" +INCLUDE "audio/sfx/snare2_2.asm" +INCLUDE "audio/sfx/snare3_2.asm" +INCLUDE "audio/sfx/snare4_2.asm" +INCLUDE "audio/sfx/snare5_2.asm" +INCLUDE "audio/sfx/triangle1_2.asm" +INCLUDE "audio/sfx/triangle2_2.asm" +INCLUDE "audio/sfx/snare6_2.asm" +INCLUDE "audio/sfx/snare7_2.asm" +INCLUDE "audio/sfx/snare8_2.asm" +INCLUDE "audio/sfx/snare9_2.asm" +INCLUDE "audio/sfx/cymbal1_2.asm" +INCLUDE "audio/sfx/cymbal2_2.asm" +INCLUDE "audio/sfx/cymbal3_2.asm" +INCLUDE "audio/sfx/muted_snare1_2.asm" +INCLUDE "audio/sfx/triangle3_2.asm" +INCLUDE "audio/sfx/muted_snare2_2.asm" +INCLUDE "audio/sfx/muted_snare3_2.asm" +INCLUDE "audio/sfx/muted_snare4_2.asm" + +INCLUDE "audio/sfx/press_ab_2.asm" +INCLUDE "audio/sfx/start_menu_2.asm" +INCLUDE "audio/sfx/tink_2.asm" +INCLUDE "audio/sfx/heal_hp_2.asm" +INCLUDE "audio/sfx/heal_ailment_2.asm" +INCLUDE "audio/sfx/silph_scope.asm" +INCLUDE "audio/sfx/ball_toss.asm" +INCLUDE "audio/sfx/ball_poof.asm" +INCLUDE "audio/sfx/faint_thud.asm" +INCLUDE "audio/sfx/run.asm" +INCLUDE "audio/sfx/dex_page_added.asm" +INCLUDE "audio/sfx/swap_2.asm" ; added in yellow +INCLUDE "audio/sfx/pokeflute_ch3.asm" +INCLUDE "audio/sfx/peck.asm" +INCLUDE "audio/sfx/faint_fall.asm" +INCLUDE "audio/sfx/battle_09.asm" +INCLUDE "audio/sfx/pound.asm" +INCLUDE "audio/sfx/battle_0b.asm" +INCLUDE "audio/sfx/battle_0c.asm" +INCLUDE "audio/sfx/battle_0d.asm" +INCLUDE "audio/sfx/battle_0e.asm" +INCLUDE "audio/sfx/battle_0f.asm" +INCLUDE "audio/sfx/damage.asm" +INCLUDE "audio/sfx/not_very_effective.asm" +INCLUDE "audio/sfx/battle_12.asm" +INCLUDE "audio/sfx/battle_13.asm" +INCLUDE "audio/sfx/battle_14.asm" +INCLUDE "audio/sfx/vine_whip.asm" +INCLUDE "audio/sfx/battle_16.asm" +INCLUDE "audio/sfx/battle_17.asm" +INCLUDE "audio/sfx/battle_18.asm" +INCLUDE "audio/sfx/battle_19.asm" +INCLUDE "audio/sfx/super_effective.asm" +INCLUDE "audio/sfx/battle_1b.asm" +INCLUDE "audio/sfx/battle_1c.asm" +INCLUDE "audio/sfx/doubleslap.asm" +INCLUDE "audio/sfx/battle_1e.asm" +INCLUDE "audio/sfx/horn_drill.asm" +INCLUDE "audio/sfx/battle_20.asm" +INCLUDE "audio/sfx/battle_21.asm" +INCLUDE "audio/sfx/battle_22.asm" +INCLUDE "audio/sfx/battle_23.asm" +INCLUDE "audio/sfx/battle_24.asm" +INCLUDE "audio/sfx/battle_25.asm" +INCLUDE "audio/sfx/battle_26.asm" +INCLUDE "audio/sfx/battle_27.asm" +INCLUDE "audio/sfx/battle_28.asm" +INCLUDE "audio/sfx/battle_29.asm" +INCLUDE "audio/sfx/battle_2a.asm" +INCLUDE "audio/sfx/battle_2b.asm" +INCLUDE "audio/sfx/battle_2c.asm" +INCLUDE "audio/sfx/psybeam.asm" +INCLUDE "audio/sfx/battle_2e.asm" +INCLUDE "audio/sfx/battle_2f.asm" +INCLUDE "audio/sfx/psychic_m.asm" +INCLUDE "audio/sfx/battle_31.asm" +INCLUDE "audio/sfx/battle_32.asm" +INCLUDE "audio/sfx/battle_33.asm" +INCLUDE "audio/sfx/battle_34.asm" +INCLUDE "audio/sfx/battle_35.asm" +INCLUDE "audio/sfx/battle_36.asm" +INCLUDE "audio/sfx/unused_2.asm" +INCLUDE "audio/sfx/cry09_2.asm" +INCLUDE "audio/sfx/cry23_2.asm" +INCLUDE "audio/sfx/cry24_2.asm" +INCLUDE "audio/sfx/cry11_2.asm" +INCLUDE "audio/sfx/cry25_2.asm" +INCLUDE "audio/sfx/cry03_2.asm" +INCLUDE "audio/sfx/cry0f_2.asm" +INCLUDE "audio/sfx/cry10_2.asm" +INCLUDE "audio/sfx/cry00_2.asm" +INCLUDE "audio/sfx/cry0e_2.asm" +INCLUDE "audio/sfx/cry06_2.asm" +INCLUDE "audio/sfx/cry07_2.asm" +INCLUDE "audio/sfx/cry05_2.asm" +INCLUDE "audio/sfx/cry0b_2.asm" +INCLUDE "audio/sfx/cry0c_2.asm" +INCLUDE "audio/sfx/cry02_2.asm" +INCLUDE "audio/sfx/cry0d_2.asm" +INCLUDE "audio/sfx/cry01_2.asm" +INCLUDE "audio/sfx/cry0a_2.asm" +INCLUDE "audio/sfx/cry08_2.asm" +INCLUDE "audio/sfx/cry04_2.asm" +INCLUDE "audio/sfx/cry19_2.asm" +INCLUDE "audio/sfx/cry16_2.asm" +INCLUDE "audio/sfx/cry1b_2.asm" +INCLUDE "audio/sfx/cry12_2.asm" +INCLUDE "audio/sfx/cry13_2.asm" +INCLUDE "audio/sfx/cry14_2.asm" +INCLUDE "audio/sfx/cry1e_2.asm" +INCLUDE "audio/sfx/cry15_2.asm" +INCLUDE "audio/sfx/cry17_2.asm" +INCLUDE "audio/sfx/cry1c_2.asm" +INCLUDE "audio/sfx/cry1a_2.asm" +INCLUDE "audio/sfx/cry1d_2.asm" +INCLUDE "audio/sfx/cry18_2.asm" +INCLUDE "audio/sfx/cry1f_2.asm" +INCLUDE "audio/sfx/cry20_2.asm" +INCLUDE "audio/sfx/cry21_2.asm" +INCLUDE "audio/sfx/cry22_2.asm" +;Audio2_WavePointers: INCLUDE "audio/wave_instruments.asm" + SECTION "Audio Engine 1", ROMX, BANK[AUDIO_1] PlayBattleMusic:: ; 9064 (2:5064) @@ -197,6 +328,88 @@ Music_Cities1AlternateTempo:: ; 99f4 (2:59f4) ld de, Music_Cities1_branch_aa6f jp Audio1_OverwriteChannelPointer +SECTION "Audio Engine 2", ROMX, BANK[AUDIO_2] + +Music_DoLowHealthAlarm:: ; 2131e (8:531e) + ld a, [wLowHealthAlarm] + cp $ff + jr z, .disableAlarm + + bit 7, a ;alarm enabled? + ret z ;nope + + and $7f ;low 7 bits are the timer. + jr nz, .asm_21383 ;if timer > 0, play low tone. + + call .playToneHi + ld a, 30 ;keep this tone for 30 frames. + jr .asm_21395 ;reset the timer. + +.asm_21383 + cp 20 + jr nz, .asm_2138a ;if timer == 20, + call .playToneLo ;actually set the sound registers. + +.asm_2138a + ld a, $86 + ld [wChannelSoundIDs + CH4], a ;disable sound channel? + ld a, [wLowHealthAlarm] + and $7f ;decrement alarm timer. + dec a + +.asm_21395 + ; reset the timer and enable flag. + set 7, a + ld [wLowHealthAlarm], a + ret + +.disableAlarm + xor a + ld [wLowHealthAlarm], a ;disable alarm + ld [wChannelSoundIDs + CH4], a ;re-enable sound channel? + ld de, .toneDataSilence + jr .playTone + +;update the sound registers to change the frequency. +;the tone set here stays until we change it. +.playToneHi + ld de, .toneDataHi + jr .playTone + +.playToneLo + ld de, .toneDataLo + +;update sound channel 1 to play the alarm, overriding all other sounds. +.playTone + ld hl, rNR10 ;channel 1 sound register + ld c, $5 + xor a + +.copyLoop + ld [hli], a + ld a, [de] + inc de + dec c + jr nz, .copyLoop + ret + +;bytes to write to sound channel 1 registers for health alarm. +;starting at FF11 (FF10 is always zeroed), so these bytes are: +;length, envelope, freq lo, freq hi +.toneDataHi + db $A0,$E2,$50,$87 + +.toneDataLo + db $B0,$E2,$EE,$86 + +;written to stop the alarm +.toneDataSilence + db $00,$00,$00,$80 + +INCLUDE "engine/menu/bills_pc.asm" + +INCLUDE "audio/engine_2.asm" + SECTION "Music 1", ROMX, BANK[AUDIO_1] Audio1_WavePointers: INCLUDE "audio/wave_instruments.asm" @@ -227,3 +440,16 @@ INCLUDE "audio/music/safarizone.asm" INCLUDE "audio/music/gym.asm" INCLUDE "audio/music/pokecenter.asm" +SECTION "Music 2", ROMX, BANK[AUDIO_2] + +INCLUDE "audio/sfx/unused2_2.asm" +INCLUDE "audio/music/gymleaderbattle.asm" +INCLUDE "audio/music/trainerbattle.asm" +INCLUDE "audio/music/wildbattle.asm" +INCLUDE "audio/music/finalbattle.asm" +INCLUDE "audio/sfx/level_up.asm" +INCLUDE "audio/sfx/get_item2_2.asm" +INCLUDE "audio/sfx/caught_mon.asm" +INCLUDE "audio/music/defeatedtrainer.asm" +INCLUDE "audio/music/defeatedwildmon.asm" +INCLUDE "audio/music/defeatedgymleader.asm"
\ No newline at end of file diff --git a/yellow/main.asm b/yellow/main.asm index e7df8582..77dcc839 100755 --- a/yellow/main.asm +++ b/yellow/main.asm @@ -553,21 +553,20 @@ PrintSafariGameOverText: ; 1e385 (7:6385) CinnabarGymQuiz_1eb0a: ; 1e4bf (7:64bf) dr $1e4bf,$20000 -SECTION "bank08",ROMX,BANK[$08] - - dr $20000,$2131e -Music_DoLowHealthAlarm: ; 2131e (8:531e) - dr $2131e,$2146f -BillsPC_: ; 2146f (8:546f) - dr $2146f,$218bb -Func_218bb: ; 218bb (8:58bb) - dr $218bb,$219f8 -Func_219f8: ; 219f8 (8:59f8) - dr $219f8,$21ab7 -Func_21ab7: ; 21ab7 (8:5ab7) - dr $21ab7,$21b3f -Func_21b3f: ; 21b3f (8:5b3f) - dr $21b3f,$24000 +;SECTION "bank08",ROMX,BANK[$08] + +; dr $20000,$218bb +;Music_DoLowHealthAlarm: ; 2131e (8:531e) +; dr $2131e,$2146f +;BillsPC_: ; 2146f (8:546f) +;Func_218bb: ; 218bb (8:58bb) +; dr $218bb,$219f8 +;Func_219f8: ; 219f8 (8:59f8) +; dr $219f8,$21ab7 +;Func_21ab7: ; 21ab7 (8:5ab7) +; dr $21ab7,$21b3f +;Func_21b3f: ; 21b3f (8:5b3f) +; dr $21b3f,$24000 SECTION "Pics 1", ROMX, BANK[PICS_1] @@ -919,7 +918,12 @@ ReadTrainer: ; 39bb6 (e:5bb6) DrawAllPokeballs: ; 3a8df (e:68df) dr $3a8df,$3a9e9 SetupPlayerAndEnemyPokeballs: ; 3a9e9 (e:69e9) - dr $3a9e9,$3aa68 + dr $3a9e9,$3aa28 + +PokeballTileGraphics:: ; 3aa28 (e:6a28) +; INCBIN "gfx/pokeball.2bpp" +;PokeballTileGraphicsEnd: + dr $3aa28,$3aa68 TradingAnimationGraphics: INCBIN "gfx/game_boy.norepeat.2bpp" @@ -1236,7 +1240,9 @@ SECTION "bank3A",ROMX,BANK[$3A] MonsterNames: ; e8000 (3a:4000) dr $e8000,$e8a5e Func_e8a5e: ; e8a5e (3a:4a5e) - dr $e8a5e,$e928a + dr $e8a5e,$e8d35 +Func_e8d35:: ; e8d35 (3a:4d35) + dr $e8d35,$e928a SurfingPikachu2Graphics: INCBIN "gfx/surfing_pikachu_2.2bpp" dr $e988a,$e9bfa |