Lab4 Marie
Lab4 Marie
Objectives:
The main objective of this lab is to get you familiarized with MARIE a simple computer
simulator.
MAR ← X
MBR ← M[MAR]
AC ← MBR
MAR ← X
MBR ← M[MAR]
AC ← AC + MBR
MAR ← X
MBR ← M[MAR]
AC ← AC - MBR
MBR ← PC
MAR ← X
M[MAR] ← MBR
MBR ← X
AC ← 1
AC ← AC + MBR
PC ← AC
MAR ← X
MBR ← M[MAR]
MAR ← MBR
MBR ← M[MAR]
AC ← AC + MBR
Name: ______________________________
Activity 2.1: Suppose the location X in a Load X instruction is 104 which contains the value of
35d and the instruction stored at 100 in the memory, complete the following table:
Activity 2.2: Suppose the location X in an ADD X instruction is 105 which contains the value of
−23d and the instruction stored at 101 in the memory, complete the following table:
Activity 2.3: Suppose the location X in a Store X instruction is 106 and the instruction stored
at 102 in the memory, complete the following table:
Load X
Subt Y
Skipcond 000
Jump Else
Then, Load Y
Subt X
Store Y
Jump Endif
Else, Load X
Subt Y
Store X
Endif, Halt
X, DEC 20
Y, DEC 30
Activity 3.2: Assemble the program, then debug or run the program in MARIE Simulator.
Activity 3.3: What is the content at location of X and Y at end of the program?
Location Content
X 0014
Y 000A
Name: ______________________________
Activity 3.4: Replace the instruction X, DEC 20 by X, DEC 40. What is the content at
location of X and Y at end of the program?
Location Content
X 000A
Y 001E
if (X - Y) < 0
Y = Y – X
else
X = X - Y
Activity 3.6: Convert each instruction in the following program to its corresponding machine
code in hex.