0

I am trying to get my program to do a simple math problem of A*B+C*D given a set of test numbers. I have the code written out, but after I input numbers for A and B it goes into an infinite loop. My code is this:

```
ORG 100
Load A
Store X /Store A in first parameter
Load B
Store Y /Store B in second parameter
JnS Mul /Jump to multiplication subroutine
Load Sum /Get result
Store E /E:= A x B
Load C
Store X /Store C in first parameter
Load D
Store Y /Store D in second parameter
JnS Mul /Jump to multiplication subroutine
Load Sum /Get result
Store F /F := C x D
Load E /Get first result
Add F /AC now contains sum of A X B + C X D
Halt /Terminate program
A, Dec 0 /Initial values of A,B,C,D not given in problem
B, Dec 0 / (give values before assembling and running)
C, Dec 0 /
D, Dec 0 /
X, Dec 0 /First parameter
Y, Dec 0 /Second parameter
Ctr, Dec 0 /Counter for looping
One, Dec 1 /Constant with value 1
E, Dec 0 /Temp storage
F, Dec 0 /Temp storage
Sum, Dec 0
Mul, Hex 0 /Store return address here
Load Y /Load second parameter to be used as counter
Store Ctr /Store as counter
Clear /Clear sum
Store Sum /Zero out the sum to begin
Loop, Load Sum /Load the sum
Add X /Add first parameter
Store Sum /Store result in Sum
Load Ctr
Subt One /Decrement counter
Store Ctr /Store counter
SkipCond 400 /If counter = 0 finish subroutine
Jump Loop /Continue subroutine loop
JumpI Mul /Done with subroutine, return to main
END
```

And the set of test number I am using is this:

Number set 1: A=2 B=3 C=4 D=5 with an output of 26

set 2: A=1 B=1 C=1 D=1 with an output of 2

set 3: A=8 B=3 C=3 D=2 with an output of 30

Thank you!