INCLUDE "console.asm"
PUSH 0 ; initial accumulator value
PUSH 0 ; zero-page byte address
STORE32 ; mem[0..3] = 0
PUSH 0 ; loop counter i
loop:
DUP
PUSH 6
CMP_LT
JMP_Z done ; exit loop when i >= 6
DUP
PRINT ; print i
PUSH 0
LOAD32
DUP
PUSH 10
ADD
PUSH 0
STORE32 ; mem[0..3] += 10
POP
PUSH 1
ADD
JMP loop
done:
PUSH 0
LOAD32
PRINT ; print 60
HALT
A tiny computer
that fits in a browser.
0xvm is a stack computer small enough to read in an afternoon: 64 KiB of RAM, 64-bit cells, byte-encoded opcodes, and 256 host device ports. Write assembly or Lua-subset source, assemble it into a VMIM ROM, and run the same bytes in the CLI, SDL3, or here in the browser. The host below is live — load a ROM, type into the console, and watch the framebuffer move.
boot.rom · 320×240 · screen path
INCLUDE "all.asm"
EQU MSG_LEN 6
EQU VALUE 10
data:
STR "total=" ; data+0..data+5
DB 0 ; data+6: NUL terminator
ALIGN 8 ; pad byte at data+7
value: DQ VALUE ; data+8..data+15: 64-bit 10
PUSH data
PUSH MSG_LEN
PRINT_STR
PUSH 10
PRINT_CHAR
PUSH value
LOAD64
PRINT
HALT
const ENABLE = 1
if ENABLE == 1 then
local w, h = screen_size()
print(w)
print(h)
set_color(0xFFC040)
plot(1, 2)
draw()
clear()
print(read_key())
print(quit_requested())
print(now_ms() >= 0)
sleep(1)
print("DEVICE OK")
end
make all
./build/0xasm -f examples/counter.asm -o build/counter.rom
./build/0xrom -f build/counter.rom
./build/0xdis -f build/counter.rom
./build/0xvm -f build/counter.rom
./build/0xvm # built-in boot ROM, no -f needed
./build/0xdb -f examples/gcd.asm
python3 -m luac compile examples/typography.lua \
-o build/lua-typography.asm -m build/lua-typography.lumap
./build/0xasm -f build/lua-typography.asm -o build/lua-typography.rom
./build/0xvm-sdl -f build/lua-typography.rom
make wasm
python3 -m http.server 8000 --directory build
Assembly or Lua-subset source describes the program and its data.
examples/counter.asm
0xluac emits 0xasm; 0xasm writes byte opcodes and a VMIM header.
0xasm -f source.asm
A VMIM v2 image carries the payload mapped at 0x0100.
build/counter.rom
CLI, SDL3, or WASM copies the payload into RAM and starts at the entry.
0xvm -f build/counter.rom
DEI and DEO cross the thin host boundary to console, screen, controller, and timer.
DEO CONSOLE_PUTC