permacomputing

Source repository for the main permacomputing wiki site
git clone http://git.permacomputing.net/repos/permacomputing.git # read-only access
Log | Files | Refs

Uxn.mdwn (2509B)


      1 # Uxn
      2 
      3 **Uxn** is a simple [[virtual machine]] geared towards graphical applications, with features reminiscent of classic home computers.
      4 
      5 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|salvage computing]].
      6 
      7 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):
      8 
      9     80 a b c M[PC+1] 08 a b?c             10 a b M[c8]      18 a b+c
     10     01 a b c+1       09 a b!c             11 a {M[c8]=b}    19 a b-c
     11     02 a b           0a a b>c             12 a b M[PC+c8]   1a a b*c
     12     03 a c           0b a b<c             13 a {M[PC+c8]=b} 1b a b/c
     13     04 a c b         0c a b {PC+=c}       14 a b M[c16]     1c a b&c
     14     05 b c a         0d a {(b8)PC+=c}     15 a {M[c16]=b}   1d a b|c
     15     06 a b c c       0e a b {rs.PC PC+=c} 16 a b D[c8]      1e a b^c
     16     07 a b c b       0f a b {rs.c}        17 a {D[c8]=b}    1f a b>>c8l<<c8h
     17     2x a16 b16+c16   4x a b c {rs.b+rs.c} 8x a b c b+c
     18 
     19 The implementation of the virtual machine is about [[100 lines of ANSI C|https://git.sr.ht/~rabbits/uxn11/tree/main/item/src/uxn11.c]]. A self-hosted assembler for the Uxntal assembly language is about [[400 lines of Uxntal|https://git.sr.ht/~rabbits/drifblim/tree/main/item/src/drifblim.tal]].
     20 
     21 Assembled Uxntal applications such as text editors, drawing programs and livecoding environments are typically about 10-15kb in size.
     22 
     23 ## Relevance to permacomputing
     24 
     25 * 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|dependency]] other than the VM itself.
     26 * The design characteristics call for small applications that use little computing power.
     27 
     28 The general issues with [[virtual machine]]s 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.
     29 
     30 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]].
     31 
     32 See also:
     33 
     34 * [Uxn at 100r.co](https://100r.co/site/uxn.html)
     35 * [Uxn at xxiivv.com](https://wiki.xxiivv.com/site/devlog.html)