📄 ex5p13.asm
字号:
**********************************************************************
*
* This program computes multiply and accumulate using the MAC
* instruction
*
* y(n) = h(0)x(n) + h(1)x(n-1) +h(2)x(n-2)
*
* where, h(0), h(1), and h(2) are in the data-memory locations
* starting at h. x(n), x(n-1), and x(n-2) are in data-memory locations
* starting at x. y(n) is to be saved in location y (low 16 bits) and
* y + 1 (high 16 bits).
*
***********************************************************************
.global _c_int00
.data
.bss x, 3
.bss y, 2
h .int 10, 20, 30
.text
_c_int00:
SSBX SXM ; Select sign extension mode
STM #x, AR2 ; Initialize AR2 to point to x(n)
STM #h, AR3 ; Initialize AR3 to point to h(0)
LD #0H, A ; Initialize result in A = 0
RPT #2 ; Repeat the next operation 3 times
MAC *AR2+,*AR3+, A ; y(n) computed
STM #y, AR2 ; Select the location for y(n)
STL A, *AR2+ ; Save the low part of y(n)
STH A, *AR2+ ; Save the high part of y(n)
NOP ; No operation
.end
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -