A CHIP-8 emulator written in Rust in ~1000 lines.
If you're interested in writing video game console emulators have a look at the article below. I explain how emulators work and how to approach writing them:
How To Write A Game Console Emulator (NOTE: This is a copy on Medium. The original used to be hosted on the project's website, which has been inactive for a while so I let the domain expire).
| File | Description |
|---|---|
src/chip8.rs |
Emulator interface |
src/chip8/clk.rs |
Clock |
src/chip8/cpu.rs |
CPU |
src/chip8/dsp.rs |
Display |
src/chip8/kbd.rs |
Keyboard |
src/chip8/mem.rs |
Memory |
src/chip8/op.rs |
Instruction decoding |
src/chip8/rng.rs |
Random number generator |
src/chip8/set.rs |
Settings |
src/main.rs |
Program entry point |
src/platform.rs |
Platform layer |
The emulator is not a complete end-user application. ROM path and emulator configuration has to be changed inside the source code in:
| File | Settings |
|---|---|
src/main.rs |
ROM path |
src/platform.rs |
Keymap |
src/chip8/set.rs |
Emulator settings (preferences and ROM compatibility) |
See the ROM compatibility list below for settings for particular ROMs.
Tested briefly:
| ROM | Notes |
|---|---|
| 15PUZZLE | 100% working |
| BLINKY | 100% working; needs shift quirk on |
| BLITZ | 100% working; needs vertical wrap off |
| BRIX | 100% working |
| CONNECT4 | 100% working |
| GUESS | 100% working |
| HIDDEN | 100% working |
| INVADERS | 100% working; needs shift quirk on |
| KALEID | 100% working |
| MAZE | 100% working |
| MERLIN | 100% working |
| MISSLE | 100% working |
| PONG | 100% working |
| PONG2 | 100% working |
| PUZZLE | 100% working |
| SYZYGY | 100% working |
| TANK | 100% working |
| TETRIS | 100% working |
| TICTAC | 100% working |
| UFO | 100% working |
| VBRIX | 100% working |
| VERS | 100% working |
| WIPEOFF | 100% working |
Things used to write this emulator: