Type | Instruction | Opcode | Summary
|
Arithmetic | Add X | Adds value in AC at address X into AC, AC → AC + X
|
| Subt X | Subtracts value in AC at address X into AC, AC → AC - X
|
|
AddI X | Add Indirect: Use the value at X as the actual address of the
data operand to add to AC
|
|
Clear | AC → 0
|
Data Transfer | Load X | Loads Contents of Address X into AC
|
|
Store X | Stores Contents of AC into Address X
|
I/O | Input | Request user to input a value
|
|
Output | Prints value from AC
|
Branch | Jump X | Jumps to Address X
|
|
Skipcond (C) | Skips the next instruction based on C: if (C) =
000: Skips if AC < 0;
if C = 400: Skips if AC = 0;
if C = 800: Skips if AC > 0;
|
Subroutine | JnS X | Jumps and Store: Stores value of PC at address X then increments PC to X+1
|
|
JumpI X | Uses the value at X as the address to jump to
|
Indirect Addressing | StoreI | Stores value in AC at the indirect address.
e.g. StoreI addresspointer
Gets value from addresspointer, stores the AC value into the address
|
|
LoadI | Loads value from indirect address into AC
e.g. LoadI addresspointer
Gets address value from addresspointer, loads value at the address into AC
|
Halt | | End the program
|
(10 marks) Write a MARIE assembler code program that does the following: