← Back to BLACKWIRE EMBER BUREAU TECH INFRA Code snippet showing memory addresses for Rainbows devices on a terminal screen

The Rainbows specification lists fixed addresses for console, arithmetic, disk and screen devices.

RAINBOWS SPECIFICATION BRINGS IO TO OK VIRTUAL MACHINE

*Rainbows defines a standard set of memory‑mapped devices for the ok VM, turning a bare stack evaluator into a usable fantasy computer. The spec lists console, arithmetic, disk and screen interfaces, each with fixed address maps.*

By EMBER Bureau - BLACKWIRE  |  October 25, 2026, 06:00 CET  |  Rainbows, ok virtual machine, memory mapping, RbConsole, RbArith

On 2026-10-06 a developer released Rainbows, a specification that layers standard I/O and arithmetic devices onto the minimalist ok virtual machine. The ok VM only supplies instruction evaluation and two stacks, leaving all peripheral interaction to user‑defined memory‑mapping functions. Rainbows fills that gap by assigning "magic" memory addresses that trigger console I/O, argument parsing, extended math, disk access and screen output. By doing so, it transforms ok from a barebones evaluator into a functional fantasy computer, ready for hobbyist OS experiments and educational demos.

What devices does Rainbows currently implement?

Rainbows currently implements four devices: RbConsole for POSIX‑style CLI interaction, RbArith for extended arithmetic, RbDisk for persistent storage, and RbScreen for framebuffer output. Each device occupies a fixed range of memory addresses that the ok VM reads and writes through user‑defined ok_mem_read and ok_mem_write callbacks. The spec notes that the list may expand as development continues, and the author promises updates when definitions change.

How does RbConsole map command line arguments?

RbConsole assigns six addresses. Address 000000 reads from standard input; 000001 writes to standard output. Address 000002 holds the argument count, mirroring the C argc variable. To fetch a specific argument, a program writes the zero‑based argument index to address 000003, then writes a character offset to address 000004. Reading from address 000005 returns the character at that offset, or zero if the offset exceeds the argument length. This design avoids arbitrary memory writes and eliminates the need for fixed‑size buffers.

Rainbows turns a stack‑only VM into a usable computer by defining a fixed set of memory‑mapped devices.

What arithmetic capabilities does RbArith add?

RbArith occupies addresses 000006 onward. Writing a magic opcode to address 000006 triggers an operation on operands stored at 000009 (x) and 00000d (y). Supported opcodes are 0 (no‑op), 1 (multiply), 2 (divide, setting error flag at 000007 to 1 on division by zero), and 3 (modulo, setting error flag to 2 on zero divisor). The width register at 000008 determines operand size: a value of 0 treats values as 1‑byte, 1 as 2‑byte, 2 as 3‑byte, and 3 as 4‑byte unsigned integers. Results are written to address 000011.

Why is Rainbows still a work in progress?

The author warns that memory layouts may shift as new devices are added or existing ones refined. The spec currently lists RbDisk with a brief mention of a custom library and a reference to a separate "Playing with Blocks" article, but the memory map for that device is incomplete. RbScreen is also listed as planned. Ongoing development means developers must track updates to avoid mismatched address expectations.

Frequently asked questions

What addresses does RbConsole use for stdin and stdout?

RbConsole maps address 000000 to stdin (read) and address 000001 to stdout (write).

Which opcodes does RbArith support?

RbArith supports opcode 0 (no‑op), 1 (multiply), 2 (divide with error flag on zero divisor), and 3 (modulo with error flag on zero divisor).

When was the Rainbows specification written?

The specification was written on 2026-10-06.

The Rainbows spec demonstrates how a lean virtual machine can gain practical capabilities without bloating its core. Its transparent address map lets developers reason about I/O in a deterministic way, while the open‑ended design invites extensions. As the author updates device definitions, the community will watch to see whether Rainbows becomes a de‑facto standard for ok‑based projects or remains a niche experiment.

Sources: Hacker News – In Rainbows (https://hitogata.neocities.org/Rainbows)