MARIE Language????

Thread Starter

JoGo

Joined Nov 17, 2009
2
How would I write this correctly in MARIE???


Input a number

If number >10 then
number = number -5
Else
number = number + 3
Endif

This what I got please fix it....Thank You in Advance!!!

Org 100
Input
Store X
Skipcond 800
Jump Else
Store Y
Subt Five
Jump Endif
Else, Load X
Add Three
Endif, Halt
X, Dec 0
Y, Dec 0
Five, Dec 5
Three, Dec 3
 

beenthere

Joined Apr 20, 2004
15,819
Marie is apparently a teaching language in computer science. There does not seem to be any material available without the textbook.
 

SgtWookie

Joined Jul 17, 2007
22,230
OK, here is your source code, re-formatted, with comments.

Rich (BB code):
         Org 100 	// Starting address
         Input 		// Load a number into AC
         Store X 	// Store the AC into X
         Skipcond 800 	// If AC > 0, skip next step
         Jump Else 	// AC was < 1; branch to Else
         Store Y	// Store > 0 value in Y
         Subt Five	// Subtract five from the AC
         Jump Endif	// Exit program
Else,    Load X		// Load X into the AC
         Add Three	// Add three to the AC
Endif,   Halt		// End of run.
X,       Dec 0 
Y,       Dec 0 
Five,    Dec 5
Three,   Dec 3
Does that make the problem easier for you to solve?
Hint:
You are missing an important step right after you store the accumulator into X.
What did you forget to do?
 
Last edited:
Top