write an Marie assembler program that will
read in or read in
M A
X B
B C
D
solve for Y solve for Y
Y=MX+B Y = AB + CD
output Y output Y
Just code one of the programs - not both
CODE: 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
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:
Get Answers For Free
Most questions answered within 1 hours.