mirror of
https://github.com/thornAvery/kep-hack.git
synced 2025-09-16 18:30:50 +12:00
Update labels to match new audio macro names
and synchronize engine_2 and engine_3 with engine_1
This commit is contained in:
parent
6574881cda
commit
969b43d443
|
@ -57,25 +57,25 @@ Audio1_ApplyMusicAffects:
|
||||||
.startChecks
|
.startChecks
|
||||||
ld hl, wChannelFlags1
|
ld hl, wChannelFlags1
|
||||||
add hl, bc
|
add hl, bc
|
||||||
bit BIT_ROTATE_DUTY, [hl]
|
bit BIT_ROTATE_DUTY_CYCLE, [hl]
|
||||||
jr z, .checkForExecuteMusic
|
jr z, .checkForExecuteMusic
|
||||||
call Audio1_ApplyDutyCycle
|
call Audio1_ApplyDutyCyclePattern
|
||||||
.checkForExecuteMusic
|
.checkForExecuteMusic
|
||||||
ld b, 0
|
ld b, 0
|
||||||
ld hl, wChannelFlags2
|
ld hl, wChannelFlags2
|
||||||
add hl, bc
|
add hl, bc
|
||||||
bit BIT_EXECUTE_MUSIC, [hl]
|
bit BIT_EXECUTE_MUSIC, [hl]
|
||||||
jr nz, .checkForPitchBend
|
jr nz, .checkForPitchSlide
|
||||||
ld hl, wChannelFlags1
|
ld hl, wChannelFlags1
|
||||||
add hl, bc
|
add hl, bc
|
||||||
bit BIT_NOISE_OR_SFX, [hl]
|
bit BIT_NOISE_OR_SFX, [hl]
|
||||||
jr nz, .skipPitchBendVibrato
|
jr nz, .skipPitchSlideVibrato
|
||||||
.checkForPitchBend
|
.checkForPitchSlide
|
||||||
ld hl, wChannelFlags1
|
ld hl, wChannelFlags1
|
||||||
add hl, bc
|
add hl, bc
|
||||||
bit BIT_PITCH_BEND_ON, [hl]
|
bit BIT_PITCH_SLIDE_ON, [hl]
|
||||||
jr z, .checkVibratoDelay
|
jr z, .checkVibratoDelay
|
||||||
jp Audio1_ApplyPitchBend
|
jp Audio1_ApplyPitchSlide
|
||||||
.checkVibratoDelay
|
.checkVibratoDelay
|
||||||
ld hl, wChannelVibratoDelayCounters
|
ld hl, wChannelVibratoDelayCounters
|
||||||
add hl, bc
|
add hl, bc
|
||||||
|
@ -83,7 +83,7 @@ Audio1_ApplyMusicAffects:
|
||||||
and a ; check if delay is over
|
and a ; check if delay is over
|
||||||
jr z, .checkForVibrato
|
jr z, .checkForVibrato
|
||||||
dec [hl] ; otherwise, dec delay
|
dec [hl] ; otherwise, dec delay
|
||||||
.skipPitchBendVibrato
|
.skipPitchSlideVibrato
|
||||||
ret
|
ret
|
||||||
.checkForVibrato
|
.checkForVibrato
|
||||||
ld hl, wChannelVibratoExtents
|
ld hl, wChannelVibratoExtents
|
||||||
|
@ -142,7 +142,7 @@ Audio1_ApplyMusicAffects:
|
||||||
ret
|
ret
|
||||||
|
|
||||||
; this routine executes all music commands that take up no time,
|
; this routine executes all music commands that take up no time,
|
||||||
; like tempo changes, duty changes etc. and doesn't return
|
; like tempo changes, duty cycle changes etc. and doesn't return
|
||||||
; until the first note is reached
|
; until the first note is reached
|
||||||
Audio1_PlayNextNote:
|
Audio1_PlayNextNote:
|
||||||
; reload the vibrato delay counter
|
; reload the vibrato delay counter
|
||||||
|
@ -155,20 +155,20 @@ Audio1_PlayNextNote:
|
||||||
|
|
||||||
ld hl, wChannelFlags1
|
ld hl, wChannelFlags1
|
||||||
add hl, bc
|
add hl, bc
|
||||||
res BIT_PITCH_BEND_ON, [hl]
|
res BIT_PITCH_SLIDE_ON, [hl]
|
||||||
res BIT_PITCH_BEND_DECREASING, [hl]
|
res BIT_PITCH_SLIDE_DECREASING, [hl]
|
||||||
call Audio1_endchannel
|
call Audio1_sound_ret
|
||||||
ret
|
ret
|
||||||
|
|
||||||
Audio1_endchannel:
|
Audio1_sound_ret:
|
||||||
call Audio1_GetNextMusicByte
|
call Audio1_GetNextMusicByte
|
||||||
ld d, a
|
ld d, a
|
||||||
cp $ff ; is this command an endchannel?
|
cp $ff ; is this command a sound_ret?
|
||||||
jp nz, Audio1_callchannel ; no
|
jp nz, Audio1_sound_call ; no
|
||||||
ld b, 0
|
ld b, 0
|
||||||
ld hl, wChannelFlags1
|
ld hl, wChannelFlags1
|
||||||
add hl, bc
|
add hl, bc
|
||||||
bit BIT_CHANNEL_CALL, [hl]
|
bit BIT_SOUND_CALL, [hl]
|
||||||
jr nz, .returnFromCall
|
jr nz, .returnFromCall
|
||||||
ld a, c
|
ld a, c
|
||||||
cp Ch4
|
cp Ch4
|
||||||
|
@ -187,15 +187,15 @@ Audio1_endchannel:
|
||||||
ld a, $80
|
ld a, $80
|
||||||
ld [rNR30], a
|
ld [rNR30], a
|
||||||
.skipSfxChannel3
|
.skipSfxChannel3
|
||||||
jr nz, .asm_9222
|
jr nz, .dontDisable
|
||||||
ld a, [wDisableChannelOutputWhenSfxEnds]
|
ld a, [wDisableChannelOutputWhenSfxEnds]
|
||||||
and a
|
and a
|
||||||
jr z, .asm_9222
|
jr z, .dontDisable
|
||||||
xor a
|
xor a
|
||||||
ld [wDisableChannelOutputWhenSfxEnds], a
|
ld [wDisableChannelOutputWhenSfxEnds], a
|
||||||
jr .disableChannelOutput
|
jr .disableChannelOutput
|
||||||
.asm_9222
|
.dontDisable
|
||||||
jr .asm_9248
|
jr .afterDisable
|
||||||
.returnFromCall
|
.returnFromCall
|
||||||
res 1, [hl]
|
res 1, [hl]
|
||||||
ld d, $0
|
ld d, $0
|
||||||
|
@ -215,19 +215,19 @@ Audio1_endchannel:
|
||||||
inc de
|
inc de
|
||||||
ld a, [de]
|
ld a, [de]
|
||||||
ld [hl], a ; loads channel address to return to
|
ld [hl], a ; loads channel address to return to
|
||||||
jp Audio1_endchannel
|
jp Audio1_sound_ret
|
||||||
.disableChannelOutput
|
.disableChannelOutput
|
||||||
ld hl, Audio1_HWChannelDisableMasks
|
ld hl, Audio1_HWChannelDisableMasks
|
||||||
add hl, bc
|
add hl, bc
|
||||||
ld a, [rNR51]
|
ld a, [rNR51]
|
||||||
and [hl]
|
and [hl]
|
||||||
ld [rNR51], a
|
ld [rNR51], a
|
||||||
.asm_9248
|
.afterDisable
|
||||||
ld a, [wChannelSoundIDs + Ch5]
|
ld a, [wChannelSoundIDs + Ch5]
|
||||||
cp CRY_SFX_START
|
cp CRY_SFX_START
|
||||||
jr nc, .asm_9251
|
jr nc, .maybeCry
|
||||||
jr .skipCry
|
jr .skipCry
|
||||||
.asm_9251
|
.maybeCry
|
||||||
ld a, [wChannelSoundIDs + Ch5]
|
ld a, [wChannelSoundIDs + Ch5]
|
||||||
cp CRY_SFX_END
|
cp CRY_SFX_END
|
||||||
jr z, .skipCry
|
jr z, .skipCry
|
||||||
|
@ -236,10 +236,10 @@ Audio1_endchannel:
|
||||||
.cry
|
.cry
|
||||||
ld a, c
|
ld a, c
|
||||||
cp Ch5
|
cp Ch5
|
||||||
jr z, .asm_9265
|
jr z, .skipRewind
|
||||||
call Audio1_GoBackOneCommandIfCry
|
call Audio1_GoBackOneCommandIfCry
|
||||||
ret c
|
ret c
|
||||||
.asm_9265
|
.skipRewind
|
||||||
ld a, [wSavedVolume]
|
ld a, [wSavedVolume]
|
||||||
ld [rNR50], a
|
ld [rNR50], a
|
||||||
xor a
|
xor a
|
||||||
|
@ -250,9 +250,9 @@ Audio1_endchannel:
|
||||||
ld [hl], b
|
ld [hl], b
|
||||||
ret
|
ret
|
||||||
|
|
||||||
Audio1_callchannel:
|
Audio1_sound_call:
|
||||||
cp $fd ; is this command a callchannel?
|
cp $fd ; is this command a sound_call?
|
||||||
jp nz, Audio1_loopchannel ; no
|
jp nz, Audio1_sound_loop ; no
|
||||||
call Audio1_GetNextMusicByte
|
call Audio1_GetNextMusicByte
|
||||||
push af
|
push af
|
||||||
call Audio1_GetNextMusicByte
|
call Audio1_GetNextMusicByte
|
||||||
|
@ -284,12 +284,12 @@ Audio1_callchannel:
|
||||||
ld b, $0
|
ld b, $0
|
||||||
ld hl, wChannelFlags1
|
ld hl, wChannelFlags1
|
||||||
add hl, bc
|
add hl, bc
|
||||||
set BIT_CHANNEL_CALL, [hl] ; set the call flag
|
set BIT_SOUND_CALL, [hl] ; set the call flag
|
||||||
jp Audio1_endchannel
|
jp Audio1_sound_ret
|
||||||
|
|
||||||
Audio1_loopchannel:
|
Audio1_sound_loop:
|
||||||
cp $fe ; is this command a loopchannel?
|
cp $fe ; is this command a sound_loop?
|
||||||
jp nz, Audio1_notetype ; no
|
jp nz, Audio1_note_type ; no
|
||||||
call Audio1_GetNextMusicByte
|
call Audio1_GetNextMusicByte
|
||||||
ld e, a
|
ld e, a
|
||||||
and a
|
and a
|
||||||
|
@ -304,7 +304,7 @@ Audio1_loopchannel:
|
||||||
ld [hl], a
|
ld [hl], a
|
||||||
call Audio1_GetNextMusicByte ; skip pointer
|
call Audio1_GetNextMusicByte ; skip pointer
|
||||||
call Audio1_GetNextMusicByte
|
call Audio1_GetNextMusicByte
|
||||||
jp Audio1_endchannel
|
jp Audio1_sound_ret
|
||||||
.loopAgain ; inc loop count
|
.loopAgain ; inc loop count
|
||||||
inc a
|
inc a
|
||||||
ld [hl], a
|
ld [hl], a
|
||||||
|
@ -323,12 +323,12 @@ Audio1_loopchannel:
|
||||||
pop af
|
pop af
|
||||||
ld [hli], a
|
ld [hli], a
|
||||||
ld [hl], b
|
ld [hl], b
|
||||||
jp Audio1_endchannel
|
jp Audio1_sound_ret
|
||||||
|
|
||||||
Audio1_notetype:
|
Audio1_note_type:
|
||||||
and $f0
|
and $f0
|
||||||
cp $d0 ; is this command a notetype?
|
cp $d0 ; is this command a note_type?
|
||||||
jp nz, Audio1_toggleperfectpitch ; no
|
jp nz, Audio1_toggle_perfect_pitch ; no
|
||||||
ld a, d
|
ld a, d
|
||||||
and $f
|
and $f
|
||||||
ld b, $0
|
ld b, $0
|
||||||
|
@ -367,11 +367,11 @@ Audio1_notetype:
|
||||||
add hl, bc
|
add hl, bc
|
||||||
ld [hl], d
|
ld [hl], d
|
||||||
.noiseChannel
|
.noiseChannel
|
||||||
jp Audio1_endchannel
|
jp Audio1_sound_ret
|
||||||
|
|
||||||
Audio1_toggleperfectpitch:
|
Audio1_toggle_perfect_pitch:
|
||||||
ld a, d
|
ld a, d
|
||||||
cp $e8 ; is this command a toggleperfectpitch?
|
cp $e8 ; is this command a toggle_perfect_pitch?
|
||||||
jr nz, Audio1_vibrato ; no
|
jr nz, Audio1_vibrato ; no
|
||||||
ld b, 0
|
ld b, 0
|
||||||
ld hl, wChannelFlags1
|
ld hl, wChannelFlags1
|
||||||
|
@ -379,11 +379,11 @@ Audio1_toggleperfectpitch:
|
||||||
ld a, [hl]
|
ld a, [hl]
|
||||||
xor $1
|
xor $1
|
||||||
ld [hl], a ; flip bit 0 of wChannelFlags1
|
ld [hl], a ; flip bit 0 of wChannelFlags1
|
||||||
jp Audio1_endchannel
|
jp Audio1_sound_ret
|
||||||
|
|
||||||
Audio1_vibrato:
|
Audio1_vibrato:
|
||||||
cp $ea ; is this command a vibrato?
|
cp $ea ; is this command a vibrato?
|
||||||
jr nz, Audio1_pitchbend ; no
|
jr nz, Audio1_pitch_slide ; no
|
||||||
call Audio1_GetNextMusicByte
|
call Audio1_GetNextMusicByte
|
||||||
ld b, 0
|
ld b, 0
|
||||||
ld hl, wChannelVibratoDelayCounters
|
ld hl, wChannelVibratoDelayCounters
|
||||||
|
@ -427,14 +427,14 @@ Audio1_vibrato:
|
||||||
or d
|
or d
|
||||||
ld [hl], a
|
ld [hl], a
|
||||||
|
|
||||||
jp Audio1_endchannel
|
jp Audio1_sound_ret
|
||||||
|
|
||||||
Audio1_pitchbend:
|
Audio1_pitch_slide:
|
||||||
cp $eb ; is this command a pitchbend?
|
cp $eb ; is this command a pitch_slide?
|
||||||
jr nz, Audio1_duty ; no
|
jr nz, Audio1_duty_cycle ; no
|
||||||
call Audio1_GetNextMusicByte
|
call Audio1_GetNextMusicByte
|
||||||
ld b, 0
|
ld b, 0
|
||||||
ld hl, wChannelPitchBendLengthModifiers
|
ld hl, wChannelPitchSlideLengthModifiers
|
||||||
add hl, bc
|
add hl, bc
|
||||||
ld [hl], a
|
ld [hl], a
|
||||||
call Audio1_GetNextMusicByte
|
call Audio1_GetNextMusicByte
|
||||||
|
@ -446,36 +446,36 @@ Audio1_pitchbend:
|
||||||
and $f
|
and $f
|
||||||
call Audio1_CalculateFrequency
|
call Audio1_CalculateFrequency
|
||||||
ld b, 0
|
ld b, 0
|
||||||
ld hl, wChannelPitchBendTargetFrequencyHighBytes
|
ld hl, wChannelPitchSlideTargetFrequencyHighBytes
|
||||||
add hl, bc
|
add hl, bc
|
||||||
ld [hl], d
|
ld [hl], d
|
||||||
ld hl, wChannelPitchBendTargetFrequencyLowBytes
|
ld hl, wChannelPitchSlideTargetFrequencyLowBytes
|
||||||
add hl, bc
|
add hl, bc
|
||||||
ld [hl], e
|
ld [hl], e
|
||||||
ld b, 0
|
ld b, 0
|
||||||
ld hl, wChannelFlags1
|
ld hl, wChannelFlags1
|
||||||
add hl, bc
|
add hl, bc
|
||||||
set BIT_PITCH_BEND_ON, [hl]
|
set BIT_PITCH_SLIDE_ON, [hl]
|
||||||
call Audio1_GetNextMusicByte
|
call Audio1_GetNextMusicByte
|
||||||
ld d, a
|
ld d, a
|
||||||
jp Audio1_notelength
|
jp Audio1_note_length
|
||||||
|
|
||||||
Audio1_duty:
|
Audio1_duty_cycle:
|
||||||
cp $ec ; is this command a duty?
|
cp $ec ; is this command a duty_cycle?
|
||||||
jr nz, Audio1_tempo ; no
|
jr nz, Audio1_tempo ; no
|
||||||
call Audio1_GetNextMusicByte
|
call Audio1_GetNextMusicByte
|
||||||
rrca
|
rrca
|
||||||
rrca
|
rrca
|
||||||
and $c0
|
and $c0
|
||||||
ld b, 0
|
ld b, 0
|
||||||
ld hl, wChannelDuties
|
ld hl, wChannelDutyCycles
|
||||||
add hl, bc
|
add hl, bc
|
||||||
ld [hl], a ; store duty
|
ld [hl], a ; store duty cycle
|
||||||
jp Audio1_endchannel
|
jp Audio1_sound_ret
|
||||||
|
|
||||||
Audio1_tempo:
|
Audio1_tempo:
|
||||||
cp $ed ; is this command a tempo?
|
cp $ed ; is this command a tempo?
|
||||||
jr nz, Audio1_stereopanning ; no
|
jr nz, Audio1_stereo_panning ; no
|
||||||
ld a, c
|
ld a, c
|
||||||
cp Ch5
|
cp Ch5
|
||||||
jr nc, .sfxChannel
|
jr nc, .sfxChannel
|
||||||
|
@ -500,19 +500,19 @@ Audio1_tempo:
|
||||||
ld [wChannelNoteDelayCountersFractionalPart + 6], a
|
ld [wChannelNoteDelayCountersFractionalPart + 6], a
|
||||||
ld [wChannelNoteDelayCountersFractionalPart + 7], a
|
ld [wChannelNoteDelayCountersFractionalPart + 7], a
|
||||||
.musicChannelDone
|
.musicChannelDone
|
||||||
jp Audio1_endchannel
|
jp Audio1_sound_ret
|
||||||
|
|
||||||
Audio1_stereopanning:
|
Audio1_stereo_panning:
|
||||||
cp $ee ; is this command a stereopanning?
|
cp $ee ; is this command a stereo_panning?
|
||||||
jr nz, Audio1_unknownmusic0xef ; no
|
jr nz, Audio1_unknownmusic0xef ; no
|
||||||
call Audio1_GetNextMusicByte
|
call Audio1_GetNextMusicByte
|
||||||
ld [wStereoPanning], a ; store panning
|
ld [wStereoPanning], a ; store panning
|
||||||
jp Audio1_endchannel
|
jp Audio1_sound_ret
|
||||||
|
|
||||||
; this appears to never be used
|
; this appears to never be used
|
||||||
Audio1_unknownmusic0xef:
|
Audio1_unknownmusic0xef:
|
||||||
cp $ef ; is this command an unknownmusic0xef?
|
cp $ef ; is this command an unknownmusic0xef?
|
||||||
jr nz, Audio1_dutycycle ; no
|
jr nz, Audio1_duty_cycle_pattern ; no
|
||||||
call Audio1_GetNextMusicByte
|
call Audio1_GetNextMusicByte
|
||||||
push bc
|
push bc
|
||||||
call Audio1_PlaySound
|
call Audio1_PlaySound
|
||||||
|
@ -525,72 +525,72 @@ Audio1_unknownmusic0xef:
|
||||||
xor a
|
xor a
|
||||||
ld [wChannelSoundIDs + Ch8], a
|
ld [wChannelSoundIDs + Ch8], a
|
||||||
.skip
|
.skip
|
||||||
jp Audio1_endchannel
|
jp Audio1_sound_ret
|
||||||
|
|
||||||
Audio1_dutycycle:
|
Audio1_duty_cycle_pattern:
|
||||||
cp $fc ; is this command a dutycycle?
|
cp $fc ; is this command a duty_cycle_pattern?
|
||||||
jr nz, Audio1_volume ; no
|
jr nz, Audio1_volume ; no
|
||||||
call Audio1_GetNextMusicByte
|
call Audio1_GetNextMusicByte
|
||||||
ld b, 0
|
ld b, 0
|
||||||
|
ld hl, wChannelDutyCyclePatterns
|
||||||
|
add hl, bc
|
||||||
|
ld [hl], a ; store full pattern
|
||||||
|
and %11000000
|
||||||
ld hl, wChannelDutyCycles
|
ld hl, wChannelDutyCycles
|
||||||
add hl, bc
|
add hl, bc
|
||||||
ld [hl], a ; store full cycle
|
ld [hl], a ; store first duty cycle
|
||||||
and $c0
|
|
||||||
ld hl, wChannelDuties
|
|
||||||
add hl, bc
|
|
||||||
ld [hl], a ; store first duty
|
|
||||||
ld hl, wChannelFlags1
|
ld hl, wChannelFlags1
|
||||||
add hl, bc
|
add hl, bc
|
||||||
set BIT_ROTATE_DUTY, [hl]
|
set BIT_ROTATE_DUTY_CYCLE, [hl]
|
||||||
jp Audio1_endchannel
|
jp Audio1_sound_ret
|
||||||
|
|
||||||
Audio1_volume:
|
Audio1_volume:
|
||||||
cp $f0 ; is this command a volume?
|
cp $f0 ; is this command a volume?
|
||||||
jr nz, Audio1_executemusic ; no
|
jr nz, Audio1_execute_music ; no
|
||||||
call Audio1_GetNextMusicByte
|
call Audio1_GetNextMusicByte
|
||||||
ld [rNR50], a ; store volume
|
ld [rNR50], a ; store volume
|
||||||
jp Audio1_endchannel
|
jp Audio1_sound_ret
|
||||||
|
|
||||||
Audio1_executemusic:
|
Audio1_execute_music:
|
||||||
cp $f8 ; is this command an executemusic?
|
cp $f8 ; is this command an execute_music?
|
||||||
jr nz, Audio1_octave ; no
|
jr nz, Audio1_octave ; no
|
||||||
ld b, $0
|
ld b, $0
|
||||||
ld hl, wChannelFlags2
|
ld hl, wChannelFlags2
|
||||||
add hl, bc
|
add hl, bc
|
||||||
set BIT_EXECUTE_MUSIC, [hl]
|
set BIT_EXECUTE_MUSIC, [hl]
|
||||||
jp Audio1_endchannel
|
jp Audio1_sound_ret
|
||||||
|
|
||||||
Audio1_octave:
|
Audio1_octave:
|
||||||
and $f0
|
and $f0
|
||||||
cp $e0 ; is this command an octave?
|
cp $e0 ; is this command an octave?
|
||||||
jr nz, Audio1_sfxnote ; no
|
jr nz, Audio1_sfx_note ; no
|
||||||
ld hl, wChannelOctaves
|
ld hl, wChannelOctaves
|
||||||
ld b, 0
|
ld b, 0
|
||||||
add hl, bc
|
add hl, bc
|
||||||
ld a, d
|
ld a, d
|
||||||
and $f
|
and $f
|
||||||
ld [hl], a ; store low nibble as octave
|
ld [hl], a ; store low nibble as octave
|
||||||
jp Audio1_endchannel
|
jp Audio1_sound_ret
|
||||||
|
|
||||||
; sfxnote is either squarenote or noisenote depending on the channel
|
; sfx_note is either square_note or noise_note depending on the channel
|
||||||
Audio1_sfxnote:
|
Audio1_sfx_note:
|
||||||
cp $20 ; is this command a sfxnote?
|
cp $20 ; is this command a sfx_note?
|
||||||
jr nz, Audio1_pitchenvelope
|
jr nz, Audio1_pitch_sweep
|
||||||
ld a, c
|
ld a, c
|
||||||
cp Ch4 ; is this a noise or sfx channel?
|
cp Ch4 ; is this a noise or sfx channel?
|
||||||
jr c, Audio1_pitchenvelope ; no
|
jr c, Audio1_pitch_sweep ; no
|
||||||
ld b, 0
|
ld b, 0
|
||||||
ld hl, wChannelFlags2
|
ld hl, wChannelFlags2
|
||||||
add hl, bc
|
add hl, bc
|
||||||
bit BIT_EXECUTE_MUSIC, [hl] ; is executemusic being used?
|
bit BIT_EXECUTE_MUSIC, [hl] ; is execute_music being used?
|
||||||
jr nz, Audio1_pitchenvelope ; yes
|
jr nz, Audio1_pitch_sweep ; yes
|
||||||
call Audio1_notelength
|
call Audio1_note_length
|
||||||
|
|
||||||
; This code seems to do the same thing as what Audio1_ApplyDutyAndSoundLength
|
; This code seems to do the same thing as what Audio1_ApplyDutyCycleAndSoundLength
|
||||||
; does below.
|
; does below.
|
||||||
ld d, a
|
ld d, a
|
||||||
ld b, 0
|
ld b, 0
|
||||||
ld hl, wChannelDuties
|
ld hl, wChannelDutyCycles
|
||||||
add hl, bc
|
add hl, bc
|
||||||
ld a, [hl]
|
ld a, [hl]
|
||||||
or d
|
or d
|
||||||
|
@ -619,18 +619,18 @@ Audio1_sfxnote:
|
||||||
.skip
|
.skip
|
||||||
ld d, a
|
ld d, a
|
||||||
push de
|
push de
|
||||||
call Audio1_ApplyDutyAndSoundLength
|
call Audio1_ApplyDutyCycleAndSoundLength
|
||||||
call Audio1_EnableChannelOutput
|
call Audio1_EnableChannelOutput
|
||||||
pop de
|
pop de
|
||||||
call Audio1_ApplyWavePatternAndFrequency
|
call Audio1_ApplyWavePatternAndFrequency
|
||||||
ret
|
ret
|
||||||
|
|
||||||
Audio1_pitchenvelope:
|
Audio1_pitch_sweep:
|
||||||
ld a, c
|
ld a, c
|
||||||
cp Ch5
|
cp Ch5
|
||||||
jr c, Audio1_note ; if not a sfx
|
jr c, Audio1_note ; if not a sfx
|
||||||
ld a, d
|
ld a, d
|
||||||
cp $10 ; is this command a pitchenvelope?
|
cp $10 ; is this command a pitch_sweep?
|
||||||
jr nz, Audio1_note ; no
|
jr nz, Audio1_note ; no
|
||||||
ld b, $0
|
ld b, $0
|
||||||
ld hl, wChannelFlags2
|
ld hl, wChannelFlags2
|
||||||
|
@ -639,17 +639,27 @@ Audio1_pitchenvelope:
|
||||||
jr nz, Audio1_note ; no
|
jr nz, Audio1_note ; no
|
||||||
call Audio1_GetNextMusicByte
|
call Audio1_GetNextMusicByte
|
||||||
ld [rNR10], a
|
ld [rNR10], a
|
||||||
jp Audio1_endchannel
|
jp Audio1_sound_ret
|
||||||
|
|
||||||
Audio1_note:
|
Audio1_note:
|
||||||
ld a, c
|
ld a, c
|
||||||
cp Ch4
|
cp Ch4
|
||||||
jr nz, Audio1_notelength ; if not noise channel
|
jr nz, Audio1_note_length ; if not noise channel
|
||||||
ld a, d
|
ld a, d
|
||||||
and $f0
|
and $f0
|
||||||
cp $b0 ; is this command a dnote?
|
cp $b0 ; is this command a dnote?
|
||||||
jr z, Audio1_dnote
|
jr z, .dnote
|
||||||
jr nc, Audio1_notelength ; no
|
jr nc, Audio1_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 dnote 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
|
swap a
|
||||||
ld b, a
|
ld b, a
|
||||||
ld a, d
|
ld a, d
|
||||||
|
@ -658,26 +668,26 @@ Audio1_note:
|
||||||
ld a, b
|
ld a, b
|
||||||
push de
|
push de
|
||||||
push bc
|
push bc
|
||||||
jr asm_94fd
|
jr .playDnote
|
||||||
|
|
||||||
Audio1_dnote:
|
.dnote
|
||||||
ld a, d
|
ld a, d
|
||||||
and $f
|
and $f
|
||||||
push af
|
push af
|
||||||
push bc
|
push bc
|
||||||
call Audio1_GetNextMusicByte ; get dnote instrument
|
call Audio1_GetNextMusicByte ; get dnote instrument
|
||||||
asm_94fd
|
.playDnote
|
||||||
ld d, a
|
ld d, a
|
||||||
ld a, [wDisableChannelOutputWhenSfxEnds]
|
ld a, [wDisableChannelOutputWhenSfxEnds]
|
||||||
and a
|
and a
|
||||||
jr nz, .asm_9508
|
jr nz, .skipDnote
|
||||||
ld a, d
|
ld a, d
|
||||||
call Audio1_PlaySound
|
call Audio1_PlaySound
|
||||||
.asm_9508
|
.skipDnote
|
||||||
pop bc
|
pop bc
|
||||||
pop de
|
pop de
|
||||||
|
|
||||||
Audio1_notelength:
|
Audio1_note_length:
|
||||||
ld a, d
|
ld a, d
|
||||||
push af
|
push af
|
||||||
and $f
|
and $f
|
||||||
|
@ -727,15 +737,15 @@ Audio1_notelength:
|
||||||
ld hl, wChannelFlags2
|
ld hl, wChannelFlags2
|
||||||
add hl, bc
|
add hl, bc
|
||||||
bit BIT_EXECUTE_MUSIC, [hl]
|
bit BIT_EXECUTE_MUSIC, [hl]
|
||||||
jr nz, Audio1_notepitch
|
jr nz, Audio1_note_pitch
|
||||||
ld hl, wChannelFlags1
|
ld hl, wChannelFlags1
|
||||||
add hl, bc
|
add hl, bc
|
||||||
bit BIT_NOISE_OR_SFX, [hl]
|
bit BIT_NOISE_OR_SFX, [hl]
|
||||||
jr z, Audio1_notepitch
|
jr z, Audio1_note_pitch
|
||||||
pop hl
|
pop hl
|
||||||
ret
|
ret
|
||||||
|
|
||||||
Audio1_notepitch:
|
Audio1_note_pitch:
|
||||||
pop af
|
pop af
|
||||||
and $f0
|
and $f0
|
||||||
cp $c0 ; compare to rest
|
cp $c0 ; compare to rest
|
||||||
|
@ -784,10 +794,10 @@ Audio1_notepitch:
|
||||||
ld b, 0
|
ld b, 0
|
||||||
ld hl, wChannelFlags1
|
ld hl, wChannelFlags1
|
||||||
add hl, bc
|
add hl, bc
|
||||||
bit BIT_PITCH_BEND_ON, [hl]
|
bit BIT_PITCH_SLIDE_ON, [hl]
|
||||||
jr z, .skipPitchBend
|
jr z, .skipPitchSlide
|
||||||
call Audio1_InitPitchBendVars
|
call Audio1_InitPitchSlideVars
|
||||||
.skipPitchBend
|
.skipPitchSlide
|
||||||
push de
|
push de
|
||||||
ld a, c
|
ld a, c
|
||||||
cp Ch5
|
cp Ch5
|
||||||
|
@ -812,13 +822,13 @@ Audio1_notepitch:
|
||||||
ld b, REG_VOLUME_ENVELOPE
|
ld b, REG_VOLUME_ENVELOPE
|
||||||
call Audio1_GetRegisterPointer
|
call Audio1_GetRegisterPointer
|
||||||
ld [hl], d
|
ld [hl], d
|
||||||
call Audio1_ApplyDutyAndSoundLength
|
call Audio1_ApplyDutyCycleAndSoundLength
|
||||||
call Audio1_EnableChannelOutput
|
call Audio1_EnableChannelOutput
|
||||||
pop de
|
pop de
|
||||||
ld b, $0
|
ld b, $0
|
||||||
ld hl, wChannelFlags1
|
ld hl, wChannelFlags1
|
||||||
add hl, bc
|
add hl, bc
|
||||||
bit BIT_PERFECT_PITCH, [hl] ; has toggleperfectpitch been used?
|
bit BIT_PERFECT_PITCH, [hl] ; has toggle_perfect_pitch been used?
|
||||||
jr z, .skipFrequencyInc
|
jr z, .skipFrequencyInc
|
||||||
inc e ; if yes, increment the frequency by 1
|
inc e ; if yes, increment the frequency by 1
|
||||||
jr nc, .skipFrequencyInc
|
jr nc, .skipFrequencyInc
|
||||||
|
@ -867,7 +877,7 @@ Audio1_EnableChannelOutput:
|
||||||
ld [rNR51], a
|
ld [rNR51], a
|
||||||
ret
|
ret
|
||||||
|
|
||||||
Audio1_ApplyDutyAndSoundLength:
|
Audio1_ApplyDutyCycleAndSoundLength:
|
||||||
ld b, 0
|
ld b, 0
|
||||||
ld hl, wChannelNoteDelayCounters ; use the note delay as sound length
|
ld hl, wChannelNoteDelayCounters ; use the note delay as sound length
|
||||||
add hl, bc
|
add hl, bc
|
||||||
|
@ -877,11 +887,11 @@ Audio1_ApplyDutyAndSoundLength:
|
||||||
jr z, .skipDuty ; if music channel 3
|
jr z, .skipDuty ; if music channel 3
|
||||||
cp Ch7
|
cp Ch7
|
||||||
jr z, .skipDuty ; if sfx channel 3
|
jr z, .skipDuty ; if sfx channel 3
|
||||||
; include duty (except on channel 3 which doesn't have it)
|
; include duty cycle (except on channel 3 which doesn't have it)
|
||||||
ld a, d
|
ld a, d
|
||||||
and $3f
|
and $3f
|
||||||
ld d, a
|
ld d, a
|
||||||
ld hl, wChannelDuties
|
ld hl, wChannelDutyCycles
|
||||||
add hl, bc
|
add hl, bc
|
||||||
ld a, [hl]
|
ld a, [hl]
|
||||||
or d
|
or d
|
||||||
|
@ -1022,29 +1032,29 @@ Audio1_IsCry:
|
||||||
scf
|
scf
|
||||||
ret
|
ret
|
||||||
|
|
||||||
Audio1_ApplyPitchBend:
|
Audio1_ApplyPitchSlide:
|
||||||
ld hl, wChannelFlags1
|
ld hl, wChannelFlags1
|
||||||
add hl, bc
|
add hl, bc
|
||||||
bit BIT_PITCH_BEND_DECREASING, [hl]
|
bit BIT_PITCH_SLIDE_DECREASING, [hl]
|
||||||
jp nz, .frequencyDecreasing
|
jp nz, .frequencyDecreasing
|
||||||
; frequency increasing
|
; frequency increasing
|
||||||
ld hl, wChannelPitchBendCurrentFrequencyLowBytes
|
ld hl, wChannelPitchSlideCurrentFrequencyLowBytes
|
||||||
add hl, bc
|
add hl, bc
|
||||||
ld e, [hl]
|
ld e, [hl]
|
||||||
ld hl, wChannelPitchBendCurrentFrequencyHighBytes
|
ld hl, wChannelPitchSlideCurrentFrequencyHighBytes
|
||||||
add hl, bc
|
add hl, bc
|
||||||
ld d, [hl]
|
ld d, [hl]
|
||||||
ld hl, wChannelPitchBendFrequencySteps
|
ld hl, wChannelPitchSlideFrequencySteps
|
||||||
add hl, bc
|
add hl, bc
|
||||||
ld l, [hl]
|
ld l, [hl]
|
||||||
ld h, b
|
ld h, b
|
||||||
add hl, de
|
add hl, de
|
||||||
ld d, h
|
ld d, h
|
||||||
ld e, l
|
ld e, l
|
||||||
ld hl, wChannelPitchBendCurrentFrequencyFractionalPart
|
ld hl, wChannelPitchSlideCurrentFrequencyFractionalPart
|
||||||
add hl, bc
|
add hl, bc
|
||||||
push hl
|
push hl
|
||||||
ld hl, wChannelPitchBendFrequencyStepsFractionalPart
|
ld hl, wChannelPitchSlideFrequencyStepsFractionalPart
|
||||||
add hl, bc
|
add hl, bc
|
||||||
ld a, [hl]
|
ld a, [hl]
|
||||||
pop hl
|
pop hl
|
||||||
|
@ -1056,26 +1066,26 @@ Audio1_ApplyPitchBend:
|
||||||
ld a, 0
|
ld a, 0
|
||||||
adc d
|
adc d
|
||||||
ld d, a
|
ld d, a
|
||||||
ld hl, wChannelPitchBendTargetFrequencyHighBytes
|
ld hl, wChannelPitchSlideTargetFrequencyHighBytes
|
||||||
add hl, bc
|
add hl, bc
|
||||||
ld a, [hl]
|
ld a, [hl]
|
||||||
cp d
|
cp d
|
||||||
jp c, .reachedTargetFrequency
|
jp c, .reachedTargetFrequency
|
||||||
jr nz, .applyUpdatedFrequency
|
jr nz, .applyUpdatedFrequency
|
||||||
ld hl, wChannelPitchBendTargetFrequencyLowBytes
|
ld hl, wChannelPitchSlideTargetFrequencyLowBytes
|
||||||
add hl, bc
|
add hl, bc
|
||||||
ld a, [hl]
|
ld a, [hl]
|
||||||
cp e
|
cp e
|
||||||
jp c, .reachedTargetFrequency
|
jp c, .reachedTargetFrequency
|
||||||
jr .applyUpdatedFrequency
|
jr .applyUpdatedFrequency
|
||||||
.frequencyDecreasing
|
.frequencyDecreasing
|
||||||
ld hl, wChannelPitchBendCurrentFrequencyLowBytes
|
ld hl, wChannelPitchSlideCurrentFrequencyLowBytes
|
||||||
add hl, bc
|
add hl, bc
|
||||||
ld a, [hl]
|
ld a, [hl]
|
||||||
ld hl, wChannelPitchBendCurrentFrequencyHighBytes
|
ld hl, wChannelPitchSlideCurrentFrequencyHighBytes
|
||||||
add hl, bc
|
add hl, bc
|
||||||
ld d, [hl]
|
ld d, [hl]
|
||||||
ld hl, wChannelPitchBendFrequencySteps
|
ld hl, wChannelPitchSlideFrequencySteps
|
||||||
add hl, bc
|
add hl, bc
|
||||||
ld e, [hl]
|
ld e, [hl]
|
||||||
sub e
|
sub e
|
||||||
|
@ -1083,7 +1093,7 @@ Audio1_ApplyPitchBend:
|
||||||
ld a, d
|
ld a, d
|
||||||
sbc b
|
sbc b
|
||||||
ld d, a
|
ld d, a
|
||||||
ld hl, wChannelPitchBendFrequencyStepsFractionalPart
|
ld hl, wChannelPitchSlideFrequencyStepsFractionalPart
|
||||||
add hl, bc
|
add hl, bc
|
||||||
ld a, [hl]
|
ld a, [hl]
|
||||||
add a
|
add a
|
||||||
|
@ -1094,22 +1104,22 @@ Audio1_ApplyPitchBend:
|
||||||
ld a, d
|
ld a, d
|
||||||
sbc b
|
sbc b
|
||||||
ld d, a
|
ld d, a
|
||||||
ld hl, wChannelPitchBendTargetFrequencyHighBytes
|
ld hl, wChannelPitchSlideTargetFrequencyHighBytes
|
||||||
add hl, bc
|
add hl, bc
|
||||||
ld a, d
|
ld a, d
|
||||||
cp [hl]
|
cp [hl]
|
||||||
jr c, .reachedTargetFrequency
|
jr c, .reachedTargetFrequency
|
||||||
jr nz, .applyUpdatedFrequency
|
jr nz, .applyUpdatedFrequency
|
||||||
ld hl, wChannelPitchBendTargetFrequencyLowBytes
|
ld hl, wChannelPitchSlideTargetFrequencyLowBytes
|
||||||
add hl, bc
|
add hl, bc
|
||||||
ld a, e
|
ld a, e
|
||||||
cp [hl]
|
cp [hl]
|
||||||
jr c, .reachedTargetFrequency
|
jr c, .reachedTargetFrequency
|
||||||
.applyUpdatedFrequency
|
.applyUpdatedFrequency
|
||||||
ld hl, wChannelPitchBendCurrentFrequencyLowBytes
|
ld hl, wChannelPitchSlideCurrentFrequencyLowBytes
|
||||||
add hl, bc
|
add hl, bc
|
||||||
ld [hl], e
|
ld [hl], e
|
||||||
ld hl, wChannelPitchBendCurrentFrequencyHighBytes
|
ld hl, wChannelPitchSlideCurrentFrequencyHighBytes
|
||||||
add hl, bc
|
add hl, bc
|
||||||
ld [hl], d
|
ld [hl], d
|
||||||
ld b, REG_FREQUENCY_LO
|
ld b, REG_FREQUENCY_LO
|
||||||
|
@ -1119,38 +1129,38 @@ Audio1_ApplyPitchBend:
|
||||||
ld [hl], d
|
ld [hl], d
|
||||||
ret
|
ret
|
||||||
.reachedTargetFrequency
|
.reachedTargetFrequency
|
||||||
; Turn off pitch bend when the target frequency has been reached.
|
; Turn off pitch slide when the target frequency has been reached.
|
||||||
ld hl, wChannelFlags1
|
ld hl, wChannelFlags1
|
||||||
add hl, bc
|
add hl, bc
|
||||||
res BIT_PITCH_BEND_ON, [hl]
|
res BIT_PITCH_SLIDE_ON, [hl]
|
||||||
res BIT_PITCH_BEND_DECREASING, [hl]
|
res BIT_PITCH_SLIDE_DECREASING, [hl]
|
||||||
ret
|
ret
|
||||||
|
|
||||||
Audio1_InitPitchBendVars:
|
Audio1_InitPitchSlideVars:
|
||||||
ld hl, wChannelPitchBendCurrentFrequencyHighBytes
|
ld hl, wChannelPitchSlideCurrentFrequencyHighBytes
|
||||||
add hl, bc
|
add hl, bc
|
||||||
ld [hl], d
|
ld [hl], d
|
||||||
ld hl, wChannelPitchBendCurrentFrequencyLowBytes
|
ld hl, wChannelPitchSlideCurrentFrequencyLowBytes
|
||||||
add hl, bc
|
add hl, bc
|
||||||
ld [hl], e
|
ld [hl], e
|
||||||
ld hl, wChannelNoteDelayCounters
|
ld hl, wChannelNoteDelayCounters
|
||||||
add hl, bc
|
add hl, bc
|
||||||
ld a, [hl]
|
ld a, [hl]
|
||||||
ld hl, wChannelPitchBendLengthModifiers
|
ld hl, wChannelPitchSlideLengthModifiers
|
||||||
add hl, bc
|
add hl, bc
|
||||||
sub [hl]
|
sub [hl]
|
||||||
jr nc, .next
|
jr nc, .next
|
||||||
ld a, 1
|
ld a, 1
|
||||||
.next
|
.next
|
||||||
ld [hl], a
|
ld [hl], a
|
||||||
ld hl, wChannelPitchBendTargetFrequencyLowBytes
|
ld hl, wChannelPitchSlideTargetFrequencyLowBytes
|
||||||
add hl, bc
|
add hl, bc
|
||||||
ld a, e
|
ld a, e
|
||||||
sub [hl]
|
sub [hl]
|
||||||
ld e, a
|
ld e, a
|
||||||
ld a, d
|
ld a, d
|
||||||
sbc b
|
sbc b
|
||||||
ld hl, wChannelPitchBendTargetFrequencyHighBytes
|
ld hl, wChannelPitchSlideTargetFrequencyHighBytes
|
||||||
add hl, bc
|
add hl, bc
|
||||||
sub [hl]
|
sub [hl]
|
||||||
jr c, .targetFrequencyGreater
|
jr c, .targetFrequencyGreater
|
||||||
|
@ -1158,18 +1168,18 @@ Audio1_InitPitchBendVars:
|
||||||
ld b, 0
|
ld b, 0
|
||||||
ld hl, wChannelFlags1
|
ld hl, wChannelFlags1
|
||||||
add hl, bc
|
add hl, bc
|
||||||
set BIT_PITCH_BEND_DECREASING, [hl]
|
set BIT_PITCH_SLIDE_DECREASING, [hl]
|
||||||
jr .next2
|
jr .next2
|
||||||
.targetFrequencyGreater
|
.targetFrequencyGreater
|
||||||
; If the target frequency is greater, subtract the current frequency from
|
; If the target frequency is greater, subtract the current frequency from
|
||||||
; the target frequency to get the absolute difference.
|
; the target frequency to get the absolute difference.
|
||||||
ld hl, wChannelPitchBendCurrentFrequencyHighBytes
|
ld hl, wChannelPitchSlideCurrentFrequencyHighBytes
|
||||||
add hl, bc
|
add hl, bc
|
||||||
ld d, [hl]
|
ld d, [hl]
|
||||||
ld hl, wChannelPitchBendCurrentFrequencyLowBytes
|
ld hl, wChannelPitchSlideCurrentFrequencyLowBytes
|
||||||
add hl, bc
|
add hl, bc
|
||||||
ld e, [hl]
|
ld e, [hl]
|
||||||
ld hl, wChannelPitchBendTargetFrequencyLowBytes
|
ld hl, wChannelPitchSlideTargetFrequencyLowBytes
|
||||||
add hl, bc
|
add hl, bc
|
||||||
ld a, [hl]
|
ld a, [hl]
|
||||||
sub e
|
sub e
|
||||||
|
@ -1184,7 +1194,7 @@ Audio1_InitPitchBendVars:
|
||||||
sbc b
|
sbc b
|
||||||
ld d, a
|
ld d, a
|
||||||
|
|
||||||
ld hl, wChannelPitchBendTargetFrequencyHighBytes
|
ld hl, wChannelPitchSlideTargetFrequencyHighBytes
|
||||||
add hl, bc
|
add hl, bc
|
||||||
ld a, [hl]
|
ld a, [hl]
|
||||||
sub d
|
sub d
|
||||||
|
@ -1192,10 +1202,10 @@ Audio1_InitPitchBendVars:
|
||||||
ld b, 0
|
ld b, 0
|
||||||
ld hl, wChannelFlags1
|
ld hl, wChannelFlags1
|
||||||
add hl, bc
|
add hl, bc
|
||||||
res BIT_PITCH_BEND_DECREASING, [hl]
|
res BIT_PITCH_SLIDE_DECREASING, [hl]
|
||||||
|
|
||||||
.next2
|
.next2
|
||||||
ld hl, wChannelPitchBendLengthModifiers
|
ld hl, wChannelPitchSlideLengthModifiers
|
||||||
add hl, bc
|
add hl, bc
|
||||||
.divideLoop
|
.divideLoop
|
||||||
inc b
|
inc b
|
||||||
|
@ -1214,20 +1224,20 @@ Audio1_InitPitchBendVars:
|
||||||
add [hl]
|
add [hl]
|
||||||
ld d, b ; d = quotient + 1
|
ld d, b ; d = quotient + 1
|
||||||
ld b, 0
|
ld b, 0
|
||||||
ld hl, wChannelPitchBendFrequencySteps
|
ld hl, wChannelPitchSlideFrequencySteps
|
||||||
add hl, bc
|
add hl, bc
|
||||||
ld [hl], d ; store quotient + 1
|
ld [hl], d ; store quotient + 1
|
||||||
ld hl, wChannelPitchBendFrequencyStepsFractionalPart
|
ld hl, wChannelPitchSlideFrequencyStepsFractionalPart
|
||||||
add hl, bc
|
add hl, bc
|
||||||
ld [hl], a ; store remainder - dividend
|
ld [hl], a ; store remainder - dividend
|
||||||
ld hl, wChannelPitchBendCurrentFrequencyFractionalPart
|
ld hl, wChannelPitchSlideCurrentFrequencyFractionalPart
|
||||||
add hl, bc
|
add hl, bc
|
||||||
ld [hl], a ; store remainder - dividend
|
ld [hl], a ; store remainder - dividend
|
||||||
ret
|
ret
|
||||||
|
|
||||||
Audio1_ApplyDutyCycle:
|
Audio1_ApplyDutyCyclePattern:
|
||||||
ld b, 0
|
ld b, 0
|
||||||
ld hl, wChannelDutyCycles
|
ld hl, wChannelDutyCyclePatterns
|
||||||
add hl, bc
|
add hl, bc
|
||||||
ld a, [hl]
|
ld a, [hl]
|
||||||
rlca
|
rlca
|
||||||
|
@ -1322,7 +1332,7 @@ Audio1_PlaySound::
|
||||||
ld [wSoundID], a
|
ld [wSoundID], a
|
||||||
cp $ff
|
cp $ff
|
||||||
jp z, .stopAllAudio
|
jp z, .stopAllAudio
|
||||||
cp MAX_SFX_ID
|
cp MAX_SFX_ID_1
|
||||||
jp z, .playSfx
|
jp z, .playSfx
|
||||||
jp c, .playSfx
|
jp c, .playSfx
|
||||||
cp $fe
|
cp $fe
|
||||||
|
@ -1346,10 +1356,10 @@ Audio1_PlaySound::
|
||||||
call .FillMem
|
call .FillMem
|
||||||
ld hl, wChannelFlags1
|
ld hl, wChannelFlags1
|
||||||
call .FillMem
|
call .FillMem
|
||||||
ld hl, wChannelDuties
|
|
||||||
call .FillMem
|
|
||||||
ld hl, wChannelDutyCycles
|
ld hl, wChannelDutyCycles
|
||||||
call .FillMem
|
call .FillMem
|
||||||
|
ld hl, wChannelDutyCyclePatterns
|
||||||
|
call .FillMem
|
||||||
ld hl, wChannelVibratoDelayCounters
|
ld hl, wChannelVibratoDelayCounters
|
||||||
call .FillMem
|
call .FillMem
|
||||||
ld hl, wChannelVibratoExtents
|
ld hl, wChannelVibratoExtents
|
||||||
|
@ -1362,21 +1372,21 @@ Audio1_PlaySound::
|
||||||
call .FillMem
|
call .FillMem
|
||||||
ld hl, wChannelFlags2
|
ld hl, wChannelFlags2
|
||||||
call .FillMem
|
call .FillMem
|
||||||
ld hl, wChannelPitchBendLengthModifiers
|
ld hl, wChannelPitchSlideLengthModifiers
|
||||||
call .FillMem
|
call .FillMem
|
||||||
ld hl, wChannelPitchBendFrequencySteps
|
ld hl, wChannelPitchSlideFrequencySteps
|
||||||
call .FillMem
|
call .FillMem
|
||||||
ld hl, wChannelPitchBendFrequencyStepsFractionalPart
|
ld hl, wChannelPitchSlideFrequencyStepsFractionalPart
|
||||||
call .FillMem
|
call .FillMem
|
||||||
ld hl, wChannelPitchBendCurrentFrequencyFractionalPart
|
ld hl, wChannelPitchSlideCurrentFrequencyFractionalPart
|
||||||
call .FillMem
|
call .FillMem
|
||||||
ld hl, wChannelPitchBendCurrentFrequencyHighBytes
|
ld hl, wChannelPitchSlideCurrentFrequencyHighBytes
|
||||||
call .FillMem
|
call .FillMem
|
||||||
ld hl, wChannelPitchBendCurrentFrequencyLowBytes
|
ld hl, wChannelPitchSlideCurrentFrequencyLowBytes
|
||||||
call .FillMem
|
call .FillMem
|
||||||
ld hl, wChannelPitchBendTargetFrequencyHighBytes
|
ld hl, wChannelPitchSlideTargetFrequencyHighBytes
|
||||||
call .FillMem
|
call .FillMem
|
||||||
ld hl, wChannelPitchBendTargetFrequencyLowBytes
|
ld hl, wChannelPitchSlideTargetFrequencyLowBytes
|
||||||
call .FillMem
|
call .FillMem
|
||||||
ld a, $1
|
ld a, $1
|
||||||
ld hl, wChannelLoopCounters
|
ld hl, wChannelLoopCounters
|
||||||
|
@ -1441,26 +1451,26 @@ Audio1_PlaySound::
|
||||||
add hl, de
|
add hl, de
|
||||||
ld a, [hl]
|
ld a, [hl]
|
||||||
and a
|
and a
|
||||||
jr z, .asm_99a3
|
jr z, .playChannel
|
||||||
ld a, e
|
ld a, e
|
||||||
cp $7
|
cp Ch8
|
||||||
jr nz, .asm_999a
|
jr nz, .notNoiseChannel
|
||||||
ld a, [wSoundID]
|
ld a, [wSoundID]
|
||||||
cp $14
|
cp NOISE_INSTRUMENTS_END
|
||||||
jr nc, .asm_9993
|
jr nc, .notNoiseInstrument
|
||||||
ret
|
ret
|
||||||
.asm_9993
|
.notNoiseInstrument
|
||||||
ld a, [hl]
|
ld a, [hl]
|
||||||
cp $14
|
cp NOISE_INSTRUMENTS_END
|
||||||
jr z, .asm_99a3
|
jr z, .playChannel
|
||||||
jr c, .asm_99a3
|
jr c, .playChannel
|
||||||
.asm_999a
|
.notNoiseChannel
|
||||||
ld a, [wSoundID]
|
ld a, [wSoundID]
|
||||||
cp [hl]
|
cp [hl]
|
||||||
jr z, .asm_99a3
|
jr z, .playChannel
|
||||||
jr c, .asm_99a3
|
jr c, .playChannel
|
||||||
ret
|
ret
|
||||||
.asm_99a3
|
.playChannel
|
||||||
xor a
|
xor a
|
||||||
push de
|
push de
|
||||||
ld h, d
|
ld h, d
|
||||||
|
@ -1483,10 +1493,10 @@ Audio1_PlaySound::
|
||||||
ld hl, wChannelFlags1
|
ld hl, wChannelFlags1
|
||||||
add hl, de
|
add hl, de
|
||||||
ld [hl], a
|
ld [hl], a
|
||||||
ld hl, wChannelDuties
|
ld hl, wChannelDutyCycles
|
||||||
add hl, de
|
add hl, de
|
||||||
ld [hl], a
|
ld [hl], a
|
||||||
ld hl, wChannelDutyCycles
|
ld hl, wChannelDutyCyclePatterns
|
||||||
add hl, de
|
add hl, de
|
||||||
ld [hl], a
|
ld [hl], a
|
||||||
ld hl, wChannelVibratoDelayCounters
|
ld hl, wChannelVibratoDelayCounters
|
||||||
|
@ -1504,28 +1514,28 @@ Audio1_PlaySound::
|
||||||
ld hl, wChannelVibratoDelayCounterReloadValues
|
ld hl, wChannelVibratoDelayCounterReloadValues
|
||||||
add hl, de
|
add hl, de
|
||||||
ld [hl], a
|
ld [hl], a
|
||||||
ld hl, wChannelPitchBendLengthModifiers
|
ld hl, wChannelPitchSlideLengthModifiers
|
||||||
add hl, de
|
add hl, de
|
||||||
ld [hl], a
|
ld [hl], a
|
||||||
ld hl, wChannelPitchBendFrequencySteps
|
ld hl, wChannelPitchSlideFrequencySteps
|
||||||
add hl, de
|
add hl, de
|
||||||
ld [hl], a
|
ld [hl], a
|
||||||
ld hl, wChannelPitchBendFrequencyStepsFractionalPart
|
ld hl, wChannelPitchSlideFrequencyStepsFractionalPart
|
||||||
add hl, de
|
add hl, de
|
||||||
ld [hl], a
|
ld [hl], a
|
||||||
ld hl, wChannelPitchBendCurrentFrequencyFractionalPart
|
ld hl, wChannelPitchSlideCurrentFrequencyFractionalPart
|
||||||
add hl, de
|
add hl, de
|
||||||
ld [hl], a
|
ld [hl], a
|
||||||
ld hl, wChannelPitchBendCurrentFrequencyHighBytes
|
ld hl, wChannelPitchSlideCurrentFrequencyHighBytes
|
||||||
add hl, de
|
add hl, de
|
||||||
ld [hl], a
|
ld [hl], a
|
||||||
ld hl, wChannelPitchBendCurrentFrequencyLowBytes
|
ld hl, wChannelPitchSlideCurrentFrequencyLowBytes
|
||||||
add hl, de
|
add hl, de
|
||||||
ld [hl], a
|
ld [hl], a
|
||||||
ld hl, wChannelPitchBendTargetFrequencyHighBytes
|
ld hl, wChannelPitchSlideTargetFrequencyHighBytes
|
||||||
add hl, de
|
add hl, de
|
||||||
ld [hl], a
|
ld [hl], a
|
||||||
ld hl, wChannelPitchBendTargetFrequencyLowBytes
|
ld hl, wChannelPitchSlideTargetFrequencyLowBytes
|
||||||
add hl, de
|
add hl, de
|
||||||
ld [hl], a
|
ld [hl], a
|
||||||
ld hl, wChannelFlags2
|
ld hl, wChannelFlags2
|
||||||
|
@ -1543,10 +1553,10 @@ Audio1_PlaySound::
|
||||||
ld [hl], a
|
ld [hl], a
|
||||||
ld a, e
|
ld a, e
|
||||||
cp Ch5
|
cp Ch5
|
||||||
jr nz, .asm_9a2b
|
jr nz, .skipSweepDisable
|
||||||
ld a, $8
|
ld a, $8
|
||||||
ld [rNR10], a ; sweep off
|
ld [rNR10], a ; sweep off
|
||||||
.asm_9a2b
|
.skipSweepDisable
|
||||||
ld a, c
|
ld a, c
|
||||||
and a
|
and a
|
||||||
jp z, .playSoundCommon
|
jp z, .playSoundCommon
|
||||||
|
@ -1667,9 +1677,9 @@ Audio1_PlaySound::
|
||||||
jr nz, .commandPointerLoop
|
jr nz, .commandPointerLoop
|
||||||
ld a, [wSoundID]
|
ld a, [wSoundID]
|
||||||
cp CRY_SFX_START
|
cp CRY_SFX_START
|
||||||
jr nc, .asm_9aeb
|
jr nc, .maybeCry
|
||||||
jr .done
|
jr .done
|
||||||
.asm_9aeb
|
.maybeCry
|
||||||
ld a, [wSoundID]
|
ld a, [wSoundID]
|
||||||
cp CRY_SFX_END
|
cp CRY_SFX_END
|
||||||
jr z, .done
|
jr z, .done
|
||||||
|
@ -1682,10 +1692,10 @@ Audio1_PlaySound::
|
||||||
ld [hli], a
|
ld [hli], a
|
||||||
ld [hl], a
|
ld [hl], a
|
||||||
ld hl, wChannelCommandPointers + Ch7 * 2 ; sfx wave channel pointer
|
ld hl, wChannelCommandPointers + Ch7 * 2 ; sfx wave channel pointer
|
||||||
ld de, Audio1_CryEndchannel
|
ld de, Audio1_CryRet
|
||||||
ld [hl], e
|
ld [hl], e
|
||||||
inc hl
|
inc hl
|
||||||
ld [hl], d ; overwrite pointer to point to endchannel
|
ld [hl], d ; overwrite pointer to point to sound_ret
|
||||||
ld a, [wSavedVolume]
|
ld a, [wSavedVolume]
|
||||||
and a
|
and a
|
||||||
jr nz, .done
|
jr nz, .done
|
||||||
|
@ -1696,7 +1706,7 @@ Audio1_PlaySound::
|
||||||
.done
|
.done
|
||||||
ret
|
ret
|
||||||
|
|
||||||
Audio1_CryEndchannel:
|
Audio1_CryRet:
|
||||||
sound_ret
|
sound_ret
|
||||||
|
|
||||||
Audio1_HWChannelBaseAddresses:
|
Audio1_HWChannelBaseAddresses:
|
||||||
|
@ -1725,5 +1735,3 @@ Audio1_Pitches:
|
||||||
dw $FB58 ; A_
|
dw $FB58 ; A_
|
||||||
dw $FB9B ; A#
|
dw $FB9B ; A#
|
||||||
dw $FBDA ; B_
|
dw $FBDA ; B_
|
||||||
|
|
||||||
|
|
||||||
|
|
1163
audio/engine_2.asm
1163
audio/engine_2.asm
File diff suppressed because it is too large
Load diff
1115
audio/engine_3.asm
1115
audio/engine_3.asm
File diff suppressed because it is too large
Load diff
|
@ -306,4 +306,3 @@ Music_MeetJessieJames_branch_83235::
|
||||||
note E_, 1
|
note E_, 1
|
||||||
rest 1
|
rest 1
|
||||||
sound_loop 0, Music_MeetJessieJames_branch_83235
|
sound_loop 0, Music_MeetJessieJames_branch_83235
|
||||||
sound_ret
|
|
||||||
|
|
|
@ -20,19 +20,27 @@ REG_DUTY_SOUND_LEN EQU 1
|
||||||
REG_VOLUME_ENVELOPE EQU 2
|
REG_VOLUME_ENVELOPE EQU 2
|
||||||
REG_FREQUENCY_LO EQU 3
|
REG_FREQUENCY_LO EQU 3
|
||||||
|
|
||||||
MAX_SFX_ID EQU $B9
|
MAX_SFX_ID_1 EQUS "SFX_SAFARI_ZONE_PA"
|
||||||
|
MAX_SFX_ID_2 EQUS "SFX_SILPH_SCOPE"
|
||||||
|
MAX_SFX_ID_3 EQUS "SFX_SHOOTING_STAR"
|
||||||
|
|
||||||
CRY_SFX_START EQU $14
|
NOISE_INSTRUMENTS_START EQUS "SFX_NOISE_INSTRUMENT01"
|
||||||
CRY_SFX_END EQU $86
|
NOISE_INSTRUMENTS_END EQUS "SFX_NOISE_INSTRUMENT19 + 1"
|
||||||
|
|
||||||
|
CRY_SFX_START EQUS "SFX_CRY_00"
|
||||||
|
CRY_SFX_END EQUS "SFX_CRY_25 + 3"
|
||||||
|
|
||||||
|
BATTLE_SFX_START EQUS "SFX_PECK"
|
||||||
|
BATTLE_SFX_END EQUS "SFX_SILPH_SCOPE + 1"
|
||||||
|
|
||||||
; wChannelFlags1 constants
|
; wChannelFlags1 constants
|
||||||
BIT_PERFECT_PITCH EQU 0 ; controlled by toggleperfectpitch command
|
BIT_PERFECT_PITCH EQU 0 ; controlled by toggle_perfect_pitch command
|
||||||
BIT_CHANNEL_CALL EQU 1 ; if in channel call
|
BIT_SOUND_CALL EQU 1 ; if in sound call
|
||||||
BIT_NOISE_OR_SFX EQU 2 ; if channel is the music noise channel or an SFX channel
|
BIT_NOISE_OR_SFX EQU 2 ; if channel is the music noise channel or an SFX channel
|
||||||
BIT_VIBRATO_DIRECTION EQU 3 ; if the pitch is above or below normal (cycles)
|
BIT_VIBRATO_DIRECTION EQU 3 ; if the pitch is above or below normal (cycles)
|
||||||
BIT_PITCH_BEND_ON EQU 4 ; if pitch bend is active
|
BIT_PITCH_SLIDE_ON EQU 4 ; if pitch slide is active
|
||||||
BIT_PITCH_BEND_DECREASING EQU 5 ; if the pitch bend frequency is decreasing (instead of increasing)
|
BIT_PITCH_SLIDE_DECREASING EQU 5 ; if the pitch slide frequency is decreasing (instead of increasing)
|
||||||
BIT_ROTATE_DUTY EQU 6 ; if rotating duty
|
BIT_ROTATE_DUTY_CYCLE EQU 6 ; if rotating duty cycle
|
||||||
|
|
||||||
; wChannelFlags2 constant (only has one flag)
|
; wChannelFlags2 constant (only has one flag)
|
||||||
BIT_EXECUTE_MUSIC EQU 0 ; if in execute music
|
BIT_EXECUTE_MUSIC EQU 0 ; if in execute music
|
||||||
|
|
|
@ -86,6 +86,14 @@ dnote: MACRO
|
||||||
db \1
|
db \1
|
||||||
ENDM
|
ENDM
|
||||||
|
|
||||||
|
;format: instrument [1, 3-10], length (in 16ths)
|
||||||
|
; like dnote but one 1 byte instead of 2
|
||||||
|
; can only be used with instruments 1-10, excluding 2
|
||||||
|
; unused
|
||||||
|
dnote_short: MACRO
|
||||||
|
db (\1 << 4) | (\2 - 1)
|
||||||
|
ENDM
|
||||||
|
|
||||||
;format: length (in 16ths)
|
;format: length (in 16ths)
|
||||||
rest: MACRO
|
rest: MACRO
|
||||||
db $C0 | (\1 - 1)
|
db $C0 | (\1 - 1)
|
||||||
|
|
20
wram.asm
20
wram.asm
|
@ -101,10 +101,10 @@ wChannelFlags1:: ; c02e
|
||||||
wChannelFlags2:: ; c036
|
wChannelFlags2:: ; c036
|
||||||
ds 8
|
ds 8
|
||||||
|
|
||||||
wChannelDuties:: ; c03e
|
wChannelDutyCycles:: ; c03e
|
||||||
ds 8
|
ds 8
|
||||||
|
|
||||||
wChannelDutyCycles:: ; c046
|
wChannelDutyCyclePatterns:: ; c046
|
||||||
ds 8
|
ds 8
|
||||||
|
|
||||||
wChannelVibratoDelayCounters:: ; c04e
|
wChannelVibratoDelayCounters:: ; c04e
|
||||||
|
@ -126,28 +126,28 @@ wChannelVibratoDelayCounterReloadValues:: ; c06e
|
||||||
; delay of the beginning of the vibrato from the start of the note
|
; delay of the beginning of the vibrato from the start of the note
|
||||||
ds 8
|
ds 8
|
||||||
|
|
||||||
wChannelPitchBendLengthModifiers:: ; c076
|
wChannelPitchSlideLengthModifiers:: ; c076
|
||||||
ds 8
|
ds 8
|
||||||
|
|
||||||
wChannelPitchBendFrequencySteps:: ; c07e
|
wChannelPitchSlideFrequencySteps:: ; c07e
|
||||||
ds 8
|
ds 8
|
||||||
|
|
||||||
wChannelPitchBendFrequencyStepsFractionalPart:: ; c086
|
wChannelPitchSlideFrequencyStepsFractionalPart:: ; c086
|
||||||
ds 8
|
ds 8
|
||||||
|
|
||||||
wChannelPitchBendCurrentFrequencyFractionalPart:: ; c08e
|
wChannelPitchSlideCurrentFrequencyFractionalPart:: ; c08e
|
||||||
ds 8
|
ds 8
|
||||||
|
|
||||||
wChannelPitchBendCurrentFrequencyHighBytes:: ; c096
|
wChannelPitchSlideCurrentFrequencyHighBytes:: ; c096
|
||||||
ds 8
|
ds 8
|
||||||
|
|
||||||
wChannelPitchBendCurrentFrequencyLowBytes:: ; c09e
|
wChannelPitchSlideCurrentFrequencyLowBytes:: ; c09e
|
||||||
ds 8
|
ds 8
|
||||||
|
|
||||||
wChannelPitchBendTargetFrequencyHighBytes:: ; c0a6
|
wChannelPitchSlideTargetFrequencyHighBytes:: ; c0a6
|
||||||
ds 8
|
ds 8
|
||||||
|
|
||||||
wChannelPitchBendTargetFrequencyLowBytes:: ; c0ae
|
wChannelPitchSlideTargetFrequencyLowBytes:: ; c0ae
|
||||||
ds 8
|
ds 8
|
||||||
|
|
||||||
wChannelNoteDelayCounters:: ; c0b6
|
wChannelNoteDelayCounters:: ; c0b6
|
||||||
|
|
Loading…
Reference in a new issue