Skip to content

MARIE Instruction Set (with Opcodes)

Eric Jiang edited this page Feb 13, 2019 · 7 revisions

In MARIE, each instruction is 16 bits long with the first 4 bits representing the opcode and the remaining 12 bits are being used to represent the address.

For example the instruction CLEAR, the Opcode is A in HEX and 1010 in binary so the instruction will look something like `1010............`

Code Table

Type Instruction Hex Opcode Summary
Arithmetic Add X 3 Adds value in AC at address X into AC, AC ← AC + X
Subt X 4 Subtracts value in AC at address X into AC, AC ← AC - X
AddI X B Add Indirect: Use the value at X as the actual address of the
data operand to add to AC
Clear A AC ← 0
Data Transfer Load X 1 Loads Contents of Address X into AC
Store X 2 Stores Contents of AC into Address X
I/O Input 5 Request user to input a value
Output 6 Prints value from AC
Branch Jump X 9 Jumps to Address X
Skipcond (C) 8 Skips the next instruction based on C: if (C) =

- 000: Skips if AC < 0
- 400: Skips if AC = 0
- 800: Skips if AC > 0
Subroutine JnS X 0 Jumps and Store: Stores value of PC at address X then increments PC to X+1
JumpI X C Uses the value at X as the address to jump to
Indirect Addressing StoreI D Stores value in AC at the indirect address.
e.g. StoreI addresspointer
Gets value from addresspointer, stores the AC value into the address
LoadI E Loads value from indirect address into AC
e.g. LoadI addresspointer
Gets address value from addresspointer, loads value at the address into AC
Halt 7 End the program
You can’t perform that action at this time.