The LEPUS-8 is an 8-bit microcomputer with strict domain-specific registers. Operations are routed depending on the mathematical domain:
A (Arithmetic Register): Used as the primary accumulator for ADD and SUB.B (Bitwise Register): Used as the primary accumulator for XOR, OR, and AND.C (Shift/Counter Register): Used as the primary accumulator for shifting (SHL, SHR, ASHR) and advanced incrementing.PC (Program Counter): Tracks the memory address of the next instruction.SP (Stack Pointer): Points to the top of the stack (grows upward from 0x58).OUT_REG: A dedicated latch register connected directly to the 7-segment display.ZF (Zero Flag): Set to 1 if the result of an ALU operation, bitwise operation, shift, increment, or decrement results in exactly 0.CF (Carry Flag): Set to 1 if an ADD operation overflows (> 255) or a SUB operation underflows (< 0).Memory is divided into fixed operational zones. Attempting to execute code outside the Program zone will halt the CPU.
| Range | Zone Name | Description |
|---|---|---|
| 0x00 - 0x57 | Program Memory | Executable code is loaded here. |
| 0x58 - 0x5F | Hardware Stack | Used by PUSH and POP (8 bytes deep). |
| 0x60 - 0x9F | Scratchpad | General purpose RAM for variables. |
| 0xA0 - 0xB7 | Video Base | General video config (unused in basic renderer). |
| 0xB8 - 0xFF | Screen Bitmap | Direct mapped to the 24x24 pixel grid. |
0x4F or 123.[0x60].*[0x60]. Works universally across most instructions!| Mnemonic | Syntax | Description |
|---|---|---|
| ILDA / ILDB / ILDC | ILDA val | Loads the literal val into register A, B, or C. |
| LDA / LDB / LDC | LDA [addr] LDA *[addr] | Loads the value stored at memory [addr] (or the pointer at *[addr]) into register A, B, or C. |
| WBA / WBB | WBA [addr] WBA *[addr] | Writes the contents of A or B into memory [addr]. If * is used, it treats the value at [addr] as a pointer to the final destination. |
| LOAD | LOAD [addr] val LOAD *[addr] val | Directly stores the literal val into memory [addr] (or pointer *[addr]). |
| SWPB / SWPC / SWPBC | SWPB | Swaps the contents of two registers: (A and B), (A and C), or (B and C). |
| Mnemonic | Syntax | Description |
|---|---|---|
| ADD | ADD src | Adds src (B, C, [addr], *[addr], or val) to A. Result stored in A. Updates CF and ZF. |
| SUB | SUB src | Subtracts src (B, C, [addr], *[addr], or val) from A. Result stored in A. Updates CF and ZF. |
| INC | INC reg INC C, src | Increments A, B, or C by 1. Alternatively, increments C by src (val, [addr], or *[addr]). Updates ZF. |
| DEC | DEC reg DEC C, src | Decrements A, B, or C by 1. Alternatively, decrements C by src (val, [addr], or *[addr]). Updates ZF. |
| Mnemonic | Syntax | Description |
|---|---|---|
| AND | AND src | Bitwise AND between B and src (A, C, [addr], *[addr], or val). Stored in B. Updates ZF. |
| OR | OR src | Bitwise OR between B and src (A, C, [addr], *[addr], or val). Stored in B. Updates ZF. |
| XOR | XOR src | Bitwise XOR between B and src (A, C, [addr], *[addr], or val). Stored in B. Updates ZF. |
| Mnemonic | Syntax | Description |
|---|---|---|
| SHL | SHL src | Logical Shift Left on C by src bits (val, [addr], or *[addr]). Updates ZF. |
| SHR | SHR src | Logical Shift Right on C. Zeros are shifted in from the left. Updates ZF. |
| ASHR | ASHR src | Arithmetic Shift Right on C. The sign bit (MSB) is preserved and shifted in. Updates ZF. |
| Mnemonic | Syntax | Description |
|---|---|---|
| JMP | JMP label | Unconditional jump. Moves the PC to label. |
| JZ | JZ label | Jump if Zero. Jumps if ZF is 1. |
| JNZ | JNZ label | Jump if Not Zero. Jumps if ZF is 0. |
| JC | JC label | Jump if Carry. Jumps if CF is 1. |
| JNC | JNC label | Jump if Not Carry. Jumps if CF is 0. |
| HLT | HLT | Halts the CPU. Code execution stops. |
| Mnemonic | Syntax | Description |
|---|---|---|
| PUSH | PUSH src | Pushes src (A, B, C, FLAG, [addr], *[addr], or val) to the stack (at SP), then increments SP. |
| POP | POP dest | Decrements SP, then pops the top of the stack into dest (A, B, C, [addr], or *[addr]). |
| OUT | OUT reg | Copies the value of A, B, or C directly to the OUT_REG, displaying it on the 7-segment hex display. |
| NOP | NOP | No Operation. Consumes a clock cycle and moves to the next instruction. |