- Immediate Loads
- Memory Reads
- Memory Writes
- Register Assignment
- Increment and Decrement
- Arithmetic and Bitwise Operators
- Comparisons
- Jumps
- Stack and Subroutines
- Interrupts
- System Control
0x_0 |
0x_1 |
0x_2 |
0x_3 |
0x_4 |
0x_5 |
0x_6 |
0x_7 |
0x_8 |
0x_9 |
0x_A |
0x_B |
0x_C |
0x_D |
0x_E |
0x_F |
|
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
0x0_ |
LIA 3c |
LIB 3c |
LIC 3c |
LIA8 2c |
LIB8 2c |
LIC8 2c |
LIA8S 2c |
LIB8S 2c |
LIC8S 2c |
SOF 3c |
||||||
0x1_ |
RDA 3c |
RDB 3c |
RDC 3c |
RDA8 2c |
RDB8 2c |
RDC8 2c |
RDA8S 2c |
RDB8S 2c |
RDC8S 2c |
|||||||
0x2_ |
RSA 5c |
RSB 5c |
RSC 5c |
RSA8 4c |
RSB8 4c |
RSC8 4c |
RSA8S 4c |
RSB8S 4c |
RSC8S 4c |
|||||||
0x3_ |
WRA 3c |
WRB 3c |
WRC 3c |
WRA8 2c |
WRB8 2c |
WRC8 2c |
||||||||||
0x4_ |
WSA 5c |
WSB 5c |
WSC 5c |
WSA8 4c |
WSB8 4c |
WSC8 4c |
||||||||||
0x5_ |
RIA 5c |
RIB 5c |
RIC 5c |
RIA8 4c |
RIB8 4c |
RIC8 4c |
RIA8S 4c |
RIB8S 4c |
RIC8S 4c |
|||||||
0x6_ |
WIA 5c |
WIB 5c |
WIC 5c |
WIA8 4c |
WIB8 4c |
WIC8 4c |
WII 7c |
WII8 5c |
||||||||
0x7_ |
||||||||||||||||
0x8_ |
HLT 1c |
CLI 1c |
STI 1c |
|||||||||||||
0x9_ |
SAB 1c |
SAC 1c |
SAS 1c |
SBA 1c |
SBC 1c |
SCA 1c |
SCB 1c |
SDC 1c |
SAD 1c |
SBD 1c |
SCD 1c |
|||||
0xA_ |
INA 1c |
INB 1c |
INC 1c |
DEA 1c |
DEB 1c |
DEC 1c |
INS 7c |
INS8 5c |
INI 7c |
INI8 5c |
DES 7c |
DES8 5c |
DEI 7c |
DEI8 5c |
||
0xB_ |
AND 1c |
IOR 1c |
XOR 1c |
NOT 1c |
ADD 1c |
SUB 1c |
MUL 1c |
RSS 1c |
LSS 1c |
ANL 1c |
MOD 1c |
DIV 1c |
NEG 1c |
|||
0xC_ |
CMP 1c |
GTE 1c |
LTE 1c |
GTC 1c |
LTC 1c |
SGE 1c |
SLE 1c |
SGT 1c |
SLT 1c |
NEQ 1c |
||||||
0xD_ |
JMP 1c |
JIA 1c |
JIB 1c |
JIC 1c |
JIX 1c |
JIY 1c |
JIZ 1c |
JSC 1c |
JMI 3c |
JAI 3c |
JBI 3c |
JCI 3c |
JXI 3c |
JYI 3c |
JZI 3c |
|
0xE_ |
SVI 14c |
LDI 14c |
SRT 3c |
SIA 3c |
SIB 3c |
SIC 3c |
SRI 5c |
RET 3c |
RTI 1c |
PSHI 5c |
PSHI8 3c |
INT 2c |
PSHN 3c |
PULN 3c |
||
0xF_ |
PSHA 3c |
PSHB 3c |
PSHC 3c |
PSHD 3c |
PULA 3c |
PULB 3c |
PULC 3c |
PULD 3c |
PSHA8 2c |
PSHB8 2c |
PSHC8 2c |
PSHD8 2c |
PULA8 2c |
PULB8 2c |
PULC8 2c |
PULD8 2c |
Name: Load Immediate into A
Opcode:0x00
Cycles: 3
Loads a 2 byte immediate value into register A.
- Fetch the low byte of the immediate value
- Fetch the high byte of the immediate value
- Combine both bytes and store the result in A
Name: Load Immediate into B
Opcode:0x01
Cycles: 3
Loads a 2 byte immediate value into register B.
- Fetch the low byte of the immediate value
- Fetch the high byte of the immediate value
- Combine both bytes and store the result in B
Name: Load Immediate into C
Opcode:0x02
Cycles: 3
Loads a 2 byte immediate value into register C.
- Fetch the low byte of the immediate value
- Fetch the high byte of the immediate value
- Combine both bytes and store the result in C
Name: Load 1 Byte Immediate into A (Zero Extended)
Opcode:0x04
Cycles: 2
Loads a 1 byte immediate into A, zero extended to 2 bytes. One byte in ROM, not two.
- Fetch the immediate byte
- Zero-extend the byte and store the result in A
Name: Load 1 Byte Immediate into B (Zero Extended)
Opcode:0x05
Cycles: 2
Loads a 1 byte immediate into B, zero extended to 2 bytes.
- Fetch the immediate byte
- Zero-extend the byte and store the result in B
Name: Load 1 Byte Immediate into C (Zero Extended)
Opcode:0x06
Cycles: 2
Loads a 1 byte immediate into C, zero extended to 2 bytes.
- Fetch the immediate byte
- Zero-extend the byte and store the result in C
Name: Load 1 Byte Immediate into A (Sign Extended)
Opcode:0x08
Cycles: 2
Loads a 1 byte immediate into A, sign extended to 2 bytes.
- Fetch the immediate byte
- Sign-extend the byte and store the result in A
Name: Load 1 Byte Immediate into B (Sign Extended)
Opcode:0x09
Cycles: 2
Loads a 1 byte immediate into B, sign extended to 2 bytes.
- Fetch the immediate byte
- Sign-extend the byte and store the result in B
Name: Load 1 Byte Immediate into C (Sign Extended)
Opcode:0x0A
Cycles: 2
Loads a 1 byte immediate into C, sign extended to 2 bytes.
- Fetch the immediate byte
- Sign-extend the byte and store the result in C
Name: Stack Offset
Opcode:0x0F
Cycles: 3
Computes a stack-pointer-relative address (STACK_START_ADDR + T + imm16) and stores it in C.
- Fetch the low byte of the offset immediate
- Fetch the high byte of the offset immediate
- Add STACK_START_ADDR, T, and the offset, and store the result in C
Name: Read into A
Opcode:0x10
Cycles: 3
Reads 2 bytes at the address in C into A.
- Read the low byte at address C
- Read the high byte at address C+1
- Combine both bytes and store the result in A
Name: Read into B
Opcode:0x11
Cycles: 3
Reads 2 bytes at the address in C into B.
- Read the low byte at address C
- Read the high byte at address C+1
- Combine both bytes and store the result in B
Name: Read into C
Opcode:0x12
Cycles: 3
Reads 2 bytes at the address in C into C.
- Read the low byte at address C
- Read the high byte at address C+1
- Combine both bytes and store the result in C
Name: Read Byte into A (Zero Extended)
Opcode:0x14
Cycles: 2
Reads 1 byte at the address in C into A, zero extended.
- Read the byte at address C
- Zero-extend the byte and store the result in A
Name: Read Byte into B (Zero Extended)
Opcode:0x15
Cycles: 2
Reads 1 byte at the address in C into B, zero extended.
- Read the byte at address C
- Zero-extend the byte and store the result in B
Name: Read Byte into C (Zero Extended)
Opcode:0x16
Cycles: 2
Reads 1 byte at the address in C into C, zero extended.
- Read the byte at address C
- Zero-extend the byte and store the result in C
Name: Read Byte into A (Sign Extended)
Opcode:0x18
Cycles: 2
Reads 1 byte at the address in C into A, sign extended.
- Read the byte at address C
- Sign-extend the byte and store the result in A
Name: Read Byte into B (Sign Extended)
Opcode:0x19
Cycles: 2
Reads 1 byte at the address in C into B, sign extended.
- Read the byte at address C
- Sign-extend the byte and store the result in B
Name: Read Byte into C (Sign Extended)
Opcode:0x1A
Cycles: 2
Reads 1 byte at the address in C into C, sign extended.
- Read the byte at address C
- Sign-extend the byte and store the result in C
Name: Read Stack-Relative into A
Opcode:0x20
Cycles: 5
Reads 2 bytes at (STACK_START_ADDR + T + imm16) into A.
- Fetch the low byte of the offset immediate
- Fetch the high byte of the offset immediate
- Compute the stack-relative address and read the low byte of the value there
- Store the low byte in A and read the high byte of the value
- Combine the high byte into A
Name: Read Stack-Relative into B
Opcode:0x21
Cycles: 5
Reads 2 bytes at (STACK_START_ADDR + T + imm16) into B.
- Fetch the low byte of the offset immediate
- Fetch the high byte of the offset immediate
- Compute the stack-relative address and read the low byte of the value there
- Store the low byte in B and read the high byte of the value
- Combine the high byte into B
Name: Read Stack-Relative into C
Opcode:0x22
Cycles: 5
Reads 2 bytes at (STACK_START_ADDR + T + imm16) into C.
- Fetch the low byte of the offset immediate
- Fetch the high byte of the offset immediate
- Compute the stack-relative address and read the low byte of the value there
- Store the low byte in C and read the high byte of the value
- Combine the high byte into C
Name: Read Stack-Relative Byte into A (Zero Extended)
Opcode:0x24
Cycles: 4
Reads 1 byte at (STACK_START_ADDR + T + imm16) into A, zero extended.
- Fetch the low byte of the offset immediate
- Fetch the high byte of the offset immediate
- Compute the stack-relative address and read the value byte there
- Zero-extend the byte and store the result in A
Name: Read Stack-Relative Byte into B (Zero Extended)
Opcode:0x25
Cycles: 4
Reads 1 byte at (STACK_START_ADDR + T + imm16) into B, zero extended.
- Fetch the low byte of the offset immediate
- Fetch the high byte of the offset immediate
- Compute the stack-relative address and read the value byte there
- Zero-extend the byte and store the result in B
Name: Read Stack-Relative Byte into C (Zero Extended)
Opcode:0x26
Cycles: 4
Reads 1 byte at (STACK_START_ADDR + T + imm16) into C, zero extended.
- Fetch the low byte of the offset immediate
- Fetch the high byte of the offset immediate
- Compute the stack-relative address and read the value byte there
- Zero-extend the byte and store the result in C
Name: Read Stack-Relative Byte into A (Sign Extended)
Opcode:0x28
Cycles: 4
Reads 1 byte at (STACK_START_ADDR + T + imm16) into A, sign extended.
- Fetch the low byte of the offset immediate
- Fetch the high byte of the offset immediate
- Compute the stack-relative address and read the value byte there
- Sign-extend the byte and store the result in A
Name: Read Stack-Relative Byte into B (Sign Extended)
Opcode:0x29
Cycles: 4
Reads 1 byte at (STACK_START_ADDR + T + imm16) into B, sign extended.
- Fetch the low byte of the offset immediate
- Fetch the high byte of the offset immediate
- Compute the stack-relative address and read the value byte there
- Sign-extend the byte and store the result in B
Name: Read Stack-Relative Byte into C (Sign Extended)
Opcode:0x2A
Cycles: 4
Reads 1 byte at (STACK_START_ADDR + T + imm16) into C, sign extended.
- Fetch the low byte of the offset immediate
- Fetch the high byte of the offset immediate
- Compute the stack-relative address and read the value byte there
- Sign-extend the byte and store the result in C
Name: Read Immediate-Address into A
Opcode:0x50
Cycles: 5
Reads 2 bytes at an immediate absolute address into A.
- Fetch the low byte of the address
- Fetch the high byte of the address
- Combine the address and read the low byte of the value there
- Store the low byte in A and read the high byte of the value
- Combine the high byte into A
Name: Read Immediate-Address into B
Opcode:0x51
Cycles: 5
Reads 2 bytes at an immediate absolute address into B.
- Fetch the low byte of the address
- Fetch the high byte of the address
- Combine the address and read the low byte of the value there
- Store the low byte in B and read the high byte of the value
- Combine the high byte into B
Name: Read Immediate-Address into C
Opcode:0x52
Cycles: 5
Reads 2 bytes at an immediate absolute address into C.
- Fetch the low byte of the address
- Fetch the high byte of the address
- Combine the address and read the low byte of the value there
- Store the low byte in C and read the high byte of the value
- Combine the high byte into C
Name: Read Immediate-Address Byte into A (Zero Extended)
Opcode:0x54
Cycles: 4
Reads 1 byte at an immediate absolute address into A, zero extended.
- Fetch the low byte of the address
- Fetch the high byte of the address
- Combine the address and read the value byte there
- Zero-extend the byte and store the result in A
Name: Read Immediate-Address Byte into B (Zero Extended)
Opcode:0x55
Cycles: 4
Reads 1 byte at an immediate absolute address into B, zero extended.
- Fetch the low byte of the address
- Fetch the high byte of the address
- Combine the address and read the value byte there
- Zero-extend the byte and store the result in B
Name: Read Immediate-Address Byte into C (Zero Extended)
Opcode:0x56
Cycles: 4
Reads 1 byte at an immediate absolute address into C, zero extended.
- Fetch the low byte of the address
- Fetch the high byte of the address
- Combine the address and read the value byte there
- Zero-extend the byte and store the result in C
Name: Read Immediate-Address Byte into A (Sign Extended)
Opcode:0x58
Cycles: 4
Reads 1 byte at an immediate absolute address into A, sign extended.
- Fetch the low byte of the address
- Fetch the high byte of the address
- Combine the address and read the value byte there
- Sign-extend the byte and store the result in A
Name: Read Immediate-Address Byte into B (Sign Extended)
Opcode:0x59
Cycles: 4
Reads 1 byte at an immediate absolute address into B, sign extended.
- Fetch the low byte of the address
- Fetch the high byte of the address
- Combine the address and read the value byte there
- Sign-extend the byte and store the result in B
Name: Read Immediate-Address Byte into C (Sign Extended)
Opcode:0x5A
Cycles: 4
Reads 1 byte at an immediate absolute address into C, sign extended.
- Fetch the low byte of the address
- Fetch the high byte of the address
- Combine the address and read the value byte there
- Sign-extend the byte and store the result in C
Name: Write A
Opcode:0x30
Cycles: 3
Writes 2 bytes of A to the address in C.
- Write the low byte of A to address C
- Write the high byte of A to address C+1
- Delay one cycle so the write commits
Name: Write B
Opcode:0x31
Cycles: 3
Writes 2 bytes of B to the address in C.
- Write the low byte of B to address C
- Write the high byte of B to address C+1
- Delay one cycle so the write commits
Name: Write C
Opcode:0x32
Cycles: 3
Writes 2 bytes of C to the address in C.
- Write the low byte of C to address C
- Write the high byte of C to address C+1
- Delay one cycle so the write commits
Name: Write Byte of A
Opcode:0x34
Cycles: 2
Writes the low 1 byte of A to the address in C.
- Write the low byte of A to address C
- Delay one cycle so the write commits
Name: Write Byte of B
Opcode:0x35
Cycles: 2
Writes the low 1 byte of B to the address in C.
- Write the low byte of B to address C
- Delay one cycle so the write commits
Name: Write Byte of C
Opcode:0x36
Cycles: 2
Writes the low 1 byte of C to the address in C.
- Write the low byte of C to address C
- Delay one cycle so the write commits
Name: Write Stack-Relative A
Opcode:0x40
Cycles: 5
Writes 2 bytes of A to (STACK_START_ADDR + T + imm16).
- Fetch the low byte of the offset immediate
- Fetch the high byte of the offset immediate
- Compute the stack-relative address and write the low byte of A there
- Write the high byte of A
- Delay one cycle so the write commits
Name: Write Stack-Relative B
Opcode:0x41
Cycles: 5
Writes 2 bytes of B to (STACK_START_ADDR + T + imm16).
- Fetch the low byte of the offset immediate
- Fetch the high byte of the offset immediate
- Compute the stack-relative address and write the low byte of B there
- Write the high byte of B
- Delay one cycle so the write commits
Name: Write Stack-Relative C
Opcode:0x42
Cycles: 5
Writes 2 bytes of C to (STACK_START_ADDR + T + imm16).
- Fetch the low byte of the offset immediate
- Fetch the high byte of the offset immediate
- Compute the stack-relative address and write the low byte of C there
- Write the high byte of C
- Delay one cycle so the write commits
Name: Write Stack-Relative Byte of A
Opcode:0x44
Cycles: 4
Writes the low 1 byte of A to (STACK_START_ADDR + T + imm16).
- Fetch the low byte of the offset immediate
- Fetch the high byte of the offset immediate
- Compute the stack-relative address and write the low byte of A there
- Delay one cycle so the write commits
Name: Write Stack-Relative Byte of B
Opcode:0x45
Cycles: 4
Writes the low 1 byte of B to (STACK_START_ADDR + T + imm16).
- Fetch the low byte of the offset immediate
- Fetch the high byte of the offset immediate
- Compute the stack-relative address and write the low byte of B there
- Delay one cycle so the write commits
Name: Write Stack-Relative Byte of C
Opcode:0x46
Cycles: 4
Writes the low 1 byte of C to (STACK_START_ADDR + T + imm16).
- Fetch the low byte of the offset immediate
- Fetch the high byte of the offset immediate
- Compute the stack-relative address and write the low byte of C there
- Delay one cycle so the write commits
Name: Write Immediate-Address A
Opcode:0x60
Cycles: 5
Writes 2 bytes of A to an immediate absolute address.
- Fetch the low byte of the address
- Fetch the high byte of the address
- Combine the address and write the low byte of A there
- Write the high byte of A
- Delay one cycle so the write commits
Name: Write Immediate-Address B
Opcode:0x61
Cycles: 5
Writes 2 bytes of B to an immediate absolute address.
- Fetch the low byte of the address
- Fetch the high byte of the address
- Combine the address and write the low byte of B there
- Write the high byte of B
- Delay one cycle so the write commits
Name: Write Immediate-Address C
Opcode:0x62
Cycles: 5
Writes 2 bytes of C to an immediate absolute address.
- Fetch the low byte of the address
- Fetch the high byte of the address
- Combine the address and write the low byte of C there
- Write the high byte of C
- Delay one cycle so the write commits
Name: Write Immediate-Address Byte of A
Opcode:0x64
Cycles: 4
Writes the low 1 byte of A to an immediate absolute address.
- Fetch the low byte of the address
- Fetch the high byte of the address
- Combine the address and write the low byte of A there
- Delay one cycle so the write commits
Name: Write Immediate-Address Byte of B
Opcode:0x65
Cycles: 4
Writes the low 1 byte of B to an immediate absolute address.
- Fetch the low byte of the address
- Fetch the high byte of the address
- Combine the address and write the low byte of B there
- Delay one cycle so the write commits
Name: Write Immediate-Address Byte of C
Opcode:0x66
Cycles: 4
Writes the low 1 byte of C to an immediate absolute address.
- Fetch the low byte of the address
- Fetch the high byte of the address
- Combine the address and write the low byte of C there
- Delay one cycle so the write commits
Name: Write Immediate Value to Immediate Address
Opcode:0x6E
Cycles: 7
Writes a 2 byte immediate value to an immediate absolute address.
- Fetch the low byte of the address
- Fetch the high byte of the address
- Combine the address and fetch the low byte of the immediate value
- Write the low byte of the value to the address
- Fetch the high byte of the immediate value
- Write the high byte of the value to address+1
- Delay one cycle so the write commits
Name: Write Immediate Byte to Immediate Address
Opcode:0x6F
Cycles: 5
Writes a 1 byte immediate value to an immediate absolute address.
- Fetch the low byte of the address
- Fetch the high byte of the address
- Combine the address and fetch the immediate value byte
- Write the value byte to the address
- Delay one cycle so the write commits
Name: Set A from B
Opcode:0x90
Cycles: 1
Copies B into A.
- Set A to the value of B.
Name: Set A from C
Opcode:0x91
Cycles: 1
Copies C into A.
- Set A to the value of C.
Name: Set A from S
Opcode:0x92
Cycles: 1
Copies the status register S into A.
- Set A to the value of S.
Name: Set B from A
Opcode:0x93
Cycles: 1
Copies A into B.
- Set B to the value of A.
Name: Set B from C
Opcode:0x94
Cycles: 1
Copies C into B.
- Set B to the value of C.
Name: Set C from A
Opcode:0x95
Cycles: 1
Copies A into C.
- Set C to the value of A.
Name: Set C from B
Opcode:0x96
Cycles: 1
Copies B into C.
- Set C to the value of B.
Name: Set D from C
Opcode:0x97
Cycles: 1
Copies C into D.
- Set D to the value of C.
Name: Set A from D
Opcode:0x98
Cycles: 1
Copies D into A.
- Set A to the value of D.
Name: Set B from D
Opcode:0x99
Cycles: 1
Copies D into B.
- Set B to the value of D.
Name: Set C from D
Opcode:0x9A
Cycles: 1
Copies D into C.
- Set C to the value of D.
Name: Increment A
Opcode:0xA0
Cycles: 1
Increments A by 1, wrapping at 0xFFFF.
- Increment A.
Name: Increment B
Opcode:0xA1
Cycles: 1
Increments B by 1, wrapping at 0xFFFF.
- Increment B.
Name: Increment C
Opcode:0xA2
Cycles: 1
Increments C by 1, wrapping at 0xFFFF.
- Increment C.
Name: Decrement A
Opcode:0xA3
Cycles: 1
Decrements A by 1, wrapping at 0xFFFF.
- Decrement A.
Name: Decrement B
Opcode:0xA4
Cycles: 1
Decrements B by 1, wrapping at 0xFFFF.
- Decrement B.
Name: Decrement C
Opcode:0xA5
Cycles: 1
Decrements C by 1, wrapping at 0xFFFF.
- Decrement C.
Name: Increment Stack-Relative
Opcode:0xA6
Cycles: 7
Increments the 2 byte value at (STACK_START_ADDR + T + imm16) by 1.
- Fetch the low byte of the offset immediate
- Fetch the high byte of the offset immediate
- Compute the stack-relative address and read the low byte of the value there
- Store the low byte in A and read the high byte of the value
- Combine and increment the value, then write the low byte back
- Write the high byte back
- Delay one cycle so the write commits
Name: Increment Stack-Relative Byte
Opcode:0xA7
Cycles: 5
Increments the 1 byte value at (STACK_START_ADDR + T + imm16) by 1.
- Fetch the low byte of the offset immediate
- Fetch the high byte of the offset immediate
- Compute the stack-relative address and read the value byte there
- Increment the value and write it back
- Delay one cycle so the write commits
Name: Increment Immediate-Address
Opcode:0xA8
Cycles: 7
Increments the 2 byte value at an immediate absolute address by 1.
- Fetch the low byte of the address
- Fetch the high byte of the address
- Combine the address and read the low byte of the value there
- Store the low byte in A and read the high byte of the value
- Combine and increment the value, then write the low byte back
- Write the high byte back
- Delay one cycle so the write commits
Name: Increment Immediate-Address Byte
Opcode:0xA9
Cycles: 5
Increments the 1 byte value at an immediate absolute address by 1.
- Fetch the low byte of the address
- Fetch the high byte of the address
- Combine the address and read the value byte there
- Increment the value and write it back
- Delay one cycle so the write commits
Name: Decrement Stack-Relative
Opcode:0xAA
Cycles: 7
Decrements the 2 byte value at (STACK_START_ADDR + T + imm16) by 1.
- Fetch the low byte of the offset immediate
- Fetch the high byte of the offset immediate
- Compute the stack-relative address and read the low byte of the value there
- Store the low byte in A and read the high byte of the value
- Combine and decrement the value, then write the low byte back
- Write the high byte back
- Delay one cycle so the write commits
Name: Decrement Stack-Relative Byte
Opcode:0xAB
Cycles: 5
Decrements the 1 byte value at (STACK_START_ADDR + T + imm16) by 1.
- Fetch the low byte of the offset immediate
- Fetch the high byte of the offset immediate
- Compute the stack-relative address and read the value byte there
- Decrement the value and write it back
- Delay one cycle so the write commits
Name: Decrement Immediate-Address
Opcode:0xAC
Cycles: 7
Decrements the 2 byte value at an immediate absolute address by 1.
- Fetch the low byte of the address
- Fetch the high byte of the address
- Combine the address and read the low byte of the value there
- Store the low byte in A and read the high byte of the value
- Combine and decrement the value, then write the low byte back
- Write the high byte back
- Delay one cycle so the write commits
Name: Decrement Immediate-Address Byte
Opcode:0xAD
Cycles: 5
Decrements the 1 byte value at an immediate absolute address by 1.
- Fetch the low byte of the address
- Fetch the high byte of the address
- Combine the address and read the value byte there
- Decrement the value and write it back
- Delay one cycle so the write commits
Name: Bitwise AND
Opcode:0xB0
Cycles: 1
C = A & B.
- Set C to A bitwise AND B
Name: Bitwise OR
Opcode:0xB1
Cycles: 1
C = A | B.
- Set C to A bitwise OR B
Name: Bitwise XOR
Opcode:0xB2
Cycles: 1
C = A ^ B.
- Set C to A bitwise XOR B
Name: Bitwise NOT
Opcode:0xB3
Cycles: 1
C = ~A. B is not used.
- Set C to the bitwise complement of A
Name: Addition
Opcode:0xB4
Cycles: 1
C = A + B. Sets the carry status bit if the result overflowed 2 bytes.
- Add A and B into C, updating the carry flag
Name: Subtraction
Opcode:0xB5
Cycles: 1
C = A - B, computed via two's complement. Sets the carry status bit if the result overflowed.
- Subtract B from A into C, updating the carry flag
Name: Multiplication
Opcode:0xB6
Cycles: 1
C = (A * B), truncated to 2 bytes. There is no wide/high-half result.
- Multiply A by B, truncate to 2 bytes, and store the result in C
Name: Right Shift
Opcode:0xB7
Cycles: 1
C = A >> B.
- Shift A right by B bits and store the result in C
Name: Left Shift
Opcode:0xB8
Cycles: 1
C = A << B, truncated to 2 bytes.
- Shift A left by B bits and store the result in C
Name: Logical AND
Opcode:0xB9
Cycles: 1
C = 1 if both A and B are nonzero, else 0.
- Set C to the logical AND of A and B
Name: Modulo
Opcode:0xBA
Cycles: 1
C = A % B.
- Set C to A modulo B
Name: Integer Division
Opcode:0xBB
Cycles: 1
C = A // B.
- Set C to A divided by B, rounded down
Name: Negate
Opcode:0xBC
Cycles: 1
C = -A, two's complement. B is not used.
- Set C to the two's complement negation of A
Name: Equals
Opcode:0xC0
Cycles: 1
C = 1 if A == B, else 0.
- Compare A and B for equality and store the result in C
Name: Unsigned Greater Than or Equal
Opcode:0xC1
Cycles: 1
C = 1 if A >= B (unsigned), else 0.
- Compare A and B as unsigned values and store the result in C
Name: Unsigned Less Than or Equal
Opcode:0xC2
Cycles: 1
C = 1 if A <= B (unsigned), else 0.
- Compare A and B as unsigned values and store the result in C
Name: Unsigned Greater Than
Opcode:0xC3
Cycles: 1
C = 1 if A > B (unsigned), else 0.
- Compare A and B as unsigned values and store the result in C
Name: Unsigned Less Than
Opcode:0xC4
Cycles: 1
C = 1 if A < B (unsigned), else 0.
- Compare A and B as unsigned values and store the result in C
Name: Signed Greater Than or Equal
Opcode:0xC5
Cycles: 1
C = 1 if A >= B, comparing both as two's complement signed values, else 0.
- Compare A and B as signed values and store the result in C
Name: Signed Less Than or Equal
Opcode:0xC6
Cycles: 1
C = 1 if A <= B, comparing both as two's complement signed values, else 0.
- Compare A and B as signed values and store the result in C
Name: Signed Greater Than
Opcode:0xC7
Cycles: 1
C = 1 if A > B, comparing both as two's complement signed values, else 0.
- Compare A and B as signed values and store the result in C
Name: Signed Less Than
Opcode:0xC8
Cycles: 1
C = 1 if A < B, comparing both as two's complement signed values, else 0.
- Compare A and B as signed values and store the result in C
Name: Not Equal
Opcode:0xC9
Cycles: 1
C = 1 if A != B, else 0.
- Compare A and B for inequality and store the result in C
Name: Jump
Opcode:0xD0
Cycles: 1
Jumps to the address in C.
- Set P to C minus 1, so the next fetch lands on C
Name: Jump if A
Opcode:0xD1
Cycles: 1
Jumps to the address in C if A is nonzero.
- Jump to C if A is nonzero
Name: Jump if B
Opcode:0xD2
Cycles: 1
Jumps to the address in C if B is nonzero.
- Jump to C if B is nonzero
Name: Jump if C
Opcode:0xD3
Cycles: 1
Jumps to the address in C if C is nonzero.
- Jump to C if C is nonzero
Name: Jump if not A
Opcode:0xD4
Cycles: 1
Jumps to the address in C if A is zero.
- Jump to C if A is zero
Name: Jump if not B
Opcode:0xD5
Cycles: 1
Jumps to the address in C if B is zero.
- Jump to C if B is zero
Name: Jump if not C
Opcode:0xD6
Cycles: 1
Jumps to the address in C if C is zero.
- Jump to C if C is zero
Name: Jump if Carry
Opcode:0xD7
Cycles: 1
Jumps to the address in C if the carry status bit is set.
- Jump to C if the carry flag is set
Name: Jump Immediate
Opcode:0xD8
Cycles: 3
Jumps to an immediate address. The address is staged in the internal scratch byte, not a general register, so it never disturbs A/B/C.
- Fetch the low byte of the target address
- Fetch the high byte of the target address
- Set P to the target address minus 1
Name: Jump Immediate if A
Opcode:0xD9
Cycles: 3
Jumps to an immediate address if A is nonzero.
- Fetch the low byte of the target address
- Fetch the high byte of the target address
- If A is nonzero, set P to the target address minus 1
Name: Jump Immediate if B
Opcode:0xDA
Cycles: 3
Jumps to an immediate address if B is nonzero.
- Fetch the low byte of the target address
- Fetch the high byte of the target address
- If B is nonzero, set P to the target address minus 1
Name: Jump Immediate if C
Opcode:0xDB
Cycles: 3
Jumps to an immediate address if C is nonzero.
- Fetch the low byte of the target address
- Fetch the high byte of the target address
- If C is nonzero, set P to the target address minus 1
Name: Jump Immediate if not A
Opcode:0xDC
Cycles: 3
Jumps to an immediate address if A is zero.
- Fetch the low byte of the target address
- Fetch the high byte of the target address
- If A is zero, set P to the target address minus 1
Name: Jump Immediate if not B
Opcode:0xDD
Cycles: 3
Jumps to an immediate address if B is zero.
- Fetch the low byte of the target address
- Fetch the high byte of the target address
- If B is zero, set P to the target address minus 1
Name: Jump Immediate if not C
Opcode:0xDE
Cycles: 3
Jumps to an immediate address if C is zero.
- Fetch the low byte of the target address
- Fetch the high byte of the target address
- If C is zero, set P to the target address minus 1
Name: Jump to Subroutine
Opcode:0xE2
Cycles: 3
Pushes the return address and jumps to the address in C.
- Push the low byte of the return address P onto the stack, checking for overflow
- Push the high byte of the return address, checking for overflow
- Jump to C
Name: Jump to Subroutine if A
Opcode:0xE3
Cycles: 3
Pushes the return address and jumps to the address in C, only if A is nonzero.
- If A is nonzero, push the low byte of the return address, checking for overflow
- If A is nonzero, push the high byte of the return address, checking for overflow
- If A is nonzero, jump to C
Name: Jump to Subroutine if B
Opcode:0xE4
Cycles: 3
Pushes the return address and jumps to the address in C, only if B is nonzero.
- If B is nonzero, push the low byte of the return address, checking for overflow
- If B is nonzero, push the high byte of the return address, checking for overflow
- If B is nonzero, jump to C
Name: Jump to Subroutine if C
Opcode:0xE5
Cycles: 3
Pushes the return address and jumps to the address in C, only if C is nonzero.
- If C is nonzero, push the low byte of the return address, checking for overflow
- If C is nonzero, push the high byte of the return address, checking for overflow
- If C is nonzero, jump to C
Name: Jump to Subroutine, Immediate
Opcode:0xE6
Cycles: 5
Pushes the return address and jumps to an immediate address.
- Fetch the low byte of the target address
- Fetch the high byte of the target address
- Combine the address and push the low byte of the return address, checking for overflow
- Push the high byte of the return address, checking for overflow
- Jump to the target address
Name: Return from Subroutine
Opcode:0xE7
Cycles: 3
Pops the return address pushed by a subroutine call and resumes there.
- Check for underflow, pop the low byte of the return address
- Check for underflow, pop the high byte of the return address
- Combine both bytes and set P to the return address
Name: Return from Interrupt
Opcode:0xE8
Cycles: 1
Restores P, A, B, C, D, S, and T from the pending interrupt frame and resumes execution there. See SVI/LDI for how that frame can be swapped before this runs.
- Restore the saved frame and resume execution
Name: Push Immediate
Opcode:0xE9
Cycles: 5
Pushes a 2 byte immediate value directly onto the stack without touching any register. One cycle cheaper than the equivalent LIx ; PSHx pair, since the second byte's fetch overlaps the first byte's stack write.
- Fetch the low byte of the immediate value
- Fetch the high byte of the immediate value
- Push the low byte, checking for overflow, and stash the high byte
- Push the high byte, checking for overflow
- Delay one cycle so the write commits
Name: Push Immediate Byte
Opcode:0xEA
Cycles: 3
Pushes a 1 byte immediate value directly onto the stack. One byte in ROM, not two.
- Fetch the immediate byte
- Push the byte, checking for overflow
- Delay one cycle so the write commits
Name: Bulk Reserve
Opcode:0xEE
Cycles: 3
T += imm16, without touching memory. Bulk equivalent of imm16/2 PSHes.
- Fetch the low byte of the count
- Fetch the high byte of the count
- Check for overflow and add the count to T
Name: Bulk Release
Opcode:0xEF
Cycles: 3
T -= imm16, without touching memory. Bulk equivalent of imm16/2 PULs.
- Fetch the low byte of the count
- Fetch the high byte of the count
- Check for underflow and subtract the count from T
Name: Push A
Opcode:0xF0
Cycles: 3
Pushes A onto the stack.
- Push the low byte of A, checking for overflow
- Push the high byte of A, checking for overflow
- Delay one cycle so the write commits
Name: Push B
Opcode:0xF1
Cycles: 3
Pushes B onto the stack.
- Push the low byte of B, checking for overflow
- Push the high byte of B, checking for overflow
- Delay one cycle so the write commits
Name: Push C
Opcode:0xF2
Cycles: 3
Pushes C onto the stack.
- Push the low byte of C, checking for overflow
- Push the high byte of C, checking for overflow
- Delay one cycle so the write commits
Name: Push D
Opcode:0xF3
Cycles: 3
Pushes D onto the stack.
- Push the low byte of D, checking for overflow
- Push the high byte of D, checking for overflow
- Delay one cycle so the write commits
Name: Pull into A
Opcode:0xF4
Cycles: 3
Pops the top of the stack (2 bytes) into A.
- Check for underflow, pop the low byte
- Check for underflow, pop the high byte
- Combine both bytes and store the result in A
Name: Pull into B
Opcode:0xF5
Cycles: 3
Pops the top of the stack (2 bytes) into B.
- Check for underflow, pop the low byte
- Check for underflow, pop the high byte
- Combine both bytes and store the result in B
Name: Pull into C
Opcode:0xF6
Cycles: 3
Pops the top of the stack (2 bytes) into C.
- Check for underflow, pop the low byte
- Check for underflow, pop the high byte
- Combine both bytes and store the result in C
Name: Pull into D
Opcode:0xF7
Cycles: 3
Pops the top of the stack (2 bytes) into D.
- Check for underflow, pop the low byte
- Check for underflow, pop the high byte
- Combine both bytes and store the result in D
Name: Push Byte of A
Opcode:0xF8
Cycles: 2
Pushes the low byte of A onto the stack.
- Push the low byte of A, checking for overflow
- Delay one cycle so the write commits
Name: Push Byte of B
Opcode:0xF9
Cycles: 2
Pushes the low byte of B onto the stack.
- Push the low byte of B, checking for overflow
- Delay one cycle so the write commits
Name: Push Byte of C
Opcode:0xFA
Cycles: 2
Pushes the low byte of C onto the stack.
- Push the low byte of C, checking for overflow
- Delay one cycle so the write commits
Name: Push Byte of D
Opcode:0xFB
Cycles: 2
Pushes the low byte of D onto the stack.
- Push the low byte of D, checking for overflow
- Delay one cycle so the write commits
Name: Pull Byte into A
Opcode:0xFC
Cycles: 2
Pops the top of the stack (1 byte) into A, zero extended.
- Check for underflow, pop the byte
- Zero-extend the byte and store the result in A
Name: Pull Byte into B
Opcode:0xFD
Cycles: 2
Pops the top of the stack (1 byte) into B, zero extended.
- Check for underflow, pop the byte
- Zero-extend the byte and store the result in B
Name: Pull Byte into C
Opcode:0xFE
Cycles: 2
Pops the top of the stack (1 byte) into C, zero extended.
- Check for underflow, pop the byte
- Zero-extend the byte and store the result in C
Name: Pull Byte into D
Opcode:0xFF
Cycles: 2
Pops the top of the stack (1 byte) into D, zero extended.
- Check for underflow, pop the byte
- Zero-extend the byte and store the result in D
Name: Save Interrupt Frame
Opcode:0xE0
Cycles: 14
Writes the pending interrupt-return frame (P, A, B, C, D, S, T - what a plain RTI would restore) to memory starting at the address in C, 1 byte per cycle. This is the primitive a preemptive scheduler needs: on interrupt entry A/B/C/D/T are already live with the interrupted process's values, so only P needs saving out of a register.
- Write the low byte of P to [C+0]
- Write the high byte of P to [C+1]
- Write the low byte of A to [C+2]
- Write the high byte of A to [C+3]
- Write the low byte of B to [C+4]
- Write the high byte of B to [C+5]
- Write the low byte of C to [C+6]
- Write the high byte of C to [C+7]
- Write the low byte of D to [C+8]
- Write the high byte of D to [C+9]
- Write S to [C+10]
- Write the low byte of T to [C+11]
- Write the high byte of T to [C+12]
- Delay one cycle so the last write commits
Name: Load Interrupt Frame
Opcode:0xE1
Cycles: 14
Reads a frame previously written by SVI back from memory at the address in C, replacing the pending interrupt frame, so the RTI that follows resumes into whatever was saved there instead of the process that was actually interrupted.
- Reset the frame buffer and read the low byte of P from [C+0]
- Store the low byte of P and read the high byte of P from [C+1]
- Store the high byte of P and read the low byte of A from [C+2]
- Store the low byte of A and read the high byte of A from [C+3]
- Store the high byte of A and read the low byte of B from [C+4]
- Store the low byte of B and read the high byte of B from [C+5]
- Store the high byte of B and read the low byte of C from [C+6]
- Store the low byte of C and read the high byte of C from [C+7]
- Store the high byte of C and read the low byte of D from [C+8]
- Store the low byte of D and read the high byte of D from [C+9]
- Store the high byte of D and read S from [C+10]
- Store S and read the low byte of T from [C+11]
- Store the low byte of T and read the high byte of T from [C+12]
- Store the high byte of T and replace the pending interrupt frame with the collected bytes
Name: Software Interrupt
Opcode:0xEB
Cycles: 2
Raises IRQ immediately, exactly as if a peripheral had called bus.irq() this cycle - same deferral rules apply (blocked by CLI, STATUS_IN_IRQ, or STATUS_IN_NMI). Lets software voluntarily trigger an IRQ handler instead of only reacting to real hardware timing.
- Fetch the immediate IRQ id
- Raise that IRQ
Name: Halt
Opcode:0x80
Cycles: 1
Stops processing.
- Set the halt status bit
Name: Disable Interrupts
Opcode:0x81
Cycles: 1
Sets the CLI status bit, blocking IRQs and NMIs.
- Set the CLI status bit
Name: Enable Interrupts
Opcode:0x82
Cycles: 1
Clears the CLI status bit, allowing IRQs and NMIs.
- Clear the CLI status bit