Uxn is a simple virtual machine geared towards graphical applications, with features reminiscent of classic home computers.

Unlike most "fantasy platforms", Uxn was designed with an implementation-first mindset with a focus on creating portable tools and games for pre-existing devices.

This stack-machine has 32 opcodes, and no registers. Given the stack a b c, the c item being the last to be added, and the first to be removed, a Program Counter(PC), a Memory(M), Devices(D) and a Return Stack(rs):

80 a b c M[PC+1] 08 a b?c             10 a b M[c8]      18 a b+c
01 a b c+1       09 a b!c             11 a {M[c8]=b}    19 a b-c
02 a b           0a a b>c             12 a b M[PC+c8]   1a a b*c
03 a c           0b a b<c             13 a {M[PC+c8]=b} 1b a b/c
04 a c b         0c a b {PC+=c}       14 a b M[c16]     1c a b&c
05 b c a         0d a {(b8)PC+=c}     15 a {M[c16]=b}   1d a b|c
06 a b c c       0e a b {rs.PC PC+=c} 16 a b D[c8]      1e a b^c
07 a b c b       0f a b {rs.c}        17 a {D[c8]=b}    1f a b>>c8l<<c8h
2x a16 b16+c16   4x a b c {rs.b+rs.c} 8x a b c b+c

The implementation of the virtual machine is about 100 lines of ANSI C. A self-hosted assembler for the Uxntal assembly language is about 400 lines of Uxntal.

Assembled Uxntal applications such as text editors, drawing programs and livecoding environments are typically about 10-15kb in size.

Relevance to permacomputing

  • Simplicity of implementation may make Uxn usable as a bedrock platform for the kind of programs that are small enough to run in it. Uxn applications are released as "roms" that have no dependencies other than the VM itself.
  • The design characteristics call for small applications that use little computing power.

The general issues with virtual machines apply: running a virtualized program takes much more processing power than an equivalent native program would. It is therefore advisable to use VMs only for computationally simple applications.

Parts of the project are geared toward the specification of a Universal Virtual Computer, such as the Uxn sign language and writing system. It is capable of hosting Collapse OS.

See also: