A CHIP-8 emulator written in Rust with multiple frontends: desktop application using SDL2 and web version with WebAssembly for browser-based gameplay.
- Full CHIP-8 instruction set implementation
- Desktop frontend with SDL2
- Web frontend with WebAssembly (coming soon)
- Keyboard input support
- Play classic CHIP-8 games
- Rust (latest stable version)
- SDL2 library
- wasm-pack (for web version)
macOS:
brew install sdl2Linux (Ubuntu/Debian):
sudo apt-get install libsdl2-devWindows: Follow the SDL2 installation guide
curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh# Clone the repository
git clone https://github.com/yourusername/chip8_rust.git
cd chip8_rust/desktop
# Run with a ROM file
cargo run --release path/to/rom# Build the WebAssembly package
cd chip8_rust/wasm
wasm-pack build --target web
# Copy WASM files to website directory
cp pkg/wasm.js pkg/wasm_bg.wasm ../website/
# Serve the web version locally
cd ../website
python3 -m http.server 8000
# Open your browser to http://localhost:8000The CHIP-8 uses a 16-key hexadecimal keypad. This emulator maps them to your keyboard (QWERTZ layout only):
Keyboard CHIP-8
+---+---+---+---+ +---+---+---+---+
| 1 | 2 | 3 | 4 | | 1 | 2 | 3 | C |
+---+---+---+---+ +---+---+---+---+
| Q | W | E | R | | 4 | 5 | 6 | D |
+---+---+---+---+ => +---+---+---+---+
| A | S | D | F | | 7 | 8 | 9 | E |
+---+---+---+---+ +---+---+---+---+
| Y | X | C | V | | A | 0 | B | F |
+---+---+---+---+ +---+---+---+---+
ESC - Exit emulator (desktop)
You can find public domain CHIP-8 ROMs here:
- CPU: 16 8-bit registers (V0-VF)
- Memory: 4KB RAM
- Display: 64x32 monochrome
- Stack: 16 levels
- Timers: 60Hz delay and sound timers
- Input: 16-key hexadecimal keypad
The emulator consists of:
chip8_core: Platform-agnostic interpreter implementing the full CHIP-8 instruction setdesktop: SDL2-based frontend for native desktop executionweb: WebAssembly frontend for browser-based play
MIT License - feel free to use this project for learning and development.
This project was built following the CHIP-8 tutorial by aquova. The original tutorial code is licensed under CC0 1.0 Universal.
Made with Love and Rust