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

📄 cos_sin.asm

📁 Practical DSP Applications in Communications Real-Time Digital Signal Processing Implementations,
💻 ASM
字号:
;
;   cos_sin.asm - table lookup cosine-sine generator
;                 use 1024 points cosine table range(0-PI)
;	                                        
;   Prototype: void cos_sin(int, int *, int *)
;	
;   Entry: arg0: T0 - alpha
;          arg1: AR0 - pinter to cosine
;          arg2: AR1 - pointer to sine

	.def  _cos_sin 
	
	.ref  tab_0_PI

	.sect "cos_sin"		
_cos_sin     
    mov   T0,AC0            ; T0=a
    sfts  AC0,#11           ; Size index for table lookup
    mov   #tab_0_PI,T0      ; Table based address
||  mov   hi(AC0),AR2
    mov   AR2,AR3
    abs   AR2               ; cos(-a) = cos(a)   
    add   #0x200,AR3        ; 90 degree offset for sine
    and   #0x7ff,AR3        ; Modulo 0x800 for 11-bit
    sub   #0x400,AR3        ; Offset 180 degree for sine
    abs   AR3               ; sin(-a) = sin(a)
||  mov   *AR2(T0),*AR0     ; *AR0=cos(a) 
    mov   *AR3(T0),*AR1     ; *AR1=sin(a)
    ret

    .end

⌨️ 快捷键说明

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