📄 sin-cos.asm
字号:
;===========================================================================
; File Name: sin_cos.asm
;
; Module Name: SIN_COS
;
;
;===========================================================================
;(To use this Module, copy this section to main system file)
;===========================================================================
.ref SINTAB_360
;===========================================================================
.include "x24x_app.h"
t_ptr .usect "sin_cos" ,1
sin_theta .usect "sin_cos" ,1
cos_theta .usect "sin_cos" ,1
;=================================================================================
SIN-COS:
;-----------------------------------
;Calculate Cos(theta_p)
;Normal precision with simple 1024 word look-up
ldp #theta_ip
LACC theta_ip
ADD #8192 ;add 90 deg, i.e. COS(A)=SIN(A+90)
AND #07FFFh ;Force positive wrap-around
SACL GPR0_ipark ;here 90 deg = 7FFFh/4
LACC GPR0_ipark,9
SACH t_ptr
LACC #SINTAB_360
ADD t_ptr
TBLR cos_theta ;cos_theta = Cos(theta_p) in Q15
;-----------------------------------
;Calculate Sin(theta_p)
;Lower precision simple 1024 word look-up
LACC theta_ip,9
SACH t_ptr
LACC #SINTAB_360
ADD t_ptr
TBLR sin_theta ;sin_theta = Sin(theta_p) in Q15
;-----------------------------------
RET
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -