;FIR8SETP - PARTIAL PROGRAM WITHOUT EIGHT SETS OF COEFFICIENTS
       .start   ".text",0x809900 ;starting address of text
       .start   ".data",0x809C00 ;starting address of data
       .include "AICCOM31.ASM"   ;AIC comm routine
       .data                     ;data section
LENGTH .set    55                ;# of filter taps
FN     .set    3                 ;set desired filter number
AICSEC .word   162Ch,1h,3872h,63h ;Fs= 10 kHz   
STORE  .word   COEFF             ;starting addr of coeff
COEFF  .word   COEFF1            ;address of 1st set of LP coeff 
       .word   COEFF2            ;address of 2nd set of HP coeff 
       .word   COEFF3            ;address of 3rd set of BP coeff 
       .word   COEFF4            ;address of 4th set of BS coeff
       .word   COEFF5            ;address of 2-passbands coeff
       .word   COEFF6            ;address of 3-passbands coeff
       .word   COEFF7            ;address of 4-passbands coeff
       .word   COEFF8            ;address of 3-stopbands coeff 
       .entry  BEGIN             ;start of code
       .text                     ;text section
BEGIN  LDP     AICSEC            ;init to data page 128
       CALL    AICSET            ;init AIC
       LDI     @XN_ADDR,AR1      ;last sample address ->AR1
       LDI     @STORE,AR2        ;start addr of coeff table->AR2 
       LDI     LENGTH,BK         ;BK = size of circular buffer
       LDI     FN,IR0            ;IR0 = selected filter number
       SUBI    1,IR0             ;correct offset address
LOOP   CALL    AICIO_P           ;AIC I/O routine IN->R6,OUT->R7
       FLOAT   R6,R3             ;input new sample -> R3
       LDI     *+AR2(IR0),AR0    ;selected coefficient set->AR0
       CALL    FILT              ;go to subroutine FILT
       FIX     R2,R7             ;R7=integer(R2)
       BR      LOOP              ;loop continuously
FILT   STF     R3,*AR1++%        ;newest sample to model delay
       LDF     0,R0              ;init R0=0
       LDF     0,R2              ;init R2=0
       RPTS    LENGTH-1          ;multiply LENGTH times
       MPYF3   *AR0++,*AR1++%,R0 ;H(N)*X(N)
||     ADDF3   R0,R2,R2          ;in parallel with accum -> R2
       ADDF    R0,R2             ;last accum -> R2
       RETS                      ;return from subroutine
       .data                     ;coefficients section
;LOWPASS COEFFICIENTS - COEFF1
COEFF1 .float   3.6353E-003,-1.1901E-003,-4.5219E-003, 2.6882E-003 
        .
        .
;3-STOPBANDS COEFFICIENTS - COEFF8     
COEFF8 .float   3.6964e-002,-1.0804e-001, 1.7129e-001,-1.1816e-001
        .
        .
XN_ADDR .word     XN+LENGTH-1       ;last (newest) input sample
        .brstart  "XN_BUFF",64      ;align samples buffer
XN      .sect     "XN_BUFF"         ;section for input samples
        .loop     LENGTH            ;loop length times
        .float    0                 ;init input samples
        .endloop                    ;end of loop
        .end                        ;end

















