Pep/9课下作业

1.伪代码

Set sum to 0
Read n1
Read n2
Set a to n1+n2
Read n3
Set b to n2+n3
Set sum to a+b
Write sum

2.机器指令

12 00 0F 00 00 00 00 00 00 00 00 00 00 00 00 C1
00 03 31 00 09 61 00 09 31 00 0B 61 00 0B 31 00
0D 61 00 0D E1 00 03 39 00 03 00 zz

3.汇编语言

   BR    main

sum: .WORD 0x0000
a: .WORD 0x0000
b: .WORD 0x0000
n1: .BLOCK 2
n2: .BLOCK 2
n3: .BLOCK 2

main:LDWA sum,d
DECI n1,d
ADDA n1,d
DECI n2,d
ADDA n2,d
DECI n3,d
ADDA n3,d
STWA sum,d
DECO sum,d
STOP
.END

posted @ 2023-10-29 20:33  20231420  阅读(15)  评论(0编辑  收藏  举报