PEP/9课下作业

1.编写伪代码算法

set sum to 0
read num1
read num2
set sum1 to num1+num2
read num3
set sum2 to num2+num3
set sum to sum1+sum2
write sum

2.用PEP/9 机器指令实现(1)中的算法

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.用PEP/9 汇编语言实现(1)中的算法

       BR    main
sum:  .WORD  0x0000
sum1: .WORD  0x0000
sum2: .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

posted @ 2023-10-29 20:13  20231413张桓溪  阅读(17)  评论(0编辑  收藏  举报