A CHIP-8 emulator written in Rust and Svelte.
CHIP-8 is an interpreted programming language that was used to create games for 8-bit microcomputers in the 1970s and 1980s. This project is a Rust and WebAssembly implementation of a CHIP-8 emulator that can run these games on modern web browsers.
- Supports all 35 opcodes of the original CHIP-8 specification
- Implements a simple graphical user interface using JavaScript and HTML5 canvas
- Allows keyboard input to emulate the 16-key hexadecimal keypad
- Provides sound effects using the Web Audio API
To run the emulator, simply go to https://chaoticwyrme.github.io/chip8-rs/ where it is deployed on GitHub Pages.
To build the project, you need to have Rust, wasm-pack, and NodeJS installed on your system. Then, clone this repository and enter the chip8_web directory. Run npm run wasm
to build chip8_core into wasm. Next, use npm install
to install the node dependencies.
Finally, you can start the dev server with npm run dev
to start a local web server that hosts the emulator and updates the interface as you make changes. You can then open http://localhost:5173
in your browser to use the emulator.
git clone https://github.com/chaoticwyrme/chip8-rs.git
cd chip8-rs
cd chip8_web
npm run wasm
npm install
npm run dev
You can use the following keyboard mappings to control the game:
Original | Emulator |
---|---|
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 |
You can also use the following keys to interact with the emulator:
Key | Action |
---|---|
P | Pause/resume |
M | Mute/unmute |
Space | Step through opcodes |
Esc | Quit |
There is a Action script for building and deploying the code. Basically the steps are:
- Install dependencies
npm ci
inchip8_web
to install JS dependencieswasm-pack build --target web --release
inchip8_wasm
to build rust into wasm for releasenpm run build
inchip8_web
to build web interface and copy over wasm files- Zip and upload
chip8_web/deploy
as an artifact. - Publish to github pages
By default, deploying is triggered by pushing to the deploy
branch, but it can also be triggered manually on any protected branch.
This project is licensed under the MIT License - see the LICENSE file for details.