A CPU, built from first principles

A custom 16-bit RISC ISA, an assembler and cycle-accurate emulator written in Rust, compiled to WebAssembly, and wired to an animated datapath diagram.

Running purely in the browser. Zero dependencies.

Scroll

Under the hood

Every layer built from scratch

Rust emulator core

Backend Layer

Custom ISA, two-pass assembler, ALU, memory subsystem, and cycle-accurate fetch-decode-execute, all unit-tested natively then compiled to WASM.

Rustwasm-packwasm-bindgen

WASM bindings

Bridge Layer

A thin JS boundary exposes Rust-defined functions. Each step returns a structured delta.

wasm-bindgenTypeScriptJSON delta

Animated datapath

Frontend Layer

SVG datapath with wire animations driven by the step delta. CodeMirror editor with a custom assembly syntax highlighter.

Next.jsSVGCodeMirror 6Tailwind

Instruction Set

12 instructions. Turing complete.

Architecture: 16-bit word size
OpcodeMnemonicSyntaxSemantics
0000ADDADDRDRS1RS2RD ← RS1 + RS2; set Z
0001SUBSUBRDRS1RS2RD ← RS1 − RS2; set Z
0010ANDANDRDRS1RS2RD ← RS1 & RS2; set Z
0011ORORRDRS1RS2RD ← RS1 | RS2; set Z
0100NOTNOTRDRS1RD ← ~RS1; set Z
0101LOADILOADIRDIMM6RD ← sign-extend(IMM6); set Z
0110LOADLOADRDRS1RD ← MEM[RS1]
0111STORESTORERS1RS2MEM[RS2] ← RS1
1000JMPJMPADDR9PC ← ADDR9
1001JMPZJMPZADDR9PC ← ADDR9 if Z
1010ADDIADDIRDRS1IMM6RD ← RS1 + sign-extend(IMM6)
1111HALTHALTStop execution

Ready to step through code?

Write assembly, compile it on the fly, and watch the electrical signals flow through the datapath on every clock cycle.

Launch Emulator