The Uxn virtual stack machine

Updated on .

Uxn is a stack machine, where computation happens using data stored in a stack, instead of the typical register files that modern CPUs use. It prioritizes small programs over convenience, using an 8-bit instruction set with only 32 different instructions. The rest of the bits for each instruction change its “mode”, targeting an alternative “return” stack, “keeping” the operands instead of consuming them, or targeting two bytes instead of one. Using two bytes for addressing allows Uxn to address 64 kibibytes of data, which is also the maximum size for a program. Single-byte addressing can accommodate a zero page that provides faster access to up to 256 bytes of data.

The assembler for uxntal, the text-based language that represents Uxn bytecode, is full-featured, with special support for precisely laying out data structures.