www.pudn.com > DSPstudyandexample.rar > C6_3_1.ASM


   		.mmregs 
   		.def main 
   		.def 	ad50_data            
spsa0  	.set  	38h  	 
spcd0  	.set  	39h   	 
drr21  	.set  	40h   	 
drr11  	.set  	41h   	 
dxr21  	.set  	42h   	 
dxr11   .set  	43h   	 
dxr10  	.set  	23h   	 
drr10  	.set  	21h   	 
 
spcr10    .set 	00h	 
spcr20	  .set 	01h 
rcr10 	  .set 	02h 
rcr20 	  .set  	03h 
xcr10  	  .set 	04h 
xcr20 	  .set 	05h 
srgr10	  .set	06h 
srgr20 	  .set 	07h 
mcr10 	  .set	08h 
mcr20 	  .set 	09h 
rcera0  	  .set 	0ah 
rcerb0 	  .set 	0bh 
xcera0 	  .set 	0ch 
xcerb0  	  .set 	0dh 
pcr0    	  .set 	0eh 
    
k_iptr  	.set 		000111000b<<07	 
k_temp  	.set 		1111111b 
 
b1        .set    1996H				 
b2        .set    -4cc2H			 
b3        .set    4cc2H				 
b4        .set    -1996H			 
 
a1        .set    -51daH			 
a2        .set    4686H				 
a3        .set    -1450H			 
 
k_a       .set    3            		 
k_b       .set    4            		 
k_buffer  	 .set    8            		 
 
buffery   .usect 	"filter_vars",k_buffer*2       
bufferx   .usect 	"filter_vars",k_buffer*2       
data_dp   .usect 	"filter_vars",0 		 
    
main: 
   stm  		4000h,sp			 
   ld   		#0h,dp				 
 
   ldm     	pmst,a					 
   and     	#k_temp,a 
   or      	#k_iptr,a 
   stl     	a,ar6 
   mvdm    	ar6,pmst 
   nop 
   nop 
   nop 
   stm     	#0ffffh,tcr				 
   stm     	#05h,prd				 
   stm     	#08e0h,tcr				 
 
   ssbx    	intm					 
   ssbx    	sxm 
   st      	#2491h,swwsr				 
   nop 
   nop 
   ssbx    	xf					 
   nop							 
   nop 
    
dss_init: 
   rsbx    	cpl					 
   nop 
   nop 
   stm     	spcr10,spsa0 
   nop 
   stm     	06h,spcd0           			 
   nop 
   stm     	spcr20,spsa0 
   nop 
   stm     	200h,spcd0          			 
   nop 
   stm     	pcr0,spsa0 
   nop 
   stm     	0eh,spcd0  
   nop 
   stm     	rcr10,spsa0 
   nop 
   stm     	40h,spcd0 
   nop 
   stm     	rcr20,spsa0 
   nop 
   stm     	4h,spcd0 
   nop 
   stm     	xcr10,spsa0 
   nop 
   stm     	40h,spcd0 
   nop 
   stm     	xcr20,spsa0 
   nop 
   stm     	4h,spcd0 
   nop 
    
   ld      	#64h,a             		 
   rpt     	#50 
   nop 
    
   stm     	spcr10,spsa0 
   nop 
   stm     	07h,spcd0           		 
   nop 
   stm     	spcr20,spsa0 
   nop 
   stm     	201h,spcd0 
   nop 
   rpt     	#50 
   nop 
 
aic_init:					 
   stm		0h,imr				 
   orm     	10h,imr 
   stm		0ffffh,ifr			 
   portw   	08h,02h 
   nop 
   nop 
   nop 
   call    	wait 
waitr$14$: 
   stm     	0h,spsa0 
   nop 
   ldm     	spcd0,a 
   nop 
   nop 
   nop 
   and    	#2h,0,a,a 
   bc     	waitr$14$,aeq			 
   stm    	#101h,dxr10			 
   call    	wait    
   stm     	0ffffh,ifr 
 
waitr$17$: 
   stm    	0h,spsa0 
   nop 
   ldm    	spcd0,a  
   nop 
   nop 
   nop 
   and    	#2h,0,a,a 
   bc     	waitr$17$,aeq			 
   stm    	#210h,dxr10			 
   call    	wait 
   stm     	0ffffh,ifr 
 
waitr$22$: 
   stm    	0h,spsa0 
   nop 
   ldm    	spcd0,a  
   nop 
   nop 
   nop 
   and    	#2h,0,a,a 
   bc     	waitr$22$,aeq		 
   ;stm    	#430h,dxr10 		 
   ;stm    	#440h,dxr10 		 
   stm    	#400h,dxr10 		 
   call    	wait			 
   stm     	0ffffh,ifr 
 
waitr$24$: 
   stm    	0h,spsa0 
   nop 
   ldm    	spcd0,a  
   nop 
   nop 
   nop 
   and    	#2h,0,a,a 
   bc     	waitr$24$,aeq		 
   stm    	#301h,dxr10		 
   call    	wait 
 
   SSBX   	FRCT                 	 
   STM    	#buffery,AR4		 
   STM    	#bufferx,AR3		 
   STM    	#buffery,AR5    
   STM    	#k_buffer,BK		 
   STM    	#1,AR0 
   nop 
   stm     	0ffffh,ifr			 
   nop 
   rsbx    	xf 
   nop    
   nop 
   nop 
   ldm   		drr10,a			 
   nop 
   stm     	0h,imr 
   orm     	10h,imr				 
   nop 
   nop  
   rsbx   	intm				 
js: 
   nop 
   nop 
   b     		js 
   nop 
   nop 
   nop 
    
wait:   					 
   rpt    		#8048 
   nop 
   ret   
   nop 
   nop    
    
ad50_data:     					 
   ldm   		drr10,a      		 
   call  		filter 			 
   nop  
   nop 
   rete 
   nop 
   nop 
    
filter:					 
   NOP 
   NOP 
   NOP 
   stl    		A,*AR3           
   NOP 
   MAR    	*AR3-0%			 
   MAR    	*AR3-0% 
   MAR    	*AR3-0% 
					 
   MPY    	*AR3+0%,#b4,B          	 
   LD     	B,A 
   MPY    	*AR3+0%,#b3,B            
   ADD     	B,A 
   MPY    	*AR3+0%,#b2,B            
   ADD     	B,A 
   MPY    	*AR3+0%,#b1,B            
   ADD    	B,A                      
   MPY    	*AR4+0%,#a3,B            
   ADD    	B,A                      
   MPY    	*AR4+0%,#a2,B            
   ADD    	B,A                      
   MPY    	*AR4+0%,#a1,B            
   ADD    	B,A                      
   sfta   		a,-2,b 
   STH    	b,*AR4-0%                
   sfta   		a,3,a 
   sth    	a,dxr10                  
   MAR    	*AR4-0%                  
   nop 
   nop 
   ret  
   nop 
   nop