I have to write this in MARIE Assemble Code:
M = 1;
N = 1;
while M < 16
{ M = M + N:
N = N + 1;
} end while
This is what I have: Can you please make adjustments as needed. Thank You in Advance!!
Org 100 / This starts the program at address 100
Load N / Load N into the AC
Add One / Increment
Store Next / Store this address as out Next pointer
Load M / Load M into the AC
Add N / Add N to M
Store Ctr / Store this value in Ctr to control looping
Loop, Load Sum / Load the Sum into AC
AddI Next /Add the value pointed to by location Next
Store Sum / Store this Sum
Load Next / load Next
Add One / Increment by one to point to next address address
Store Next / Store in our pointer Next
Load Ctr / Load the loop control variable
Add Next / Add the value pointed to by location Next
Store Ctr / Store thie new value in loop control variable
Skipcond 000 / if control variable < 16 then skip next instruction
Jump Loop / Otherwise, go to Loop
Halt / Terminate Program
M, Dec 1 / M = 1
N, Dec 1 / N = 1
One, Dec 1 / Used to Increment or Decrement
Next, Hex 0 / A pointer to the next number to add
Ctr, Hex 0 / The loop control variable
Sum, Dec 0 / The sum
M = 1;
N = 1;
while M < 16
{ M = M + N:
N = N + 1;
} end while
This is what I have: Can you please make adjustments as needed. Thank You in Advance!!
Org 100 / This starts the program at address 100
Load N / Load N into the AC
Add One / Increment
Store Next / Store this address as out Next pointer
Load M / Load M into the AC
Add N / Add N to M
Store Ctr / Store this value in Ctr to control looping
Loop, Load Sum / Load the Sum into AC
AddI Next /Add the value pointed to by location Next
Store Sum / Store this Sum
Load Next / load Next
Add One / Increment by one to point to next address address
Store Next / Store in our pointer Next
Load Ctr / Load the loop control variable
Add Next / Add the value pointed to by location Next
Store Ctr / Store thie new value in loop control variable
Skipcond 000 / if control variable < 16 then skip next instruction
Jump Loop / Otherwise, go to Loop
Halt / Terminate Program
M, Dec 1 / M = 1
N, Dec 1 / N = 1
One, Dec 1 / Used to Increment or Decrement
Next, Hex 0 / A pointer to the next number to add
Ctr, Hex 0 / The loop control variable
Sum, Dec 0 / The sum