Pep/9课下作业

1.伪代码算法

Set sum to 0
Set num1
Set num2
Set num3
Read num1
Read num2
Read num3
sum <- num1 + num2 +num3
Write sum 

2.机器语言

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.汇编语言

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
        

 

posted @ 2022-10-02 16:37  20221312付安旭  阅读(26)  评论(0编辑  收藏  举报