CHIP-8 Emulator
A cycle-accurate CHIP-8 virtual machine built in Rust and WebAssembly. Watch machine code execute in real-time while playing classic games from the 1970s.
How It Works
🔧 Fetch-Decode-Execute
Each cycle, the emulator fetches a 2-byte opcode from RAM, decodes it into an instruction, and executes the operation. The execution log shows this process in real-time.
🖥️ 64×32 Display
The CHIP-8 uses a 1-bit monochrome display. Sprites are drawn using XOR logic—if a pixel is already on, drawing over it turns it off and sets the collision flag (VF).
⌨️ Hex Keypad
The original CHIP-8 had a 16-key hexadecimal keypad (0-F). This emulator maps it to your keyboard: 1-4 / Q-R / A-F / Z-V rows.
📜 35 Instructions
CHIP-8 has only 35 opcodes covering jumps, conditionals, math, graphics, and input. The disassembler converts raw bytes into readable mnemonics like JMP 200 or LD V0, 42.
Technical Details
- 4KB RAM: Programs load at address 0x200, with fonts stored at 0x000-0x050.
- 16 Registers: V0-VE are general purpose, VF is the carry/collision flag.
- Stack: 16 levels deep for subroutine calls.
- Timers: Delay and sound timers count down at 60Hz.
- Rust + WebAssembly: The entire VM runs in compiled Rust for near-native performance in the browser.