📄 ex5p11.asm
字号:
*************************************************************************
* This program computes multiply and accumulate using direct addressing
* mode.
*
* y(n) = h(0)x(n) + h(1)x(n-1) + h(2)x(n-2)
*
* h(0), h(1), and h(2) are stored in data-memory locations starting at
* location h and x(n), x(n-1), and x(n-2) are stored in data-memory
* locations starting at location x. y(n) is saved in data-memory
* location y (low 16 bits) and y + 1 (high 16 bits).
*
************************************************************************
.global _c_int00
x .usect "Input Samples", 3
y .usect "Output", 2
h .usect "Coefficients", 3
.text
_c_int00:
SSBX SXM ; Select sign extension mode
LD #h, DP ; Select the data page for coefficients
LD @h, T ; Get the coefficient h(0)
LD #x, DP ; Select the data page for input samples
MPY @x, A ; A = x(n)*h(0)
LD #h, DP ; Select the data page for coefficients
LD @h+1,T ; Get the coefficient h(1)
LD #x, DP ; Select the data page for input signals
MPY @x+1, B ; B = x(n-1)*h(1)
ADD A, B ; B = x(n)*h(0) + x(n-1)*h(1)
LD #h, DP ; Select the data page for coefficients
LD @h+2,T ; Get the coefficient h(2)
LD #x, DP ; Select the data page for input signals
MPY @x+2, A ; A = x(n-2)*h(3)
ADD A, B ; B = x(n)*h(0) + x(n-1)*h(1) + x(n-2)*h(3)
LD #y, DP ; Select the data page for output
STL B, @y ; Save low part of output
STH B, @y+1 ; Save high part of output
NOP ; No operation
.end
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -