Skip to content

Latest commit

 

History

History
127 lines (107 loc) · 2.46 KB

README.md

File metadata and controls

127 lines (107 loc) · 2.46 KB

MARIE Simulator

Build

An assembly language simulator written in Javascript with VueJS

Cheatsheet

Registers

AC, a 16-bit accumulator
IR, a 16-bit register that holds an instruction immediately preceding its execution.
MBR, a 16-bit register that holds the data after its retrieval from or before its placement into memory.
PC, a 12-bit register that holds the address of the next program instruction to be executed.
MAR, a 12-bit register that holds the memory address of an instruction or the operand of an instruction.
InREG, an 8-bit register that holds data read from an input device.
OutREG, an 8-bit register that holds data that is ready for the output device

JNS (0000)

MBR ← PC  
MAR ← X
M[MAR] ← MBR  
AC ← 1  
AC ← AC + MBR  
PC ← AC

LOAD (0001)

MAR ← X
MBR ← M[MAR]  
AC ← MBR

STORE (0010)

MAR ← X
MBR ← AC  
M[MBR] ← MBR

ADD (0011)

MAR ← X
MBR ← M[MBR]  
AC ← AC + MBR

SUBT (0100)

MAR ← X  
MBR ← M[MBR]  
AC ← AC - MBR

INPUT (0101)

AC ← InREG

OUTPUT (0110)

OutREG ← AC

HALT (0111)

SKIPCOND (1000)

if IR[11-10] == 00 do
  if AC < 0 do
    PC ← PC+1
else if IR[11-10] == 01 do
  if AC < 0 do
    PC ← PC+1
else if IR[11-10] == 10 do
  if AC > 0 do
    PC ← PC+1

JUMP (1001)

PC ← IR[11-0]

CLEAR (1010)

AC ← 0

ADDI (1011)

MAR ← X
MBR ← M[MAR]  
MAR ← MBR  
MBR ← M[MAR]  
AC ← AC + MBR

JUMPI (1100)

MAR ← X
MBR ← M[MAR]  
PC ← MBR

LOADI (1101)

MAR ← X
MBR ← M[MAR]  
MAR ← MBR  
MBR ← M[MAR]  
AC ← MBR

STOREI (1110)

MAR ← X
MBR ← M[MAR]  
MAR ← MBR  
MBR ← AC  
M[MAR] ← MBR

Acknowledgements

Thank you to Marco Schweighauser for his blog post

Essentials of Computer Organization and Architecture, Second Edition by Linda Null and Julia Lobur for the creation of the Marie Simulator