MARIE - Assembly Language Programs
- prabhu p
- Feb 29, 2024
- 8 min read
Updated: Mar 2, 2024

Let’s talk about some Marie programs!
1. Introduction of Marie
Please refer to the below 2 resources to learn the introduction of Marie
2. Marie Simulator :
3. Marie Instruction :
4. Marie Programs :
Below is the list of Marie’s programs, you can copy-paste directly into Marie's simulator and you can see the step-by-step output.
Click below link for direct visit.
Program 1 :
START, Input / starting the program, getting user input
Subt ONETEN / subtract 110 DEC from given user input
Skipcond 400 / skip next line or move to line 5 if ACC value is zero
Skipcond 000 / skip next line or Move to line 6 if ACC value is less than zero
Jump GONETEN / jump to line 9 or Label GONETEN
Jump LONETEN / jump to line 14 or label LONETEN
GONETEN,Load BEEF /Load HEX value BEEF into ACC
Output /print the ACC value
Halt /End the program
LONETEN,Load FEED /Load HEX value FEED into ACC
Output / print the ACC value
Halt / End the program
BEEF, HEX BEEF /Assign HEX value BEEF to label BEEF
FEED, HEX FEED /Assign HEX value FEED to label FEED
ONETEN,DEC 110 /Assign DEC 110 value to label ONETENProgram 2 :
START, Load ZERO / Loads the value of 0 into the Accumulator
Input / Takes user input
Store 300 / Stores the user input in memory location 300
Load 300 / Loads the user input from memory location 300 into the Accumulator
Output / Outputs the value stored in the Accumulator
Skipcond 400 / Skips the next line if the value in the Accumulator is zero
Skipcond 000 / Skips the next line if the value in the Accumulator is negative
Jump Positive / Jumps to the Positive section of the code (line 20) if the value is non-negative
Jump Negative / Jumps to the Negative section of the code (line 11) if the value is negative
Negative, Add ONE / Adds the value of 1 to the Accumulator
Store 300 / Stores the new value in memory location 300
Load 300 / Loads the new value from memory location 300 into the Accumulator
Output / Outputs the new value from the Accumulator
Skipcond 800 / Skips the next line if the value in the Accumulator is positive
Jump Negative / Jumps to the Negative section of the code (line 11) if the value is still negative
Output / Outputs the current value in the Accumulator
Jump Halt / Jumps to the Halt section of the code (line 36) to end the program
Positive, Load 300 / Loads the value stored in memory location 300 into the Accumulator
Output / Outputs the value from the Accumulator
Subt FIFTY / Subtracts 50 from the value in the Accumulator
Skipcond 800 / Skips the next line if the value in the Accumulator is positive or zero
Jump PositiveLoop / Jumps to the PositiveLoop section of the code (line 27)
Jump Halt / Jumps to the Halt section of the code (line 36) to end the program
PositiveLoop, Load 300 / Loads the value stored in memory location 300 into the Accumulator
Add TWO / Adds the value of 2 to the Accumulator
Store 300 / Stores the new value in memory location 300
Load 300 / Loads the new value from memory location 300 into the Accumulator
Output / Outputs the new value from the Accumulator
Subt FIFTY / Subtracts 50 from the value in the Accumulator
Skipcond 800 / Skips the next line if the value in the Accumulator is positive
Jump PositiveLoop / Jumps back to the PositiveLoop section of the code (line 27)
Halt, Load 300 / Loads the final value from memory location 300 into the Accumulator
Output / Outputs the final value from the Accumulator
Halt / Ends the program
ONE, DEC 1 /Assign DEC value 1 to label ONE
TWO, DEC 2 /Assign DEC value 2 to label TWO
FIFTY, DEC 50 /Assign DEC value 50 to label FIFTY
ZERO, DEC 0 /Assign DEC value 0 to label ZEROProgram 3 : Multiplication program
multiplicant, Input / Take input for the multiplicand
Store 400 / Store the multiplicand in memory location 400
multiplier, Input / Take input for the multiplier
Store 500 / Store the multiplier in memory location 500
Checkzero1,Load 400 / Load the multiplicand
skipcond 400 / Skip if it's zero
Jump CHECKZERO2 / If it's not zero, continue
Jump HALT / If it's zero, halt the program
CHECKZERO2,Load 500 / Load the multiplier
Skipcond 400 / Skip if it's zero
Jump IntegerONE / If it's not zero, proceed to IntegerONE
Jump HALT / If it's zero, halt the program
IntegerONE,load 500 / Load the multiplier
Subt ONE / Subtract 1 from the multiplier
Skipcond 400 / Skip if the result is zero
Jump Integercheck / If it's not zero, continue to Integercheck
Load 400 / If the result is zero, output the multiplicand and halt
Output
Halt
Integercheck,Load 400 / Load the multiplicand
Skipcond 800 / Skip if it's positive
Jump negcheck / If it's negative, jump to negcheck
Jump poscheck / If it's positive, jump to poscheck
poscheck,Load 500 / Load the multiplier
skipcond 800 / Skip if it's positive
Jump NegPos / If it's negative, jump to NegPos
Jump Positive / If it's positive, jump to Positive
negcheck, Load 500 / Load the multiplier
skipcond 000 / Skip if it's negative
Jump Positive / If it's positive, jump to Positive
Jump Negative / If it's negative, jump to Negative
Positive,Load 500 / Load the multiplier
subt ONE / Subtract 1 from the multiplier
store 500 / Store the updated multiplier
Load 400 / Load the multiplicand
Jump mult / Jump to the multiplication process
Multiplication,Load 401 / Load the current result
mult,Add 400 / Add the multiplicand
store 401 / Store the updated result
load 500 / Load the multiplier
skipcond 400 / Skip if it's zero
subt ONE / Subtract 1 from the multiplier
Store 500 / Store the updated multiplier
skipcond 400 / Skip if it's zero
Jump Multiplication / If it's not zero, continue the multiplication process
Load,Load 401 / Load the final result
Output / Output the result
Halt / Halt the program
Negative,Load 500 / Load the multiplier
Add ONE / Add 1 to the multiplier
store 500 / Store the updated multiplier
Load 400 / Load the multiplicand
Jump Nmult / Jump to the negative multiplication process
NMultiplication,Load 401 / Load the current result
Nmult,Add 400 / Add the multiplicand
store 401 / Store the updated result
load 500 / Load the multiplier
skipcond 400 / Skip if it's zero
Add ONE / Add 1 to the multiplier
Store 500 / Store the updated multiplier
skipcond 400 / Skip if it's zero
Jump NMultiplication / If it's not zero, continue the multiplication process
Load 401 / Load the final result
Output / Output the result
Halt / Halt the program
NegPos,Load 500 / Load the multiplier
Add ONE / Add 1 to the multiplier
store 500 / Store the updated multiplier
Load 400 / Load the multiplicand
Jump NPmult / Jump to the negative-positive multiplication process
NPMultiplication,Load 401 / Load the current result
NPmult,Add 400 / Add the multiplicand
store 401 / Store the updated result
load 500 / Load the multiplier
skipcond 400 / Skip if it's zero
Add ONE / Add 1 to the multiplier
Store 500 / Store the updated multiplier
skipcond 400 / Skip if it's zero
Jump NPMultiplication / If it's not zero, continue the multiplication process
Load 401 / Load the final result
Subt 401 / Negate the final result
Subt 401 / Negate the final result again to make it positive
Output / Output the result
Halt / Halt the program
HALT,Load ZERO / Load constant value 0
Output / Output the result
Halt / Halt the program
ONE,DEC 1 / Constant value 1
ZERO,DEC 0 / Constant value 0Program 4 : Division program
DIVIDEND,Input // Take input for the dividend
Store 500 // Store the dividend in memory location 500
DIVISOR,Input // Take input for the divisor
Store 300 // Store the divisor in memory location 300
Load 500 // Load the dividend
Store 400 // Store a copy of the dividend for later use
OutsideLoop, Load 400 // Load the copy of the dividend
Skipcond 800 // Skip if it's less than or equal to 0
Jump EndLoop // If it's 0 or less, end the loop
Load ONE // Load the value 1
Store POWER // Initialize POWER to 1
Load 300 // Load the divisor
Store 600 // Store the divisor in memory location 600
InsideLoop,Load 600 // Load the divisor
Add 600 // Double the divisor
Subt 400 // Subtract the doubled divisor from the dividend
Skipcond 000 // If result is negative, jump to Inside2
Jump InsideLoop // Otherwise, continue looping
Load 600 // Load the divisor
Add 600 // Double the divisor
Store 600 // Store the doubled divisor
Load POWER // Load POWER
Add POWER // Double POWER
Store POWER // Store the updated POWER
Jump InsideLoop // Continue looping
Inside2,Load 400 // Load the dividend
Subt 600 // Subtract the doubled divisor from the dividend
Store 400 // Store the updated dividend
Load Quotient // Load the quotient
Add POWER // Add POWER to the quotient
Store Quotient // Store the updated quotient
Jump OutsideLoop // Continue outside the loop
EndLoop,Load 400 // Load the dividend
Skipcond 000 // If the dividend is zero, end the program
Jump Halt // Otherwise, subtract 1 from the quotient
Load Quotient
Subt ONE
HALT, Load Quotient // Output the quotient and halt
Output
Halt
ONE,DEC 1 // Constant value 1
POWER, DEC 0 // Initialize POWER to 0
Quotient,DEC 0 // Initialize Quotient to 0Program 5 : Recursion : parameter passing and return value handled through global stack
Main, input
storeI ToS / push N onto stack before call
load ToS / (and increment ToS)
add Incr
store ToS
JnS Sum
load ToS / pop final result for output
subt Incr / (after decrementing ToS)
store ToS
loadI ToS
output
halt
Sum, hex 000 / int sum(int N);
clear / set result = 0 (only used for base case)
store SumR
load ToS / pop N off stack into local
subt Incr / (after decrementing ToS)
store ToS
loadI ToS
store SumN
skipcond 800 / if N > 0 skip to body
Jump Return / else we're done (go return 0)
Body, load SumN / push N onto stack so we can get it back after recursive call
storeI ToS / (then increment ToS)
load ToS
add Incr
store ToS
load Sum / push return addr onto stack so we can get it back after call
storeI ToS / (then increment ToS)
load ToS
add Incr
store ToS
load SumN / compute and push N-1 onto stack for param
subt Incr / (then increment ToS)
storeI ToS
load ToS
add Incr
store ToS
JnS Sum / call sum(N-1)
load ToS / pop result off stack
subt Incr / (after decrementing ToS)
store ToS
loadI ToS
store SumR
load ToS / pop our stored return addr off stack
subt Incr / (after decrementing ToS)
store ToS
loadI ToS
store Sum
load ToS / pop our stored N off stack
subt Incr / (after decrementing ToS)
store ToS
loadI ToS
store SumN
add SumR / compute result = N + result
store SumR
Return, load SumR / push result onto stack
storeI ToS / (then increment ToS)
load ToS
add Incr
store ToS
JumpI Sum / return
SumR, hex 0 / local result within Sum
SumN, hex 0 / local N within Sum
Incr, hex 1 / used for ++, --
Stack, hex 43 / base of stack
ToS, hex 43 / top element on stackProgram 6 - if/else Program
/ program to get x,y from user
/ if x < y print x then y
/ else if x > y print y then x
/ else just print x
org 100
input / get value for x
store X
input / get value for y
store Y
Test1, subt X / acc = y - x
skipcond 000 / if negative then x bigger, skip further tests
jump Test2
load X / got here if x bigger, print x then y, then done
output
load Y
output
jump Done
Test2, skipcond 800 / if positive then y bigger, skip further tests
jump XYEq / if here then equal, go to XYeq print section
load Y / got here if y bigger, print y then x, then done
output
load X / then print y
output
jump Done
XYEq, load X / just print x, then done
output
Done, halt
X, dec 0 / default value for x
Y, dec 0 / default value for y
More Programs
I have added more Marie programs to my GitHub page with comments for the instructions. If you have any uncertainties, feel free to post them in the discussion below, and I will respond accordingly.

Comments