GitHub - vladris/pixie: Minimal 16-bit toy VM and assembler

1 min read Original article ↗

Pixie is a 16-bit word-addressable register VM with 7 registers, 16 op codes, and 128 KB of memory, with port-mapped I/O.

Dust is an assembler for the VM.

A program which counts down from 10, outputs numbers, then terminates:

# Countdown from 10
    mov r0 10
REPEAT:
    out r0 0
    sub r0 1
    jnz r0 :REPEAT
# Pixie terminates when PC is at 0xFFFF
    jnz 1 0xFFFF  

Assemble:

dust.py countdown.dust countdown.pixie

Run:

Output:

For a more complex example, check out the Brainfuck interpreter here.

This project serves no practical purposes (see Turing tarpit) and was not thoroughly tested. For more details, check out the wiki.