⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 main.asm

📁 DSP集成开发环境的样例代码下载.rar
💻 ASM
字号:
				
;******************************************************************************
;**		G.723.1  speech encoder   main.asm      
;******************************************************************************


			.mmregs                 
			.include "const.inc"    
        	.include "global.inc"
               	
        	.bss	is_g723_coder,1
        	
		.global _rtdx_init,_rtdx_close,_main,is_g723_coder
		.ref _init_des,is_new_data,is_send_data,_c_int00
		.ref AD_Buffer,DA_Buffer,_send_data_to_pc,_READ_DATA
		.ref is_read
		.ref	_SWI_post,G723_CODER,G723_DECODE	
		.global 	_idl_g723_loop,_process_g723_decoder,_process_g723_coder

SIZE_FRAME	.set 	240

;Stack_Beg:	.sect	"STACK_SEG"
;			.space	1792*16
			 
;addr_record			.usect	".debug",0x400	
			 
			.text
;_c_int00:
_main:				
;  			stm	#Stack_Beg+0x700,SP
			frame 	-1
			pshm 	st1
			pshm 	st0
			
			stm		#K_ST0,		ST0
			stm		#K_ST1,		ST1 
			ssbx	INTM       		; close all int !
			call	Init_Coder
			call	Init_Decod
			
;			call 	_rtdx_init
			call	_init_des
			
			st		#1,*(__first)		; for debug DES !
			st		#0,*(is_g723_coder)			
			st	#1 , *(UseVx)
			st	#1 , *(Cod_UseHp)
			st	#0 , *(Crc)
			st	#1 , *(UsePf)
			st	#0 , *(WrkRate)			; 1:Rate53, 0:Rate63
			st	#0 , *(is_read)			; 1: RTDX has read !                      
			;rsbx    intm				; enable all int
			
			popm	st0
			popm	st1
			frame 	1
			rete

;*************************************************************************
;  The following codes are used in IDL_LOOP
;*************************************************************************
_idl_g723_loop:			
		
			frame 	-1
			pshm 	st0
			pshm	st1
			 
			bitf 	*(is_new_data),#1 	; test is_new_data == 1 ?
     		bc   	con_coder,ntc     	; ==1, then call P_FUN ! new AD data in new_ad(0x64)
     		calld 	_SWI_post
     		ld		#G723_CODER,a
con_coder:			
			cmpm	*(is_g723_coder),#1	; if is_g723_coder == 1, has been save CODER data !
			bc		con_decoder,ntc
			calld 	_SWI_post
     		ld		#G723_DECODE,a
con_decoder:			
			popm 	st1
			popm 	st0
			frame 	1
			ret
			;b  		wait_data

;*************************************************************************
;  The following codes are used to G723_CODER
;*************************************************************************
_process_g723_coder:
			frame 	-1
			pshm	st0
			pshm	st1
			stm		#K_ST0,		ST0
			stm		#K_ST1,		ST1 

			st		#0,*(is_new_data)
			call	Coder
			
			st 		#1,*(is_g723_coder)
;			ld 		#Vout,a				; send G723_CODER from RTDX !
;			call	_send_data_to_pc			
			call 	compress_data
			
			popm	st1
			popm	st0
			frame 	1
			ret
;*************************************************************************
;  The following codes are used to G723_DECODE
;*************************************************************************
_process_g723_decoder:
			frame 	-1
			pshm	st0
			pshm	st1
			stm		#K_ST0,		ST0
			stm		#K_ST1,		ST1 
			
			st 		#0,*(is_g723_coder)			
;			stm		#Vout,ar0
;			rpt	    #24-1
;			mvdk	*ar0+,#Vinp
			call 	de_compress_data
		
			ld	*(Crc) , A
			call	Decod
			st		#1,*(is_send_data)		; have decoder data !
			st		#0,*(__first)		; for debug DES !
			
			popm	st1
			popm	st0
			frame 	1
			ret			
;------------------------------------------
;  if in interupt, must save ah,al,ag !
;-----------------------------------------
compress_data:					
			pshm	ag
			pshm	ah
			pshm	al
			pshm	ar2
			pshm	ar3
			stm		#11,brc				; repeat times 12 !
			stm		#Vout,ar2
			mvmm	ar2,ar3
			rptb	compress_again
			ld		*ar2+,a
			sftl	a,8
			or		*ar2+,a
compress_again:
			stl		a,*ar3+

			popm	ar3
			popm	ar2
			popm	al
			popm	ah
			popm	ag
			ret

de_compress_data:
			pshm	ag
			pshm	ah
			pshm	al
			pshm	ar2
			pshm	ar3

			stm		#11,brc				; repeat times 12 !
			stm		#Vout,ar2
			stm		#Vinp,ar3
			mar		*+ar2(11)
			mar		*+ar3(23)
			rptb	de_compress_again
			ld		*ar2,a
			and		#0ffh,a				; save low 8 bits
			stl		a,*ar3-
			ld		*ar2-,a
			and		#0ff00h,a
			sftl	a,-8
de_compress_again:
			stl		a,*ar3-

			popm	ar3
			popm	ar2
			popm	al
			popm	ah
			popm	ag
			ret

;=================================================================
			
	
			.end	
			
;end of main.asm	
					
					

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -