📄 atant.asm
字号:
;***********************************************************
; Version 2.20.01
;***********************************************************
;****************************************************************
; Function: atan16
; Description: Arctangent implementation
;
; Copyright Texas instruments Inc, 1998
;----------------------------------------------------------------
; Revision History:
; 1.00, A. Aboagye, 8/31/98 - Original release from code written by Jeff Axelrod
;
;****************************************************************
.mmregs
.def _atan16
.if __far_mode
OFFSET .set 1
.else
OFFSET .set 0
.endif
AR_X .set ar0
AR_Y .set ar2
AR_N .set ar3
AR_TABLE .set ar6 ; Use same storage as SP_INDEX
; Stack local variables
FSZ .set 0
; Command-line stack arguments
ARG_Y .set 4 + OFFSET
ARG_N .set 5 + OFFSET
_atan16:
pshm ar6
PSHM ST0 ; 1 cycle
PSHM ST1 ; 1 cycle
RSBX OVA ; 1 cycle
RSBX OVB ; 1 cycle
; Modify any registers needed
ssbx FRCT ; MUST Set Product shift to +1
ssbx OVM ; saturate
; Process command-line arguments
stlm a, AR_X
mvdk *sp(ARG_Y), AR_Y
ld *sp(ARG_N), a
sub #1,a
stlm a, brc
st #atancoeffs, *(AR_TABLE)
rptbd END_LOOP - 1
frame #-FSZ
nop
LOOP:
ld *AR_X+, t
ld *AR_TABLE+, 16, a
ld *AR_TABLE+, 16, b
poly *AR_TABLE+
poly *AR_TABLE+
poly *AR_TABLE+
poly *AR_TABLE
poly *AR_TABLE
st #atancoeffs, *(AR_TABLE)
sth a,*AR_Y+
END_LOOP:
DONE:
frame #FSZ
ld #0, A
xc 1, AOV
ld #1, A
POPM ST1 ; 1 cycle
POPM ST0 ; 1 cycle
popm ar6
.if __far_mode
fretd
.else
retd
.endif
nop
nop
*********************************************************************************
.data
atancoeffs: ; coefficients obtained from polyfit function of matlab
; for 0 <= x <= 1
.word 2596
.word 0
.word -9464
.word 0
.word 32617
.word 0
;end of file. please do not remove. it is left here to ensure that no lines of code are removed by any editor
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -