# Marie code

#### JoGo

Joined Nov 17, 2009
2
I have to write this in MARIE Assemble Code:

M = 1;
N = 1;
while M < 16
{ M = M + N:
N = N + 1;
} end while

Org 100 / This starts the program at address 100
Store Next / Store this address as out Next pointer
Store Ctr / Store this value in Ctr to control looping
Store Sum / Store this Sum
Store Next / Store in our pointer 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

#### SgtWookie

Joined Jul 17, 2007
22,201
OK, for starters - here's your pseudocode, re-formatted:
Rich (BB code):
/ Pseudocode:
M = 1;
N = 1;
while M < 16 {
M = M + N:
N = N + 1;
} end while
Rich (BB code):
         Org 100       / This starts the program at address 100
Store Next    / Store this address as out Next pointer
Store Ctr     / Store this value in Ctr to control looping
Store Sum     / Store this Sum
Store Next    / Store in our pointer 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
Can you honestly say that the program you wrote bears much resemblance to the pseudocode?

You're using Next and Ctr, but those really are a bit advanced for just two variables. If you were adding vectors/arrays, then it would make sense.

I can't do this for you, but I can nudge you in the right direction.

#### Wendy

Joined Mar 24, 2008
21,839
What is the VBulliten command to post code like that?

#### t06afre

Joined May 11, 2009
5,936
What is the VBulliten command to post code like that?
Rich (BB code):
 http://forum.allaboutcircuits.com/misc.php?do=bbcode#code