exp4c54_4.asm

来自「用dsp解压mp3程序的算法」· 汇编 代码 · 共 45 行

ASM
45
字号
**************************************************************
* exp4c54_4.asm - An assembly program for C5000 CCS simulator
*                 Scaling and saturation in Section 4.6.4
*     
**************************************************************
* Section allocation
*
	.def	 x,s,init
x	.usect   "vars",8	; reserve 8 locations for x
s       .usect   "vars",1	; reserve 1 location for y

		.sect	 "table"
init	.int	 0,5792,8191,5792,0,-5792,-8191,-5792; value of x

		.text		; create code section
		.def	 start	; label of the beginning of code

* Copy data to vector x using indirect addressing mode

start:
	NOP
copy:	
	STM	#x,AR1		; AR0 pointing to x0
	RPT	#7           	; repeat next instruction 8 times
	MVPD init,*AR1+ 	; copy 8 data to x

* Add the first 4 data using direct addressing mode

scale:
	.mmregs
	STM #7, BRC
	;RSBX OVM		;if OVM is not set, overflow will occur
	SSBX OVM		;OVM Is set 
	STM #x, AR2
	
	RPTB done-1		; Block repeat is used to execute 
	LD *AR2,16,A            ; the following 3 instructions 8 times
	SFTA A, 3
	STH A, *AR2+
done:	
end
	NOP
	B	end		; stop here

⌨️ 快捷键说明

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