Riadh Chelbi
← All work

lazychip

Role —
Author
Date —
June 6, 2026
Stack —
Zig, Emulation

lazychip implements the core CHIP-8 virtual machine as a reusable Zig library. The Engine struct manages the full interpreter state: 4KB RAM, 16 general-purpose registers, an index register, a program counter, a 64x32 pixel display, a 16-key input state, delay/sound timers, and a 16-level call stack.

The opcode parser handles the complete CHIP-8 instruction set — control flow, ALU operations, drawing, input handling, timers, and BCD encoding.

Architecture

  • Engine.zig — core VM with state, tick loop, fetch/decode/execute
  • opcode.zig — opcode type definitions and parser
  • Stack.zig — fixed-size 16-entry call stack
  • Designed as a library (lazychiplib) — import into your own frontend

Status

The engine covers the full standard instruction set. A frontend (display rendering, audio, input handling) is not yet included — the focus was on getting the VM right first.