Skip to content

Commit

Permalink
Write carrier frequency regardless of Kxx state
Browse files Browse the repository at this point in the history
Fixes #196.
  • Loading branch information
Gumball2415 committed Feb 17, 2024
1 parent b03df29 commit d5a976c
Show file tree
Hide file tree
Showing 9 changed files with 2,555 additions and 2,530 deletions.
30 changes: 26 additions & 4 deletions Source/drivers/asm/effects.s
Original file line number Diff line number Diff line change
Expand Up @@ -317,10 +317,9 @@ ft_calc_period:

; apply frequency multiplication
lda var_ch_Harmonic, x
beq @MaxPeriod ; K00 results in lowest possible frequency
cmp #$01
beq @SkipHarmonic ; skip calculation if it's not affecting pitch
cmp #$00
beq @MaxPeriod ; K00 results in lowest possible frequency

lda ft_channel_type, x
cmp #CHAN_NOI
Expand All @@ -334,7 +333,7 @@ ft_calc_period:
; FDS and N163 use angular frequency
.if .defined(USE_FDS)
cmp #CHAN_FDS
beq @HarmonicMultiply
beq @HarmonicMultiplyFDS
.endif
.if .defined(USE_N163)
cmp #CHAN_N163
Expand All @@ -351,6 +350,10 @@ ft_calc_period:
sta AUX + 1
jsr DIV
jmp @HarmonicEnd
.if .defined(USE_FDS)
@HarmonicMultiplyFDS:
jsr @CopyPeriodToCarrier
.endif
@HarmonicMultiply:
lda var_ch_PeriodCalcLo, x
sta var_Temp16
Expand All @@ -370,11 +373,19 @@ ft_calc_period:
sta var_ch_PeriodCalcLo, x
lda ACC + 1
sta var_ch_PeriodCalcHi, x
jmp @JumpHarmonicEnd
@SkipHarmonic:

.if .defined(USE_FDS)
lda ft_channel_type, x
cmp #CHAN_FDS
bne @JumpHarmonicEnd
jsr @CopyPeriodToCarrier
.endif
@JumpHarmonicEnd:
jsr ft_vibrato
jsr ft_tremolo
rts

@MaxPeriod:
; no limits for noise
lda ft_channel_type, x
Expand Down Expand Up @@ -406,6 +417,17 @@ ft_calc_period:
@EndCalcPeriod:
rts

.if .defined(USE_FDS)
@CopyPeriodToCarrier:
; copy period to var_ch_FDSCarrier
; needed for modulation
lda var_ch_PeriodCalcLo, x
sta var_ch_FDSCarrier
lda var_ch_PeriodCalcHi, x
sta var_ch_FDSCarrier + 1
rts
.endif

;
; Portamento
;
Expand Down
526 changes: 263 additions & 263 deletions Source/drivers/drv_2a03.h

Large diffs are not rendered by default.

1,023 changes: 512 additions & 511 deletions Source/drivers/drv_all.h

Large diffs are not rendered by default.

608 changes: 305 additions & 303 deletions Source/drivers/drv_fds.h

Large diffs are not rendered by default.

534 changes: 267 additions & 267 deletions Source/drivers/drv_mmc5.h

Large diffs are not rendered by default.

614 changes: 307 additions & 307 deletions Source/drivers/drv_n163.h

Large diffs are not rendered by default.

556 changes: 278 additions & 278 deletions Source/drivers/drv_s5b.h

Large diffs are not rendered by default.

564 changes: 282 additions & 282 deletions Source/drivers/drv_vrc6.h

Large diffs are not rendered by default.

630 changes: 315 additions & 315 deletions Source/drivers/drv_vrc7.h

Large diffs are not rendered by default.

0 comments on commit d5a976c

Please sign in to comment.