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

📄 dot3.asm

📁 TI DSP常用例程
💻 ASM
字号:
;
;   dot_3.asm
;
;   calculates dot product of two 3-vectors
;
;   float   dot_3();
;
;   float   a[3];
;   float   b[3];
;   float   c;
;
;   c = dot_3( a, b );
;
;
;      James M. Patterson
;      Texas Instruments
;      370 South North Lake Boulevard
;      Altamonte Springs, Florida 32701
;
;
FP	.set	AR3
	.global _dot_3
	.text

_dot_3:

;
;   first, set up address pointers
;
;   AR0 points to A vector
;   AR1 points to B vector
;   dot product returned in R0
;

	ldi	ST, R0		    ;save status register
	and	~2000h, ST	    ;temporarily disable interrupts
	pop	AR0		    ;bump stack pointer
	pop	AR0		    ;get A address
	pop	AR1		    ;get B address
	addi	3, SP		    ;restore SP
	ldi	R0, ST		    ;restore status register

;	 push	 FP		     ;save caller's FP
;	 ldi	 SP, FP 	     ;set local FP
;	 ldi	 *-FP(2), AR0	     ;get A address
;	 ldi	 *-FP(3), AR1	     ;get B address
;	 pop	 FP		     ;restore FP

;
;   do calculation
;
	mpyf3	*AR0++, *AR1++, R0  ;a[0] * b[0] -> R0
	mpyf3	*AR0++, *AR1++, R1  ;a[1] * b[1] -> R1
	mpyf3	*AR0,	*AR1,	R0  ;a[2] * b[2] -> R2
    ||	addf3	R0, R1, R3	    ;(a[0]*b[0]) + (a[1]*b[1]) -> R3
	addf	R3, R0		    ;complete dot product in R0

	rets			    ;the end

	.end

⌨️ 快捷键说明

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