LLC24 LiteScript Reference
LLC24 LiteScript is a custom assembly-style language designed for the LLC24 lighting controller module. This page covers the CPU/core architecture, registers, memory, instructions, operands, and full command set.
LiteScript Mission Solutions
Module Overview: LLC24
- Core: 8-bit virtual CPU, optimized for real-time control
- Instruction Format: Fixed 5-byte instructions (2-byte opcode + 3 operands)
- Memory Banks: Modular, addressed via prefix symbols (see below)
- I/O: Four input channels (
@IN0
—@IN3
), four output channels (@RED
/@GRN
/@BLU
/@WHT
)
- Scratch Memory: 24 bytes (
@M00
—@M23
)
- Stack: Dedicated, used only by PUSH/POP (not exposed in basic LiteScript)
- No built-in multitasking or interrupts (main loop is one tick per frame).
- Instruction Set: 5-byte wide, operand count & addressing fixed by op
Addressing & Memory Bank Symbols
Module Overview: LLC24
- Core: 8-bit virtual CPU, optimized for real-time control
- Instruction Format: Fixed 5-byte instructions (2-byte opcode + 3 operands)
- Memory Banks: Modular, addressed via prefix symbols (see below)
- I/O: Four input channels (
@IN0
—@IN3
), four output channels (@RED
/@GRN
/@BLU
/@WHT
) - Scratch Memory: 24 bytes (
@M00
—@M23
) - Stack: Dedicated, used only by PUSH/POP (not exposed in basic LiteScript)
- No built-in multitasking or interrupts (main loop is one tick per frame).
- Instruction Set: 5-byte wide, operand count & addressing fixed by op
Addressing & Memory Bank Symbols
Prefix | Bank Name | Description |
---|---|---|
# | Core | Executable code (self-modifiable) |
@ | MEM | General-purpose RAM (scratch and variables) |
$ | I/O | Device I/O registers (inputs and outputs) |
false | Immediate | No prefix: use for constants (numeric literals 0–255) |
* | Pointer | Single-level indirect addressing into RAM |
Example: MOV @IN2, @M01
moves real-time input 2 into scratch memory slot M01.
Registers / Standard Locations
- Inputs (read-only):
@IN0
,@IN1
,@IN2
,@IN3
- Outputs (read/write):
@RED
,@GRN
,@BLU
,@WHT
- Values: 0–255 (PWM intensity or digital high/low)
- Scratch Memory:
@M00
to@M23
(mutable, 24 bytes) - Pointer:
*M00
to*M23
(read/write)
Instruction Format
-
Syntax:
OPCODE operand1, operand2, ...
-
Operands: 0–3 depending on instruction.
Types: Constant (“immediate”), direct address (@
), pointer (*
). -
Each instruction is 5 bytes wide (fixed width): opcode (16 bits) + three 8-bit operands.
Unused operand slots are ignored by that instruction.
Ex:
ADD @IN0, 10, @M04
will add 10 to input 0 and store in scratch M04.Operands
Type | How to Write | Meaning |
---|---|---|
Immediate | 42 |
The literal value (0–255) |
Direct Address | @M01 , @RED |
Accesses the value in RAM, input, or output location |
Pointer | *M05 |
Uses the value of RAM at M05 as the address to access |
Commands / Instruction Reference
Instruction | Usage | Description |
---|---|---|
MOV | MOV a, b |
Copy value of a to b |
ADD | ADD a, b, c |
Add a + b , store result in c |
SUB | SUB a, b, c |
Subtract a - b , store result in c |
MUL | MUL a, b, c |
Multiply a * b , store result in c |
DIV | DIV a, b, c |
Divide a / b (if b != 0 ), store result in c |
MOD | MOD a, b, c |
a % b (modulo, if b != 0 ), result to c |
INC | INC dst, val |
Increment dst by val |
DEC | DEC dst, val |
Decrement dst by val |
AND | AND a, b, c |
Bitwise AND, c = a & b |
OR | OR a, b, c |
Bitwise OR, c = a | b |
XOR | XOR a, b, c |
Bitwise XOR, c = a ^ b |
NOT | NOT a, c |
Bitwise NOT,c = ~a |
CLR | CLR dst |
Set dst to 0 |
FLP | FLP a, b |
Swap (flip) contents of a and b |
JMP | JMP n |
Unconditional jump to line/address n |
JEQ | JEQ a, b, n |
Jump to n if a==b |
JNE | JNE a, b, n |
Jump to n if a!=b |
JGR | JGR a, b, n |
Jump to n if a > b |
Notes:
- All values are 8-bit (0–255). Exceeding 255 wraps around (0-255 overflow).
- Inputs
@IN0
–@IN3
are read-only. - Outputs
@RED
,@GRN
,@BLU
,@WHT
can be set arbitrarily at any tick. - Pointers allow indirect addressing for algorithms/data structures.
- Branches (
JMP
/JEQ
/JNE
/JGR
) use line numbers or memory addresses.
CPU & Execution Rules
- Each line is executed every simulation tick, from top down.
- All register and memory changes are visible immediately to subsequent lines, per tick.
- If an invalid instruction or bad operand is encountered, it is skipped.
- Inputs update once per tick only.
- Program always runs to bottom then loops (unless JMP jumps to zero or elsewhere).
Examples
Example 1: Mirror IN0 to RED
MOV @IN0, @RED
Example 2: Light blue if IN3 is greater than 100
JGR @IN3, 100, 03 CLR @BLU JMP 04 MOV 255, @BLU
Example 3: Toggle white light on rising edge of IN1
SUB @IN1, @M00, @M01 JGR @M01, 0, 05 JMP 07 MOV 255, @WHT MOV @IN1, @M00
Special: Memory & Pointers
- You can use the
*
operator for single-level pointer indirection into scratch memory.- Example:
MOV 123, @M05
thenMOV *M05, @RED
reads from@M123
and sets to@RED
.
- Example:
- Pointer operands accepted in
MOV
,FLP
, and select others. - Arithmetic/logical ops (ADD/SUB/AND/OR/XOR/...) only work with constants and direct addresses.
Error/Notes
- Out-of-range addresses wrap (modulo 256). Using a pointer to
@M99
targets address 99. - Division or modulo by zero yields 0.
- Invalid or unknown commands/skipped lines do not halt the simulation.
Reserved Words & Registers
- Inputs:
@IN0
,@IN1
,@IN2
,@IN3
- Outputs:
@RED
,@GRN
,@BLU
,@WHT
- Scratch:
@M00
–@M23
- Pointers:
*M00
–*M23
- Constants: 0–255
- Line/Jump Targets: Line numbers or addresses
- Bank Prefixes:
(none),
@
,*
,#
Resources
More official docs and community solutions:
nightbyte.net/llc24
LiteScript and LLC24 are products of Nightbyte Lighting. © Nightbyte, all rights reserved.