Code: Select all
;pot1 = flange rate
mem fladel 512
equ fladel_138 fladel+138 ;mid pointer to flange delay
equ fladel_139 fladel+139 ;mid pointer to flange delay +1
equ tri reg0 ;triangle made from ramp
equ flaout reg1 ;mixed flanger output
equ fladout reg2 ;flange delay output
equ k1 reg3 ;first coefficient for linear interpolation
equ k2 reg4 ;second coefficient for linear interpolation
equ temp reg5 ;general temp register
; Inputs control
rdax fladout, 0.6 ; get fraction of flange output
rdax adcl, 0.5 ; add inputs * 0.5 each
rdax adcr, 0.5
wra fladel, 0 ; write flange delay input, clear acc
; Flanger control
sof 0, -0.13
rdax pot0, 0.13
sof 0.00015, 0 ; scale to filter
rdax tri, 0.9999 ; filter triangle waveform so that pitch bend does not get too great at high rates
wrax tri, 0 ; write triangle wave to register, clear accumulator
; Formulate delay pointer,
or fladel_138 < 8 ; fladel^ + 138 ;get midpoint address pointer
rdax tri, 0.03125 ; add triangle wave modulation, scaled to fit delay range
wrax addr_ptr, 1 ; establish address for lower interpolation sample
; Develop fraction of tri:
and 0x0000FF ; mask off integer portion of address, leaving a fractional value in the lowest acc byte
sof -2,0 ; these operations shift the resulting fractional value to the range 0.0 to 0.999...
sof -2,0 ; only -2.0 is exact, but it changes sign of shifted value
sof -2,0
sof -2,0
sof -2,0
sof -2,0
sof -2,0
sof -2,0
sof -2,0
sof -2,0
sof -2,0
sof -2,0
sof -2,0
sof -2,0
sof -2, 0
sof -1, 0 ; 15 shifts
wrax k2, 0 ; write result as coefficient for second sample read
or 0x7FFFFF
rdax k2, -1
wrax k1, 0 ; write result as coefficient for first sample read
; Read from first pointer:
rmpa 1 ; read memory for first sample read
mulx k1 ; multiply by K1
wrax temp, 0 ; and store in temp, while clearing the acc
; Get second pointer:
or fladel_139 < 8 ; fladel^ + 139 ;form second pointer
rdax tri, 0.03125 ; add triangle waveform again
wrax addr_ptr, 0 ; establish address for upper interpolation sample
rmpa 1 ; read second interpolation sample
mulx k2 ; multiply by K2
rdax temp, 1 ; add temp (first value*K1)
wrax fladout, 1 ; write the result to the flanger delay output
rda fladel, 1 ; add the input to the flanger delay
wrax flaout, 0 ; write result to flaout and clear acc
rdax flaout, 1 ; add flaout
wrax dacr, 1 ; write to right output, save accumulator
wrax dacl, 0 ; write to left output, clear acc