📄 asmutils.s
字号:
; Assembly Language Utility Routines
;...........................................................................
;
.text
.global _CalcLpIir
.global _CalcABS
;+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
; C-callable routine to compute n samples of a Low Pass IIR filter
; void CalcLpIir( unsigned int Size, fractional* pIn, fractional* pLPVal, unsigned int LPK);
;+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
_CalcLpIir:
; w0 contains array size
; w1 contains pointer to fractional input array
; w2 contains pointer to the Current Filter value
; w3 contains the LP averaging value
push w8
push w9
mov w1, w9 ; transfer input buffer pointer to DSP address register
mov w2, w8 ; w8 = pLPVal
mov w3, w5 ; w5 = LPK
mov #0x8000,w6 ;
sub w6,w5,w6 ; w6 = (1.0 - LPK)
clr A,[w9]+=2,w4 ; preload DSP operand, w4, with input buffer ptr
dec w0, w0 ; reduce DO count Size by one
do w0, CLPImainloop ; perform DO loop 'Size' times
mpy w4*w5, A, [w9]+=2, w4 ; ACC = LPK * pIn[i]
mov [w8], w7
mac w6*w7, A ; ACC = LPK * pIn[i] + (1.0-LPK) * LpVal
Sac.r a,[w8]
CLPImainloop:
clr A
pop w9
pop w8
return ; return to calling section
;..........................................................................
;+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
; C-callable routine to compute n samples of absolute value of vector pIn
; void CalcABS( unsigned int Size, fractional* pIn);
;+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
_CalcABS:
; w0 contains array size
; w1 contains pointer to fractional input array
clr w2
dec w0, w0 ; reduce DO count Size by one
do w0, CABSmainloop ; perform DO loop 'Size' times
ior w2, [w1],[w1]
bra NN,CABSmainloop
neg [w1],[w1]
CABSmainloop:
inc2 w1,w1
return ; return to calling section
;..........................................................................
.end
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -