/************************************************************************
File Name:	IIR_test.asm

Date Modified:	6/21/01	BJM
				
Description:	ADSP-2192 single-core program to call 
				IIR.asm.  IIR.asm implements a Cascaded 
				Biquad IIR filter.  All data values and 
				coefficients are assumed to be in 1.15 
				format.
	
************************************************************************/

#define N_samp          256            		
#define Biquad_secs   	2                 
#define Coef_Length		4*Biquad_secs + 1
 
.EXTERN IIR, Zero_Dline;
.GLOBAL Dline, Coefs, Outbuf;

/* A2   A1	 B2   B1   A2   A1   B2   B1 */
/* A21, A11, B21, B11, A22, A12, B22, B12*/
.section/pm data2;
.VAR    Coefs[4 * Biquad_secs] = "coef_hex.dat"; 

.section/data data1;
.VAR    Inbuf[N_samp] = "inreal_256.dat";
.VAR    Dline[2 * Biquad_secs];        	
.VAR    Outbuf[N_samp];                 		/* Filtered sample buffer */

/* PM interrupt vector code */
.section/pm IVreset;
        JUMP start; NOP; NOP; NOP;      /* Interupt vector table */
      
/* Program memory code */
.section/pm program;
start: 
	DMPG2 = page(Coefs);	 
    I0=Dline;               		/* Initialize delay line pointer */
	I1 = Inbuf;                   	/* Initialize input data pointer */
	I2 = Outbuf;                  	/* Initialize output data pointer */
	I4 = Coefs;
    M0=1;                           
	M3 = 1;                         
   	M4 = 1; 
	AX0 = I0;                       
    reg(B0) = AX0;                  /* Initialize pointer to delay line */
	AX0 = I4;                       
    reg(B4) = AX0;                  /* Initialize pointer to delay line */
	
	CALL Zero_Dline (db);			/* Call zero delay function */
   	L0 = length(Dline);         	/* Initialize delay line circular buffer */
	L1 = 0;   						/* Initialize for modulo addressing */
    CALL IIR (db);   				/* Call IIR filter function */
   	M0 = 0;                         
	L4 = Coef_Length;               /* Initialize for modulo addressing */
	
looping:   JUMP looping;          	/* Loop upon itself */
    
          




