📄 lab4a.asm
字号:
************************************************
* lab4a.asm y= a1*x1+a2*x2+a3*x3+a4*x4 *
************************************************
.title "lab4a.asm"
.mmregs
STACK .usect "STACK",10h ;allocate space for stack
.bss x,5 ;allocate 9 word for variates
.bss a,5
.bss y,1
.def start
.data
table: .word 1*32768/10,2*32768/10,3*32768/10,4*32768/10,5*32768/10
.word 1*32768/10,2*32768/10,3*32768/10,4*32768/10,5*32768/10
.text ;code follows ...
start: STM #STACK+10h,SP ;set stack pointer
STM #table,AR1 ;AR1 point to table
STM #x,AR2 ;AR2 point to x
STM #9,AR0
LD #0,A
STM #0,SWWSR
loop: LD *AR1+,A ;move 10 values
STL A,*AR2+ ;from data memory
BANZ loop,*AR0- ;into data memory
SSBX FRCT
CALL SUM ;call SUM subrotine
end: B end
SUM: STM #a,AR3 ;The subrotine lmplememt
STM #x,AR4 ;multiply--accumulate
RPTZ A,#4
MAC *AR3+,*AR4+,A
STH A,@y
RET
.end
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -