I have been working on writing a program that does this:
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.
I believe it is correct for the most part, but unfortunately there is not a very reliable mano assembly compiler out there to test my code. Anyways, my only concern is where I have the CLA instruction at line 17. I did this to set DF1 to zero because we want to load a fresh value in there of 1. Would this be the correct thing to do?
If anyone has any other critiques or suggestions on errors or improvements that I might have missed please provide your input.
Any and all help/input is greatly appreciated. Thanks.
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 -