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