0

我一直在写一个这样的程序:

Suppose we have the following program:
  DF1 = A - B
  SUM = DF1 + C
  DF1 = 1
  SUM = SUM + DF1 + C
Write a (Mano) assembly program that does what the pseudo-code program does.  
Assume that each variable is translated to a labelled memory address.

我相信它在大多数情况下是正确的,但不幸的是,没有一个非常可靠的 mano 汇编编译器来测试我的代码。无论如何,我唯一关心的是我在第 17 行有CLA指令。我这样做是为了将 DF1 设置为零,因为我们想在其中加载一个新的值1。这是正确的做法吗?

如果有人对我可能错过的错误或改进有任何其他批评或建议,请提供您的意见。

非常感谢任何和所有帮助/输入。谢谢。

ORG 100   /Program loaded into address 100 (hex)
CLA       /Clear accumulator....DF1 = 0
STA DF1   /Save DF1
LDA DF1   /Load current DF1
LDA B       /Load B to accumulator
CMA       /Create 2's complement
INC
ADD A       /Subtract B from A  
STA DF1   /Save DFI

LDA SUM   /Load current SUM
ADD DF1   /Add DF1 to SUM
ADD C       /Add C to SUM
STA SUM   /Save SUM

CLA       /Clear accumulator....DF1 = 0 
LDA DF1   /Load current DF1
ADD 1       /Add 1 to DF1
STA DF1   /Save DF1

ADD SUM   /Add SUM to DF1
ADD C       /Add C to DF1
STA SUM   /Save SUM 

DF1 -
SUM -
A   -
B   -
C   -
4

0 回答 0