| 1 |
* initialization |
| 2 |
n equ 20 |
| 3 |
start equ $40 |
| 4 |
wddr equ $0 |
| 5 |
cddr equ $0 |
| 6 |
input equ $ffe0 |
| 7 |
output equ $ffe1 |
| 8 |
; |
| 9 |
org p:start |
| 10 |
move #wddr,r0 ;r0 ¬ samples |
| 11 |
move #cddr,r4 ;r1 ¬ coefficients |
| 12 |
move #n-1,m0 ;set modulo arithmetic |
| 13 |
move m0,m4 ;for the 2 circular buffers |
| 14 |
; |
| 15 |
opt cc |
| 16 |
; filter loop :8+(n-1) cycles |
| 17 |
|
| 18 |
movep y:input,x: (r0) ;input sample in memory |
| 19 |
clr a x:(r0)+,x0 y: (r4)+,y0 |
| 20 |
rep #n-1 |
| 21 |
mac x0,y0,a x:(r0)+,x0 y:(r4)+,y0 |
| 22 |
macr x0,x0,a (r0)- |
| 23 |
|
| 24 |
movep a,y:output ;output filtered sample |
| 25 |
|
| 26 |
fftr2a macro points,data,coef |
| 27 |
fftr2a: ident 1,1 |
| 28 |
|
| 29 |
move #points/2,n0 ;initialize butterflies per group |
| 30 |
move #1,n2 ;initialize groups per pass |
| 31 |
move #points/4,n6 ;initialize C pointer offset |
| 32 |
move #-1,m0 ;initialize A and B address modifiers |
| 33 |
move m0,m1 ;for linear addressing |
| 34 |
move m0,m4 |
| 35 |
move m0,m5 |
| 36 |
move #0,m6 ;initialize C address modifier for |
| 37 |
;reverse carry (bit-reversed) addressing |
| 38 |
|
| 39 |
do #@cvi (@log(points)/@log(2)+0.5),_end_pass |
| 40 |
move #data,r0 ;initialize A input pointer |
| 41 |
move r0,r4 ;initialize A output pointer |
| 42 |
|
| 43 |
_end_bfy |
| 44 |
move a,x:(r5)+n5 y:(r1)+n1,y1 |
| 45 |
|
| 46 |
end_cell |
| 47 |
rnd a |
| 48 |
movep #0,x:$fffe |
| 49 |
dc @sin(@cvf(count)*freq) |
| 50 |
move #twiddle,r2 |
| 51 |
|
| 52 |
MOVE L:<$1,A |
| 53 |
SUB X,A L:<$3,B |
| 54 |
|
| 55 |
bad_label |
| 56 |
good_label: |