LC-3 Instructions
Trapvector
unique code that specifies the service routine X23: input a character from the keyboard X21: Output a character to the mointor X25: Halt the processor input and output is stored in R0
Operate Instructions
-AND -NOT -ADD -LEA
Data Movement Instructions
-LD -ST -LDI -STI -LDR -STR
JMP
Addressing mode: - Operands: [5:0] - 000000, non relevant info [8:6] - BaseR, base register [11:9] - 000, non relevant info Function: loads PC with the instruction stored in the address that BaseR holds
BR
Addressing mode: - Operands: [8:0] - PCoffset9, offset to add to the PC [11:9] - N, Z, P registers Function: N/Z/P bits will be 1 in the instruction, if the N/Z/P registers match those 1s then the PC is updated to the PC + PCoffset9
LDR
Addressing modes: -Base + Offset Operands: [5:0] - offset6, offset to add to the Base Register [8:6] - BaseR, base register [11:9] - DR Function: Moves data from memory to a register by adding a offset to an address held in the Base Register
STR
Addressing modes: -Base + Offset Operands: [5:0] - offset6, offset to add to the Base Register [8:6] - BaseR, base register [11:9] - SR Function: Moves data from a register to memory by adding a offset to an address held in the Base Register
LEA
Addressing modes: -Immediate Operands: [8:0] - PCoffset9, offset to add to PC [11:9] - DR Function: Stores a address in a register
LD
Addressing modes: -PC-Relative Operands: [8:0] - PCoffset9, offset to add to PC [11:9] - DR Function: Moves data from memory relative to a PC to a register
ST
Addressing modes: -PC-Relative Operands: [8:0] - PCoffset9, offset to add to PC [11:9] - SR Function: Moves data from register to a memory location relative to the PC
NOT
Addressing modes: -register operands: [5:0] - 11111, holds no relevant info [8:6] - SR [11:9] - DR
AND
Addressing modes: -register addressing -immediate addressing operands (immediate): [0:4] - immediate value to add [5] - 1, meaning immediate addressing mode [8:6] - SR1 [11:9] - DR
ADD
Addressing modes: -register addressing -immediate addressing operands (immediate): [4:0] - immediate value to add [5] - 1, meaning immediate addressing mode [8:6] - SR1 [11:9] - DR operands (register): [2:0] - immediate value to add [4:3] - 00, non relevant data [5] - 0, meaning register addressing mode [8:6] - SR1 [11:9] - DR
LDI
Addressing modes: -relative Operands: [8:0] - PCoffset9, offset to add to PC [11:9] - SR Function: takes the address stored at the PC + PCoffset9 location and loads from that address
STI
Addressing modes: -relative Operands: [8:0] - PCoffset9, offset to add to PC [11:9] - SR Function: takes the address stored at the PC + PCoffset9 location and stores information at that address
TRAP
Operands: [7:0] - trapvect8, trap vector Function: Gives control to the operating system to perform a task that user code is not allowed to do