I've been working on a project using the teensy/audio and FV-1 effects chip, and in the process I am learning many efficient techniques to make assembler dsp code for the FV-1. I just found a sine/cosine oscillator technique that uses only a few multiply/accumulate and registers to create a sine/cosine oscillator. I wanted to post the PDF here in case anyone wanted to check them out and possibly implement them before I get to it.


I think its possible with these methods to make an extremely efficient group of library objects that could allow for loads of oscillators.

The Assembler code for the FV-1 implementation is :

equ	oscSin	reg0
equ	oscCos	reg1
equ	oscFreq	pot0 

;----------- load ---------------
SKP 	RUN ,	3            ; skips the next 3 instructions after the initial first run
WRAX 	oscSin,	0    ; writes to the register defined by equ oscSin above (reg0) 
                                      ;  and multiplies the accumulator by 0
SOF 	0,	-1                   ; scale and offset the accumulator, times 0 plus -1
WRAX 	oscCos,	0    ;  write to cosine register and clear accumulator

;------ Oscillator--------------
RDAX 	oscSin,	0.6   ; read sine register multiplied by 0.6
MULX 	oscFreq             ; multiply by register defined by equ above (pot input 0)

RDAX 	oscCos,	1      ; add cosine register times 1
WRAX 	oscCos,	-0.6  ; write to cosine register and multiply accumulator by -0.6
MULX 	oscFreq             ; multiply by register currently defined as pot0

RDAX 	oscSin,	1      ; add sine register times 1
WRAX 	oscSin,	0      ; write to sine register and clear accumulator