diff options
Diffstat (limited to 'audio')
138 files changed, 2706 insertions, 3393 deletions
diff --git a/audio/engine_1.asm b/audio/engine_1.asm index 11962d55..bd021ab3 100644 --- a/audio/engine_1.asm +++ b/audio/engine_1.asm @@ -157,6 +157,15 @@ Audio1_PlayNextNote: add hl, bc res BIT_PITCH_SLIDE_ON, [hl] res BIT_PITCH_SLIDE_DECREASING, [hl] + ld a, c + cp $4 + jr nz, .asm_918c + ld a, [wLowHealthAlarm] + bit 7, a + jr z, .asm_918c + call Audio1_EnableChannelOutput + ret +.asm_918c call Audio1_sound_ret ret @@ -515,7 +524,8 @@ Audio1_unknownmusic0xef: jr nz, Audio1_duty_cycle_pattern ; no call Audio1_GetNextMusicByte push bc - call Audio1_PlaySound + ld b, a + call DetermineAudioFunction pop bc ld a, [wDisableChannelOutputWhenSfxEnds] and a @@ -681,8 +691,8 @@ Audio1_note: ld a, [wDisableChannelOutputWhenSfxEnds] and a jr nz, .skipDnote - ld a, d - call Audio1_PlaySound + ld b, d + call DetermineAudioFunction .skipDnote pop bc pop de @@ -842,7 +852,7 @@ Audio1_note_pitch: Audio1_EnableChannelOutput: ld b, 0 - ld hl, Audio1_HWChannelEnableMasks + call Audio1_9972 add hl, bc ld a, [rNR51] or [hl] ; set this channel's bits @@ -862,7 +872,7 @@ Audio1_EnableChannelOutput: ; If this is the SFX noise channel or a music channel whose corresponding ; SFX channel is off, apply stereo panning. ld a, [wStereoPanning] - ld hl, Audio1_HWChannelEnableMasks + call Audio1_9972 add hl, bc and [hl] ld d, a @@ -950,12 +960,31 @@ Audio1_ApplyWavePatternAndFrequency: ld [hl], e ; store frequency low byte inc hl ld [hl], d ; store frequency high byte + ld a, c + cp $4 + jr c, .asm_9642 call Audio1_ApplyFrequencyModifier +.asm_9642 + ret +.asm_9643 + ld a, c + cp $4 + ret nz + ld a, [wLowHealthAlarm] + bit 7, a + ret z + xor a + ld [wFrequencyModifier], a + ld a, $80 + ld [wTempoModifier], a ret Audio1_SetSfxTempo: call Audio1_IsCry + jr c, .isCry + call Audio1_96c3 jr nc, .notCry +.isCry ld d, 0 ld a, [wTempoModifier] add $80 @@ -965,18 +994,20 @@ Audio1_SetSfxTempo: ld [wSfxTempo + 1], a ld a, d ld [wSfxTempo], a - jr .done + ret .notCry xor a ld [wSfxTempo + 1], a - ld a, $1 + inc a ld [wSfxTempo], a -.done ret Audio1_ApplyFrequencyModifier: call Audio1_IsCry - jr nc, .done + jr c, .isCry + call Audio1_96c3 + ret nc +.isCry ; if playing a cry, add the cry's frequency modifier ld a, [wFrequencyModifier] add e @@ -1010,8 +1041,7 @@ Audio1_GoBackOneCommandIfCry: scf ret .done - scf - ccf + and a ret Audio1_IsCry: @@ -1032,6 +1062,26 @@ Audio1_IsCry: scf ret +Audio1_96c3: + ld a, [wAudioROMBank] + cp BANK(AudioEngine2) + jr nz, .asm_96dc + ld a, [wChannelSoundIDs + Ch8] + ld b, a + ld a, [wChannelSoundIDs + Ch5] + or b + cp $9d + jr c, .asm_96dc + cp $ea + jr z, .asm_96de + jr c, .asm_96de +.asm_96dc + and a + ret +.asm_96de + scf + ret + Audio1_ApplyPitchSlide: ld hl, wChannelFlags1 add hl, bc @@ -1254,21 +1304,7 @@ Audio1_ApplyDutyCyclePattern: ret Audio1_GetNextMusicByte: - 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 + call GetNextMusicByte ret Audio1_GetRegisterPointer: @@ -1330,6 +1366,7 @@ Audio1_CalculateFrequency: Audio1_PlaySound:: ld [wSoundID], a + ld a, [wSoundID] cp $ff jp z, .stopAllAudio cp MAX_SFX_ID_1 @@ -1340,76 +1377,7 @@ Audio1_PlaySound:: jp nc, .playSfx .playMusic - xor a - ld [wUnusedC000], a - ld [wDisableChannelOutputWhenSfxEnds], a - ld [wMusicTempo + 1], a - ld [wMusicWaveInstrument], a - ld [wSfxWaveInstrument], a - ld d, $8 - ld hl, wChannelReturnAddresses - call .FillMem - ld hl, wChannelCommandPointers - call .FillMem - ld d, $4 - ld hl, wChannelSoundIDs - call .FillMem - ld hl, wChannelFlags1 - call .FillMem - ld hl, wChannelDutyCycles - call .FillMem - ld hl, wChannelDutyCyclePatterns - call .FillMem - ld hl, wChannelVibratoDelayCounters - call .FillMem - ld hl, wChannelVibratoExtents - call .FillMem - ld hl, wChannelVibratoRates - call .FillMem - ld hl, wChannelFrequencyLowBytes - call .FillMem - ld hl, wChannelVibratoDelayCounterReloadValues - call .FillMem - ld hl, wChannelFlags2 - call .FillMem - ld hl, wChannelPitchSlideLengthModifiers - call .FillMem - ld hl, wChannelPitchSlideFrequencySteps - call .FillMem - ld hl, wChannelPitchSlideFrequencyStepsFractionalPart - call .FillMem - ld hl, wChannelPitchSlideCurrentFrequencyFractionalPart - call .FillMem - ld hl, wChannelPitchSlideCurrentFrequencyHighBytes - call .FillMem - ld hl, wChannelPitchSlideCurrentFrequencyLowBytes - call .FillMem - ld hl, wChannelPitchSlideTargetFrequencyHighBytes - call .FillMem - ld hl, wChannelPitchSlideTargetFrequencyLowBytes - call .FillMem - ld a, $1 - ld hl, wChannelLoopCounters - call .FillMem - ld hl, wChannelNoteDelayCounters - call .FillMem - ld hl, wChannelNoteSpeeds - call .FillMem - ld [wMusicTempo], a - ld a, $ff - ld [wStereoPanning], a - xor a - ld [rNR50], a - ld a, $8 - ld [rNR10], a - ld a, 0 - ld [rNR51], a - xor a - ld [rNR30], a - ld a, $80 - ld [rNR30], a - ld a, $77 - ld [rNR50], a + call InitMusicVariables jp .playSoundCommon .playSfx @@ -1471,92 +1439,7 @@ Audio1_PlaySound:: jr c, .playChannel ret .playChannel - xor a - push de - ld h, d - ld l, e - add hl, hl - ld d, h - ld e, l - ld hl, wChannelReturnAddresses - add hl, de - ld [hli], a - ld [hl], a - ld hl, wChannelCommandPointers - add hl, de - ld [hli], a - ld [hl], a - pop de - ld hl, wChannelSoundIDs - add hl, de - ld [hl], a - ld hl, wChannelFlags1 - add hl, de - ld [hl], a - ld hl, wChannelDutyCycles - add hl, de - ld [hl], a - ld hl, wChannelDutyCyclePatterns - add hl, de - ld [hl], a - ld hl, wChannelVibratoDelayCounters - add hl, de - ld [hl], a - ld hl, wChannelVibratoExtents - add hl, de - ld [hl], a - ld hl, wChannelVibratoRates - add hl, de - ld [hl], a - ld hl, wChannelFrequencyLowBytes - add hl, de - ld [hl], a - ld hl, wChannelVibratoDelayCounterReloadValues - add hl, de - ld [hl], a - ld hl, wChannelPitchSlideLengthModifiers - add hl, de - ld [hl], a - ld hl, wChannelPitchSlideFrequencySteps - add hl, de - ld [hl], a - ld hl, wChannelPitchSlideFrequencyStepsFractionalPart - add hl, de - ld [hl], a - ld hl, wChannelPitchSlideCurrentFrequencyFractionalPart - add hl, de - ld [hl], a - ld hl, wChannelPitchSlideCurrentFrequencyHighBytes - add hl, de - ld [hl], a - ld hl, wChannelPitchSlideCurrentFrequencyLowBytes - add hl, de - ld [hl], a - ld hl, wChannelPitchSlideTargetFrequencyHighBytes - add hl, de - ld [hl], a - ld hl, wChannelPitchSlideTargetFrequencyLowBytes - add hl, de - ld [hl], a - ld hl, wChannelFlags2 - add hl, de - ld [hl], a - ld a, $1 - ld hl, wChannelLoopCounters - add hl, de - ld [hl], a - ld hl, wChannelNoteDelayCounters - add hl, de - ld [hl], a - ld hl, wChannelNoteSpeeds - add hl, de - ld [hl], a - ld a, e - cp Ch5 - jr nz, .skipSweepDisable - ld a, $8 - ld [rNR10], a ; sweep off -.skipSweepDisable + call InitSFXVariables ld a, c and a jp z, .playSoundCommon @@ -1564,51 +1447,7 @@ Audio1_PlaySound:: jp .sfxChannelLoop .stopAllAudio - ld a, $80 - ld [rNR52], a ; sound hardware on - ld [rNR30], a ; wave playback on - xor a - ld [rNR51], a ; no sound output - ld [rNR32], a ; mute channel 3 (wave channel) - ld a, $8 - ld [rNR10], a ; sweep off - ld [rNR12], a ; mute channel 1 (pulse channel 1) - ld [rNR22], a ; mute channel 2 (pulse channel 2) - ld [rNR42], a ; mute channel 4 (noise channel) - ld a, $40 - ld [rNR14], a ; counter mode - ld [rNR24], a - ld [rNR44], a - ld a, $77 - ld [rNR50], a ; full volume - xor a - ld [wUnusedC000], a - ld [wDisableChannelOutputWhenSfxEnds], a - ld [wMuteAudioAndPauseMusic], a - ld [wMusicTempo + 1], a - ld [wSfxTempo + 1], a - ld [wMusicWaveInstrument], a - ld [wSfxWaveInstrument], a - ld d, $a0 - ld hl, wChannelCommandPointers - call .FillMem - ld a, $1 - ld d, $18 - ld hl, wChannelNoteDelayCounters - call .FillMem - ld [wMusicTempo], a - ld [wSfxTempo], a - ld a, $ff - ld [wStereoPanning], a - ret - -; fills d bytes at hl with a -.FillMem - ld b, d -.loop - ld [hli], a - dec b - jr nz, .loop + call StopAllAudio ret .playSoundCommon @@ -1644,16 +1483,11 @@ Audio1_PlaySound:: inc hl jr .commandPointerLoop .next + push af 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 Ch4 jr c, .skipSettingFlag ld hl, wChannelFlags1 @@ -1668,6 +1502,17 @@ Audio1_PlaySound:: ld a, [de] ld [hli], a inc de + pop af + push hl + push bc + ld b, 0 + ld c, a + ld hl, wChannelSoundIDs + add hl, bc + ld a, [wSoundID] + ld [hl], a + pop bc + pop hl inc c dec b ld a, b @@ -1718,9 +1563,29 @@ Audio1_HWChannelDisableMasks: db HW_CH1_DISABLE_MASK, HW_CH2_DISABLE_MASK, HW_CH3_DISABLE_MASK, HW_CH4_DISABLE_MASK ; channels 0-3 db HW_CH1_DISABLE_MASK, HW_CH2_DISABLE_MASK, HW_CH3_DISABLE_MASK, HW_CH4_DISABLE_MASK ; channels 4-7 +Audio1_9972: + push af + push bc + ld a, [wOptions] + and %110000 ; channel options + srl a + ld c, a + ld b, 0 + ld hl, Audio1_HWChannelEnableMasks + add hl, bc + pop bc + pop af + ret + Audio1_HWChannelEnableMasks: db HW_CH1_ENABLE_MASK, HW_CH2_ENABLE_MASK, HW_CH3_ENABLE_MASK, HW_CH4_ENABLE_MASK ; channels 0-3 db HW_CH1_ENABLE_MASK, HW_CH2_ENABLE_MASK, HW_CH3_ENABLE_MASK, HW_CH4_ENABLE_MASK ; channels 4-7 + db $01,$20,$44,$88 + db $11,$22,$44,$88 + db $01,$20,$04,$80 + db $01,$20,$04,$80 + db $01,$02,$40,$80 + db $01,$02,$40,$80 Audio1_Pitches: dw $F82C ; C_ diff --git a/audio/engine_2.asm b/audio/engine_2.asm index 026ade7c..5fe686a8 100644 --- a/audio/engine_2.asm +++ b/audio/engine_2.asm @@ -2,1407 +2,218 @@ ; This copy has a few differences relating to battle sound effects ; and the low health alarm that plays in battle -Audio2_UpdateMusic:: - ld c, Ch1 -.loop - ld b, 0 - ld hl, wChannelSoundIDs - add hl, bc - ld a, [hl] - and a - jr z, .nextChannel - ld a, c - cp Ch5 - 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 ; disable all channels' output - ld [rNR51], a - ld [rNR30], a - ld a, $80 - ld [rNR30], a - jr .nextChannel -.applyAffects - call Audio2_ApplyMusicAffects -.nextChannel - ld a, c - inc c ; inc channel number - cp Ch8 - jr nz, .loop - ret +Audio2_PlaySound:: + ld [wSoundID], a + ld a, [wSoundID] + cp $ff + jp z, .stopAllAudio + cp MAX_SFX_ID_2 + jp z, .playSfx + jp c, .playSfx + cp $fe + jr z, .playMusic + jp nc, .playSfx -; this routine checks flags for music effects currently applied -; to the channel and calls certain functions based on flags. -Audio2_ApplyMusicAffects: - ld b, $0 - ld hl, wChannelNoteDelayCounters ; delay until next note - add hl, bc +.playMusic + call InitMusicVariables + jp .playSoundCommon + +.playSfx + 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 +.sfxChannelLoop + ld d, c ld a, c - cp Ch5 - jr nc, .startChecks ; if a sfx channel - ld hl, wChannelSoundIDs + Ch5 - add hl, bc - ld a, [hl] - and a - jr z, .startChecks - ret -.startChecks - ld hl, wChannelFlags1 - add hl, bc - bit BIT_ROTATE_DUTY_CYCLE, [hl] - jr z, .checkForExecuteMusic - call Audio2_ApplyDutyCyclePattern -.checkForExecuteMusic - ld b, 0 - ld hl, wChannelFlags2 - add hl, bc - bit BIT_EXECUTE_MUSIC, [hl] - jr nz, .checkForPitchSlide - ld hl, wChannelFlags1 - add hl, bc - bit BIT_NOISE_OR_SFX, [hl] - jr nz, .skipPitchSlideVibrato -.checkForPitchSlide - ld hl, wChannelFlags1 - add hl, bc - bit BIT_PITCH_SLIDE_ON, [hl] - jr z, .checkVibratoDelay - jp Audio2_ApplyPitchSlide -.checkVibratoDelay - ld hl, wChannelVibratoDelayCounters - add hl, bc - ld a, [hl] - and a ; check if delay is over - jr z, .checkForVibrato - dec [hl] ; otherwise, dec delay -.skipPitchSlideVibrato - ret -.checkForVibrato - ld hl, wChannelVibratoExtents - add hl, bc - ld a, [hl] - and a - jr nz, .vibrato - ret ; no vibrato -.vibrato - ld d, a - ld hl, wChannelVibratoRates + 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 - and a - jr z, .applyVibrato - dec [hl] ; decrement counter - ret -.applyVibrato + ld e, a ; software channel ID + ld d, 0 + ld hl, wChannelSoundIDs + add hl, de ld a, [hl] - swap [hl] - or [hl] - ld [hl], a ; reload the counter - ld hl, wChannelFrequencyLowBytes - add hl, bc - ld e, [hl] ; get note pitch - ld hl, wChannelFlags1 - add hl, bc -; This is the only code that sets/resets the vibrato direction bit, so it -; continuously alternates which path it takes. - bit BIT_VIBRATO_DIRECTION, [hl] - jr z, .unset - res BIT_VIBRATO_DIRECTION, [hl] - ld a, d - and $f - ld d, a + and a + jr z, .playChannel ld a, e - sub d - jr nc, .noCarry - ld a, 0 -.noCarry - jr .done -.unset - set BIT_VIBRATO_DIRECTION, [hl] - ld a, d - and $f0 - swap a - add e - jr nc, .done - ld a, $ff -.done - ld d, a - ld b, REG_FREQUENCY_LO - call Audio2_GetRegisterPointer - ld [hl], d + cp Ch8 + jr nz, .notNoiseChannel + ld a, [wSoundID] + cp NOISE_INSTRUMENTS_END + jr nc, .notNoiseInstrument ret - -; this routine executes all music commands that take up no time, -; like tempo changes, duty cycle changes etc. and doesn't return -; until the first note is reached -Audio2_PlayNextNote: -; reload the vibrato delay counter - ld hl, wChannelVibratoDelayCounterReloadValues - add hl, bc +.notNoiseInstrument ld a, [hl] - ld hl, wChannelVibratoDelayCounters - add hl, bc - ld [hl], a - - ld hl, wChannelFlags1 - add hl, bc - res BIT_PITCH_SLIDE_ON, [hl] - res BIT_PITCH_SLIDE_DECREASING, [hl] - ; --- this section is only present in this copy of the sound engine - ld a, c - cp Ch5 - jr nz, .beginChecks - ld a, [wLowHealthAlarm] ; low health alarm enabled? - bit 7, a - ret nz -.beginChecks - ; --- - call Audio2_sound_ret + cp NOISE_INSTRUMENTS_END + jr z, .playChannel + jr c, .playChannel +.notNoiseChannel + ld a, [wSoundID] + cp [hl] + jr z, .playChannel + jr c, .playChannel ret - -Audio2_sound_ret: - call Audio2_GetNextMusicByte - ld d, a - cp $ff ; is this command a sound_ret? - jp nz, Audio2_sound_call ; no - ld b, 0 - ld hl, wChannelFlags1 - add hl, bc - bit BIT_SOUND_CALL, [hl] - jr nz, .returnFromCall +.playChannel + call InitSFXVariables ld a, c - cp Ch4 - jr nc, .noiseOrSfxChannel - jr .disableChannelOutput -.noiseOrSfxChannel - res BIT_NOISE_OR_SFX, [hl] - ld hl, wChannelFlags2 - add hl, bc - res BIT_EXECUTE_MUSIC, [hl] - cp Ch7 - jr nz, .skipSfxChannel3 -; restart hardware channel 3 (wave channel) output - ld a, $0 - ld [rNR30], a - ld a, $80 - ld [rNR30], a -.skipSfxChannel3 - jr nz, .dontDisable - ld a, [wDisableChannelOutputWhenSfxEnds] and a - jr z, .dontDisable - xor a - ld [wDisableChannelOutputWhenSfxEnds], a - jr .disableChannelOutput -.dontDisable - jr .afterDisable -.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_sound_ret -.disableChannelOutput - ld hl, Audio2_HWChannelDisableMasks - add hl, bc - ld a, [rNR51] - and [hl] - ld [rNR51], a -.afterDisable - ld a, [wChannelSoundIDs + Ch5] - cp CRY_SFX_START - jr nc, .maybeCry - jr .skipCry -.maybeCry - ld a, [wChannelSoundIDs + Ch5] - cp CRY_SFX_END - jr z, .skipCry - jr c, .cry - jr .skipCry -.cry - ld a, c - cp Ch5 - jr z, .skipRewind - call Audio2_GoBackOneCommandIfCry - ret c -.skipRewind - ld a, [wSavedVolume] - ld [rNR50], a - xor a - ld [wSavedVolume], a -.skipCry - ld hl, wChannelSoundIDs - add hl, bc - ld [hl], b + jp z, .playSoundCommon + dec c + jp .sfxChannelLoop + +.stopAllAudio + call StopAllAudio ret -Audio2_sound_call: - cp $fd ; is this command a sound_call? - jp nz, Audio2_sound_loop ; no - call Audio2_GetNextMusicByte - 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 +.playSoundCommon + 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 BIT_SOUND_CALL, [hl] ; set the call flag - jp Audio2_sound_ret - -Audio2_sound_loop: - cp $fe ; is this command a sound_loop? - jp nz, Audio2_note_type ; no - call Audio2_GetNextMusicByte - 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_sound_ret -.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_sound_ret - -Audio2_note_type: - and $f0 - cp $d0 ; is this command a note_type? - jp nz, Audio2_toggle_perfect_pitch ; no - ld a, d - and $f - ld b, $0 - ld hl, wChannelNoteSpeeds - add hl, bc - ld [hl], a ; store low nibble as speed - ld a, c - cp Ch4 - jr z, .noiseChannel ; noise channel has 0 params - call Audio2_GetNextMusicByte - ld d, a - ld a, c - cp Ch3 - jr z, .musicChannel3 - cp Ch7 - jr nz, .skipChannel3 - ld hl, wSfxWaveInstrument - jr .channel3 -.musicChannel3 - ld hl, wMusicWaveInstrument -.channel3 - ld a, d - and $f - ld [hl], a ; store low nibble of param as wave instrument - 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) -.skipChannel3 - ld b, 0 - ld hl, wChannelVolumes - add hl, bc - ld [hl], d -.noiseChannel - jp Audio2_sound_ret - -Audio2_toggle_perfect_pitch: - ld a, d - cp $e8 ; is this command a toggle_perfect_pitch? - jr nz, Audio2_vibrato ; no - ld b, 0 - ld hl, wChannelFlags1 - add hl, bc - ld a, [hl] - xor $1 - ld [hl], a ; flip bit 0 of wChannelFlags1 - jp Audio2_sound_ret - -Audio2_vibrato: - cp $ea ; is this command a vibrato? - jr nz, Audio2_pitch_slide ; no - call Audio2_GetNextMusicByte - 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 - -; The high nybble of the command byte is the extent of the vibrato. -; Let n be the extent. -; The upper nybble of the channel's byte in the wChannelVibratoExtents -; array will store the extent above the note: (n / 2) + (n % 2). -; The lower nybble will store the extent below the note: (n / 2). -; These two values add to the total extent, n. - 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 - -; The low nybble of the command byte is the rate of the vibrato. -; The high and low nybbles of the channel's byte in the wChannelVibratoRates -; array are both initialised to this value because the high nybble is the -; counter reload value and the low nybble is the counter itself, which should -; start at its value upon reload. - ld a, d - and $f - ld d, a - ld hl, wChannelVibratoRates - add hl, bc - swap a - or d - ld [hl], a - - jp Audio2_sound_ret - -Audio2_pitch_slide: - cp $eb ; is this command a pitch_slide? - jr nz, Audio2_duty_cycle ; no - call Audio2_GetNextMusicByte - ld b, 0 - ld hl, wChannelPitchSlideLengthModifiers - add hl, bc - ld [hl], a - call Audio2_GetNextMusicByte - ld d, a - and $f0 - swap a - ld b, a - ld a, d - and $f - call Audio2_CalculateFrequency - ld b, 0 - ld hl, wChannelPitchSlideTargetFrequencyHighBytes - add hl, bc - ld [hl], d - ld hl, wChannelPitchSlideTargetFrequencyLowBytes - add hl, bc - ld [hl], e - ld b, 0 - ld hl, wChannelFlags1 - add hl, bc - set BIT_PITCH_SLIDE_ON, [hl] - call Audio2_GetNextMusicByte - ld d, a - jp Audio2_note_length - -Audio2_duty_cycle: - cp $ec ; is this command a duty_cycle? - jr nz, Audio2_tempo ; no - call Audio2_GetNextMusicByte - rrca - rrca - and $c0 - ld b, 0 - ld hl, wChannelDutyCycles - add hl, bc - ld [hl], a ; store duty cycle - jp Audio2_sound_ret - -Audio2_tempo: - cp $ed ; is this command a tempo? - jr nz, Audio2_stereo_panning ; no - ld a, c - cp Ch5 - 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_sound_ret - -Audio2_stereo_panning: - cp $ee ; is this command a stereo_panning? - jr nz, Audio2_unknownmusic0xef ; no - call Audio2_GetNextMusicByte - ld [wStereoPanning], a ; store panning - jp Audio2_sound_ret - -; this appears to never be used -Audio2_unknownmusic0xef: - cp $ef ; is this command an unknownmusic0xef? - jr nz, Audio2_duty_cycle_pattern ; no - call Audio2_GetNextMusicByte - push bc - call Audio2_PlaySound - pop bc - ld a, [wDisableChannelOutputWhenSfxEnds] - and a - jr nz, .skip - ld a, [wChannelSoundIDs + Ch8] - ld [wDisableChannelOutputWhenSfxEnds], a - xor a - ld [wChannelSoundIDs + Ch8], a -.skip - jp Audio2_sound_ret - -Audio2_duty_cycle_pattern: - cp $fc ; is this command a duty_cycle_pattern? - jr nz, Audio2_volume ; no - call Audio2_GetNextMusicByte - ld b, 0 - ld hl, wChannelDutyCyclePatterns - add hl, bc - ld [hl], a ; store full pattern - and %11000000 - ld hl, wChannelDutyCycles - add hl, bc - ld [hl], a ; store first duty cycle - ld hl, wChannelFlags1 - add hl, bc - set BIT_ROTATE_DUTY_CYCLE, [hl] - jp Audio2_sound_ret - -Audio2_volume: - cp $f0 ; is this command a volume? - jr nz, Audio2_execute_music ; no - call Audio2_GetNextMusicByte - ld [rNR50], a ; store volume - jp Audio2_sound_ret - -Audio2_execute_music: - cp $f8 ; is this command an execute_music? - jr nz, Audio2_octave ; no - ld b, $0 - ld hl, wChannelFlags2 - add hl, bc - set BIT_EXECUTE_MUSIC, [hl] - jp Audio2_sound_ret - -Audio2_octave: - and $f0 - cp $e0 ; is this command an octave? - jr nz, Audio2_sfx_note ; no - ld hl, wChannelOctaves - ld b, 0 - add hl, bc - ld a, d - and $f - ld [hl], a ; store low nibble as octave - jp Audio2_sound_ret - -; sfx_note is either square_note or noise_note depending on the channel -Audio2_sfx_note: - cp $20 ; is this command a sfx_note? - jr nz, Audio2_pitch_sweep - ld a, c - cp Ch4 ; is this a noise or sfx channel? - jr c, Audio2_pitch_sweep ; no - ld b, 0 - ld hl, wChannelFlags2 - add hl, bc - bit BIT_EXECUTE_MUSIC, [hl] ; is execute_music being used? - jr nz, Audio2_pitch_sweep ; yes - call Audio2_note_length - -; This code seems to do the same thing as what Audio2_ApplyDutyCycleAndSoundLength -; does below. - ld d, a - ld b, 0 - ld hl, wChannelDutyCycles - add hl, bc - ld a, [hl] - or d - ld d, a - ld b, REG_DUTY_SOUND_LEN - call Audio2_GetRegisterPointer - ld [hl], d - - call Audio2_GetNextMusicByte - ld d, a - ld b, REG_VOLUME_ENVELOPE - call Audio2_GetRegisterPointer - ld [hl], d - call Audio2_GetNextMusicByte - ld e, a - ld a, c - cp Ch8 - ld a, 0 - jr z, .skip -; Channels 1 through 3 have 2 registers that control frequency, but the noise -; channel a single register (the polynomial counter) that controls frequency, -; so this command has one less byte on the noise channel. - push de - call Audio2_GetNextMusicByte - pop de -.skip - ld d, a - push de - call Audio2_ApplyDutyCycleAndSoundLength - call Audio2_EnableChannelOutput - pop de - call Audio2_ApplyWavePatternAndFrequency - ret - -Audio2_pitch_sweep: - ld a, c - cp Ch5 - jr c, Audio2_note ; if not a sfx - ld a, d - cp $10 ; is this command a pitch_sweep? - jr nz, Audio2_note ; no - ld b, $0 - ld hl, wChannelFlags2 - add hl, bc - bit BIT_EXECUTE_MUSIC, [hl] - jr nz, Audio2_note ; no - call Audio2_GetNextMusicByte - ld [rNR10], a - jp Audio2_sound_ret - -Audio2_note: - ld a, c - cp Ch4 - jr nz, Audio2_note_length ; if not noise channel - ld a, d - and $f0 - cp $b0 ; is this command a drum_note? - jr z, .drum_note - jr nc, Audio2_note_length ; no - - ; this executes when on the noise channel and - ; the command id is less than $b0 - ; in this case, the upper nybble is used as the noise instrument ($1-$a) - ; and the lower nybble is the length minus 1 (0-15) - ; however, this doesn't work for instrument #2 because the command id - ; is captured by the noise_note command (command id $2x) - ; this essentially acts like a drum_note command that is only 1 byte - ; instead of 2 and can only be used with instruments 1 and 3 through 10 - ; this is unused by the game - 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 .playDnote - -.drum_note - ld a, d and $f + ld b, c + inc b + inc de + ld c, 0 +.commandPointerLoop + cp c + jr z, .next + inc c + inc hl + inc hl + jr .commandPointerLoop +.next push af + push hl push bc - call Audio2_GetNextMusicByte ; get drum_note instrument -.playDnote - ld d, a - ld a, [wDisableChannelOutputWhenSfxEnds] - and a - jr nz, .skipDnote - ld a, d - call Audio2_PlaySound -.skipDnote - pop bc - pop de - -Audio2_note_length: - 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_MultiplyAdd - ld a, c - cp Ch5 - 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 Ch8 - jr z, .skip ; if noise channel - call Audio2_SetSfxTempo - ld a, [wSfxTempo] - ld d, a - ld a, [wSfxTempo + 1] - ld e, a -.skip - ld a, l ; a = note_length * note_speed - ld b, 0 - ld hl, wChannelNoteDelayCountersFractionalPart - add hl, bc - ld l, [hl] - call Audio2_MultiplyAdd - ld e, l - ld d, h ; de = note_delay_frac_part + (note_length * note_speed * tempo) - 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 BIT_EXECUTE_MUSIC, [hl] - jr nz, Audio2_note_pitch + ld c, a + cp Ch4 + jr c, .skipSettingFlag ld hl, wChannelFlags1 add hl, bc - bit BIT_NOISE_OR_SFX, [hl] - jr z, Audio2_note_pitch + set BIT_NOISE_OR_SFX, [hl] +.skipSettingFlag + pop bc pop hl - ret - -Audio2_note_pitch: + 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 Ch5 - jr nc, .next -; If this isn't an SFX channel, try the corresponding SFX channel. - ld hl, wChannelSoundIDs + Ch5 - add hl, bc - ld a, [hl] - and a - jr nz, .done - ; fall through -.next - ld a, c - cp Ch3 - jr z, .channel3 - cp Ch7 - jr nz, .notChannel3 -.channel3 + push hl + push bc ld b, 0 - ld hl, Audio2_HWChannelDisableMasks + ld c, a + ld hl, wChannelSoundIDs add hl, bc - ld a, [rNR51] - and [hl] - ld [rNR51], a ; disable hardware channel 3's output - jr .done -.notChannel3 - ld b, REG_VOLUME_ENVELOPE - call Audio2_GetRegisterPointer - ld a, $8 ; fade in sound - ld [hli], a - inc hl - ld a, $80 ; restart sound + 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_CalculateFrequency - ld b, 0 - ld hl, wChannelFlags1 - add hl, bc - bit BIT_PITCH_SLIDE_ON, [hl] - jr z, .skipPitchSlide - call Audio2_InitPitchSlideVars -.skipPitchSlide - push de - ld a, c - cp Ch5 - jr nc, .sfxChannel ; if sfx channel -; If this isn't an SFX channel, try the corresponding SFX channel. - ld hl, wChannelSoundIDs + Ch5 - ld d, 0 - ld e, a - add hl, de - ld a, [hl] - and a - jr nz, .noSfx - jr .sfxChannel -.noSfx - pop de - ret -.sfxChannel - ld b, 0 - ld hl, wChannelVolumes - add hl, bc - ld d, [hl] - ld b, REG_VOLUME_ENVELOPE - call Audio2_GetRegisterPointer - ld [hl], d - call Audio2_ApplyDutyCycleAndSoundLength - call Audio2_EnableChannelOutput - pop de - ld b, $0 - ld hl, wChannelFlags1 - add hl, bc - bit BIT_PERFECT_PITCH, [hl] ; has toggle_perfect_pitch been used? - jr z, .skipFrequencyInc - inc e ; if yes, increment the frequency by 1 - jr nc, .skipFrequencyInc - inc d -.skipFrequencyInc - ld hl, wChannelFrequencyLowBytes - add hl, bc - ld [hl], e - call Audio2_ApplyWavePatternAndFrequency - ret - -Audio2_EnableChannelOutput: - ld b, 0 - ld hl, Audio2_HWChannelEnableMasks - add hl, bc - ld a, [rNR51] - or [hl] ; set this channel's bits - ld d, a - ld a, c - cp Ch8 - jr z, .noiseChannelOrNoSfx - cp Ch5 - jr nc, .skip ; if sfx channel -; If this isn't an SFX channel, try the corresponding SFX channel. - ld hl, wChannelSoundIDs + Ch5 - add hl, bc - ld a, [hl] + pop bc + pop hl + inc c + dec b + ld a, b and a - jr nz, .skip -.noiseChannelOrNoSfx -; If this is the SFX noise channel or a music channel whose corresponding -; SFX channel is off, apply stereo panning. - ld a, [wStereoPanning] - ld hl, Audio2_HWChannelEnableMasks - add hl, bc - and [hl] - ld d, a - ld a, [rNR51] - ld hl, Audio2_HWChannelDisableMasks - add hl, bc - and [hl] ; reset this channel's output bits - or d ; set this channel's output bits that enabled in [wStereoPanning] - ld d, a -.skip - ld a, d - ld [rNR51], a - ret - -Audio2_ApplyDutyCycleAndSoundLength: - ld b, 0 - ld hl, wChannelNoteDelayCounters ; use the note delay as sound length - add hl, bc - ld d, [hl] - ld a, c - cp Ch3 - jr z, .skipDuty ; if music channel 3 - cp Ch7 - jr z, .skipDuty ; if sfx channel 3 -; include duty cycle (except on channel 3 which doesn't have it) - ld a, d - and $3f - ld d, a - ld hl, wChannelDutyCycles - add hl, bc - ld a, [hl] - or d - ld d, a -.skipDuty - ld b, REG_DUTY_SOUND_LEN - call Audio2_GetRegisterPointer - ld [hl], d - ret - -Audio2_ApplyWavePatternAndFrequency: - ld a, c - cp Ch3 - jr z, .channel3 - cp Ch7 - jr nz, .notChannel3 - ; fall through -.channel3 - push de - ld de, wMusicWaveInstrument - cp Ch3 - jr z, .next - ld de, wSfxWaveInstrument -.next - 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 ; wave pattern RAM - ld b, $f - ld a, $0 ; stop hardware channel 3 - ld [rNR30], a -.loop ld a, [de] inc de - ld [hli], a - ld a, b - dec b - and a - jr nz, .loop - ld a, $80 ; start hardware channel 3 - ld [rNR30], a - pop de -.notChannel3 - ld a, d - or $80 ; use counter mode (i.e. disable output when the counter reaches 0) - and $c7 ; zero the unused bits in the register - ld d, a - ld b, REG_FREQUENCY_LO - call Audio2_GetRegisterPointer - ld [hl], e ; store frequency low byte - inc hl - ld [hl], d ; store frequency high byte - ; --- this section is only present in this copy of the sound engine - ld a, c - cp Ch5 - jr c, .musicChannel - call Audio2_ApplyFrequencyModifier -.musicChannel - ; --- - ret - -; --- this section is only present in this copy of the sound engine -; unused -Audio2_ResetCryModifiers: - ld a, c - cp Ch5 - jr nz, .skip - ld a, [wLowHealthAlarm] - bit 7, a - jr z, .skip - xor a - ld [wFrequencyModifier], a - ld a, $80 - ld [wTempoModifier], a -.skip - ret -; --- - -Audio2_SetSfxTempo: - call Audio2_IsCry - jr c, .skipCryCheck - call Audio2_IsBattleSFX - jr nc, .notCry -.skipCryCheck - ld d, 0 - ld a, [wTempoModifier] - add $80 - jr nc, .next - inc d -.next - ld [wSfxTempo + 1], a - ld a, d - ld [wSfxTempo], a + jr nz, .commandPointerLoop + ld a, [wSoundID] + cp CRY_SFX_START + jr nc, .maybeCry jr .done -.notCry - xor a - ld [wSfxTempo + 1], a - ld a, $1 - ld [wSfxTempo], a -.done - ret - -Audio2_ApplyFrequencyModifier: - call Audio2_IsCry - jr c, .skipCryCheck - call Audio2_IsBattleSFX - jr nc, .done -.skipCryCheck -; if playing a cry, add the cry's frequency modifier - ld a, [wFrequencyModifier] - add e - jr nc, .noCarry - inc d -.noCarry - dec hl - ld e, a - ld [hl], e - inc hl - ld [hl], d -.done - ret - -Audio2_GoBackOneCommandIfCry: - call Audio2_IsCry - jr nc, .done - ld hl, wChannelCommandPointers - ld e, c - ld d, 0 - sla e - rl d - add hl, de - ld a, [hl] - sub 1 +.maybeCry + ld a, [wSoundID] + cp CRY_SFX_END + jr z, .done + jr c, .cry + jr .done +.cry + ld hl, wChannelSoundIDs + Ch5 + ld [hli], a + ld [hli], a + ld [hli], a ld [hl], a + ld hl, wChannelCommandPointers + Ch7 * 2 ; sfx wave channel pointer + ld de, Audio2_CryRet + ld [hl], e inc hl - ld a, [hl] - sbc 0 - ld [hl], a - scf - ret + ld [hl], d ; overwrite pointer to point to sound_ret + ld a, [wSavedVolume] + and a + jr nz, .done + ld a, [rNR50] + ld [wSavedVolume], a + ld a, $77 + ld [rNR50], a .done - scf - ccf ret -Audio2_IsCry: -; Returns whether the currently playing audio is a cry in carry. - ld a, [wChannelSoundIDs + Ch5] - cp CRY_SFX_START - jr nc, .next - jr .no -.next - cp CRY_SFX_END - jr z, .no - jr c, .yes -.no - scf - ccf - ret -.yes - scf - ret - -; --- this section is only present in this copy of the sound engine -Audio2_IsBattleSFX: -; Returns whether the currently playing audio is a cry in carry. - ld a, [wChannelSoundIDs + Ch8] - ld b, a - ld a, [wChannelSoundIDs + Ch5] - or b - cp BATTLE_SFX_START - jr nc, .next - jr .no -.next - cp BATTLE_SFX_END - jr z, .no - jr c, .yes -.no - scf - ccf - ret -.yes - scf - ret -; --- +Audio2_CryRet: + sound_ret -Audio2_ApplyPitchSlide: - ld hl, wChannelFlags1 - add hl, bc - bit BIT_PITCH_SLIDE_DECREASING, [hl] - jp nz, .frequencyDecreasing -; frequency increasing - ld hl, wChannelPitchSlideCurrentFrequencyLowBytes - add hl, bc - ld e, [hl] - ld hl, wChannelPitchSlideCurrentFrequencyHighBytes - add hl, bc - ld d, [hl] - ld hl, wChannelPitchSlideFrequencySteps - add hl, bc - ld l, [hl] - ld h, b - add hl, de - ld d, h - ld e, l - ld hl, wChannelPitchSlideCurrentFrequencyFractionalPart - add hl, bc - push hl - ld hl, wChannelPitchSlideFrequencyStepsFractionalPart - 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, wChannelPitchSlideTargetFrequencyHighBytes - add hl, bc - ld a, [hl] - cp d - jp c, .reachedTargetFrequency - jr nz, .applyUpdatedFrequency - ld hl, wChannelPitchSlideTargetFrequencyLowBytes - add hl, bc - ld a, [hl] - cp e - jp c, .reachedTargetFrequency - jr .applyUpdatedFrequency -.frequencyDecreasing - ld hl, wChannelPitchSlideCurrentFrequencyLowBytes - add hl, bc - ld a, [hl] - ld hl, wChannelPitchSlideCurrentFrequencyHighBytes - add hl, bc - ld d, [hl] - ld hl, wChannelPitchSlideFrequencySteps - add hl, bc - ld e, [hl] - sub e - ld e, a - ld a, d - sbc b - ld d, a - ld hl, wChannelPitchSlideFrequencyStepsFractionalPart - 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, wChannelPitchSlideTargetFrequencyHighBytes - add hl, bc - ld a, d - cp [hl] - jr c, .reachedTargetFrequency - jr nz, .applyUpdatedFrequency - ld hl, wChannelPitchSlideTargetFrequencyLowBytes - add hl, bc - ld a, e - cp [hl] - jr c, .reachedTargetFrequency -.applyUpdatedFrequency - ld hl, wChannelPitchSlideCurrentFrequencyLowBytes - add hl, bc - ld [hl], e - ld hl, wChannelPitchSlideCurrentFrequencyHighBytes - add hl, bc - ld [hl], d - ld b, REG_FREQUENCY_LO - call Audio2_GetRegisterPointer +Music_PokeFluteInBattle:: + ; begin playing the "caught mon" sound effect + ld a, SFX_CAUGHT_MON + call PlaySoundWaitForCurrent + ; then immediately overwrtie the channel pointers + ld hl, wChannelCommandPointers + Ch5 * 2 + ld de, SFX_Pokeflute_Ch5 + call Audio2_OverwriteChannelPointer + ld de, SFX_Pokeflute_Ch6 + call Audio2_OverwriteChannelPointer + ld de, SFX_Pokeflute_Ch7 + +Audio2_OverwriteChannelPointer: ld a, e ld [hli], a - ld [hl], d - ret -.reachedTargetFrequency -; Turn off pitch slide when the target frequency has been reached. - ld hl, wChannelFlags1 - add hl, bc - res BIT_PITCH_SLIDE_ON, [hl] - res BIT_PITCH_SLIDE_DECREASING, [hl] - ret - -Audio2_InitPitchSlideVars: - ld hl, wChannelPitchSlideCurrentFrequencyHighBytes - add hl, bc - ld [hl], d - ld hl, wChannelPitchSlideCurrentFrequencyLowBytes - add hl, bc - ld [hl], e - ld hl, wChannelNoteDelayCounters - add hl, bc - ld a, [hl] - ld hl, wChannelPitchSlideLengthModifiers - add hl, bc - sub [hl] - jr nc, .next - ld a, 1 -.next - ld [hl], a - ld hl, wChannelPitchSlideTargetFrequencyLowBytes - add hl, bc - ld a, e - sub [hl] - ld e, a - ld a, d - sbc b - ld hl, wChannelPitchSlideTargetFrequencyHighBytes - add hl, bc - sub [hl] - jr c, .targetFrequencyGreater - ld d, a - ld b, 0 - ld hl, wChannelFlags1 - add hl, bc - set BIT_PITCH_SLIDE_DECREASING, [hl] - jr .next2 -.targetFrequencyGreater -; If the target frequency is greater, subtract the current frequency from -; the target frequency to get the absolute difference. - ld hl, wChannelPitchSlideCurrentFrequencyHighBytes - add hl, bc - ld d, [hl] - ld hl, wChannelPitchSlideCurrentFrequencyLowBytes - add hl, bc - ld e, [hl] - ld hl, wChannelPitchSlideTargetFrequencyLowBytes - add hl, bc - ld a, [hl] - sub e - ld e, a - -; Bug. Instead of borrowing from the high byte of the target frequency as it -; should, it borrows from the high byte of the current frequency instead. -; This means that the result will be 0x200 greater than it should be if the -; low byte of the current frequency is greater than the low byte of the -; target frequency. ld a, d - sbc b - ld d, a - - ld hl, wChannelPitchSlideTargetFrequencyHighBytes - add hl, bc - ld a, [hl] - sub d - ld d, a - ld b, 0 - ld hl, wChannelFlags1 - add hl, bc - res BIT_PITCH_SLIDE_DECREASING, [hl] - -.next2 - ld hl, wChannelPitchSlideLengthModifiers - add hl, bc -.divideLoop - inc b - ld a, e - sub [hl] - ld e, a - jr nc, .divideLoop - ld a, d - and a - jr z, .doneDividing - dec a - ld d, a - jr .divideLoop -.doneDividing - ld a, e ; a = remainder - dividend - add [hl] - ld d, b ; d = quotient + 1 - ld b, 0 - ld hl, wChannelPitchSlideFrequencySteps - add hl, bc - ld [hl], d ; store quotient + 1 - ld hl, wChannelPitchSlideFrequencyStepsFractionalPart - add hl, bc - ld [hl], a ; store remainder - dividend - ld hl, wChannelPitchSlideCurrentFrequencyFractionalPart - add hl, bc - ld [hl], a ; store remainder - dividend - ret - -Audio2_ApplyDutyCyclePattern: - ld b, 0 - ld hl, wChannelDutyCyclePatterns - add hl, bc - ld a, [hl] - rlca - rlca - ld [hl], a - and $c0 - ld d, a - ld b, REG_DUTY_SOUND_LEN - call Audio2_GetRegisterPointer - ld a, [hl] - and $3f - or d - ld [hl], a - ret - -Audio2_GetNextMusicByte: - 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_GetRegisterPointer: -; hl = address of hardware sound register b for software channel c - ld a, c - ld hl, Audio2_HWChannelBaseAddresses - add l - jr nc, .noCarry - inc h -.noCarry - ld l, a - ld a, [hl] - add b - ld l, a - ld h, $ff - ret - -Audio2_MultiplyAdd: -; hl = l + (a * de) - ld h, 0 -.loop - srl a - jr nc, .skipAdd - add hl, de -.skipAdd - sla e - rl d - and a - jr z, .done - jr .loop -.done - ret - -Audio2_CalculateFrequency: -; return the frequency for note a, octave b in de - 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 7 - 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:: - ld [wSoundID], a - cp $ff - jp z, .stopAllAudio - cp MAX_SFX_ID_2 - jp z, .playSfx - jp c, .playSfx - cp $fe - jr z, .playMusic - jp nc, .playSfx +INCLUDE "audio/sfx/pokeflute_ch5_ch6.asm" -.playMusic +Audio2_InitMusicVariables:: xor a ld [wUnusedC000], a ld [wDisableChannelOutputWhenSfxEnds], a @@ -1411,53 +222,53 @@ Audio2_PlaySound:: ld [wSfxWaveInstrument], a ld d, $8 ld hl, wChannelReturnAddresses - call .FillMem + call Audio2_FillMem ld hl, wChannelCommandPointers - call .FillMem + call Audio2_FillMem ld d, $4 ld hl, wChannelSoundIDs - call .FillMem + call Audio2_FillMem ld hl, wChannelFlags1 - call .FillMem + call Audio2_FillMem ld hl, wChannelDutyCycles - call .FillMem + call Audio2_FillMem ld hl, wChannelDutyCyclePatterns - call .FillMem + call Audio2_FillMem ld hl, wChannelVibratoDelayCounters - call .FillMem + call Audio2_FillMem ld hl, wChannelVibratoExtents - call .FillMem + call Audio2_FillMem ld hl, wChannelVibratoRates - call .FillMem + call Audio2_FillMem ld hl, wChannelFrequencyLowBytes - call .FillMem + call Audio2_FillMem ld hl, wChannelVibratoDelayCounterReloadValues - call .FillMem + call Audio2_FillMem ld hl, wChannelFlags2 - call .FillMem + call Audio2_FillMem ld hl, wChannelPitchSlideLengthModifiers - call .FillMem + call Audio2_FillMem ld hl, wChannelPitchSlideFrequencySteps - call .FillMem + call Audio2_FillMem ld hl, wChannelPitchSlideFrequencyStepsFractionalPart - call .FillMem + call Audio2_FillMem ld hl, wChannelPitchSlideCurrentFrequencyFractionalPart - call .FillMem + call Audio2_FillMem ld hl, wChannelPitchSlideCurrentFrequencyHighBytes - call .FillMem + call Audio2_FillMem ld hl, wChannelPitchSlideCurrentFrequencyLowBytes - call .FillMem + call Audio2_FillMem ld hl, wChannelPitchSlideTargetFrequencyHighBytes - call .FillMem + call Audio2_FillMem ld hl, wChannelPitchSlideTargetFrequencyLowBytes - call .FillMem + call Audio2_FillMem ld a, $1 ld hl, wChannelLoopCounters - call .FillMem + call Audio2_FillMem ld hl, wChannelNoteDelayCounters - call .FillMem + call Audio2_FillMem ld hl, wChannelNoteSpeeds - call .FillMem + call Audio2_FillMem ld [wMusicTempo], a ld a, $ff ld [wStereoPanning], a @@ -1473,67 +284,9 @@ Audio2_PlaySound:: ld [rNR30], a ld a, $77 ld [rNR50], a - jp .playSoundCommon - -.playSfx - 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 -.sfxChannelLoop - 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 ; software channel ID - ld d, 0 - ld hl, wChannelSoundIDs - add hl, de - ld a, [hl] - and a - jr z, .playChannel - ld a, e - cp Ch8 - jr nz, .notNoiseChannel - ld a, [wSoundID] - cp NOISE_INSTRUMENTS_END - jr nc, .notNoiseInstrument ret -.notNoiseInstrument - ld a, [hl] - cp NOISE_INSTRUMENTS_END - jr z, .playChannel - jr c, .playChannel -.notNoiseChannel - ld a, [wSoundID] - cp [hl] - jr z, .playChannel - jr c, .playChannel - ret -.playChannel + +Audio2_InitSFXVariables:: xor a push de ld h, d @@ -1616,17 +369,12 @@ Audio2_PlaySound:: ld [hl], a ld a, e cp Ch5 - jr nz, .skipSweepDisable + ret nz ld a, $8 ld [rNR10], a ; sweep off -.skipSweepDisable - ld a, c - and a - jp z, .playSoundCommon - dec c - jp .sfxChannelLoop + ret -.stopAllAudio +Audio2_StopAllAudio:: ld a, $80 ld [rNR52], a ; sound hardware on ld [rNR30], a ; wave playback on @@ -1652,13 +400,13 @@ Audio2_PlaySound:: ld [wSfxTempo + 1], a ld [wMusicWaveInstrument], a ld [wSfxWaveInstrument], a - ld d, $a0 + ld d, $b0 ld hl, wChannelCommandPointers - call .FillMem + call Audio2_FillMem ld a, $1 ld d, $18 ld hl, wChannelNoteDelayCounters - call .FillMem + call Audio2_FillMem ld [wMusicTempo], a ld [wSfxTempo], a ld a, $ff @@ -1666,135 +414,10 @@ Audio2_PlaySound:: ret ; fills d bytes at hl with a -.FillMem +Audio2_FillMem ld b, d .loop ld [hli], a dec b jr nz, .loop ret - -.playSoundCommon - 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 -.commandPointerLoop - cp c - jr z, .next - inc c - inc hl - inc hl - jr .commandPointerLoop -.next - 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 Ch4 - jr c, .skipSettingFlag - ld hl, wChannelFlags1 - add hl, bc - set BIT_NOISE_OR_SFX, [hl] -.skipSettingFlag - 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, .commandPointerLoop - ld a, [wSoundID] - cp CRY_SFX_START - jr nc, .maybeCry - jr .done -.maybeCry - ld a, [wSoundID] - cp CRY_SFX_END - jr z, .done - jr c, .cry - jr .done -.cry - ld hl, wChannelSoundIDs + Ch5 - ld [hli], a - ld [hli], a - ld [hli], a - ld [hl], a - ld hl, wChannelCommandPointers + Ch7 * 2 ; sfx wave channel pointer - ld de, Audio2_CryRet - ld [hl], e - inc hl - ld [hl], d ; overwrite pointer to point to sound_ret - ld a, [wSavedVolume] - and a - jr nz, .done - ld a, [rNR50] - ld [wSavedVolume], a - ld a, $77 - ld [rNR50], a ; full volume -.done - ret - -Audio2_CryRet: - sound_ret - -Audio2_HWChannelBaseAddresses: -; the low bytes of each HW channel's base address - db HW_CH1_BASE, HW_CH2_BASE, HW_CH3_BASE, HW_CH4_BASE ; channels 0-3 - db HW_CH1_BASE, HW_CH2_BASE, HW_CH3_BASE, HW_CH4_BASE ; channels 4-7 - -Audio2_HWChannelDisableMasks: - db HW_CH1_DISABLE_MASK, HW_CH2_DISABLE_MASK, HW_CH3_DISABLE_MASK, HW_CH4_DISABLE_MASK ; channels 0-3 - db HW_CH1_DISABLE_MASK, HW_CH2_DISABLE_MASK, HW_CH3_DISABLE_MASK, HW_CH4_DISABLE_MASK ; channels 4-7 - -Audio2_HWChannelEnableMasks: - db HW_CH1_ENABLE_MASK, HW_CH2_ENABLE_MASK, HW_CH3_ENABLE_MASK, HW_CH4_ENABLE_MASK ; channels 0-3 - db HW_CH1_ENABLE_MASK, HW_CH2_ENABLE_MASK, HW_CH3_ENABLE_MASK, HW_CH4_ENABLE_MASK ; channels 4-7 - -Audio2_Pitches: - 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_ diff --git a/audio/engine_3.asm b/audio/engine_3.asm index 4085dd3c..2d4a30e3 100644 --- a/audio/engine_3.asm +++ b/audio/engine_3.asm @@ -1,1415 +1,19 @@ ; The third of three duplicated sound engines. -Audio3_UpdateMusic:: - ld c, Ch1 -.loop - ld b, 0 - ld hl, wChannelSoundIDs - add hl, bc - ld a, [hl] - and a - jr z, .nextChannel - ld a, c - cp Ch5 - 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 ; disable all channels' output - ld [rNR51], a - ld [rNR30], a - ld a, $80 - ld [rNR30], a - jr .nextChannel -.applyAffects - call Audio3_ApplyMusicAffects -.nextChannel - ld a, c - inc c ; inc channel number - cp Ch8 - jr nz, .loop - ret - -; this routine checks flags for music effects currently applied -; to the channel and calls certain functions based on flags. -Audio3_ApplyMusicAffects: - ld b, $0 - ld hl, wChannelNoteDelayCounters ; delay until next note - add hl, bc - ld a, [hl] - cp $1 ; if the delay is 1, play next note - jp z, Audio3_PlayNextNote - dec a ; otherwise, decrease the delay timer - ld [hl], a - ld a, c - cp Ch5 - jr nc, .startChecks ; if a sfx channel - ld hl, wChannelSoundIDs + Ch5 - add hl, bc - ld a, [hl] - and a - jr z, .startChecks - ret -.startChecks - ld hl, wChannelFlags1 - add hl, bc - bit BIT_ROTATE_DUTY_CYCLE, [hl] - jr z, .checkForExecuteMusic - call Audio3_ApplyDutyCyclePattern -.checkForExecuteMusic - ld b, 0 - ld hl, wChannelFlags2 - add hl, bc - bit BIT_EXECUTE_MUSIC, [hl] - jr nz, .checkForPitchSlide - ld hl, wChannelFlags1 - add hl, bc - bit BIT_NOISE_OR_SFX, [hl] - jr nz, .skipPitchSlideVibrato -.checkForPitchSlide - ld hl, wChannelFlags1 - add hl, bc - bit BIT_PITCH_SLIDE_ON, [hl] - jr z, .checkVibratoDelay - jp Audio3_ApplyPitchSlide -.checkVibratoDelay - ld hl, wChannelVibratoDelayCounters - add hl, bc - ld a, [hl] - and a ; check if delay is over - jr z, .checkForVibrato - dec [hl] ; otherwise, dec delay -.skipPitchSlideVibrato - ret -.checkForVibrato - ld hl, wChannelVibratoExtents - add hl, bc - ld a, [hl] - and a - jr nz, .vibrato - ret ; no vibrato -.vibrato - ld d, a - ld hl, wChannelVibratoRates - add hl, bc - ld a, [hl] - and $f - and a - jr z, .applyVibrato - dec [hl] ; decrement counter - ret -.applyVibrato - ld a, [hl] - swap [hl] - or [hl] - ld [hl], a ; reload the counter - ld hl, wChannelFrequencyLowBytes - add hl, bc - ld e, [hl] ; get note pitch - ld hl, wChannelFlags1 - add hl, bc -; This is the only code that sets/resets the vibrato direction bit, so it -; continuously alternates which path it takes. - bit BIT_VIBRATO_DIRECTION, [hl] - jr z, .unset - res BIT_VIBRATO_DIRECTION, [hl] - ld a, d - and $f - ld d, a - ld a, e - sub d - jr nc, .noCarry - ld a, 0 -.noCarry - jr .done -.unset - set BIT_VIBRATO_DIRECTION, [hl] - ld a, d - and $f0 - swap a - add e - jr nc, .done - ld a, $ff -.done - ld d, a - ld b, REG_FREQUENCY_LO - call Audio3_GetRegisterPointer - ld [hl], d - ret - -; this routine executes all music commands that take up no time, -; like tempo changes, duty cycle changes etc. and doesn't return -; until the first note is reached -Audio3_PlayNextNote: -; reload the vibrato delay counter - ld hl, wChannelVibratoDelayCounterReloadValues - add hl, bc - ld a, [hl] - ld hl, wChannelVibratoDelayCounters - add hl, bc - ld [hl], a - - ld hl, wChannelFlags1 - add hl, bc - res BIT_PITCH_SLIDE_ON, [hl] - res BIT_PITCH_SLIDE_DECREASING, [hl] - call Audio3_sound_ret - ret - -Audio3_sound_ret: - call Audio3_GetNextMusicByte - ld d, a - cp $ff ; is this command a sound_ret? - jp nz, Audio3_sound_call ; no - ld b, 0 - ld hl, wChannelFlags1 - add hl, bc - bit BIT_SOUND_CALL, [hl] - jr nz, .returnFromCall - ld a, c - cp Ch4 - jr nc, .noiseOrSfxChannel - jr .disableChannelOutput -.noiseOrSfxChannel - res BIT_NOISE_OR_SFX, [hl] - ld hl, wChannelFlags2 - add hl, bc - res BIT_EXECUTE_MUSIC, [hl] - cp Ch7 - jr nz, .skipSfxChannel3 -; restart hardware channel 3 (wave channel) output - ld a, $0 - ld [rNR30], a - ld a, $80 - ld [rNR30], a -.skipSfxChannel3 - jr nz, .dontDisable - ld a, [wDisableChannelOutputWhenSfxEnds] - and a - jr z, .dontDisable - xor a - ld [wDisableChannelOutputWhenSfxEnds], a - jr .disableChannelOutput -.dontDisable - jr .afterDisable -.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 Audio3_sound_ret -.disableChannelOutput - ld hl, Audio3_HWChannelDisableMasks - add hl, bc - ld a, [rNR51] - and [hl] - ld [rNR51], a -.afterDisable - ld a, [wChannelSoundIDs + Ch5] - cp CRY_SFX_START - jr nc, .maybeCry - jr .skipCry -.maybeCry - ld a, [wChannelSoundIDs + Ch5] - cp CRY_SFX_END - jr z, .skipCry - jr c, .cry - jr .skipCry -.cry - ld a, c - cp Ch5 - jr z, .skipRewind - call Audio3_GoBackOneCommandIfCry - ret c -.skipRewind - ld a, [wSavedVolume] - ld [rNR50], a - xor a - ld [wSavedVolume], a -.skipCry - ld hl, wChannelSoundIDs - add hl, bc - ld [hl], b - ret - -Audio3_sound_call: - cp $fd ; is this command a sound_call? - jp nz, Audio3_sound_loop ; no - call Audio3_GetNextMusicByte - push af - call Audio3_GetNextMusicByte - ld d, a - pop af - ld e, a - push de ; store pointer - ld d, $0 - ld a, c - add a - ld e, a - ld hl, wChannelCommandPointers - add hl, de - push hl - ld hl, wChannelReturnAddresses - 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 BIT_SOUND_CALL, [hl] ; set the call flag - jp Audio3_sound_ret - -Audio3_sound_loop: - cp $fe ; is this command a sound_loop? - jp nz, Audio3_note_type ; no - call Audio3_GetNextMusicByte - 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 Audio3_GetNextMusicByte ; skip pointer - call Audio3_GetNextMusicByte - jp Audio3_sound_ret -.loopAgain ; inc loop count - inc a - ld [hl], a - ; fall through -.infiniteLoop ; overwrite current address with pointer - call Audio3_GetNextMusicByte - push af - call Audio3_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 Audio3_sound_ret - -Audio3_note_type: - and $f0 - cp $d0 ; is this command a note_type? - jp nz, Audio3_toggle_perfect_pitch ; no - ld a, d - and $f - ld b, $0 - ld hl, wChannelNoteSpeeds - add hl, bc - ld [hl], a ; store low nibble as speed - ld a, c - cp Ch4 - jr z, .noiseChannel ; noise channel has 0 params - call Audio3_GetNextMusicByte - ld d, a - ld a, c - cp Ch3 - jr z, .musicChannel3 - cp Ch7 - jr nz, .skipChannel3 - ld hl, wSfxWaveInstrument - jr .channel3 -.musicChannel3 - ld hl, wMusicWaveInstrument -.channel3 - ld a, d - and $f - ld [hl], a ; store low nibble of param as wave instrument - 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) -.skipChannel3 - ld b, 0 - ld hl, wChannelVolumes - add hl, bc - ld [hl], d -.noiseChannel - jp Audio3_sound_ret - -Audio3_toggle_perfect_pitch: - ld a, d - cp $e8 ; is this command a toggle_perfect_pitch? - jr nz, Audio3_vibrato ; no - ld b, 0 - ld hl, wChannelFlags1 - add hl, bc - ld a, [hl] - xor $1 - ld [hl], a ; flip bit 0 of wChannelFlags1 - jp Audio3_sound_ret - -Audio3_vibrato: - cp $ea ; is this command a vibrato? - jr nz, Audio3_pitch_slide ; no - call Audio3_GetNextMusicByte - 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 Audio3_GetNextMusicByte - ld d, a - -; The high nybble of the command byte is the extent of the vibrato. -; Let n be the extent. -; The upper nybble of the channel's byte in the wChannelVibratoExtents -; array will store the extent above the note: (n / 2) + (n % 2). -; The lower nybble will store the extent below the note: (n / 2). -; These two values add to the total extent, n. - 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 - -; The low nybble of the command byte is the rate of the vibrato. -; The high and low nybbles of the channel's byte in the wChannelVibratoRates -; array are both initialised to this value because the high nybble is the -; counter reload value and the low nybble is the counter itself, which should -; start at its value upon reload. - ld a, d - and $f - ld d, a - ld hl, wChannelVibratoRates - add hl, bc - swap a - or d - ld [hl], a - - jp Audio3_sound_ret - -Audio3_pitch_slide: - cp $eb ; is this command a pitch_slide? - jr nz, Audio3_duty_cycle ; no - call Audio3_GetNextMusicByte - ld b, 0 - ld hl, wChannelPitchSlideLengthModifiers - add hl, bc - ld [hl], a - call Audio3_GetNextMusicByte - ld d, a - and $f0 - swap a - ld b, a - ld a, d - and $f - call Audio3_CalculateFrequency - ld b, 0 - ld hl, wChannelPitchSlideTargetFrequencyHighBytes - add hl, bc - ld [hl], d - ld hl, wChannelPitchSlideTargetFrequencyLowBytes - add hl, bc - ld [hl], e - ld b, 0 - ld hl, wChannelFlags1 - add hl, bc - set BIT_PITCH_SLIDE_ON, [hl] - call Audio3_GetNextMusicByte - ld d, a - jp Audio3_note_length - -Audio3_duty_cycle: - cp $ec ; is this command a duty_cycle? - jr nz, Audio3_tempo ; no - call Audio3_GetNextMusicByte - rrca - rrca - and $c0 - ld b, 0 - ld hl, wChannelDutyCycles - add hl, bc - ld [hl], a ; store duty cycle - jp Audio3_sound_ret - -Audio3_tempo: - cp $ed ; is this command a tempo? - jr nz, Audio3_stereo_panning ; no - ld a, c - cp Ch5 - jr nc, .sfxChannel - call Audio3_GetNextMusicByte - ld [wMusicTempo], a ; store first param - call Audio3_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 Audio3_GetNextMusicByte - ld [wSfxTempo], a ; store first param - call Audio3_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 Audio3_sound_ret - -Audio3_stereo_panning: - cp $ee ; is this command a stereo_panning? - jr nz, Audio3_unknownmusic0xef ; no - call Audio3_GetNextMusicByte - ld [wStereoPanning], a ; store panning - jp Audio3_sound_ret - -; this appears to never be used -Audio3_unknownmusic0xef: - cp $ef ; is this command an unknownmusic0xef? - jr nz, Audio3_duty_cycle_pattern ; no - call Audio3_GetNextMusicByte - push bc - call Audio3_PlaySound - pop bc - ld a, [wDisableChannelOutputWhenSfxEnds] - and a - jr nz, .skip - ld a, [wChannelSoundIDs + Ch8] - ld [wDisableChannelOutputWhenSfxEnds], a - xor a - ld [wChannelSoundIDs + Ch8], a -.skip - jp Audio3_sound_ret - -Audio3_duty_cycle_pattern: - cp $fc ; is this command a duty_cycle_pattern? - jr nz, Audio3_volume ; no - call Audio3_GetNextMusicByte - ld b, 0 - ld hl, wChannelDutyCyclePatterns - add hl, bc - ld [hl], a ; store full pattern - and %11000000 - ld hl, wChannelDutyCycles - add hl, bc - ld [hl], a ; store first duty cycle - ld hl, wChannelFlags1 - add hl, bc - set BIT_ROTATE_DUTY_CYCLE, [hl] - jp Audio3_sound_ret - -Audio3_volume: - cp $f0 ; is this command a volume? - jr nz, Audio3_execute_music ; no - call Audio3_GetNextMusicByte - ld [rNR50], a ; store volume - jp Audio3_sound_ret - -Audio3_execute_music: - cp $f8 ; is this command an execute_music? - jr nz, Audio3_octave ; no - ld b, $0 - ld hl, wChannelFlags2 - add hl, bc - set BIT_EXECUTE_MUSIC, [hl] - jp Audio3_sound_ret - -Audio3_octave: - and $f0 - cp $e0 ; is this command an octave? - jr nz, Audio3_sfx_note ; no - ld hl, wChannelOctaves - ld b, 0 - add hl, bc - ld a, d - and $f - ld [hl], a ; store low nibble as octave - jp Audio3_sound_ret - -; sfx_note is either square_note or noise_note depending on the channel -Audio3_sfx_note: - cp $20 ; is this command a sfx_note? - jr nz, Audio3_pitch_sweep - ld a, c - cp Ch4 ; is this a noise or sfx channel? - jr c, Audio3_pitch_sweep ; no - ld b, 0 - ld hl, wChannelFlags2 - add hl, bc - bit BIT_EXECUTE_MUSIC, [hl] ; is execute_music being used? - jr nz, Audio3_pitch_sweep ; yes - call Audio3_note_length - -; This code seems to do the same thing as what Audio3_ApplyDutyCycleAndSoundLength -; does below. - ld d, a - ld b, 0 - ld hl, wChannelDutyCycles - add hl, bc - ld a, [hl] - or d - ld d, a - ld b, REG_DUTY_SOUND_LEN - call Audio3_GetRegisterPointer - ld [hl], d - - call Audio3_GetNextMusicByte - ld d, a - ld b, REG_VOLUME_ENVELOPE - call Audio3_GetRegisterPointer - ld [hl], d - call Audio3_GetNextMusicByte - ld e, a - ld a, c - cp Ch8 - ld a, 0 - jr z, .skip -; Channels 1 through 3 have 2 registers that control frequency, but the noise -; channel a single register (the polynomial counter) that controls frequency, -; so this command has one less byte on the noise channel. - push de - call Audio3_GetNextMusicByte - pop de -.skip - ld d, a - push de - call Audio3_ApplyDutyCycleAndSoundLength - call Audio3_EnableChannelOutput - pop de - call Audio3_ApplyWavePatternAndFrequency - ret - -Audio3_pitch_sweep: - ld a, c - cp Ch5 - jr c, Audio3_note ; if not a sfx - ld a, d - cp $10 ; is this command a pitch_sweep? - jr nz, Audio3_note ; no - ld b, $0 - ld hl, wChannelFlags2 - add hl, bc - bit BIT_EXECUTE_MUSIC, [hl] - jr nz, Audio3_note ; no - call Audio3_GetNextMusicByte - ld [rNR10], a - jp Audio3_sound_ret - -Audio3_note: - ld a, c - cp Ch4 - jr nz, Audio3_note_length ; if not noise channel - ld a, d - and $f0 - cp $b0 ; is this command a drum_note? - jr z, .drum_note - jr nc, Audio3_note_length ; no - - ; this executes when on the noise channel and - ; the command id is less than $b0 - ; in this case, the upper nybble is used as the noise instrument ($1-$a) - ; and the lower nybble is the length minus 1 (0-15) - ; however, this doesn't work for instrument #2 because the command id - ; is captured by the noise_note command (command id $2x) - ; this essentially acts like a drum_note command that is only 1 byte - ; instead of 2 and can only be used with instruments 1 and 3 through 10 - ; this is unused by the game - swap a - ld b, a - ld a, d - and $f - ld d, a - ld a, b - push de - push bc - jr .playDnote - -.drum_note - ld a, d - and $f - push af - push bc - call Audio3_GetNextMusicByte ; get drum_note instrument -.playDnote - ld d, a - ld a, [wDisableChannelOutputWhenSfxEnds] - and a - jr nz, .skipDnote - ld a, d - call Audio3_PlaySound -.skipDnote - pop bc - pop de - -Audio3_note_length: - 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 Audio3_MultiplyAdd - ld a, c - cp Ch5 - 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 Ch8 - jr z, .skip ; if noise channel - call Audio3_SetSfxTempo - ld a, [wSfxTempo] - ld d, a - ld a, [wSfxTempo + 1] - ld e, a -.skip - ld a, l ; a = note_length * note_speed - ld b, 0 - ld hl, wChannelNoteDelayCountersFractionalPart - add hl, bc - ld l, [hl] - call Audio3_MultiplyAdd - ld e, l - ld d, h ; de = note_delay_frac_part + (note_length * note_speed * tempo) - 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 BIT_EXECUTE_MUSIC, [hl] - jr nz, Audio3_note_pitch - ld hl, wChannelFlags1 - add hl, bc - bit BIT_NOISE_OR_SFX, [hl] - jr z, Audio3_note_pitch - pop hl - ret - -Audio3_note_pitch: - pop af - and $f0 - cp $c0 ; compare to rest - jr nz, .notRest - ld a, c - cp Ch5 - jr nc, .next -; If this isn't an SFX channel, try the corresponding SFX channel. - ld hl, wChannelSoundIDs + Ch5 - add hl, bc - ld a, [hl] - and a - jr nz, .done - ; fall through -.next - ld a, c - cp Ch3 - jr z, .channel3 - cp Ch7 - jr nz, .notChannel3 -.channel3 - ld b, 0 - ld hl, Audio3_HWChannelDisableMasks - add hl, bc - ld a, [rNR51] - and [hl] - ld [rNR51], a ; disable hardware channel 3's output - jr .done -.notChannel3 - ld b, REG_VOLUME_ENVELOPE - call Audio3_GetRegisterPointer - ld a, $8 ; fade in sound - ld [hli], a - inc hl - ld a, $80 ; restart sound - ld [hl], a -.done - ret -.notRest - swap a - ld b, 0 - ld hl, wChannelOctaves - add hl, bc - ld b, [hl] - call Audio3_CalculateFrequency - ld b, 0 - ld hl, wChannelFlags1 - add hl, bc - bit BIT_PITCH_SLIDE_ON, [hl] - jr z, .skipPitchSlide - call Audio3_InitPitchSlideVars -.skipPitchSlide - push de - ld a, c - cp Ch5 - jr nc, .sfxChannel ; if sfx channel -; If this isn't an SFX channel, try the corresponding SFX channel. - ld hl, wChannelSoundIDs + Ch5 - ld d, 0 - ld e, a - add hl, de - ld a, [hl] - and a - jr nz, .noSfx - jr .sfxChannel -.noSfx - pop de - ret -.sfxChannel - ld b, 0 - ld hl, wChannelVolumes - add hl, bc - ld d, [hl] - ld b, REG_VOLUME_ENVELOPE - call Audio3_GetRegisterPointer - ld [hl], d - call Audio3_ApplyDutyCycleAndSoundLength - call Audio3_EnableChannelOutput - pop de - ld b, $0 - ld hl, wChannelFlags1 - add hl, bc - bit BIT_PERFECT_PITCH, [hl] ; has toggle_perfect_pitch been used? - jr z, .skipFrequencyInc - inc e ; if yes, increment the frequency by 1 - jr nc, .skipFrequencyInc - inc d -.skipFrequencyInc - ld hl, wChannelFrequencyLowBytes - add hl, bc - ld [hl], e - call Audio3_ApplyWavePatternAndFrequency - ret - -Audio3_EnableChannelOutput: - ld b, 0 - ld hl, Audio3_HWChannelEnableMasks - add hl, bc - ld a, [rNR51] - or [hl] ; set this channel's bits - ld d, a - ld a, c - cp Ch8 - jr z, .noiseChannelOrNoSfx - cp Ch5 - jr nc, .skip ; if sfx channel -; If this isn't an SFX channel, try the corresponding SFX channel. - ld hl, wChannelSoundIDs + Ch5 - add hl, bc - ld a, [hl] - and a - jr nz, .skip -.noiseChannelOrNoSfx -; If this is the SFX noise channel or a music channel whose corresponding -; SFX channel is off, apply stereo panning. - ld a, [wStereoPanning] - ld hl, Audio3_HWChannelEnableMasks - add hl, bc - and [hl] - ld d, a - ld a, [rNR51] - ld hl, Audio3_HWChannelDisableMasks - add hl, bc - and [hl] ; reset this channel's output bits - or d ; set this channel's output bits that enabled in [wStereoPanning] - ld d, a -.skip - ld a, d - ld [rNR51], a - ret - -Audio3_ApplyDutyCycleAndSoundLength: - ld b, 0 - ld hl, wChannelNoteDelayCounters ; use the note delay as sound length - add hl, bc - ld d, [hl] - ld a, c - cp Ch3 - jr z, .skipDuty ; if music channel 3 - cp Ch7 - jr z, .skipDuty ; if sfx channel 3 -; include duty cycle (except on channel 3 which doesn't have it) - ld a, d - and $3f - ld d, a - ld hl, wChannelDutyCycles - add hl, bc - ld a, [hl] - or d - ld d, a -.skipDuty - ld b, REG_DUTY_SOUND_LEN - call Audio3_GetRegisterPointer - ld [hl], d - ret - -Audio3_ApplyWavePatternAndFrequency: - ld a, c - cp Ch3 - jr z, .channel3 - cp Ch7 - jr nz, .notChannel3 - ; fall through -.channel3 - push de - ld de, wMusicWaveInstrument - cp Ch3 - jr z, .next - ld de, wSfxWaveInstrument -.next - ld a, [de] - add a - ld d, 0 - ld e, a - ld hl, Audio3_WavePointers - add hl, de - ld e, [hl] - inc hl - ld d, [hl] - ld hl, $ff30 ; wave pattern RAM - ld b, $f - ld a, $0 ; stop hardware channel 3 - ld [rNR30], a -.loop - ld a, [de] - inc de - ld [hli], a - ld a, b - dec b - and a - jr nz, .loop - ld a, $80 ; start hardware channel 3 - ld [rNR30], a - pop de -.notChannel3 - ld a, d - or $80 ; use counter mode (i.e. disable output when the counter reaches 0) - and $c7 ; zero the unused bits in the register - ld d, a - ld b, REG_FREQUENCY_LO - call Audio3_GetRegisterPointer - ld [hl], e ; store frequency low byte - inc hl - ld [hl], d ; store frequency high byte - call Audio3_ApplyFrequencyModifier - ret - -Audio3_SetSfxTempo: - call Audio3_IsCry - jr nc, .notCry - ld d, 0 - ld a, [wTempoModifier] - add $80 - jr nc, .next - inc d -.next - ld [wSfxTempo + 1], a - ld a, d - ld [wSfxTempo], a - jr .done -.notCry - xor a - ld [wSfxTempo + 1], a - ld a, $1 - ld [wSfxTempo], a -.done - ret - -Audio3_ApplyFrequencyModifier: - call Audio3_IsCry - jr nc, .done -; if playing a cry, add the cry's frequency modifier - ld a, [wFrequencyModifier] - add e - jr nc, .noCarry - inc d -.noCarry - dec hl - ld e, a - ld [hl], e - inc hl - ld [hl], d -.done - ret - -Audio3_GoBackOneCommandIfCry: - call Audio3_IsCry - jr nc, .done - ld hl, wChannelCommandPointers - ld e, c - ld d, 0 - sla e - rl d - add hl, de - ld a, [hl] - sub 1 - ld [hl], a - inc hl - ld a, [hl] - sbc 0 - ld [hl], a - scf - ret -.done - scf - ccf - ret - -Audio3_IsCry: -; Returns whether the currently playing audio is a cry in carry. - ld a, [wChannelSoundIDs + Ch5] - cp CRY_SFX_START - jr nc, .next - jr .no -.next - cp CRY_SFX_END - jr z, .no - jr c, .yes -.no - scf - ccf - ret -.yes - scf - ret - -Audio3_ApplyPitchSlide: - ld hl, wChannelFlags1 - add hl, bc - bit BIT_PITCH_SLIDE_DECREASING, [hl] - jp nz, .frequencyDecreasing -; frequency increasing - ld hl, wChannelPitchSlideCurrentFrequencyLowBytes - add hl, bc - ld e, [hl] - ld hl, wChannelPitchSlideCurrentFrequencyHighBytes - add hl, bc - ld d, [hl] - ld hl, wChannelPitchSlideFrequencySteps - add hl, bc - ld l, [hl] - ld h, b - add hl, de - ld d, h - ld e, l - ld hl, wChannelPitchSlideCurrentFrequencyFractionalPart - add hl, bc - push hl - ld hl, wChannelPitchSlideFrequencyStepsFractionalPart - 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, wChannelPitchSlideTargetFrequencyHighBytes - add hl, bc - ld a, [hl] - cp d - jp c, .reachedTargetFrequency - jr nz, .applyUpdatedFrequency - ld hl, wChannelPitchSlideTargetFrequencyLowBytes - add hl, bc - ld a, [hl] - cp e - jp c, .reachedTargetFrequency - jr .applyUpdatedFrequency -.frequencyDecreasing - ld hl, wChannelPitchSlideCurrentFrequencyLowBytes - add hl, bc - ld a, [hl] - ld hl, wChannelPitchSlideCurrentFrequencyHighBytes - add hl, bc - ld d, [hl] - ld hl, wChannelPitchSlideFrequencySteps - add hl, bc - ld e, [hl] - sub e - ld e, a - ld a, d - sbc b - ld d, a - ld hl, wChannelPitchSlideFrequencyStepsFractionalPart - 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, wChannelPitchSlideTargetFrequencyHighBytes - add hl, bc - ld a, d - cp [hl] - jr c, .reachedTargetFrequency - jr nz, .applyUpdatedFrequency - ld hl, wChannelPitchSlideTargetFrequencyLowBytes - add hl, bc - ld a, e - cp [hl] - jr c, .reachedTargetFrequency -.applyUpdatedFrequency - ld hl, wChannelPitchSlideCurrentFrequencyLowBytes - add hl, bc - ld [hl], e - ld hl, wChannelPitchSlideCurrentFrequencyHighBytes - add hl, bc - ld [hl], d - ld b, REG_FREQUENCY_LO - call Audio3_GetRegisterPointer - ld a, e - ld [hli], a - ld [hl], d - ret -.reachedTargetFrequency -; Turn off pitch slide when the target frequency has been reached. - ld hl, wChannelFlags1 - add hl, bc - res BIT_PITCH_SLIDE_ON, [hl] - res BIT_PITCH_SLIDE_DECREASING, [hl] - ret - -Audio3_InitPitchSlideVars: - ld hl, wChannelPitchSlideCurrentFrequencyHighBytes - add hl, bc - ld [hl], d - ld hl, wChannelPitchSlideCurrentFrequencyLowBytes - add hl, bc - ld [hl], e - ld hl, wChannelNoteDelayCounters - add hl, bc - ld a, [hl] - ld hl, wChannelPitchSlideLengthModifiers - add hl, bc - sub [hl] - jr nc, .next - ld a, 1 -.next - ld [hl], a - ld hl, wChannelPitchSlideTargetFrequencyLowBytes - add hl, bc - ld a, e - sub [hl] - ld e, a - ld a, d - sbc b - ld hl, wChannelPitchSlideTargetFrequencyHighBytes - add hl, bc - sub [hl] - jr c, .targetFrequencyGreater - ld d, a - ld b, 0 - ld hl, wChannelFlags1 - add hl, bc - set BIT_PITCH_SLIDE_DECREASING, [hl] - jr .next2 -.targetFrequencyGreater -; If the target frequency is greater, subtract the current frequency from -; the target frequency to get the absolute difference. - ld hl, wChannelPitchSlideCurrentFrequencyHighBytes - add hl, bc - ld d, [hl] - ld hl, wChannelPitchSlideCurrentFrequencyLowBytes - add hl, bc - ld e, [hl] - ld hl, wChannelPitchSlideTargetFrequencyLowBytes - add hl, bc - ld a, [hl] - sub e - ld e, a - -; Bug. Instead of borrowing from the high byte of the target frequency as it -; should, it borrows from the high byte of the current frequency instead. -; This means that the result will be 0x200 greater than it should be if the -; low byte of the current frequency is greater than the low byte of the -; target frequency. - ld a, d - sbc b - ld d, a - - ld hl, wChannelPitchSlideTargetFrequencyHighBytes - add hl, bc - ld a, [hl] - sub d - ld d, a - ld b, 0 - ld hl, wChannelFlags1 - add hl, bc - res BIT_PITCH_SLIDE_DECREASING, [hl] - -.next2 - ld hl, wChannelPitchSlideLengthModifiers - add hl, bc -.divideLoop - inc b - ld a, e - sub [hl] - ld e, a - jr nc, .divideLoop - ld a, d - and a - jr z, .doneDividing - dec a - ld d, a - jr .divideLoop -.doneDividing - ld a, e ; a = remainder - dividend - add [hl] - ld d, b ; d = quotient + 1 - ld b, 0 - ld hl, wChannelPitchSlideFrequencySteps - add hl, bc - ld [hl], d ; store quotient + 1 - ld hl, wChannelPitchSlideFrequencyStepsFractionalPart - add hl, bc - ld [hl], a ; store remainder - dividend - ld hl, wChannelPitchSlideCurrentFrequencyFractionalPart - add hl, bc - ld [hl], a ; store remainder - dividend - ret - -Audio3_ApplyDutyCyclePattern: - ld b, 0 - ld hl, wChannelDutyCyclePatterns - add hl, bc - ld a, [hl] - rlca - rlca - ld [hl], a - and $c0 - ld d, a - ld b, REG_DUTY_SOUND_LEN - call Audio3_GetRegisterPointer - ld a, [hl] - and $3f - or d - ld [hl], a - ret - -Audio3_GetNextMusicByte: - 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 - -Audio3_GetRegisterPointer: -; hl = address of hardware sound register b for software channel c - ld a, c - ld hl, Audio3_HWChannelBaseAddresses - add l - jr nc, .noCarry - inc h -.noCarry - ld l, a - ld a, [hl] - add b - ld l, a - ld h, $ff - ret - -Audio3_MultiplyAdd: -; hl = l + (a * de) - ld h, 0 -.loop - srl a - jr nc, .skipAdd - add hl, de -.skipAdd - sla e - rl d - and a - jr z, .done - jr .loop -.done - ret - -Audio3_CalculateFrequency: -; return the frequency for note a, octave b in de - ld h, 0 - ld l, a - add hl, hl - ld d, h - ld e, l - ld hl, Audio3_Pitches - add hl, de - ld e, [hl] - inc hl - ld d, [hl] - ld a, b -.loop - cp 7 - jr z, .done - sra d - rr e - inc a - jr .loop -.done - ld a, 8 - add d - ld d, a - ret - Audio3_PlaySound:: ld [wSoundID], a + ld a, [wSoundID] cp $ff jp z, .stopAllAudio cp MAX_SFX_ID_3 jp z, .playSfx jp c, .playSfx - cp $fe + cp $fd jr z, .playMusic jp nc, .playSfx .playMusic - xor a - ld [wUnusedC000], a - ld [wDisableChannelOutputWhenSfxEnds], a - ld [wMusicTempo + 1], a - ld [wMusicWaveInstrument], a - ld [wSfxWaveInstrument], a - ld d, $8 - ld hl, wChannelReturnAddresses - call .FillMem - ld hl, wChannelCommandPointers - call .FillMem - ld d, $4 - ld hl, wChannelSoundIDs - call .FillMem - ld hl, wChannelFlags1 - call .FillMem - ld hl, wChannelDutyCycles - call .FillMem - ld hl, wChannelDutyCyclePatterns - call .FillMem - ld hl, wChannelVibratoDelayCounters - call .FillMem - ld hl, wChannelVibratoExtents - call .FillMem - ld hl, wChannelVibratoRates - call .FillMem - ld hl, wChannelFrequencyLowBytes - call .FillMem - ld hl, wChannelVibratoDelayCounterReloadValues - call .FillMem - ld hl, wChannelFlags2 - call .FillMem - ld hl, wChannelPitchSlideLengthModifiers - call .FillMem - ld hl, wChannelPitchSlideFrequencySteps - call .FillMem - ld hl, wChannelPitchSlideFrequencyStepsFractionalPart - call .FillMem - ld hl, wChannelPitchSlideCurrentFrequencyFractionalPart - call .FillMem - ld hl, wChannelPitchSlideCurrentFrequencyHighBytes - call .FillMem - ld hl, wChannelPitchSlideCurrentFrequencyLowBytes - call .FillMem - ld hl, wChannelPitchSlideTargetFrequencyHighBytes - call .FillMem - ld hl, wChannelPitchSlideTargetFrequencyLowBytes - call .FillMem - ld a, $1 - ld hl, wChannelLoopCounters - call .FillMem - ld hl, wChannelNoteDelayCounters - call .FillMem - ld hl, wChannelNoteSpeeds - call .FillMem - ld [wMusicTempo], a - ld a, $ff - ld [wStereoPanning], a - xor a - ld [rNR50], a - ld a, $8 - ld [rNR10], a - ld a, 0 - ld [rNR51], a - xor a - ld [rNR30], a - ld a, $80 - ld [rNR30], a - ld a, $77 - ld [rNR50], a + call InitMusicVariables jp .playSoundCommon .playSfx @@ -1471,92 +75,7 @@ Audio3_PlaySound:: jr c, .playChannel ret .playChannel - xor a - push de - ld h, d - ld l, e - add hl, hl - ld d, h - ld e, l - ld hl, wChannelReturnAddresses - add hl, de - ld [hli], a - ld [hl], a - ld hl, wChannelCommandPointers - add hl, de - ld [hli], a - ld [hl], a - pop de - ld hl, wChannelSoundIDs - add hl, de - ld [hl], a - ld hl, wChannelFlags1 - add hl, de - ld [hl], a - ld hl, wChannelDutyCycles - add hl, de - ld [hl], a - ld hl, wChannelDutyCyclePatterns - add hl, de - ld [hl], a - ld hl, wChannelVibratoDelayCounters - add hl, de - ld [hl], a - ld hl, wChannelVibratoExtents - add hl, de - ld [hl], a - ld hl, wChannelVibratoRates - add hl, de - ld [hl], a - ld hl, wChannelFrequencyLowBytes - add hl, de - ld [hl], a - ld hl, wChannelVibratoDelayCounterReloadValues - add hl, de - ld [hl], a - ld hl, wChannelPitchSlideLengthModifiers - add hl, de - ld [hl], a - ld hl, wChannelPitchSlideFrequencySteps - add hl, de - ld [hl], a - ld hl, wChannelPitchSlideFrequencyStepsFractionalPart - add hl, de - ld [hl], a - ld hl, wChannelPitchSlideCurrentFrequencyFractionalPart - add hl, de - ld [hl], a - ld hl, wChannelPitchSlideCurrentFrequencyHighBytes - add hl, de - ld [hl], a - ld hl, wChannelPitchSlideCurrentFrequencyLowBytes - add hl, de - ld [hl], a - ld hl, wChannelPitchSlideTargetFrequencyHighBytes - add hl, de - ld [hl], a - ld hl, wChannelPitchSlideTargetFrequencyLowBytes - add hl, de - ld [hl], a - ld hl, wChannelFlags2 - add hl, de - ld [hl], a - ld a, $1 - ld hl, wChannelLoopCounters - add hl, de - ld [hl], a - ld hl, wChannelNoteDelayCounters - add hl, de - ld [hl], a - ld hl, wChannelNoteSpeeds - add hl, de - ld [hl], a - ld a, e - cp Ch5 - jr nz, .skipSweepDisable - ld a, $8 - ld [rNR10], a ; sweep off -.skipSweepDisable + call InitSFXVariables ld a, c and a jp z, .playSoundCommon @@ -1564,51 +83,7 @@ Audio3_PlaySound:: jp .sfxChannelLoop .stopAllAudio - ld a, $80 - ld [rNR52], a ; sound hardware on - ld [rNR30], a ; wave playback on - xor a - ld [rNR51], a ; no sound output - ld [rNR32], a ; mute channel 3 (wave channel) - ld a, $8 - ld [rNR10], a ; sweep off - ld [rNR12], a ; mute channel 1 (pulse channel 1) - ld [rNR22], a ; mute channel 2 (pulse channel 2) - ld [rNR42], a ; mute channel 4 (noise channel) - ld a, $40 - ld [rNR14], a ; counter mode - ld [rNR24], a - ld [rNR44], a - ld a, $77 - ld [rNR50], a ; full volume - xor a - ld [wUnusedC000], a - ld [wDisableChannelOutputWhenSfxEnds], a - ld [wMuteAudioAndPauseMusic], a - ld [wMusicTempo + 1], a - ld [wSfxTempo + 1], a - ld [wMusicWaveInstrument], a - ld [wSfxWaveInstrument], a - ld d, $a0 - ld hl, wChannelCommandPointers - call .FillMem - ld a, $1 - ld d, $18 - ld hl, wChannelNoteDelayCounters - call .FillMem - ld [wMusicTempo], a - ld [wSfxTempo], a - ld a, $ff - ld [wStereoPanning], a - ret - -; fills d bytes at hl with a -.FillMem - ld b, d -.loop - ld [hli], a - dec b - jr nz, .loop + call StopAllAudio ret .playSoundCommon @@ -1644,16 +119,11 @@ Audio3_PlaySound:: inc hl jr .commandPointerLoop .next + push af 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 Ch4 jr c, .skipSettingFlag ld hl, wChannelFlags1 @@ -1668,6 +138,17 @@ Audio3_PlaySound:: ld a, [de] ld [hli], a inc de + pop af + push hl + push bc + ld b, 0 + ld c, a + ld hl, wChannelSoundIDs + add hl, bc + ld a, [wSoundID] + ld [hl], a + pop bc + pop hl inc c dec b ld a, b @@ -1708,30 +189,3 @@ Audio3_PlaySound:: Audio3_CryRet: sound_ret - -Audio3_HWChannelBaseAddresses: -; the low bytes of each HW channel's base address - db HW_CH1_BASE, HW_CH2_BASE, HW_CH3_BASE, HW_CH4_BASE ; channels 0-3 - db HW_CH1_BASE, HW_CH2_BASE, HW_CH3_BASE, HW_CH4_BASE ; channels 4-7 - -Audio3_HWChannelDisableMasks: - db HW_CH1_DISABLE_MASK, HW_CH2_DISABLE_MASK, HW_CH3_DISABLE_MASK, HW_CH4_DISABLE_MASK ; channels 0-3 - db HW_CH1_DISABLE_MASK, HW_CH2_DISABLE_MASK, HW_CH3_DISABLE_MASK, HW_CH4_DISABLE_MASK ; channels 4-7 - -Audio3_HWChannelEnableMasks: - db HW_CH1_ENABLE_MASK, HW_CH2_ENABLE_MASK, HW_CH3_ENABLE_MASK, HW_CH4_ENABLE_MASK ; channels 0-3 - db HW_CH1_ENABLE_MASK, HW_CH2_ENABLE_MASK, HW_CH3_ENABLE_MASK, HW_CH4_ENABLE_MASK ; channels 4-7 - -Audio3_Pitches: - 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_ diff --git a/audio/engine_4.asm b/audio/engine_4.asm new file mode 100644 index 00000000..2f0d9ade --- /dev/null +++ b/audio/engine_4.asm @@ -0,0 +1,191 @@ +; The fourth of three duplicated sound engines. + +Audio4_PlaySound:: + ld [wSoundID], a + ld a, [wSoundID] + cp $ff + jp z, .stopAllAudio + cp MAX_SFX_ID_4 + jp z, .playSfx + jp c, .playSfx + cp $a3 + jr z, .playMusic + jp nc, .playSfx + +.playMusic + call InitMusicVariables + jp .playSoundCommon + +.playSfx + ld l, a + ld e, a + ld h, 0 + ld d, h + add hl, hl + add hl, de + ld de, SFX_Headers_4 + 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 +.sfxChannelLoop + 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 ; software channel ID + ld d, 0 + ld hl, wChannelSoundIDs + add hl, de + ld a, [hl] + and a + jr z, .playChannel + ld a, e + cp Ch8 + jr nz, .notNoiseChannel + ld a, [wSoundID] + cp NOISE_INSTRUMENTS_END + jr nc, .notNoiseInstrument + ret +.notNoiseInstrument + ld a, [hl] + cp NOISE_INSTRUMENTS_END + jr z, .playChannel + jr c, .playChannel +.notNoiseChannel + ld a, [wSoundID] + cp [hl] + jr z, .playChannel + jr c, .playChannel + ret +.playChannel + call InitSFXVariables + ld a, c + and a + jp z, .playSoundCommon + dec c + jp .sfxChannelLoop + +.stopAllAudio + call StopAllAudio + ret + +.playSoundCommon + 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_4 + 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 +.commandPointerLoop + cp c + jr z, .next + inc c + inc hl + inc hl + jr .commandPointerLoop +.next + push af + push hl + push bc + ld b, 0 + ld c, a + cp Ch4 + jr c, .skipSettingFlag + ld hl, wChannelFlags1 + add hl, bc + set BIT_NOISE_OR_SFX, [hl] +.skipSettingFlag + pop bc + pop hl + ld a, [de] ; get channel pointer + ld [hli], a + inc de + ld a, [de] + ld [hli], a + inc de + pop af + push hl + push bc + ld b, 0 + ld c, a + ld hl, wChannelSoundIDs + add hl, bc + ld a, [wSoundID] + ld [hl], a + pop bc + pop hl + inc c + dec b + ld a, b + and a + ld a, [de] + inc de + jr nz, .commandPointerLoop + ld a, [wSoundID] + cp CRY_SFX_START + jr nc, .maybeCry + jr .done +.maybeCry + ld a, [wSoundID] + cp CRY_SFX_END + jr z, .done + jr c, .cry + jr .done +.cry + ld hl, wChannelSoundIDs + Ch5 + ld [hli], a + ld [hli], a + ld [hli], a + ld [hl], a + ld hl, wChannelCommandPointers + Ch7 * 2 ; sfx wave channel pointer + ld de, Audio4_CryRet + ld [hl], e + inc hl + ld [hl], d ; overwrite pointer to point to sound_ret + ld a, [wSavedVolume] + and a + jr nz, .done + ld a, [rNR50] + ld [wSavedVolume], a + ld a, $77 + ld [rNR50], a ; full volume +.done + ret + +Audio4_CryRet: + sound_ret diff --git a/audio/headers/musicheaders1.asm b/audio/headers/musicheaders1.asm index ef85eae6..ef85eae6 100755..100644 --- a/audio/headers/musicheaders1.asm +++ b/audio/headers/musicheaders1.asm diff --git a/audio/headers/musicheaders2.asm b/audio/headers/musicheaders2.asm index d6cca9a9..d6cca9a9 100755..100644 --- a/audio/headers/musicheaders2.asm +++ b/audio/headers/musicheaders2.asm diff --git a/audio/headers/musicheaders3.asm b/audio/headers/musicheaders3.asm index ca21b419..51c67966 100755..100644 --- a/audio/headers/musicheaders3.asm +++ b/audio/headers/musicheaders3.asm @@ -22,8 +22,8 @@ Music_Surfing:: Music_GameCorner:: audio_header Music_GameCorner, Ch1, Ch2, Ch3 -Music_IntroBattle:: - audio_header Music_IntroBattle, Ch1, Ch2, Ch3, Ch4 +Music_YellowIntro:: + audio_header Music_YellowIntro, Ch1, Ch2, Ch3 ; Power Plant, Cerulean Cave, Rocket HQ Music_Dungeon1:: diff --git a/audio/headers/musicheaders4.asm b/audio/headers/musicheaders4.asm new file mode 100644 index 00000000..8c537ff9 --- /dev/null +++ b/audio/headers/musicheaders4.asm @@ -0,0 +1,11 @@ +Music_SurfingPikachu:: + audio_header Music_SurfingPikachu, Ch1, Ch2, Ch3 + +Music_MeetJessieJames:: + audio_header Music_MeetJessieJames, Ch1, Ch2, Ch3 + +Music_YellowUnusedSong:: + audio_header Music_YellowUnusedSong, Ch1, Ch2, Ch3, Ch4 + +Music_GBPrinter:: + audio_header Music_GBPrinter, Ch3 diff --git a/audio/headers/sfxheaders1.asm b/audio/headers/sfxheaders1.asm index 2d5eca4a..de0d3b89 100644 --- a/audio/headers/sfxheaders1.asm +++ b/audio/headers/sfxheaders1.asm @@ -1,5 +1,5 @@ SFX_Headers_1:: - db $ff, $ff, $ff ; padding + dbw -1, -1 ; padding SFX_Noise_Instrument01_1:: audio_header SFX_Noise_Instrument01_1, Ch8 diff --git a/audio/headers/sfxheaders2.asm b/audio/headers/sfxheaders2.asm index 912d137e..eb8eb4c1 100644 --- a/audio/headers/sfxheaders2.asm +++ b/audio/headers/sfxheaders2.asm @@ -1,5 +1,5 @@ SFX_Headers_2:: - db $ff, $ff, $ff ; padding + dbw -1, -1 ; padding SFX_Noise_Instrument01_2:: audio_header SFX_Noise_Instrument01_2, Ch8 diff --git a/audio/headers/sfxheaders3.asm b/audio/headers/sfxheaders3.asm index 2732767f..d1e0a127 100644 --- a/audio/headers/sfxheaders3.asm +++ b/audio/headers/sfxheaders3.asm @@ -1,5 +1,5 @@ SFX_Headers_3:: - db $ff, $ff, $ff ; padding + dbw -1, -1 ; padding SFX_Noise_Instrument01_3:: audio_header SFX_Noise_Instrument01_3, Ch8 diff --git a/audio/headers/sfxheaders4.asm b/audio/headers/sfxheaders4.asm new file mode 100644 index 00000000..c7f7e9d6 --- /dev/null +++ b/audio/headers/sfxheaders4.asm @@ -0,0 +1,212 @@ +SFX_Headers_4:: + dbw -1, -1 ; padding + +SFX_Noise_Instrument01_4:: + audio_header SFX_Noise_Instrument01_4, Ch8 + +SFX_Noise_Instrument02_4:: + audio_header SFX_Noise_Instrument02_4, Ch8 + +SFX_Noise_Instrument03_4:: + audio_header SFX_Noise_Instrument03_4, Ch8 + +SFX_Noise_Instrument04_4:: + audio_header SFX_Noise_Instrument04_4, Ch8 + +SFX_Noise_Instrument05_4:: + audio_header SFX_Noise_Instrument05_4, Ch8 + +SFX_Noise_Instrument06_4:: + audio_header SFX_Noise_Instrument06_4, Ch8 + +SFX_Noise_Instrument07_4:: + audio_header SFX_Noise_Instrument07_4, Ch8 + +SFX_Noise_Instrument08_4:: + audio_header SFX_Noise_Instrument08_4, Ch8 + +SFX_Noise_Instrument09_4:: + audio_header SFX_Noise_Instrument09_4, Ch8 + +SFX_Noise_Instrument10_4:: + audio_header SFX_Noise_Instrument10_4, Ch8 + +SFX_Noise_Instrument11_4:: + audio_header SFX_Noise_Instrument11_4, Ch8 + +SFX_Noise_Instrument12_4:: + audio_header SFX_Noise_Instrument12_4, Ch8 + +SFX_Noise_Instrument13_4:: + audio_header SFX_Noise_Instrument13_4, Ch8 + +SFX_Noise_Instrument14_4:: + audio_header SFX_Noise_Instrument14_4, Ch8 + +SFX_Noise_Instrument15_4:: + audio_header SFX_Noise_Instrument15_4, Ch8 + +SFX_Noise_Instrument16_4:: + audio_header SFX_Noise_Instrument16_4, Ch8 + +SFX_Noise_Instrument17_4:: + audio_header SFX_Noise_Instrument17_4, Ch8 + +SFX_Noise_Instrument18_4:: + audio_header SFX_Noise_Instrument18_4, Ch8 + +SFX_Noise_Instrument19_4:: + audio_header SFX_Noise_Instrument19_4, Ch8 + +SFX_Unknown_805db:: + audio_header SFX_Unknown_805db, Ch5, Ch6, Ch8 + +SFX_Unknown_807eb:: + audio_header SFX_Unknown_807eb, Ch5, Ch6, Ch8 + +SFX_Unknown_80760:: + audio_header SFX_Unknown_80760, Ch5, Ch6, Ch8 + +SFX_Unknown_804fa:: + audio_header SFX_Unknown_804fa, Ch5, Ch6, Ch8 + +SFX_Unknown_808a9:: + audio_header SFX_Unknown_808a9, Ch5, Ch6, Ch8 + +SFX_Unknown_80689:: + audio_header SFX_Unknown_80689, Ch5, Ch6, Ch8 + +SFX_Unknown_80633:: + audio_header SFX_Unknown_80633, Ch5, Ch6, Ch8 + +SFX_Unknown_80661:: + audio_header SFX_Unknown_80661, Ch5, Ch6, Ch8 + +SFX_Unknown_80879:: + audio_header SFX_Unknown_80879, Ch5, Ch6, Ch8 + +SFX_Unknown_80383:: + audio_header SFX_Unknown_80383, Ch5, Ch6, Ch8 + +SFX_Unknown_8081e:: + audio_header SFX_Unknown_8081e, Ch5, Ch6, Ch8 + +SFX_Unknown_806af:: + audio_header SFX_Unknown_806af, Ch5, Ch6, Ch8 + +SFX_Unknown_80712:: + audio_header SFX_Unknown_80712, Ch5, Ch6, Ch8 + +SFX_Unknown_8077e:: + audio_header SFX_Unknown_8077e, Ch5, Ch6, Ch8 + +SFX_Unknown_80603:: + audio_header SFX_Unknown_80603, Ch5, Ch6, Ch8 + +SFX_Unknown_80545:: + audio_header SFX_Unknown_80545, Ch5, Ch6, Ch8 + +SFX_Unknown_8058b:: + audio_header SFX_Unknown_8058b, Ch5, Ch6, Ch8 + +SFX_Unknown_80467:: + audio_header SFX_Unknown_80467, Ch5, Ch6, Ch8 + +SFX_Unknown_8097f:: + audio_header SFX_Unknown_8097f, Ch5, Ch6, Ch8 + +SFX_Unknown_809b2:: + audio_header SFX_Unknown_809b2, Ch5, Ch6, Ch8 + +SFX_Unknown_809fb:: + audio_header SFX_Unknown_809fb, Ch5, Ch6, Ch8 + +SFX_Unknown_80a89:: + audio_header SFX_Unknown_80a89, Ch5, Ch6, Ch8 + +SFX_Unknown_8091c:: + audio_header SFX_Unknown_8091c, Ch5, Ch6, Ch8 + +SFX_Unknown_80ad2:: + audio_header SFX_Unknown_80ad2, Ch5, Ch6, Ch8 + +SFX_Unknown_80be2:: + audio_header SFX_Unknown_80be2, Ch5, Ch6, Ch8 + +SFX_Unknown_808fa:: + audio_header SFX_Unknown_808fa, Ch5, Ch6, Ch8 + +SFX_Unknown_80b53:: + audio_header SFX_Unknown_80b53, Ch5, Ch6, Ch8 + +SFX_Unknown_80944:: + audio_header SFX_Unknown_80944, Ch5, Ch6, Ch8 + +SFX_Unknown_80b05:: + audio_header SFX_Unknown_80b05, Ch5, Ch6, Ch8 + +SFX_Unknown_80b9c:: + audio_header SFX_Unknown_80b9c, Ch5, Ch6, Ch8 + +SFX_Unknown_80a23:: + audio_header SFX_Unknown_80a23, Ch5, Ch6, Ch8 + +SFX_Unknown_80c3b:: + audio_header SFX_Unknown_80c3b, Ch5, Ch6, Ch8 + +SFX_Unknown_80c6e:: + audio_header SFX_Unknown_80c6e, Ch5, Ch6, Ch8 + +SFX_Unknown_80ca1:: + audio_header SFX_Unknown_80ca1, Ch5, Ch6, Ch8 + +SFX_Unknown_80ce7:: + audio_header SFX_Unknown_80ce7, Ch5, Ch6, Ch8 + +SFX_Unknown_803da:: + audio_header SFX_Unknown_803da, Ch5, Ch6, Ch8 + +SFX_Unknown_80411:: + audio_header SFX_Unknown_80411, Ch5, Ch6, Ch8 + +SFX_Unknown_804bf:: + audio_header SFX_Unknown_804bf, Ch5, Ch6, Ch8 + +SFX_Get_Item1_4:: + audio_header SFX_Get_Item1_4, Ch5, Ch6, Ch7 + +SFX_Get_Item2_4:: + audio_header SFX_Get_Item2_4, Ch5, Ch6, Ch7 + +SFX_Tink_4:: + audio_header SFX_Tink_4, Ch5 + +SFX_Unknown_8027f:: + audio_header SFX_Unknown_8027f, Ch5 + +SFX_Unknown_8026a:: + audio_header SFX_Unknown_8026a, Ch5 + +SFX_Unknown_80263:: + audio_header SFX_Unknown_80263, Ch8 + +SFX_Surfing_Add_Points:: + audio_header SFX_Surfing_Add_Points, Ch5 + +SFX_Surfing_Jump:: + audio_header SFX_Surfing_Jump, Ch8 + +SFX_Surfing_Flip:: + audio_header SFX_Surfing_Flip, Ch5 + +SFX_Surfing_Land:: + audio_header SFX_Surfing_Land, Ch8 + +SFX_Unknown_802cc:: + audio_header SFX_Unknown_802cc, Ch5 + +SFX_Surfing_Crash:: + audio_header SFX_Surfing_Crash, Ch8 + +SFX_Get_Item2_4_2:: + audio_header SFX_Get_Item2_4_2, Ch5, Ch6, Ch7 diff --git a/audio/music/dungeon1.asm b/audio/music/dungeon1.asm index 49c6f89c..6bcb1fc0 100644 --- a/audio/music/dungeon1.asm +++ b/audio/music/dungeon1.asm @@ -6,10 +6,10 @@ Music_Dungeon1_Ch1:: vibrato 10, 1, 4 note_type 12, 4, -5 rest 8 - stereo_panning %1110, %1101 + ; stereo_panning %1110, %1101 octave 4 note F#, 8 - stereo_panning %1111, %1111 + ; stereo_panning %1111, %1111 Music_Dungeon1_branch_7dee5:: note_type 12, 11, 2 diff --git a/audio/music/yellow/meetjessiejames.asm b/audio/music/meetjessiejames.asm index d1f9f795..7f1f4598 100644 --- a/audio/music/yellow/meetjessiejames.asm +++ b/audio/music/meetjessiejames.asm @@ -306,3 +306,4 @@ Music_MeetJessieJames_branch_83235:: note E_, 1 rest 1 sound_loop 0, Music_MeetJessieJames_branch_83235 + sound_ret diff --git a/audio/music/printer.asm b/audio/music/printer.asm new file mode 100755 index 00000000..4466db5b --- /dev/null +++ b/audio/music/printer.asm @@ -0,0 +1,316 @@ +Music_GBPrinter_Ch3:: + tempo 256 + note_type 12, 1, 0 + octave 4 + note B_, 6 + octave 5 + note C#, 1 + rest 1 + octave 4 + note B_, 6 + octave 5 + note C#, 1 + rest 1 + octave 4 + note B_, 1 + rest 1 + octave 5 + note E_, 1 + rest 1 + note D#, 1 + rest 1 + note C#, 1 + rest 1 + octave 4 + note B_, 1 + rest 1 + note A_, 1 + rest 1 + note G#, 1 + rest 1 + note F#, 1 + rest 1 +.loop + note E_, 1 + rest 1 + note B_, 1 + rest 1 + note E_, 1 + rest 1 + note B_, 1 + rest 1 + note E_, 1 + rest 1 + note B_, 1 + rest 1 + note E_, 1 + rest 1 + note B_, 1 + rest 1 + note E_, 1 + rest 1 + note B_, 1 + rest 1 + note E_, 1 + rest 1 + note B_, 1 + rest 1 + note E_, 1 + rest 1 + note B_, 1 + rest 1 + note E_, 1 + rest 1 + note B_, 1 + rest 1 + note F#, 1 + rest 1 + note A_, 1 + rest 1 + note F#, 1 + rest 1 + note A_, 1 + rest 1 + note F#, 1 + rest 1 + octave 5 + note C#, 1 + note C_, 1 + note C#, 1 + rest 1 + octave 4 + note F#, 1 + rest 1 + note E_, 1 + rest 1 + note G#, 1 + rest 1 + note E_, 1 + rest 1 + note G#, 1 + rest 1 + note E_, 1 + rest 1 + octave 5 + note E_, 1 + note D#, 1 + note E_, 1 + rest 1 + octave 4 + note D#, 1 + rest 1 + note E_, 1 + rest 1 + note B_, 1 + rest 1 + note E_, 1 + rest 1 + note B_, 1 + rest 1 + note E_, 1 + rest 1 + note B_, 1 + rest 1 + note E_, 1 + rest 1 + note B_, 1 + rest 1 + note E_, 1 + rest 1 + note B_, 1 + rest 1 + note E_, 1 + rest 1 + note B_, 1 + rest 1 + note E_, 1 + rest 1 + note B_, 1 + rest 1 + note E_, 1 + rest 1 + note B_, 1 + rest 1 + note F#, 1 + rest 1 + note A_, 1 + rest 1 + note F#, 1 + rest 1 + note A_, 1 + rest 1 + note B_, 1 + rest 1 + note A_, 1 + rest 1 + note G#, 1 + rest 1 + note F#, 1 + rest 1 + note E_, 1 + rest 1 + note B_, 1 + rest 1 + note E_, 1 + rest 1 + note B_, 1 + rest 1 + note E_, 1 + rest 1 + octave 3 + note B_, 1 + rest 1 + octave 4 + note C#, 1 + rest 1 + note D_, 1 + rest 1 + note D#, 1 + rest 1 + note F#, 1 + rest 1 + octave 3 + note B_, 1 + rest 1 + octave 4 + note F#, 1 + rest 1 + note D#, 1 + rest 1 + note F#, 1 + rest 1 + octave 3 + note B_, 1 + rest 1 + octave 4 + note F#, 1 + rest 1 + note E_, 1 + rest 1 + note G#, 1 + rest 1 + octave 3 + note B_, 1 + rest 1 + octave 4 + note G#, 1 + rest 1 + note E_, 1 + rest 1 + note G#, 1 + rest 1 + octave 3 + note B_, 1 + rest 1 + octave 4 + note G#, 1 + rest 1 + note F#, 1 + rest 1 + note A_, 1 + rest 1 + note C#, 1 + rest 1 + note A_, 1 + rest 1 + note F#, 1 + rest 1 + note A_, 1 + rest 1 + note C#, 1 + rest 1 + note A_, 1 + rest 1 + note B_, 1 + note A#, 1 + note B_, 1 + rest 1 + note E_, 1 + rest 1 + note F#, 1 + rest 1 + note G#, 1 + rest 1 + octave 3 + note B_, 1 + rest 1 + octave 4 + note C#, 1 + rest 1 + note D_, 1 + rest 1 + note D#, 1 + rest 1 + note F#, 1 + rest 1 + octave 3 + note B_, 1 + rest 1 + octave 4 + note F#, 1 + rest 1 + note D#, 1 + rest 1 + note F#, 1 + rest 1 + octave 3 + note B_, 1 + rest 1 + octave 4 + note F#, 1 + rest 1 + note E_, 1 + rest 1 + note G#, 1 + rest 1 + octave 3 + note B_, 1 + rest 1 + octave 4 + note G#, 1 + rest 1 + note E_, 1 + rest 1 + note G#, 1 + rest 1 + octave 3 + note B_, 1 + rest 1 + octave 4 + note G#, 1 + rest 1 + note F#, 1 + rest 1 + note A_, 1 + rest 1 + note C#, 1 + rest 1 + note A_, 1 + rest 1 + note F#, 1 + rest 1 + note A_, 1 + rest 1 + note F#, 1 + rest 1 + note D#, 1 + rest 1 + note B_, 1 + rest 1 + note B_, 1 + rest 1 + note A_, 1 + rest 1 + note A_, 1 + rest 1 + note G#, 1 + rest 1 + octave 3 + note B_, 1 + rest 1 + octave 4 + note C#, 1 + rest 1 + note D#, 1 + rest 1 + sound_loop 0, .loop diff --git a/audio/music/yellow/surfingpikachu.asm b/audio/music/surfingpikachu.asm index 8e161443..8e161443 100644 --- a/audio/music/yellow/surfingpikachu.asm +++ b/audio/music/surfingpikachu.asm diff --git a/audio/music/yellow/yellowintro.asm b/audio/music/yellowintro.asm index bb741a22..bb741a22 100644 --- a/audio/music/yellow/yellowintro.asm +++ b/audio/music/yellowintro.asm diff --git a/audio/music/yellow/yellowunusedsong.asm b/audio/music/yellowunusedsong.asm index f1e4d18f..f1e4d18f 100644 --- a/audio/music/yellow/yellowunusedsong.asm +++ b/audio/music/yellowunusedsong.asm diff --git a/audio/pikachu_cries.asm b/audio/pikachu_cries.asm new file mode 100644 index 00000000..a09425b3 --- /dev/null +++ b/audio/pikachu_cries.asm @@ -0,0 +1,210 @@ +pcm: MACRO + dw .End - .Start +.Start: +\1 +.End: +ENDM + +SECTION "Pikachu Cries 1", ROMX ; BANK $21 + +PikachuCry1:: + pcm INCBIN "audio/pikachu_cries/pikachu_cry_1.pcm" + db $77 ; unused + ; All of the pcm data has one trailing byte that is never processed. + +PikachuCry2:: + pcm INCBIN "audio/pikachu_cries/pikachu_cry_2.pcm" + db $77 ; unused + +PikachuCry3:: + pcm INCBIN "audio/pikachu_cries/pikachu_cry_3.pcm" + db $03 ; unused + +PikachuCry4:: + pcm INCBIN "audio/pikachu_cries/pikachu_cry_4.pcm" + db $e0 ; unused + + +SECTION "Pikachu Cries 2", ROMX ; BANK $22 + +PikachuCry5:: + pcm INCBIN "audio/pikachu_cries/pikachu_cry_5.pcm" + db $77 ; unused + +PikachuCry6:: + pcm INCBIN "audio/pikachu_cries/pikachu_cry_6.pcm" + db $77 ; unused + +PikachuCry7:: + pcm INCBIN "audio/pikachu_cries/pikachu_cry_7.pcm" + db $ff ; unused + + +SECTION "Pikachu Cries 3", ROMX ; BANK $23 + +PikachuCry8:: + pcm INCBIN "audio/pikachu_cries/pikachu_cry_8.pcm" + db $f7 ; unused + +PikachuCry9:: + pcm INCBIN "audio/pikachu_cries/pikachu_cry_9.pcm" + db $f3 ; unused + +PikachuCry10:: + pcm INCBIN "audio/pikachu_cries/pikachu_cry_10.pcm" + db $ff ; unused + + +SECTION "Pikachu Cries 4", ROMX ; BANK $24 + +PikachuCry11:: + pcm INCBIN "audio/pikachu_cries/pikachu_cry_11.pcm" + db $77 ; unused + +PikachuCry12:: + pcm INCBIN "audio/pikachu_cries/pikachu_cry_12.pcm" + db $ff ; unused + +PikachuCry13:: + pcm INCBIN "audio/pikachu_cries/pikachu_cry_13.pcm" + db $f0 ; unused + + +SECTION "Pikachu Cries 5", ROMX ; BANK $25 + +PikachuCry14:: + pcm INCBIN "audio/pikachu_cries/pikachu_cry_14.pcm" + db $fc ; unused + +PikachuCry15:: + pcm INCBIN "audio/pikachu_cries/pikachu_cry_15.pcm" + db $77 ; unused + +SECTION "Pikachu Cries 6", ROMX ; BANK $31 + +PikachuCry16:: + pcm INCBIN "audio/pikachu_cries/pikachu_cry_16.pcm" + db $e7 ; unused + +PikachuCry18:: + pcm INCBIN "audio/pikachu_cries/pikachu_cry_18.pcm" + db $00 ; unused + +PikachuCry22:: + pcm INCBIN "audio/pikachu_cries/pikachu_cry_22.pcm" + db $7e ; unused + + +SECTION "Pikachu Cries 7", ROMX ; BANK $32 + +PikachuCry20:: + pcm INCBIN "audio/pikachu_cries/pikachu_cry_20.pcm" + db $07 ; unused + +PikachuCry21:: + pcm INCBIN "audio/pikachu_cries/pikachu_cry_21.pcm" + db $ff ; unused + + +SECTION "Pikachu Cries 8", ROMX ; BANK $33 + +PikachuCry19:: + pcm INCBIN "audio/pikachu_cries/pikachu_cry_19.pcm" + db $06 ; unused + +PikachuCry24:: + pcm INCBIN "audio/pikachu_cries/pikachu_cry_24.pcm" + db $e0 ; unused + +PikachuCry26:: + pcm INCBIN "audio/pikachu_cries/pikachu_cry_26.pcm" + db $00 ; unused + +SECTION "Pikachu Cries 9", ROMX ; BANK $34 + +PikachuCry17:: + pcm INCBIN "audio/pikachu_cries/pikachu_cry_17.pcm" + db $00 ; unused + +PikachuCry23:: + pcm INCBIN "audio/pikachu_cries/pikachu_cry_23.pcm" + db $00 ; unused + +PikachuCry25:: + pcm INCBIN "audio/pikachu_cries/pikachu_cry_25.pcm" + db $03 ; unused + + +SECTION "Pikachu Cries 10", ROMX ; BANK $35 + +PikachuCry27:: + pcm INCBIN "audio/pikachu_cries/pikachu_cry_27.pcm" + db $ff ; unused + +PikachuCry28:: + pcm INCBIN "audio/pikachu_cries/pikachu_cry_28.pcm" + db $1b ; unused + +PikachuCry29:: + pcm INCBIN "audio/pikachu_cries/pikachu_cry_29.pcm" + db $87 ; unused + +PikachuCry30:: + pcm INCBIN "audio/pikachu_cries/pikachu_cry_30.pcm" + db $00 ; unused + +PikachuCry31:: + pcm INCBIN "audio/pikachu_cries/pikachu_cry_31.pcm" + db $00 ; unused + +SECTION "Pikachu Cries 11", ROMX ; BANK $36 + +PikachuCry32:: + pcm INCBIN "audio/pikachu_cries/pikachu_cry_32.pcm" + db $ff ; unused + +PikachuCry33:: + pcm INCBIN "audio/pikachu_cries/pikachu_cry_33.pcm" + db $1f ; unused + +PikachuCry34:: + pcm INCBIN "audio/pikachu_cries/pikachu_cry_34.pcm" + db $01 ; unused + +PikachuCry41:: + pcm INCBIN "audio/pikachu_cries/pikachu_cry_41.pcm" + db $9b ; unused + + +SECTION "Pikachu Cries 12", ROMX ; BANK $37 + +PikachuCry35:: + pcm INCBIN "audio/pikachu_cries/pikachu_cry_35.pcm" + db $00 ; unused + +PikachuCry36:: + pcm INCBIN "audio/pikachu_cries/pikachu_cry_36.pcm" + db $01 ; unused + +PikachuCry39:: + pcm INCBIN "audio/pikachu_cries/pikachu_cry_39.pcm" + db $0f ; unused + + +SECTION "Pikachu Cries 13", ROMX ; BANK $38 + +PikachuCry37:: + pcm INCBIN "audio/pikachu_cries/pikachu_cry_37.pcm" + db $3f ; unused + +PikachuCry38:: + pcm INCBIN "audio/pikachu_cries/pikachu_cry_38.pcm" + db $ff ; unused + +PikachuCry40:: + pcm INCBIN "audio/pikachu_cries/pikachu_cry_40.pcm" + db $ff ; unused + +PikachuCry42:: + pcm INCBIN "audio/pikachu_cries/pikachu_cry_42.pcm" + db $00 ; unused diff --git a/audio/pikachu_cries/pikachu_cry_1.wav b/audio/pikachu_cries/pikachu_cry_1.wav Binary files differnew file mode 100644 index 00000000..98714511 --- /dev/null +++ b/audio/pikachu_cries/pikachu_cry_1.wav diff --git a/audio/pikachu_cries/pikachu_cry_10.wav b/audio/pikachu_cries/pikachu_cry_10.wav Binary files differnew file mode 100644 index 00000000..e51a2979 --- /dev/null +++ b/audio/pikachu_cries/pikachu_cry_10.wav diff --git a/audio/pikachu_cries/pikachu_cry_11.wav b/audio/pikachu_cries/pikachu_cry_11.wav Binary files differnew file mode 100644 index 00000000..44eece5a --- /dev/null +++ b/audio/pikachu_cries/pikachu_cry_11.wav diff --git a/audio/pikachu_cries/pikachu_cry_12.wav b/audio/pikachu_cries/pikachu_cry_12.wav Binary files differnew file mode 100644 index 00000000..cad90cfe --- /dev/null +++ b/audio/pikachu_cries/pikachu_cry_12.wav diff --git a/audio/pikachu_cries/pikachu_cry_13.wav b/audio/pikachu_cries/pikachu_cry_13.wav Binary files differnew file mode 100644 index 00000000..981768b5 --- /dev/null +++ b/audio/pikachu_cries/pikachu_cry_13.wav diff --git a/audio/pikachu_cries/pikachu_cry_14.wav b/audio/pikachu_cries/pikachu_cry_14.wav Binary files differnew file mode 100644 index 00000000..3da9a543 --- /dev/null +++ b/audio/pikachu_cries/pikachu_cry_14.wav diff --git a/audio/pikachu_cries/pikachu_cry_15.wav b/audio/pikachu_cries/pikachu_cry_15.wav Binary files differnew file mode 100644 index 00000000..4ef874c3 --- /dev/null +++ b/audio/pikachu_cries/pikachu_cry_15.wav diff --git a/audio/pikachu_cries/pikachu_cry_16.wav b/audio/pikachu_cries/pikachu_cry_16.wav Binary files differnew file mode 100644 index 00000000..baddf17c --- /dev/null +++ b/audio/pikachu_cries/pikachu_cry_16.wav diff --git a/audio/pikachu_cries/pikachu_cry_17.wav b/audio/pikachu_cries/pikachu_cry_17.wav Binary files differnew file mode 100644 index 00000000..f8bd9c73 --- /dev/null +++ b/audio/pikachu_cries/pikachu_cry_17.wav diff --git a/audio/pikachu_cries/pikachu_cry_18.wav b/audio/pikachu_cries/pikachu_cry_18.wav Binary files differnew file mode 100644 index 00000000..69b2d3b8 --- /dev/null +++ b/audio/pikachu_cries/pikachu_cry_18.wav diff --git a/audio/pikachu_cries/pikachu_cry_19.wav b/audio/pikachu_cries/pikachu_cry_19.wav Binary files differnew file mode 100644 index 00000000..a9429132 --- /dev/null +++ b/audio/pikachu_cries/pikachu_cry_19.wav diff --git a/audio/pikachu_cries/pikachu_cry_2.wav b/audio/pikachu_cries/pikachu_cry_2.wav Binary files differnew file mode 100644 index 00000000..d95343de --- /dev/null +++ b/audio/pikachu_cries/pikachu_cry_2.wav diff --git a/audio/pikachu_cries/pikachu_cry_20.wav b/audio/pikachu_cries/pikachu_cry_20.wav Binary files differnew file mode 100644 index 00000000..1c1842e4 --- /dev/null +++ b/audio/pikachu_cries/pikachu_cry_20.wav diff --git a/audio/pikachu_cries/pikachu_cry_21.wav b/audio/pikachu_cries/pikachu_cry_21.wav Binary files differnew file mode 100644 index 00000000..d74ebc12 --- /dev/null +++ b/audio/pikachu_cries/pikachu_cry_21.wav diff --git a/audio/pikachu_cries/pikachu_cry_22.wav b/audio/pikachu_cries/pikachu_cry_22.wav Binary files differnew file mode 100644 index 00000000..89fa5c77 --- /dev/null +++ b/audio/pikachu_cries/pikachu_cry_22.wav diff --git a/audio/pikachu_cries/pikachu_cry_23.wav b/audio/pikachu_cries/pikachu_cry_23.wav Binary files differnew file mode 100644 index 00000000..ea092080 --- /dev/null +++ b/audio/pikachu_cries/pikachu_cry_23.wav diff --git a/audio/pikachu_cries/pikachu_cry_24.wav b/audio/pikachu_cries/pikachu_cry_24.wav Binary files differnew file mode 100644 index 00000000..ec51d8cb --- /dev/null +++ b/audio/pikachu_cries/pikachu_cry_24.wav diff --git a/audio/pikachu_cries/pikachu_cry_25.wav b/audio/pikachu_cries/pikachu_cry_25.wav Binary files differnew file mode 100644 index 00000000..77dac608 --- /dev/null +++ b/audio/pikachu_cries/pikachu_cry_25.wav diff --git a/audio/pikachu_cries/pikachu_cry_26.wav b/audio/pikachu_cries/pikachu_cry_26.wav Binary files differnew file mode 100644 index 00000000..9a9a0776 --- /dev/null +++ b/audio/pikachu_cries/pikachu_cry_26.wav diff --git a/audio/pikachu_cries/pikachu_cry_27.wav b/audio/pikachu_cries/pikachu_cry_27.wav Binary files differnew file mode 100644 index 00000000..44a79ee0 --- /dev/null +++ b/audio/pikachu_cries/pikachu_cry_27.wav diff --git a/audio/pikachu_cries/pikachu_cry_28.wav b/audio/pikachu_cries/pikachu_cry_28.wav Binary files differnew file mode 100644 index 00000000..ccf8bde2 --- /dev/null +++ b/audio/pikachu_cries/pikachu_cry_28.wav diff --git a/audio/pikachu_cries/pikachu_cry_29.wav b/audio/pikachu_cries/pikachu_cry_29.wav Binary files differnew file mode 100644 index 00000000..fb3375b3 --- /dev/null +++ b/audio/pikachu_cries/pikachu_cry_29.wav diff --git a/audio/pikachu_cries/pikachu_cry_3.wav b/audio/pikachu_cries/pikachu_cry_3.wav Binary files differnew file mode 100644 index 00000000..d3423966 --- /dev/null +++ b/audio/pikachu_cries/pikachu_cry_3.wav diff --git a/audio/pikachu_cries/pikachu_cry_30.wav b/audio/pikachu_cries/pikachu_cry_30.wav Binary files differnew file mode 100644 index 00000000..9bdafdc2 --- /dev/null +++ b/audio/pikachu_cries/pikachu_cry_30.wav diff --git a/audio/pikachu_cries/pikachu_cry_31.wav b/audio/pikachu_cries/pikachu_cry_31.wav Binary files differnew file mode 100644 index 00000000..2853bc0b --- /dev/null +++ b/audio/pikachu_cries/pikachu_cry_31.wav diff --git a/audio/pikachu_cries/pikachu_cry_32.wav b/audio/pikachu_cries/pikachu_cry_32.wav Binary files differnew file mode 100644 index 00000000..8ded504e --- /dev/null +++ b/audio/pikachu_cries/pikachu_cry_32.wav diff --git a/audio/pikachu_cries/pikachu_cry_33.wav b/audio/pikachu_cries/pikachu_cry_33.wav Binary files differnew file mode 100644 index 00000000..9be38b10 --- /dev/null +++ b/audio/pikachu_cries/pikachu_cry_33.wav diff --git a/audio/pikachu_cries/pikachu_cry_34.wav b/audio/pikachu_cries/pikachu_cry_34.wav Binary files differnew file mode 100644 index 00000000..45986668 --- /dev/null +++ b/audio/pikachu_cries/pikachu_cry_34.wav diff --git a/audio/pikachu_cries/pikachu_cry_35.wav b/audio/pikachu_cries/pikachu_cry_35.wav Binary files differnew file mode 100644 index 00000000..91b4d35b --- /dev/null +++ b/audio/pikachu_cries/pikachu_cry_35.wav diff --git a/audio/pikachu_cries/pikachu_cry_36.wav b/audio/pikachu_cries/pikachu_cry_36.wav Binary files differnew file mode 100644 index 00000000..789f9ca6 --- /dev/null +++ b/audio/pikachu_cries/pikachu_cry_36.wav diff --git a/audio/pikachu_cries/pikachu_cry_37.wav b/audio/pikachu_cries/pikachu_cry_37.wav Binary files differnew file mode 100644 index 00000000..bc004c25 --- /dev/null +++ b/audio/pikachu_cries/pikachu_cry_37.wav diff --git a/audio/pikachu_cries/pikachu_cry_38.wav b/audio/pikachu_cries/pikachu_cry_38.wav Binary files differnew file mode 100644 index 00000000..b7d23e25 --- /dev/null +++ b/audio/pikachu_cries/pikachu_cry_38.wav diff --git a/audio/pikachu_cries/pikachu_cry_39.wav b/audio/pikachu_cries/pikachu_cry_39.wav Binary files differnew file mode 100644 index 00000000..da02dee2 --- /dev/null +++ b/audio/pikachu_cries/pikachu_cry_39.wav diff --git a/audio/pikachu_cries/pikachu_cry_4.wav b/audio/pikachu_cries/pikachu_cry_4.wav Binary files differnew file mode 100644 index 00000000..8cfc1041 --- /dev/null +++ b/audio/pikachu_cries/pikachu_cry_4.wav diff --git a/audio/pikachu_cries/pikachu_cry_40.wav b/audio/pikachu_cries/pikachu_cry_40.wav Binary files differnew file mode 100644 index 00000000..a048a408 --- /dev/null +++ b/audio/pikachu_cries/pikachu_cry_40.wav diff --git a/audio/pikachu_cries/pikachu_cry_41.wav b/audio/pikachu_cries/pikachu_cry_41.wav Binary files differnew file mode 100644 index 00000000..bbf5eabd --- /dev/null +++ b/audio/pikachu_cries/pikachu_cry_41.wav diff --git a/audio/pikachu_cries/pikachu_cry_42.wav b/audio/pikachu_cries/pikachu_cry_42.wav Binary files differnew file mode 100644 index 00000000..cd18baa0 --- /dev/null +++ b/audio/pikachu_cries/pikachu_cry_42.wav diff --git a/audio/pikachu_cries/pikachu_cry_5.wav b/audio/pikachu_cries/pikachu_cry_5.wav Binary files differnew file mode 100644 index 00000000..a2293acd --- /dev/null +++ b/audio/pikachu_cries/pikachu_cry_5.wav diff --git a/audio/pikachu_cries/pikachu_cry_6.wav b/audio/pikachu_cries/pikachu_cry_6.wav Binary files differnew file mode 100644 index 00000000..814d7139 --- /dev/null +++ b/audio/pikachu_cries/pikachu_cry_6.wav diff --git a/audio/pikachu_cries/pikachu_cry_7.wav b/audio/pikachu_cries/pikachu_cry_7.wav Binary files differnew file mode 100644 index 00000000..6ffa781f --- /dev/null +++ b/audio/pikachu_cries/pikachu_cry_7.wav diff --git a/audio/pikachu_cries/pikachu_cry_8.wav b/audio/pikachu_cries/pikachu_cry_8.wav Binary files differnew file mode 100644 index 00000000..04218660 --- /dev/null +++ b/audio/pikachu_cries/pikachu_cry_8.wav diff --git a/audio/pikachu_cries/pikachu_cry_9.wav b/audio/pikachu_cries/pikachu_cry_9.wav Binary files differnew file mode 100644 index 00000000..484c92bc --- /dev/null +++ b/audio/pikachu_cries/pikachu_cry_9.wav diff --git a/audio/sfx/get_item1_4.asm b/audio/sfx/get_item1_4.asm new file mode 100644 index 00000000..3fc984c5 --- /dev/null +++ b/audio/sfx/get_item1_4.asm @@ -0,0 +1,47 @@ +SFX_Get_Item1_4_Ch5: + execute_music + tempo 256 + volume 7, 7 + vibrato 6, 2, 6 + duty_cycle 2 + toggle_perfect_pitch + note_type 4, 11, 1 + octave 3 + note G#, 2 + note G#, 2 + note G#, 2 + note_type 12, 11, 3 + octave 4 + note E_, 4 + sound_ret + + +SFX_Get_Item1_4_Ch6: + execute_music + vibrato 8, 2, 7 + duty_cycle 2 + note_type 4, 12, 1 + octave 4 + note E_, 2 + note E_, 2 + note E_, 2 + note_type 12, 12, 3 + note B_, 4 + sound_ret + + +SFX_Get_Item1_4_Ch7: + execute_music + note_type 4, 1, 0 + octave 4 + note B_, 1 + rest 1 + note B_, 1 + rest 1 + note B_, 1 + rest 1 + note_type 12, 1, 0 + octave 4 + note B_, 2 + rest 2 + sound_ret diff --git a/audio/sfx/get_item2_4.asm b/audio/sfx/get_item2_4.asm new file mode 100644 index 00000000..33681fb2 --- /dev/null +++ b/audio/sfx/get_item2_4.asm @@ -0,0 +1,69 @@ +SFX_Get_Item2_4_Ch5: + execute_music + tempo 256 + volume 7, 7 + duty_cycle 2 + toggle_perfect_pitch + note_type 5, 11, 4 + octave 4 + note D_, 4 + note C_, 4 + octave 3 + note A_, 8 + note_type 5, 11, 2 + octave 4 + note D#, 2 + note D#, 2 + note D_, 2 + note C_, 2 + note C_, 2 + octave 3 + note A#, 2 + note_type 5, 11, 4 + octave 4 + note C_, 8 + sound_ret + + +SFX_Get_Item2_4_Ch6: + execute_music + vibrato 8, 2, 7 + duty_cycle 2 + note_type 5, 12, 5 + octave 4 + note A_, 4 + note F_, 4 + note C_, 8 + note_type 5, 12, 2 + note A#, 2 + note A#, 2 + note A#, 2 + note G_, 2 + note G_, 2 + note A#, 2 + note_type 5, 12, 4 + note A_, 8 + sound_ret + + +SFX_Get_Item2_4_Ch7: + execute_music + note_type 5, 1, 0 + octave 5 + note F_, 4 + note D#, 4 + note C_, 8 + note D#, 1 + rest 1 + note D#, 1 + rest 1 + note E_, 1 + rest 1 + note F_, 1 + rest 1 + note F_, 1 + rest 1 + note G_, 1 + rest 1 + note A_, 8 + sound_ret diff --git a/audio/sfx/get_item2_4_2.asm b/audio/sfx/get_item2_4_2.asm new file mode 100644 index 00000000..04ca9f21 --- /dev/null +++ b/audio/sfx/get_item2_4_2.asm @@ -0,0 +1,69 @@ +SFX_Get_Item2_4_2_Ch5: + execute_music + tempo 256 + volume 7, 7 + duty_cycle 2 + toggle_perfect_pitch + note_type 5, 11, 4 + octave 4 + note D_, 4 + note C_, 4 + octave 3 + note A_, 8 + note_type 5, 11, 2 + octave 4 + note D#, 2 + note D#, 2 + note D_, 2 + note C_, 2 + note C_, 2 + octave 3 + note A#, 2 + note_type 5, 11, 4 + octave 4 + note C_, 8 + sound_ret + + +SFX_Get_Item2_4_2_Ch6: + execute_music + vibrato 8, 2, 7 + duty_cycle 2 + note_type 5, 12, 5 + octave 4 + note A_, 4 + note F_, 4 + note C_, 8 + note_type 5, 12, 2 + note A#, 2 + note A#, 2 + note A#, 2 + note G_, 2 + note G_, 2 + note A#, 2 + note_type 5, 12, 4 + note A_, 8 + sound_ret + + +SFX_Get_Item2_4_2_Ch7: + execute_music + note_type 5, 1, 0 + octave 5 + note F_, 4 + note D#, 4 + note C_, 8 + note D#, 1 + rest 1 + note D#, 1 + rest 1 + note E_, 1 + rest 1 + note F_, 1 + rest 1 + note F_, 1 + rest 1 + note G_, 1 + rest 1 + note A_, 8 + sound_ret diff --git a/audio/sfx/noise_instrument01_4.asm b/audio/sfx/noise_instrument01_4.asm new file mode 100755 index 00000000..9b7aaadb --- /dev/null +++ b/audio/sfx/noise_instrument01_4.asm @@ -0,0 +1,3 @@ +SFX_Noise_Instrument01_4_Ch8: + noise_note 0, 12, 1, 51 + sound_ret diff --git a/audio/sfx/noise_instrument02_4.asm b/audio/sfx/noise_instrument02_4.asm new file mode 100755 index 00000000..769e1610 --- /dev/null +++ b/audio/sfx/noise_instrument02_4.asm @@ -0,0 +1,3 @@ +SFX_Noise_Instrument02_4_Ch8: + noise_note 0, 11, 1, 51 + sound_ret diff --git a/audio/sfx/noise_instrument03_4.asm b/audio/sfx/noise_instrument03_4.asm new file mode 100755 index 00000000..d4a0535d --- /dev/null +++ b/audio/sfx/noise_instrument03_4.asm @@ -0,0 +1,3 @@ +SFX_Noise_Instrument03_4_Ch8: + noise_note 0, 10, 1, 51 + sound_ret diff --git a/audio/sfx/noise_instrument04_4.asm b/audio/sfx/noise_instrument04_4.asm new file mode 100644 index 00000000..5defa2de --- /dev/null +++ b/audio/sfx/noise_instrument04_4.asm @@ -0,0 +1,3 @@ +SFX_Noise_Instrument04_4_Ch8: + noise_note 0, 8, 1, 51 + sound_ret diff --git a/audio/sfx/noise_instrument05_4.asm b/audio/sfx/noise_instrument05_4.asm new file mode 100644 index 00000000..6e713056 --- /dev/null +++ b/audio/sfx/noise_instrument05_4.asm @@ -0,0 +1,8 @@ +SFX_Noise_Instrument05_4_Ch8: + noise_note 7, 8, 4, 55 + noise_note 6, 8, 4, 54 + noise_note 5, 8, 3, 53 + noise_note 4, 8, 3, 52 + noise_note 3, 8, 2, 51 + noise_note 2, 8, 1, 50 + sound_ret diff --git a/audio/sfx/noise_instrument06_4.asm b/audio/sfx/noise_instrument06_4.asm new file mode 100644 index 00000000..fb7402a9 --- /dev/null +++ b/audio/sfx/noise_instrument06_4.asm @@ -0,0 +1,3 @@ +SFX_Noise_Instrument06_4_Ch8: + noise_note 0, 5, 1, 42 + sound_ret diff --git a/audio/sfx/noise_instrument07_4.asm b/audio/sfx/noise_instrument07_4.asm new file mode 100644 index 00000000..d6262f95 --- /dev/null +++ b/audio/sfx/noise_instrument07_4.asm @@ -0,0 +1,4 @@ +SFX_Noise_Instrument07_4_Ch8: + noise_note 1, 4, 1, 43 + noise_note 0, 6, 1, 42 + sound_ret diff --git a/audio/sfx/noise_instrument08_4.asm b/audio/sfx/noise_instrument08_4.asm new file mode 100644 index 00000000..9c3b3ba6 --- /dev/null +++ b/audio/sfx/noise_instrument08_4.asm @@ -0,0 +1,3 @@ +SFX_Noise_Instrument08_4_Ch8: + noise_note 0, 8, 1, 16 + sound_ret diff --git a/audio/sfx/noise_instrument09_4.asm b/audio/sfx/noise_instrument09_4.asm new file mode 100644 index 00000000..89839b7c --- /dev/null +++ b/audio/sfx/noise_instrument09_4.asm @@ -0,0 +1,3 @@ +SFX_Noise_Instrument09_4_Ch8: + noise_note 0, 8, 2, 35 + sound_ret diff --git a/audio/sfx/noise_instrument10_4.asm b/audio/sfx/noise_instrument10_4.asm new file mode 100644 index 00000000..694fa6c7 --- /dev/null +++ b/audio/sfx/noise_instrument10_4.asm @@ -0,0 +1,3 @@ +SFX_Noise_Instrument10_4_Ch8: + noise_note 0, 8, 2, 37 + sound_ret diff --git a/audio/sfx/noise_instrument11_4.asm b/audio/sfx/noise_instrument11_4.asm new file mode 100644 index 00000000..868b73c6 --- /dev/null +++ b/audio/sfx/noise_instrument11_4.asm @@ -0,0 +1,3 @@ +SFX_Noise_Instrument11_4_Ch8: + noise_note 0, 8, 2, 38 + sound_ret diff --git a/audio/sfx/noise_instrument12_4.asm b/audio/sfx/noise_instrument12_4.asm new file mode 100644 index 00000000..1d55d4f5 --- /dev/null +++ b/audio/sfx/noise_instrument12_4.asm @@ -0,0 +1,3 @@ +SFX_Noise_Instrument12_4_Ch8: + noise_note 0, 10, 1, 16 + sound_ret diff --git a/audio/sfx/noise_instrument13_4.asm b/audio/sfx/noise_instrument13_4.asm new file mode 100644 index 00000000..1b461841 --- /dev/null +++ b/audio/sfx/noise_instrument13_4.asm @@ -0,0 +1,3 @@ +SFX_Noise_Instrument13_4_Ch8: + noise_note 0, 10, 2, 17 + sound_ret diff --git a/audio/sfx/noise_instrument14_4.asm b/audio/sfx/noise_instrument14_4.asm new file mode 100644 index 00000000..7d1f5734 --- /dev/null +++ b/audio/sfx/noise_instrument14_4.asm @@ -0,0 +1,3 @@ +SFX_Noise_Instrument14_4_Ch8: + noise_note 0, 10, 2, 80 + sound_ret diff --git a/audio/sfx/noise_instrument15_4.asm b/audio/sfx/noise_instrument15_4.asm new file mode 100644 index 00000000..6d25965a --- /dev/null +++ b/audio/sfx/noise_instrument15_4.asm @@ -0,0 +1,4 @@ +SFX_Noise_Instrument15_4_Ch8: + noise_note 0, 10, 1, 24 + noise_note 0, 3, 1, 51 + sound_ret diff --git a/audio/sfx/noise_instrument16_4.asm b/audio/sfx/noise_instrument16_4.asm new file mode 100644 index 00000000..8a3e4808 --- /dev/null +++ b/audio/sfx/noise_instrument16_4.asm @@ -0,0 +1,4 @@ +SFX_Noise_Instrument16_4_Ch8: + noise_note 2, 9, 1, 40 + noise_note 0, 7, 1, 24 + sound_ret diff --git a/audio/sfx/noise_instrument17_4.asm b/audio/sfx/noise_instrument17_4.asm new file mode 100644 index 00000000..42d04ea2 --- /dev/null +++ b/audio/sfx/noise_instrument17_4.asm @@ -0,0 +1,3 @@ +SFX_Noise_Instrument17_4_Ch8: + noise_note 0, 9, 1, 34 + sound_ret diff --git a/audio/sfx/noise_instrument18_4.asm b/audio/sfx/noise_instrument18_4.asm new file mode 100644 index 00000000..c0c77719 --- /dev/null +++ b/audio/sfx/noise_instrument18_4.asm @@ -0,0 +1,3 @@ +SFX_Noise_Instrument18_4_Ch8: + noise_note 0, 7, 1, 34 + sound_ret diff --git a/audio/sfx/noise_instrument19_4.asm b/audio/sfx/noise_instrument19_4.asm new file mode 100644 index 00000000..1b37d5a1 --- /dev/null +++ b/audio/sfx/noise_instrument19_4.asm @@ -0,0 +1,3 @@ +SFX_Noise_Instrument19_4_Ch8: + noise_note 0, 6, 1, 34 + sound_ret diff --git a/audio/sfx/save_3.asm b/audio/sfx/save_3.asm index 8db092b2..10589ab3 100644 --- a/audio/sfx/save_3.asm +++ b/audio/sfx/save_3.asm @@ -1,36 +1,19 @@ SFX_Save_3_Ch5: duty_cycle 2 -IF DEF(_RED) - square_note 4, 15, 4, 1792 - square_note 3, 14, 4, 1664 - square_note 3, 14, 4, 1728 - square_note 3, 14, 4, 1792 - square_note 2, 14, 4, 1952 -ELSE square_note 3, 14, 4, 1536 square_note 3, 14, 4, 1664 square_note 3, 14, 4, 1728 square_note 3, 14, 4, 1792 square_note 15, 15, 2, 2016 -ENDC sound_ret SFX_Save_3_Ch6: duty_cycle 2 -IF DEF(_RED) - square_note 4, 0, 8, 0 - square_note 3, 13, 4, 1793 - square_note 3, 12, 4, 1665 - square_note 3, 12, 4, 1729 - square_note 3, 12, 4, 1793 - square_note 2, 12, 4, 1953 -ELSE square_note 3, 0, 8, 0 square_note 3, 12, 4, 1537 square_note 3, 12, 4, 1665 square_note 3, 12, 4, 1729 square_note 3, 12, 4, 1793 square_note 15, 13, 2, 2017 -ENDC sound_ret diff --git a/audio/sfx/shooting_star.asm b/audio/sfx/shooting_star.asm index cbef7398..6a06ec5a 100644 --- a/audio/sfx/shooting_star.asm +++ b/audio/sfx/shooting_star.asm @@ -1,5 +1,5 @@ SFX_Shooting_Star_Ch5: - duty_cycle_pattern 3, 2, 1, 0 + duty_cycle_pattern 2, 0, 2, 0 pitch_sweep 2, -7 square_note 4, 4, 0, 2016 square_note 4, 6, 0, 2016 diff --git a/audio/sfx/surfing_add_points.asm b/audio/sfx/surfing_add_points.asm new file mode 100644 index 00000000..3eeed285 --- /dev/null +++ b/audio/sfx/surfing_add_points.asm @@ -0,0 +1,7 @@ +SFX_Surfing_Add_Points_Ch5: + duty_cycle 2 + square_note 0, 9, 1, 1984 + square_note 0, 8, 1, 2000 + square_note 0, 9, 1, 1984 + square_note 12, 10, 1, 2000 + sound_ret diff --git a/audio/sfx/surfing_crash.asm b/audio/sfx/surfing_crash.asm new file mode 100644 index 00000000..e1af7f6a --- /dev/null +++ b/audio/sfx/surfing_crash.asm @@ -0,0 +1,5 @@ +SFX_Surfing_Crash_Ch8: + noise_note 2, 15, 1, 50 + noise_note 2, 0, 0, 0 + noise_note 4, 14, 6, 33 + sound_ret diff --git a/audio/sfx/surfing_flip.asm b/audio/sfx/surfing_flip.asm new file mode 100644 index 00000000..034a55d2 --- /dev/null +++ b/audio/sfx/surfing_flip.asm @@ -0,0 +1,8 @@ +SFX_Surfing_Flip_Ch5: + duty_cycle 2 + square_note 3, 12, 4, 1888 + square_note 0, 10, 4, 1856 + square_note 2, 12, 4, 1856 + square_note 0, 10, 4, 1888 + square_note 15, 12, 1, 1888 + sound_ret diff --git a/audio/sfx/surfing_jump.asm b/audio/sfx/surfing_jump.asm new file mode 100644 index 00000000..af12d9e9 --- /dev/null +++ b/audio/sfx/surfing_jump.asm @@ -0,0 +1,9 @@ +SFX_Surfing_Jump_Ch8: + noise_note 6, 15, 1, 17 + noise_note 7, 15, 2, 34 + noise_note 8, 15, 3, 51 + noise_note 9, 15, 4, 66 + noise_note 10, 15, 5, 51 + noise_note 11, 15, 6, 34 + noise_note 12, 15, 7, 17 + sound_ret diff --git a/audio/sfx/surfing_land.asm b/audio/sfx/surfing_land.asm new file mode 100644 index 00000000..41ece761 --- /dev/null +++ b/audio/sfx/surfing_land.asm @@ -0,0 +1,5 @@ +SFX_Surfing_Land_Ch8: + noise_note 3, 15, 3, 102 + noise_note 3, 3, 3, 83 + noise_note 7, 15, 5, 81 + sound_ret diff --git a/audio/sfx/swap_2.asm b/audio/sfx/swap_2.asm new file mode 100644 index 00000000..51d0f273 --- /dev/null +++ b/audio/sfx/swap_2.asm @@ -0,0 +1,11 @@ +SFX_Swap_2_Ch5: + duty_cycle 2 + square_note 8, 14, 1, 1856 + sound_ret + + +SFX_Swap_2_Ch6: + duty_cycle 2 + square_note 2, 0, 8, 0 + square_note 8, 11, 1, 1857 + sound_ret diff --git a/audio/sfx/tink_4.asm b/audio/sfx/tink_4.asm new file mode 100755 index 00000000..16b7be91 --- /dev/null +++ b/audio/sfx/tink_4.asm @@ -0,0 +1,8 @@ +SFX_Tink_4_Ch5: + duty_cycle 2 + pitch_sweep 3, -2 + square_note 4, 15, 2, 512 + pitch_sweep 2, 2 + square_note 8, 14, 2, 512 + pitch_sweep 0, 8 + sound_ret diff --git a/audio/sfx/unknown_80263.asm b/audio/sfx/unknown_80263.asm new file mode 100755 index 00000000..e1be6dd5 --- /dev/null +++ b/audio/sfx/unknown_80263.asm @@ -0,0 +1,4 @@ +SFX_Unknown_80263_Ch8: + noise_note 1, 14, 2, 51 + noise_note 8, 14, 1, 34 + sound_ret diff --git a/audio/sfx/unknown_8026a.asm b/audio/sfx/unknown_8026a.asm new file mode 100644 index 00000000..c9ee20c4 --- /dev/null +++ b/audio/sfx/unknown_8026a.asm @@ -0,0 +1,9 @@ +SFX_Unknown_8026a_Ch5: + duty_cycle 2 + pitch_sweep 1, 4 + square_note 4, 15, 2, 1536 + square_note 4, 15, 2, 1536 + pitch_sweep 1, 7 + square_note 15, 15, 2, 1536 + pitch_sweep 0, 8 + sound_ret diff --git a/audio/sfx/unknown_8027f.asm b/audio/sfx/unknown_8027f.asm new file mode 100644 index 00000000..5fbb4618 --- /dev/null +++ b/audio/sfx/unknown_8027f.asm @@ -0,0 +1,7 @@ +SFX_Unknown_8027f_Ch5: + duty_cycle 2 + pitch_sweep 1, 7 + square_note 15, 15, 0, 1264 + square_note 15, 15, 2, 1616 + pitch_sweep 0, 8 + sound_ret diff --git a/audio/sfx/unknown_802cc.asm b/audio/sfx/unknown_802cc.asm new file mode 100755 index 00000000..3126cf1e --- /dev/null +++ b/audio/sfx/unknown_802cc.asm @@ -0,0 +1,5 @@ +SFX_Unknown_802cc_Ch5: + duty_cycle 2 + square_note 3, 11, 4, 1984 + square_note 0, 10, 1, 1920 + sound_ret diff --git a/audio/sfx/unknown_80337.asm b/audio/sfx/unknown_80337.asm new file mode 100644 index 00000000..047dfaf4 --- /dev/null +++ b/audio/sfx/unknown_80337.asm @@ -0,0 +1,31 @@ +SFX_Unknown_80337_Ch5: + duty_cycle_pattern 3, 3, 0, 0 + square_note 15, 14, 0, 1920 + square_note 15, 15, 0, 1924 + square_note 15, 12, 3, 1504 + square_note 15, 12, 4, 1536 + square_note 10, 6, -4, 1920 + square_note 8, 7, 1, 1924 + sound_ret + + +SFX_Unknown_80337_Ch6: + duty_cycle_pattern 0, 0, 1, 1 + square_note 15, 10, 0, 1857 + square_note 15, 11, 0, 1859 + square_note 15, 9, 3, 1457 + square_note 15, 9, 4, 1473 + square_note 10, 4, -4, 1857 + square_note 8, 3, 1, 1862 + sound_ret + + +SFX_Unknown_80337_Ch8: + noise_note 2, 15, 2, 76 + noise_note 6, 14, 0, 58 + noise_note 15, 13, 0, 58 + noise_note 8, 13, 0, 44 + noise_note 6, 14, 6, 76 + noise_note 12, 7, -5, 76 + noise_note 15, 13, 3, 76 + sound_ret diff --git a/audio/sfx/unknown_80383.asm b/audio/sfx/unknown_80383.asm new file mode 100644 index 00000000..a99c601b --- /dev/null +++ b/audio/sfx/unknown_80383.asm @@ -0,0 +1,35 @@ +SFX_Unknown_80383_Ch5: + duty_cycle_pattern 3, 3, 0, 0 + square_note 15, 15, 7, 1952 + square_note 6, 14, 6, 1955 + square_note 10, 15, 4, 1952 + duty_cycle_pattern 2, 2, 1, 1 + square_note 10, 15, 6, 2008 + square_note 4, 14, 3, 2007 + square_note 15, 15, 2, 2008 + sound_ret + + +SFX_Unknown_80383_Ch6: + duty_cycle_pattern 0, 0, 1, 1 + square_note 2, 0, 8, 0 + square_note 15, 10, 7, 1697 + square_note 6, 8, 6, 1698 + square_note 10, 7, 4, 1697 + duty_cycle_pattern 1, 1, 3, 3 + square_note 10, 7, 6, 1750 + square_note 4, 8, 3, 1753 + square_note 15, 10, 2, 1751 + sound_ret + + +SFX_Unknown_80383_Ch8: + noise_note 2, 15, 2, 60 + noise_note 8, 14, 4, 62 + noise_note 15, 13, 7, 60 + noise_note 6, 12, 5, 59 + noise_note 6, 14, 4, 61 + noise_note 8, 11, 6, 60 + noise_note 6, 13, 4, 61 + noise_note 8, 12, 1, 59 + sound_ret diff --git a/audio/sfx/unknown_803da.asm b/audio/sfx/unknown_803da.asm new file mode 100644 index 00000000..40fba1ca --- /dev/null +++ b/audio/sfx/unknown_803da.asm @@ -0,0 +1,25 @@ +SFX_Unknown_803da_Ch5: + duty_cycle_pattern 3, 3, 0, 0 + square_note 15, 15, 7, 1984 + square_note 6, 14, 4, 1985 + square_note 10, 15, 6, 1984 + square_note 4, 13, 3, 1986 + square_note 8, 12, 1, 1984 + sound_ret + + +SFX_Unknown_803da_Ch6: + duty_cycle_pattern 1, 1, 3, 3 + square_note 15, 9, 7, 1921 + square_note 6, 8, 4, 1920 + square_note 10, 9, 6, 1921 + square_note 15, 8, 3, 1921 + sound_ret + + +SFX_Unknown_803da_Ch8: + noise_note 3, 15, 2, 60 + noise_note 13, 14, 6, 44 + noise_note 15, 13, 7, 60 + noise_note 8, 12, 1, 44 + sound_ret diff --git a/audio/sfx/unknown_80411.asm b/audio/sfx/unknown_80411.asm new file mode 100644 index 00000000..a6ba154b --- /dev/null +++ b/audio/sfx/unknown_80411.asm @@ -0,0 +1,33 @@ +SFX_Unknown_80411_Ch5: + duty_cycle_pattern 3, 3, 0, 0 + square_note 15, 15, 7, 1664 + square_note 10, 14, 6, 1668 + square_note 15, 13, 7, 1680 + square_note 8, 13, 5, 1680 + square_note 6, 12, 4, 1672 + square_note 5, 13, 3, 1648 + square_note 4, 13, 3, 1632 + square_note 8, 12, 1, 1600 + sound_ret + + +SFX_Unknown_80411_Ch6: + duty_cycle_pattern 0, 0, 1, 1 + square_note 15, 11, 7, 1601 + square_note 10, 9, 6, 1602 + square_note 15, 10, 7, 1617 + square_note 8, 10, 5, 1617 + square_note 6, 9, 4, 1607 + square_note 5, 10, 3, 1585 + square_note 4, 9, 3, 1570 + square_note 8, 7, 1, 1537 + sound_ret + + +SFX_Unknown_80411_Ch8: + noise_note 15, 14, 4, 60 + noise_note 10, 12, 7, 76 + noise_note 10, 12, 7, 60 + noise_note 12, 11, 7, 76 + noise_note 15, 10, 2, 92 + sound_ret diff --git a/audio/sfx/unknown_80467.asm b/audio/sfx/unknown_80467.asm new file mode 100644 index 00000000..07fe1ca8 --- /dev/null +++ b/audio/sfx/unknown_80467.asm @@ -0,0 +1,34 @@ +SFX_Unknown_80467_Ch5: + duty_cycle_pattern 3, 3, 0, 0 + square_note 6, 15, 7, 1952 + square_note 8, 14, 6, 1956 + square_note 4, 13, 6, 1952 + square_note 15, 13, 3, 1824 + square_note 8, 12, 3, 1827 + square_note 2, 12, 2, 1832 + square_note 8, 11, 1, 1840 + sound_ret + + +SFX_Unknown_80467_Ch6: + duty_cycle_pattern 0, 0, 2, 2 + square_note 4, 0, 8, 0 + square_note 6, 10, 7, 1857 + square_note 8, 8, 6, 1859 + square_note 4, 7, 6, 1857 + square_note 13, 8, 3, 1730 + square_note 7, 7, 3, 1729 + square_note 3, 8, 2, 1740 + square_note 8, 7, 1, 1752 + sound_ret + + +SFX_Unknown_80467_Ch8: + noise_note 2, 15, 2, 76 + noise_note 6, 14, 6, 58 + noise_note 4, 13, 7, 58 + noise_note 6, 13, 6, 44 + noise_note 8, 14, 5, 60 + noise_note 12, 13, 2, 61 + noise_note 8, 13, 1, 44 + sound_ret diff --git a/audio/sfx/unknown_804bf.asm b/audio/sfx/unknown_804bf.asm new file mode 100644 index 00000000..a4e5c616 --- /dev/null +++ b/audio/sfx/unknown_804bf.asm @@ -0,0 +1,26 @@ +SFX_Unknown_804bf_Ch5: + duty_cycle_pattern 2, 2, 1, 1 + square_note 6, 15, 4, 1856 + square_note 15, 14, 3, 1840 + square_note 4, 15, 4, 1856 + square_note 5, 11, 3, 1864 + square_note 8, 13, 1, 1872 + sound_ret + + +SFX_Unknown_804bf_Ch6: + duty_cycle_pattern 1, 3, 1, 3 + square_note 6, 12, 3, 1810 + square_note 15, 11, 3, 1796 + square_note 3, 12, 3, 1810 + square_note 4, 12, 3, 1825 + square_note 8, 11, 1, 1842 + sound_ret + + +SFX_Unknown_804bf_Ch8: + noise_note 8, 13, 6, 44 + noise_note 12, 12, 6, 60 + noise_note 10, 11, 6, 44 + noise_note 8, 9, 1, 28 + sound_ret diff --git a/audio/sfx/unknown_804fa.asm b/audio/sfx/unknown_804fa.asm new file mode 100644 index 00000000..0660ffd5 --- /dev/null +++ b/audio/sfx/unknown_804fa.asm @@ -0,0 +1,30 @@ +SFX_Unknown_804fa_Ch5: + duty_cycle_pattern 3, 3, 0, 0 + square_note 4, 15, 7, 1544 + square_note 6, 14, 6, 1536 + square_note 6, 13, 7, 1520 + square_note 6, 12, 4, 1504 + square_note 5, 13, 3, 1472 + square_note 4, 13, 3, 1440 + square_note 8, 14, 1, 1408 + sound_ret + + +SFX_Unknown_804fa_Ch6: + duty_cycle_pattern 0, 0, 2, 2 + square_note 4, 12, 7, 1284 + square_note 6, 10, 6, 1282 + square_note 6, 9, 7, 1265 + square_note 4, 11, 4, 1249 + square_note 5, 10, 3, 1218 + square_note 4, 11, 3, 1187 + square_note 8, 12, 1, 1154 + sound_ret + + +SFX_Unknown_804fa_Ch8: + noise_note 12, 14, 4, 76 + noise_note 10, 12, 7, 92 + noise_note 12, 11, 6, 76 + noise_note 15, 10, 2, 92 + sound_ret diff --git a/audio/sfx/unknown_80545.asm b/audio/sfx/unknown_80545.asm new file mode 100644 index 00000000..ab819869 --- /dev/null +++ b/audio/sfx/unknown_80545.asm @@ -0,0 +1,29 @@ +SFX_Unknown_80545_Ch5: + duty_cycle_pattern 3, 3, 0, 1 + square_note 4, 15, 7, 1984 + square_note 12, 14, 6, 1986 + square_note 6, 11, 5, 1664 + square_note 4, 12, 4, 1648 + square_note 4, 11, 5, 1632 + square_note 8, 12, 1, 1600 + sound_ret + + +SFX_Unknown_80545_Ch6: + duty_cycle_pattern 3, 0, 3, 0 + square_note 3, 12, 7, 1921 + square_note 12, 11, 6, 1920 + square_note 6, 10, 5, 1601 + square_note 4, 12, 4, 1586 + square_note 6, 11, 5, 1569 + square_note 8, 10, 1, 1538 + sound_ret + + +SFX_Unknown_80545_Ch8: + noise_note 3, 14, 4, 60 + noise_note 12, 13, 6, 44 + noise_note 4, 14, 4, 60 + noise_note 8, 11, 7, 92 + noise_note 15, 12, 2, 93 + sound_ret diff --git a/audio/sfx/unknown_8058b.asm b/audio/sfx/unknown_8058b.asm new file mode 100644 index 00000000..b3082714 --- /dev/null +++ b/audio/sfx/unknown_8058b.asm @@ -0,0 +1,31 @@ +SFX_Unknown_8058b_Ch5: + duty_cycle_pattern 3, 0, 2, 1 + square_note 8, 15, 7, 1664 + square_note 2, 15, 7, 1632 + square_note 1, 14, 7, 1600 + square_note 1, 14, 7, 1568 + square_note 15, 13, 1, 1536 + square_note 4, 12, 7, 1856 + square_note 4, 10, 7, 1840 + square_note 15, 9, 1, 1824 + sound_ret + + +SFX_Unknown_8058b_Ch6: + duty_cycle_pattern 1, 3, 2, 1 + square_note 10, 14, 7, 1666 + square_note 2, 14, 7, 1634 + square_note 1, 13, 7, 1602 + square_note 1, 13, 7, 1570 + square_note 15, 12, 1, 1538 + square_note 4, 11, 7, 1858 + square_note 2, 9, 7, 1842 + square_note 15, 8, 1, 1826 + sound_ret + + +SFX_Unknown_8058b_Ch8: + noise_note 4, 7, 4, 33 + noise_note 4, 7, 4, 16 + noise_note 4, 7, 1, 32 + sound_ret diff --git a/audio/sfx/unknown_805db.asm b/audio/sfx/unknown_805db.asm new file mode 100644 index 00000000..7bb82004 --- /dev/null +++ b/audio/sfx/unknown_805db.asm @@ -0,0 +1,21 @@ +SFX_Unknown_805db_Ch5: + duty_cycle_pattern 3, 3, 1, 1 + square_note 4, 15, 3, 1816 + square_note 15, 14, 5, 1944 + square_note 8, 9, 1, 1880 + sound_ret + + +SFX_Unknown_805db_Ch6: + duty_cycle_pattern 2, 2, 0, 0 + square_note 5, 11, 3, 1800 + square_note 15, 12, 5, 1928 + square_note 8, 7, 1, 1864 + sound_ret + + +SFX_Unknown_805db_Ch8: + noise_note 3, 10, 1, 28 + noise_note 14, 9, 4, 44 + noise_note 8, 8, 1, 28 + sound_ret diff --git a/audio/sfx/unknown_80603.asm b/audio/sfx/unknown_80603.asm new file mode 100644 index 00000000..c673990c --- /dev/null +++ b/audio/sfx/unknown_80603.asm @@ -0,0 +1,23 @@ +SFX_Unknown_80603_Ch5: + duty_cycle_pattern 2, 2, 1, 1 + square_note 4, 14, 1, 1792 + square_note 4, 15, 2, 1920 + square_note 2, 9, 2, 1856 + square_note 8, 14, 1, 1536 + sound_ret + + +SFX_Unknown_80603_Ch6: + duty_cycle_pattern 0, 0, 2, 2 + square_note 4, 11, 1, 1761 + square_note 3, 12, 2, 1761 + square_note 3, 6, 2, 1665 + square_note 8, 11, 1, 1505 + sound_ret + + +SFX_Unknown_80603_Ch8: + noise_note 2, 6, 1, 50 + noise_note 2, 6, 1, 33 + noise_note 8, 6, 1, 17 + sound_ret diff --git a/audio/sfx/unknown_80633.asm b/audio/sfx/unknown_80633.asm new file mode 100644 index 00000000..c2b421e1 --- /dev/null +++ b/audio/sfx/unknown_80633.asm @@ -0,0 +1,22 @@ +SFX_Unknown_80633_Ch5: + duty_cycle_pattern 3, 3, 2, 2 + square_note 6, 8, 3, 583 + square_note 15, 6, 2, 550 + square_note 4, 5, 2, 581 + square_note 9, 6, 3, 518 + square_note 15, 8, 2, 549 + square_note 15, 4, 2, 519 + + +SFX_Unknown_80633_Ch6: + sound_ret + + +SFX_Unknown_80633_Ch8: + noise_note 8, 13, 4, 140 + noise_note 4, 14, 2, 156 + noise_note 15, 12, 6, 140 + noise_note 8, 14, 4, 172 + noise_note 15, 13, 7, 156 + noise_note 15, 15, 2, 172 + sound_ret diff --git a/audio/sfx/unknown_80661.asm b/audio/sfx/unknown_80661.asm new file mode 100644 index 00000000..e45a2b1f --- /dev/null +++ b/audio/sfx/unknown_80661.asm @@ -0,0 +1,21 @@ +SFX_Unknown_80661_Ch5: + duty_cycle_pattern 3, 3, 0, 0 + square_note 4, 15, 3, 1760 + square_note 15, 14, 4, 1600 + square_note 8, 12, 1, 1568 + sound_ret + + +SFX_Unknown_80661_Ch6: + duty_cycle_pattern 0, 0, 2, 2 + square_note 3, 12, 3, 1667 + square_note 14, 11, 4, 1538 + square_note 8, 10, 1, 1537 + sound_ret + + +SFX_Unknown_80661_Ch8: + noise_note 4, 13, 3, 92 + noise_note 15, 14, 6, 76 + noise_note 8, 11, 1, 92 + sound_ret diff --git a/audio/sfx/unknown_80689.asm b/audio/sfx/unknown_80689.asm new file mode 100644 index 00000000..50e3d7dc --- /dev/null +++ b/audio/sfx/unknown_80689.asm @@ -0,0 +1,19 @@ +SFX_Unknown_80689_Ch5: + duty_cycle_pattern 0, 0, 2, 2 + square_note 6, 14, 2, 1280 + square_note 6, 14, 3, 1408 + square_note 6, 13, 3, 1392 + square_note 8, 10, 1, 1376 + sound_ret + + +SFX_Unknown_80689_Ch6: + duty_cycle_pattern 3, 3, 1, 1 + square_note 6, 14, 2, 1154 + square_note 6, 13, 3, 1281 + square_note 6, 11, 2, 1250 + square_note 8, 8, 1, 1217 + + +SFX_Unknown_80689_Ch8: + sound_ret diff --git a/audio/sfx/unknown_806af.asm b/audio/sfx/unknown_806af.asm new file mode 100644 index 00000000..611b655a --- /dev/null +++ b/audio/sfx/unknown_806af.asm @@ -0,0 +1,37 @@ +SFX_Unknown_806af_Ch5: + duty_cycle_pattern 3, 0, 3, 0 + square_note 4, 15, 1, 1792 + square_note 4, 14, 1, 1920 + square_note 4, 13, 1, 1856 + square_note 4, 14, 1, 1856 + square_note 4, 15, 1, 1920 + square_note 4, 13, 1, 1792 + square_note 4, 15, 1, 1793 + square_note 4, 13, 1, 1922 + square_note 4, 12, 1, 1858 + square_note 8, 11, 1, 1857 + sound_ret + + +SFX_Unknown_806af_Ch6: + duty_cycle_pattern 1, 0, 1, 0 + square_note 12, 0, 8, 0 + square_note 4, 15, 1, 1793 + square_note 4, 14, 1, 1922 + square_note 4, 13, 1, 1857 + square_note 4, 14, 1, 1857 + square_note 4, 15, 1, 1922 + square_note 8, 13, 1, 1793 + sound_ret + + +SFX_Unknown_806af_Ch8: + noise_note 15, 0, 8, 0 + noise_note 4, 0, 8, 0 + noise_note 4, 13, 1, 76 + noise_note 4, 11, 1, 44 + noise_note 4, 13, 1, 60 + noise_note 4, 11, 1, 60 + noise_note 4, 12, 1, 44 + noise_note 8, 10, 1, 76 + sound_ret diff --git a/audio/sfx/unknown_80712.asm b/audio/sfx/unknown_80712.asm new file mode 100644 index 00000000..48d00508 --- /dev/null +++ b/audio/sfx/unknown_80712.asm @@ -0,0 +1,29 @@ +SFX_Unknown_80712_Ch5: + duty_cycle_pattern 3, 0, 3, 0 + square_note 8, 15, 5, 1536 + square_note 2, 13, 2, 1592 + square_note 2, 12, 2, 1584 + square_note 2, 12, 2, 1576 + square_note 2, 11, 2, 1568 + square_note 2, 11, 2, 1552 + square_note 2, 10, 2, 1560 + square_note 2, 11, 2, 1552 + square_note 8, 12, 1, 1568 + sound_ret + + +SFX_Unknown_80712_Ch6: + duty_cycle_pattern 1, 0, 1, 0 + square_note 12, 12, 3, 1472 + square_note 3, 11, 1, 1529 + square_note 2, 10, 1, 1521 + square_note 2, 10, 1, 1513 + square_note 2, 9, 1, 1505 + square_note 2, 9, 1, 1497 + square_note 2, 8, 1, 1489 + square_note 2, 9, 1, 1497 + square_note 8, 9, 1, 1505 + + +SFX_Unknown_80712_Ch8: + sound_ret diff --git a/audio/sfx/unknown_80760.asm b/audio/sfx/unknown_80760.asm new file mode 100644 index 00000000..4fd9eba2 --- /dev/null +++ b/audio/sfx/unknown_80760.asm @@ -0,0 +1,17 @@ +SFX_Unknown_80760_Ch5: + duty_cycle 0 + square_note 8, 15, 5, 1152 + square_note 2, 14, 1, 1504 + square_note 8, 13, 1, 1500 + sound_ret + + +SFX_Unknown_80760_Ch6: + duty_cycle_pattern 2, 2, 1, 1 + square_note 7, 9, 5, 1089 + square_note 2, 8, 1, 1313 + square_note 8, 6, 1, 1306 + + +SFX_Unknown_80760_Ch8: + sound_ret diff --git a/audio/sfx/unknown_8077e.asm b/audio/sfx/unknown_8077e.asm new file mode 100644 index 00000000..c0ea51ad --- /dev/null +++ b/audio/sfx/unknown_8077e.asm @@ -0,0 +1,40 @@ +SFX_Unknown_8077e_Ch5: + duty_cycle_pattern 2, 0, 2, 0 + square_note 5, 15, 2, 1616 + square_note 9, 13, 1, 1632 + square_note 5, 14, 2, 1554 + square_note 9, 12, 1, 1570 + square_note 5, 15, 2, 1552 + square_note 6, 13, 1, 1568 + sound_loop 2, SFX_Unknown_8077e_Ch5 + sound_ret + + +SFX_Unknown_8077e_Ch6: + duty_cycle_pattern 1, 0, 0, 0 + square_note 4, 0, 8, 0 + square_note 5, 15, 2, 1617 + square_note 9, 13, 1, 1633 + square_note 5, 14, 2, 1556 + square_note 8, 12, 1, 1572 + square_note 5, 15, 2, 1553 + square_note 12, 13, 1, 1569 + square_note 5, 14, 2, 1556 + square_note 8, 12, 1, 1572 + square_note 5, 15, 2, 1553 + square_note 4, 13, 1, 1569 + sound_ret + + +SFX_Unknown_8077e_Ch8: + noise_note 6, 13, 2, 28 + noise_note 9, 11, 1, 44 + noise_note 8, 12, 2, 44 + noise_note 9, 11, 1, 60 + noise_note 6, 12, 2, 44 + noise_note 9, 10, 2, 60 + noise_note 7, 12, 2, 44 + noise_note 5, 10, 1, 60 + noise_note 9, 12, 2, 44 + noise_note 4, 10, 1, 60 + sound_ret diff --git a/audio/sfx/unknown_807eb.asm b/audio/sfx/unknown_807eb.asm new file mode 100644 index 00000000..c98628a0 --- /dev/null +++ b/audio/sfx/unknown_807eb.asm @@ -0,0 +1,24 @@ +SFX_Unknown_807eb_Ch5: + duty_cycle_pattern 2, 2, 0, 0 + square_note 4, 15, 3, 1536 + square_note 8, 13, 5, 1888 + square_note 3, 14, 2, 1824 + square_note 8, 13, 1, 1808 + sound_ret + + +SFX_Unknown_807eb_Ch6: + duty_cycle_pattern 1, 1, 2, 2 + square_note 5, 11, 3, 1777 + square_note 7, 12, 5, 1874 + square_note 3, 10, 2, 1809 + square_note 8, 11, 1, 1537 + sound_ret + + +SFX_Unknown_807eb_Ch8: + noise_note 3, 10, 2, 60 + noise_note 12, 9, 4, 44 + noise_note 3, 8, 2, 28 + noise_note 8, 7, 1, 44 + sound_ret diff --git a/audio/sfx/unknown_8081e.asm b/audio/sfx/unknown_8081e.asm new file mode 100644 index 00000000..ca5e8aa1 --- /dev/null +++ b/audio/sfx/unknown_8081e.asm @@ -0,0 +1,35 @@ +SFX_Unknown_8081e_Ch5: + duty_cycle_pattern 3, 3, 0, 0 + square_note 8, 15, 7, 1760 + square_note 6, 14, 6, 1765 + square_note 3, 15, 4, 1760 + square_note 3, 15, 6, 1744 + square_note 3, 14, 3, 1728 + square_note 4, 15, 2, 1712 + square_note 15, 10, 2, 1736 + sound_ret + + +SFX_Unknown_8081e_Ch6: + duty_cycle_pattern 0, 0, 1, 1 + square_note 3, 0, 8, 0 + square_note 8, 10, 7, 1697 + square_note 6, 8, 6, 1699 + square_note 3, 7, 4, 1697 + square_note 3, 7, 6, 1681 + square_note 3, 8, 3, 1666 + square_note 4, 10, 2, 1649 + square_note 15, 7, 2, 1673 + sound_ret + + +SFX_Unknown_8081e_Ch8: + noise_note 2, 15, 2, 60 + noise_note 8, 14, 4, 62 + noise_note 8, 13, 7, 60 + noise_note 5, 12, 5, 59 + noise_note 3, 13, 4, 44 + noise_note 2, 11, 6, 60 + noise_note 3, 10, 4, 44 + noise_note 8, 9, 1, 60 + sound_ret diff --git a/audio/sfx/unknown_80879.asm b/audio/sfx/unknown_80879.asm new file mode 100644 index 00000000..bbb4043e --- /dev/null +++ b/audio/sfx/unknown_80879.asm @@ -0,0 +1,23 @@ +SFX_Unknown_80879_Ch5: + duty_cycle_pattern 3, 3, 0, 0 + square_note 15, 15, 6, 1381 + square_note 10, 14, 4, 1404 + square_note 3, 12, 2, 1372 + square_note 15, 11, 2, 1340 + sound_ret + + +SFX_Unknown_80879_Ch6: + duty_cycle_pattern 1, 1, 2, 2 + square_note 14, 13, 6, 1283 + square_note 9, 11, 4, 1307 + square_note 4, 9, 2, 1274 + square_note 15, 10, 2, 1243 + sound_ret + + +SFX_Unknown_80879_Ch8: + noise_note 12, 14, 6, 76 + noise_note 11, 13, 7, 92 + noise_note 15, 12, 2, 76 + sound_ret diff --git a/audio/sfx/unknown_808a9.asm b/audio/sfx/unknown_808a9.asm new file mode 100644 index 00000000..b27eeada --- /dev/null +++ b/audio/sfx/unknown_808a9.asm @@ -0,0 +1,32 @@ +SFX_Unknown_808a9_Ch5: + duty_cycle_pattern 3, 3, 0, 0 + square_note 4, 15, 7, 1696 + square_note 8, 14, 6, 1700 + square_note 4, 13, 6, 1696 + square_note 12, 13, 3, 1568 + square_note 8, 12, 3, 1572 + square_note 4, 12, 2, 1568 + square_note 8, 11, 1, 1552 + sound_ret + + +SFX_Unknown_808a9_Ch6: + duty_cycle_pattern 1, 1, 2, 2 + square_note 4, 14, 7, 1537 + square_note 8, 13, 6, 1539 + square_note 4, 12, 6, 1537 + square_note 12, 12, 3, 1409 + square_note 8, 11, 3, 1411 + square_note 4, 11, 2, 1410 + square_note 8, 10, 1, 1393 + sound_ret + + +SFX_Unknown_808a9_Ch8: + noise_note 7, 13, 6, 92 + noise_note 8, 14, 6, 76 + noise_note 4, 13, 4, 92 + noise_note 4, 13, 4, 76 + noise_note 7, 12, 3, 76 + noise_note 8, 10, 1, 92 + sound_ret diff --git a/audio/sfx/unknown_808fa.asm b/audio/sfx/unknown_808fa.asm new file mode 100644 index 00000000..37d49937 --- /dev/null +++ b/audio/sfx/unknown_808fa.asm @@ -0,0 +1,18 @@ +SFX_Unknown_808fa_Ch5: + duty_cycle_pattern 0, 1, 2, 3 + square_note 7, 13, 2, 1856 + square_note 15, 14, 5, 1888 + square_note 15, 12, 1, 1840 + sound_ret + + +SFX_Unknown_808fa_Ch6: + duty_cycle_pattern 2, 0, 0, 1 + square_note 2, 12, 2, 1793 + square_note 4, 12, 2, 1800 + square_note 15, 13, 7, 1857 + square_note 15, 10, 2, 1793 + + +SFX_Unknown_808fa_Ch8: + sound_ret diff --git a/audio/sfx/unknown_8091c.asm b/audio/sfx/unknown_8091c.asm new file mode 100644 index 00000000..0d160799 --- /dev/null +++ b/audio/sfx/unknown_8091c.asm @@ -0,0 +1,21 @@ +SFX_Unknown_8091c_Ch5: + duty_cycle_pattern 3, 3, 0, 0 + square_note 15, 13, 7, 1920 + square_note 4, 14, 6, 1952 + square_note 15, 13, 2, 1856 + sound_ret + + +SFX_Unknown_8091c_Ch6: + duty_cycle_pattern 1, 1, 2, 2 + square_note 15, 12, 7, 1875 + square_note 5, 11, 6, 1906 + square_note 15, 12, 2, 1809 + sound_ret + + +SFX_Unknown_8091c_Ch8: + noise_note 13, 15, 6, 76 + noise_note 4, 14, 6, 60 + noise_note 15, 15, 2, 76 + sound_ret diff --git a/audio/sfx/unknown_80944.asm b/audio/sfx/unknown_80944.asm new file mode 100644 index 00000000..adfc42b2 --- /dev/null +++ b/audio/sfx/unknown_80944.asm @@ -0,0 +1,26 @@ +SFX_Unknown_80944_Ch5: + duty_cycle_pattern 3, 3, 0, 0 + square_note 6, 15, 7, 1728 + square_note 15, 14, 7, 1792 + square_note 4, 15, 4, 1776 + square_note 4, 14, 4, 1760 + square_note 8, 13, 1, 1744 + sound_ret + + +SFX_Unknown_80944_Ch6: + duty_cycle_pattern 0, 0, 2, 2 + square_note 7, 14, 6, 1665 + square_note 14, 13, 5, 1729 + square_note 4, 12, 4, 1713 + square_note 4, 13, 4, 1697 + square_note 8, 12, 1, 1681 + sound_ret + + +SFX_Unknown_80944_Ch8: + noise_note 10, 10, 6, 60 + noise_note 14, 9, 4, 44 + noise_note 5, 10, 3, 60 + noise_note 8, 9, 1, 44 + sound_ret diff --git a/audio/sfx/unknown_8097f.asm b/audio/sfx/unknown_8097f.asm new file mode 100644 index 00000000..259b6b34 --- /dev/null +++ b/audio/sfx/unknown_8097f.asm @@ -0,0 +1,24 @@ +SFX_Unknown_8097f_Ch5: + duty_cycle_pattern 2, 2, 1, 1 + square_note 12, 15, 2, 1088 + square_note 15, 14, 3, 1184 + square_note 4, 13, 2, 1168 + square_note 8, 13, 1, 1152 + sound_ret + + +SFX_Unknown_8097f_Ch6: + duty_cycle_pattern 3, 2, 3, 2 + square_note 11, 13, 2, 1080 + square_note 14, 12, 6, 1176 + square_note 3, 11, 2, 1160 + square_note 8, 11, 1, 1144 + sound_ret + + +SFX_Unknown_8097f_Ch8: + noise_note 10, 14, 6, 108 + noise_note 15, 13, 2, 92 + noise_note 3, 12, 2, 108 + noise_note 8, 13, 1, 92 + sound_ret diff --git a/audio/sfx/unknown_809b2.asm b/audio/sfx/unknown_809b2.asm new file mode 100644 index 00000000..08946ec9 --- /dev/null +++ b/audio/sfx/unknown_809b2.asm @@ -0,0 +1,30 @@ +SFX_Unknown_809b2_Ch5: + duty_cycle_pattern 0, 3, 0, 3 + square_note 15, 15, 6, 1472 + square_note 8, 14, 3, 1468 + square_note 6, 13, 2, 1488 + square_note 6, 11, 2, 1504 + square_note 6, 12, 2, 1520 + square_note 8, 11, 1, 1536 + sound_ret + + +SFX_Unknown_809b2_Ch6: + duty_cycle_pattern 2, 1, 2, 1 + square_note 14, 12, 6, 1201 + square_note 7, 12, 3, 1197 + square_note 5, 11, 2, 1217 + square_note 8, 9, 2, 1233 + square_note 6, 10, 2, 1249 + square_note 8, 9, 1, 1265 + sound_ret + + +SFX_Unknown_809b2_Ch8: + noise_note 10, 14, 6, 92 + noise_note 10, 13, 6, 108 + noise_note 4, 12, 2, 76 + noise_note 6, 13, 3, 92 + noise_note 8, 11, 3, 76 + noise_note 8, 10, 1, 92 + sound_ret diff --git a/audio/sfx/unknown_809fb.asm b/audio/sfx/unknown_809fb.asm new file mode 100644 index 00000000..68edf2c9 --- /dev/null +++ b/audio/sfx/unknown_809fb.asm @@ -0,0 +1,21 @@ +SFX_Unknown_809fb_Ch5: + duty_cycle_pattern 3, 3, 0, 0 + square_note 8, 14, 4, 1936 + square_note 15, 15, 5, 1984 + square_note 8, 13, 1, 2008 + sound_ret + + +SFX_Unknown_809fb_Ch6: + duty_cycle_pattern 2, 2, 1, 1 + square_note 10, 12, 4, 1905 + square_note 15, 11, 6, 1954 + square_note 8, 10, 1, 1975 + sound_ret + + +SFX_Unknown_809fb_Ch8: + noise_note 8, 14, 4, 76 + noise_note 14, 12, 4, 60 + noise_note 8, 13, 1, 44 + sound_ret diff --git a/audio/sfx/unknown_80a23.asm b/audio/sfx/unknown_80a23.asm new file mode 100644 index 00000000..447ad7f3 --- /dev/null +++ b/audio/sfx/unknown_80a23.asm @@ -0,0 +1,38 @@ +SFX_Unknown_80a23_Ch5: + duty_cycle_pattern 3, 3, 0, 0 + square_note 6, 15, 2, 1536 + square_note 6, 14, 2, 1600 + square_note 6, 13, 2, 1664 + square_note 6, 14, 2, 1728 + square_note 6, 13, 2, 1792 + square_note 6, 12, 2, 1856 + square_note 6, 11, 2, 1920 + square_note 8, 10, 1, 1984 + sound_ret + + +SFX_Unknown_80a23_Ch6: + duty_cycle_pattern 0, 1, 0, 1 + square_note 3, 0, 8, 1 + square_note 6, 12, 2, 1473 + square_note 6, 11, 2, 1538 + square_note 6, 10, 2, 1601 + square_note 6, 11, 2, 1666 + square_note 6, 10, 2, 1730 + square_note 6, 9, 2, 1793 + square_note 6, 10, 2, 1858 + square_note 8, 8, 1, 1921 + sound_ret + + +SFX_Unknown_80a23_Ch8: + noise_note 6, 0, 8, 1 + noise_note 5, 14, 2, 92 + noise_note 5, 12, 2, 76 + noise_note 5, 13, 2, 60 + noise_note 5, 11, 2, 44 + noise_note 5, 12, 2, 28 + noise_note 5, 10, 2, 27 + noise_note 5, 9, 2, 26 + noise_note 8, 8, 1, 24 + sound_ret diff --git a/audio/sfx/unknown_80a89.asm b/audio/sfx/unknown_80a89.asm new file mode 100644 index 00000000..21a1d998 --- /dev/null +++ b/audio/sfx/unknown_80a89.asm @@ -0,0 +1,30 @@ +SFX_Unknown_80a89_Ch5: + duty_cycle_pattern 3, 3, 0, 0 + square_note 4, 15, 3, 1920 + square_note 15, 14, 7, 1792 + square_note 8, 13, 3, 1808 + square_note 4, 12, 2, 1792 + square_note 4, 13, 2, 1776 + square_note 8, 12, 1, 1760 + sound_ret + + +SFX_Unknown_80a89_Ch6: + duty_cycle_pattern 1, 1, 2, 2 + square_note 6, 12, 3, 1793 + square_note 14, 11, 7, 1665 + square_note 7, 11, 3, 1682 + square_note 3, 10, 2, 1665 + square_note 4, 11, 2, 1650 + square_note 8, 10, 1, 1633 + sound_ret + + +SFX_Unknown_80a89_Ch8: + noise_note 6, 14, 3, 92 + noise_note 14, 13, 6, 76 + noise_note 6, 12, 6, 60 + noise_note 3, 11, 3, 76 + noise_note 3, 10, 2, 92 + noise_note 8, 11, 1, 108 + sound_ret diff --git a/audio/sfx/unknown_80ad2.asm b/audio/sfx/unknown_80ad2.asm new file mode 100644 index 00000000..ab114678 --- /dev/null +++ b/audio/sfx/unknown_80ad2.asm @@ -0,0 +1,24 @@ +SFX_Unknown_80ad2_Ch5: + duty_cycle_pattern 0, 0, 3, 3 + square_note 15, 15, 7, 1280 + square_note 15, 14, 7, 1288 + square_note 8, 11, 4, 1152 + square_note 15, 10, 2, 1120 + sound_ret + + +SFX_Unknown_80ad2_Ch6: + duty_cycle_pattern 1, 0, 1, 0 + square_note 14, 13, 7, 1153 + square_note 14, 12, 7, 1161 + square_note 10, 11, 4, 1025 + square_note 15, 12, 2, 993 + sound_ret + + +SFX_Unknown_80ad2_Ch8: + noise_note 14, 15, 7, 124 + noise_note 12, 15, 6, 108 + noise_note 9, 14, 4, 124 + noise_note 15, 14, 2, 108 + sound_ret diff --git a/audio/sfx/unknown_80b05.asm b/audio/sfx/unknown_80b05.asm new file mode 100644 index 00000000..e92fb103 --- /dev/null +++ b/audio/sfx/unknown_80b05.asm @@ -0,0 +1,31 @@ +SFX_Unknown_80b05_Ch5: + duty_cycle_pattern 3, 3, 1, 1 + square_note 7, 13, 6, 2017 + square_note 6, 12, 6, 2018 + square_note 9, 13, 6, 2017 + square_note 7, 12, 6, 2016 + square_note 5, 11, 6, 2018 + square_note 7, 12, 6, 2017 + square_note 6, 11, 6, 2016 + square_note 8, 10, 1, 2015 + sound_ret + + +SFX_Unknown_80b05_Ch6: + duty_cycle_pattern 1, 0, 1, 0 + square_note 6, 12, 3, 1993 + square_note 6, 11, 3, 1991 + square_note 10, 12, 4, 1987 + square_note 8, 11, 4, 1991 + square_note 6, 12, 3, 1993 + square_note 15, 10, 2, 1989 + sound_ret + + +SFX_Unknown_80b05_Ch8: + noise_note 13, 1, -1, 124 + noise_note 13, 15, 7, 140 + noise_note 12, 13, 6, 124 + noise_note 8, 12, 4, 108 + noise_note 15, 11, 3, 92 + sound_ret diff --git a/audio/sfx/unknown_80b53.asm b/audio/sfx/unknown_80b53.asm new file mode 100644 index 00000000..7645d225 --- /dev/null +++ b/audio/sfx/unknown_80b53.asm @@ -0,0 +1,30 @@ +SFX_Unknown_80b53_Ch5: + duty_cycle_pattern 3, 3, 0, 0 + square_note 6, 15, 7, 1856 + square_note 12, 14, 6, 1860 + square_note 6, 13, 5, 1872 + square_note 4, 12, 3, 1888 + square_note 3, 12, 3, 1920 + square_note 8, 13, 1, 1952 + sound_ret + + +SFX_Unknown_80b53_Ch6: + duty_cycle_pattern 0, 0, 2, 2 + square_note 6, 12, 7, 1793 + square_note 11, 11, 6, 1794 + square_note 6, 10, 5, 1809 + square_note 4, 9, 3, 1825 + square_note 3, 10, 3, 1857 + square_note 8, 9, 1, 1890 + sound_ret + + +SFX_Unknown_80b53_Ch8: + noise_note 3, 14, 2, 60 + noise_note 8, 13, 6, 76 + noise_note 5, 13, 4, 60 + noise_note 12, 12, 7, 76 + noise_note 2, 14, 2, 60 + noise_note 8, 13, 1, 44 + sound_ret diff --git a/audio/sfx/unknown_80b9c.asm b/audio/sfx/unknown_80b9c.asm new file mode 100644 index 00000000..9e6bf047 --- /dev/null +++ b/audio/sfx/unknown_80b9c.asm @@ -0,0 +1,29 @@ +SFX_Unknown_80b9c_Ch5: + duty_cycle_pattern 3, 3, 1, 0 + square_note 15, 15, 0, 1797 + square_note 10, 14, 0, 1792 + square_note 6, 11, 4, 1808 + square_note 4, 13, 3, 1792 + square_note 6, 11, 2, 1568 + square_note 8, 10, 1, 1572 + sound_ret + + +SFX_Unknown_80b9c_Ch6: + duty_cycle_pattern 0, 2, 0, 2 + square_note 15, 11, 0, 1731 + square_note 10, 10, 0, 1729 + square_note 6, 8, 4, 1746 + square_note 4, 9, 3, 1729 + square_note 6, 8, 2, 1505 + square_note 8, 6, 1, 1512 + sound_ret + + +SFX_Unknown_80b9c_Ch8: + noise_note 6, 14, 6, 76 + noise_note 15, 13, 6, 60 + noise_note 10, 12, 5, 74 + noise_note 1, 11, 2, 91 + noise_note 15, 12, 2, 76 + sound_ret diff --git a/audio/sfx/unknown_80be2.asm b/audio/sfx/unknown_80be2.asm new file mode 100644 index 00000000..2efda306 --- /dev/null +++ b/audio/sfx/unknown_80be2.asm @@ -0,0 +1,34 @@ +SFX_Unknown_80be2_Ch5: + duty_cycle_pattern 1, 1, 0, 0 + square_note 10, 15, 5, 1664 + square_note 3, 14, 2, 1696 + square_note 3, 15, 2, 1728 + square_note 3, 14, 2, 1760 + square_note 3, 13, 2, 1792 + square_note 3, 12, 2, 1760 + square_note 3, 13, 2, 1728 + square_note 8, 12, 1, 1696 + sound_ret + + +SFX_Unknown_80be2_Ch6: + duty_cycle_pattern 0, 0, 3, 3 + square_note 9, 13, 5, 1585 + square_note 3, 13, 2, 1618 + square_note 3, 14, 2, 1649 + square_note 3, 11, 2, 1681 + square_note 3, 12, 2, 1714 + square_note 3, 11, 2, 1681 + square_note 3, 12, 2, 1649 + square_note 8, 11, 1, 1617 + sound_ret + + +SFX_Unknown_80be2_Ch8: + noise_note 6, 14, 3, 76 + noise_note 4, 12, 3, 60 + noise_note 5, 13, 4, 60 + noise_note 4, 12, 4, 44 + noise_note 6, 11, 4, 60 + noise_note 8, 12, 1, 44 + sound_ret diff --git a/audio/sfx/unknown_80c3b.asm b/audio/sfx/unknown_80c3b.asm new file mode 100644 index 00000000..9eadefb9 --- /dev/null +++ b/audio/sfx/unknown_80c3b.asm @@ -0,0 +1,24 @@ +SFX_Unknown_80c3b_Ch5: + duty_cycle_pattern 2, 2, 1, 1 + square_note 3, 15, 4, 1601 + square_note 13, 13, 6, 1825 + square_note 8, 15, 4, 1817 + square_note 8, 12, 1, 1818 + sound_ret + + +SFX_Unknown_80c3b_Ch6: + duty_cycle_pattern 3, 0, 3, 0 + square_note 4, 15, 4, 1408 + square_note 14, 14, 6, 1760 + square_note 8, 13, 5, 1752 + square_note 8, 13, 1, 1756 + sound_ret + + +SFX_Unknown_80c3b_Ch8: + noise_note 5, 12, 4, 70 + noise_note 13, 10, 5, 68 + noise_note 8, 12, 4, 69 + noise_note 8, 11, 1, 68 + sound_ret diff --git a/audio/sfx/unknown_80c6e.asm b/audio/sfx/unknown_80c6e.asm new file mode 100644 index 00000000..360ad173 --- /dev/null +++ b/audio/sfx/unknown_80c6e.asm @@ -0,0 +1,24 @@ +SFX_Unknown_80c6e_Ch5: + duty_cycle_pattern 3, 3, 0, 0 + square_note 13, 15, 1, 1297 + square_note 13, 14, 1, 1301 + square_note 13, 14, 1, 1297 + square_note 8, 13, 1, 1297 + sound_ret + + +SFX_Unknown_80c6e_Ch6: + duty_cycle_pattern 0, 1, 1, 1 + square_note 12, 14, 1, 1292 + square_note 12, 13, 1, 1296 + square_note 14, 12, 1, 1292 + square_note 8, 12, 1, 1290 + sound_ret + + +SFX_Unknown_80c6e_Ch8: + noise_note 14, 15, 2, 101 + noise_note 13, 14, 2, 85 + noise_note 14, 13, 2, 86 + noise_note 8, 13, 1, 102 + sound_ret diff --git a/audio/sfx/unknown_80ca1.asm b/audio/sfx/unknown_80ca1.asm new file mode 100644 index 00000000..d42abd93 --- /dev/null +++ b/audio/sfx/unknown_80ca1.asm @@ -0,0 +1,27 @@ +SFX_Unknown_80ca1_Ch5: + duty_cycle_pattern 0, 1, 2, 3 + square_note 3, 15, 3, 1380 + square_note 2, 14, 2, 1348 + square_note 5, 13, 1, 1314 + square_note 2, 11, 2, 1156 + square_note 8, 13, 1, 1186 + square_note 3, 15, 3, 1316 + square_note 4, 14, 4, 1252 + square_note 8, 13, 1, 1282 + sound_ret + + +SFX_Unknown_80ca1_Ch6: + duty_cycle_pattern 3, 0, 3, 0 + square_note 3, 13, 3, 1376 + square_note 2, 12, 2, 1344 + square_note 5, 12, 1, 1312 + square_note 2, 9, 2, 1152 + square_note 8, 12, 1, 1184 + square_note 3, 13, 3, 1312 + square_note 3, 12, 4, 1248 + square_note 8, 12, 1, 1280 + + +SFX_Unknown_80ca1_Ch8: + sound_ret diff --git a/audio/sfx/unknown_80ce7.asm b/audio/sfx/unknown_80ce7.asm new file mode 100644 index 00000000..9c7706c2 --- /dev/null +++ b/audio/sfx/unknown_80ce7.asm @@ -0,0 +1,24 @@ +SFX_Unknown_80ce7_Ch5: + duty_cycle_pattern 0, 1, 0, 1 + square_note 2, 3, -5, 897 + square_note 7, 15, 5, 1537 + square_note 1, 12, 2, 1153 + square_note 8, 9, 1, 897 + sound_ret + + +SFX_Unknown_80ce7_Ch6: + duty_cycle_pattern 3, 2, 3, 2 + square_note 2, 3, -6, 1456 + square_note 7, 13, 5, 1885 + square_note 1, 11, 2, 1712 + square_note 8, 6, 1, 1456 + sound_ret + + +SFX_Unknown_80ce7_Ch8: + noise_note 2, 9, 2, 73 + noise_note 7, 11, 5, 41 + noise_note 1, 10, 2, 57 + noise_note 8, 9, 1, 73 + sound_ret diff --git a/audio/sfx/unknown_80e91.asm b/audio/sfx/unknown_80e91.asm new file mode 100644 index 00000000..8db0a395 --- /dev/null +++ b/audio/sfx/unknown_80e91.asm @@ -0,0 +1,47 @@ +SFX_Unknown_80e91_Ch5: + execute_music + tempo 256 + volume 7, 7 + vibrato 6, 2, 6 + duty_cycle 2 + toggle_perfect_pitch + note_type 4, 11, 1 + octave 3 + note G#, 2 + note G#, 2 + note G#, 2 + note_type 12, 11, 3 + octave 4 + note E_, 4 + sound_ret + + +SFX_Unknown_80e91_Ch6: + execute_music + vibrato 8, 2, 7 + duty_cycle 2 + note_type 4, 12, 1 + octave 4 + note E_, 2 + note E_, 2 + note E_, 2 + note_type 12, 12, 3 + note B_, 4 + sound_ret + + +SFX_Unknown_80e91_Ch8: + execute_music + note_type 4, 1, 0 + octave 4 + note B_, 1 + rest 1 + note B_, 1 + rest 1 + note B_, 1 + rest 1 + note_type 12, 1, 0 + octave 4 + note B_, 2 + rest 2 + sound_ret diff --git a/audio/unknown_832b9.bin b/audio/unknown_832b9.bin Binary files differnew file mode 100755 index 00000000..1c14816a --- /dev/null +++ b/audio/unknown_832b9.bin diff --git a/audio/wave_instruments.asm b/audio/wave_instruments.asm index fede06af..9f34d3ac 100644 --- a/audio/wave_instruments.asm +++ b/audio/wave_instruments.asm @@ -6,7 +6,7 @@ dw .wave5 ; used in the Lavender Town and Pokemon Tower themes dw .wave5 ; unused dw .wave5 ; unused - dw .wave5 ; unused +; dw .wave5 ; unused ; these are the definitions for the channel 3 instruments ; each instrument definition is made up of 32 points (nibbles) that form |