Added xyw.
h3rald h3rald@h3rald.com
Mon, 27 Jul 2026 15:24:41 +0200
2 files changed,
44 insertions(+),
1 deletions(-)
A
contents/xyw.md
@@ -0,0 +1,43 @@
+----- +code: xyw +sourcehut: xyw +home: /xyw/ +site: "https://xyw.2c.fyi" +title: "hex" +subtitle: "A minimal virtual machine and assembler targeting terminals, inspired by Uxn." +summary: "xyw is a simple and minimal virtual machine and assembler inspured by Uxn, that aims at providing a low-level, future-proof way to create terminal applications." +content-type: project +active: true +version: 280-D +conver: true +changelog: true +stage: prototype +license: MIT +----- + +xyw is a specification for a minimalist virtual machine programmable via a concatenative, assembly-like language. It is implemented primarily as a [stack machine](https://en.wikipedia.org/wiki/Stack_machine), but it also provides four "registers" that can be used by most instructions by specifying dedicated modes, to reduce the need of stack juggling operations common to languages like Forth. + +### Rationale + +xyw is heavily inspired by [Uxn](https://100r.co/site/uxn.html) and its fork [Bedrock](https://benbridle.com/projects/bedrock Bedrock), but aims at being even simpler and easier to learn. In particular, it differs from Uxn because: + +- its syntax is more minimalist: no runes or sigils except for . for directives, $ for hex numbers and % for binary numbers (all these are inspired by 6502 assembly syntax). +- it includes specific modes to operate on registers. +- it exposes more basic and simpler devices by default. +- it only exposes a single stack to the user (corresponding to Uxn's working stack). +- it has a concept of relocatable zero page (direct page), partly borrowed from 6809 assembly. +- it maps devices to addressable memory. + +In a nutshell, if Uxn can be used to create small multimedia programs that could be running on low-end laptops and small gaming handhelds, xyw can create programs that could hypothetically run on the equivalent of a 1980s [pocket computer](https://en.wikipedia.org/wiki/Pocket_computer) or early terminal. + +### Key Features + +- up to 64KiB of addressable memory. +- two stacks, one used internally by the system to manage subroutines, and one accessible to the user. +- 32 instructions, each with up to three different modes to operate on registers and on 16bit values. +- Two 8bit registers called x and y, and two 16bit registers accessible via the w mode. +- Up to a maximum of 16 memory-mapped devices, each with up to 16 reserved bytes (like Uxn). +- Event-based operation, similar to Uxn. +- Direct page accessible via a single byte, set by default to the device page, that can be moved to different locations in memory. +- A few assembly-inspired directives, which are also used to implement labels. +- Support for integers expressed in hexadecimal or binary notation.