[][src]Module lc3_vm::hardware::instructions

An instr is a command which tells the CPU to do some fundamental task, instrs have both an opcode which indicates the kind of task to perform and a set of parameters which provide inputs to the task being performed.

Modules

add
and
br
jmp
jsr
ld
ldi
ldr
lea
not
opcode

An instruction is a command which tells the CPU to do some fundamental task, such as add two numbers. super have both an opcode which indicates the kind of task to perform and a set of parameters which provide inputs to the task being performed. Each opcode represents one task that the CPU "knows" how to do. There are just 16 opcodes in LC-3. Everything the computer can calculate is some sequence of these simple super. Each instruction is 16 bits long, with the left 4 bits storing the opcode. The rest of the bits are used to store the parameters.

st
sti
str
trap

trap : The LC-3 provides a few predefined routines for performing common tasks and interacting with I/O devices. For example, there are routines for getting input from the keyboard and for displaying strings to the console. These are called trap routines which you can think of as the operating system or API for the LC-3. Each trap routine is assigned a trap code which identifies it (similar to an opcode). To execute one, the TRAP instruction is called with the trap code of the desired routine.