?? iircas5.asm
字號:
;***********************************************************
; Version 2.20.01
;***********************************************************
;*****************************************************************************
; Function: iircas5
; Description: cascaded IIR direct form II using 5-coefs per biquad
;
; Copyright Texas instruments Inc, 1998
;-----------------------------------------------------------------------------
; Revision History:
; 1.00 R. Piedra, 8/31/98. Original version. Started from code by
; George Peak and Pedro Gelabert
; 2.00 Li Yuan, 6/08/01. Fixed the problem of overflow.
; 3.00 Cesar Iovescu, 10/04/01. Use a1/2 insead of a1 to avoid overflow.
;*****************************************************************************
.mmregs
; Far-mode adjustment
.if __far_mode
offset .set 1 ; far mode uses one extra location for ret addr ll
.else
offset .set 0
.endif
.asg (2), save_ar6 ; stack description
.asg (3), save_ar1
.asg (4), ret_addr
; x in A
.asg (5 + offset), arg_h
.asg (6 + offset), arg_y
.asg (7 + offset), arg_d
.asg (8 + offset), arg_nbiq
.asg (9 + offset), arg_n
; register usage
; ar0: circ addr. idx
.asg ar1, ar_x
.asg ar2, ar_d
.asg ar3, ar_h
.asg ar4, ar_y
.asg ar5, ar_count
.asg ar6, ar_hsave
;****************************************************************************
.def _iircas5
_iircas5
; Preserve registers
;-------------------
pshm ar1 ; (1)
pshm ar6 ; (1)
PSHM ST0 ; 1 cycle
PSHM ST1 ; 1 cycle
RSBX OVA ; 1 cycle
RSBX OVB ; 1 cycle
ssbx sxm ; sign extension on (1)
ssbx frct ; fract on (1)
ld #0,ASM ; clear ASM (st||mac) (1)
; Get arguments
;--------------
stlm a, ar_x ; pointer to x (1)
mvdk *sp(arg_h),*(ar_hsave) ; pointer to h (2)
mvdk *sp(arg_y),*(ar_y) ; pointer to y (2)
mvdk *sp(arg_d),*(ar_d) ; de-referencing (2)
mvdk *ar_d,*(ar_d) ; pointer to d (2)
mvdk *sp(arg_nbiq),*(ar0) ; ar0 = nbiq (2)
mvdk *sp(arg_n),*(ar_count) ; sample counter (2)
mar *ar_count- ; ar_count = nsamples-1 (1)
ldm ar0, a ; a = nbiq (1)
sub #1, a, b ; b = nbiq -1(store in brc later) (2)
ld a,1,a ; a = nbiq * 2 (1)
stlm a,bk ; circ buffer size = nbiq * 2 (1)
; Loop through N samples
;-----------------------
; d(n) = x(n) - 2*(a1/2*d(n-1)) - a2*d(n-2)
; y(n) = b0*d(n) + b1*d(n-1) + b2*d(n-2)
; coef. order : a1/2 a2 b2 b0 b1 .... other biquads
; delay buffer order : d1(n-1) d2(n-1) .... d1(n-2) d2(n-2)....
; d1 = for biquad 1
; d2 = for biquad 2
_start:
next_sample
stlm b,brc ; loop nbiq times(each sample) (1)
mvmm ar_hsave,ar_h ; reinitialize h pointer to top (1)
; Loop each sample through nbiquads
;----------------------------------
rptbd eloop-1 ; (2)
ld *ar_x+,16,a ; ah = x0 = new sample (1)
nop ; (1)
mas *ar_d,*ar_h,a ; a -= d(n-1) * a1/2 (1)
mas *ar_d+0%,*ar_h+,a ; a -= d(n-1) * a1 (1)
; t = d(n-1)(no use)
; point to d(n-2)
mas *ar_d, *ar_h+, a ; a -= d(n-2) * a2 (1)
; t = d(n-2)
; point to d(n-2)
; new d(n) = a = x0 - a1*d(n-1) - a2*d(n-2) complete
st a, *ar_d ; d(n-2) = new d(n) (1)
; replace oldest
; point to d(n-2) = d(n)
|| mpy *ar_h+, a ; a = (t=d(n-2))*b2
mac *ar_d+0%, *ar_h+, a ; a += b0 * d(n) (1)
mac *ar_d+, *ar_h+, a ; a += b1 * d(n-1) (1)
; point to next biq d(n-1)
; point to next biq a1
; a = b0*d(n) + b1*d(n-1) + b2*d(n-2)
eloop
; all biquads completed
; for current sample
; Store output sample
;--------------------
sth a, *ar_y+ ; store output in Q15 (1)
banzd next_sample, *ar_count- ; compute next sample (2)
mar *ar_d- ; correct ar_d overshoot (1)
mar *ar_d+% ; modify for circ addr (1)
; Return
;-------
_end:
.asg ar_h, ar_temp ; ar_h not used anymore
mvdk *sp(arg_d),*(ar_temp) ; (2)
mvkd *(ar_d), *ar_temp ; update new ar_d (2)
ld #0, a ; (1)
xc 1,AOV ; (1)
ld #1,a ; return overflow flag (1)
POPM ST1 ; 1 cycle
POPM ST0 ; 1 cycle
popm ar6 ; (1)
popm ar1 ; (1)
.if __far_mode
fretd ; (4)
.else
retd ; (3)
.endif
nop
nop
;end of file. please do not remove. it is left here to ensure that no lines of code are removed by any editor
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -