(1)编写一个伪代码算法,读入三个值,输出它们的和。
输入三个数字相加的伪代码
set sum to 0
read num1
set sum to sum + num1
read num2
set sum to sum + num2
read num3
set sum to sum + num3
write sum
输出结果
(2)用PEP/9 机器指令实现(1)中的算法
12 00 0B 00 00 00 00 00 00 00 00 C1 00 03 31 00
05 61 00 05 31 00 07 61 00 07 31 00 09 61 00 09
E1 00 03 39 00 03 00 zz
(3)用PEP/9 汇编语言实现(1)中的算法
BR main
sum:.WORD 0x0000
num1:.BLOCK 2
num2:.BLOCK 2
num3:.BLOCK 2
main: LDWA sum,d
DECI num1,d
ADDA num1,d
DECI num2,d
ADDA num2,d
DECI num3,d
ADDA num3,d
STWA sum,d
DECO sum,d
STOP
.END
- 如图