A CHIP-8 emulator written in Rust with WebAssembly support.
The Hello World of Emulation!
CHIP-8 is a simple, interpreted programming language from the 1970s used for video games on early microcomputers. This project implements a complete CHIP-8 emulator in Rust, featuring both a native desktop version (SDL2) and a web version (WebAssembly).
- ✅ Full CHIP-8 instruction set implementation
- 🦀 Written in Rust for safety and performance
- 🖥️ Desktop version with SDL2 graphics and audio
- 🌐 Web version with WebAssembly (runs in browser)
- 🎮 Includes 20+ classic CHIP-8 games
- 🎵 Sound timer support with beep audio
- ⌨️ Keyboard controls for both desktop and web
- 📦 Modular architecture with reusable core library
Prerequisites:
- Rust toolchain (stable)
- SDL2 development libraries
Build and Run:
git clone https://github.com/Jayesh-Dev21/Chip8_emulation.git
cd Chip8_emulation/rust/desktop
cargo run --releasePrerequisites:
- Rust toolchain with
wasm32-unknown-unknowntarget - wasm-pack
Build:
cd rust/wasm
wasm-pack build --target web --out-dir ../../web/pkg --releaseServe locally:
cd web
python3 -m http.server 8000
# Open http://localhost:8000Keyboard Mapping:
CHIP-8 Keypad: Your Keyboard:
1 2 3 C 1 2 3 4
4 5 6 D => Q W E R
7 8 9 E A S D F
A 0 B F Z X C V
showcase.webm
Chip8_emulation/
├── rust/
│ ├── chip8_core/ # Core emulator logic (library)
│ ├── desktop/ # SDL2 desktop application
│ └── wasm/ # WebAssembly wrapper
├── web/ # Web UI (HTML/CSS/JS)
│ ├── pkg/ # Generated wasm files
│ └── c8games/ # ROM files
├── ROMS/ # Additional ROM collection
└── README.md
- Core Library: Platform-agnostic CHIP-8 emulator
- Desktop: Uses SDL2 for graphics, input, and audio
- Web: Compiled to WebAssembly, runs in modern browsers
- Audio: Native rodio (desktop) / WebAudio API (web)
- Random: Deterministic fallback for wasm builds
Contributions welcome! Feel free to open issues or submit pull requests.
MIT License - see LICENSE file for details.
- CHIP-8 Wikipedia
- Cowgod's CHIP-8 Technical Reference
- Rust and WebAssembly communities
Made with ❤️ by Jayesh-Dev21