Installation | Getting Started | CHIP-8 Overview | Instruction Set
This project is a CHIP-8 emulator, which allows you to play classic CHIP-8 games on modern hardware. The emulator is built using Rust and SDL2 for rendering.
To set up the CHIP-8 emulator, you need to install SDL2 for rust. For guidance on installing SDL2, especially on Windows, refer to the instructions provided in this GitHub issue comment.
Once SDL2 is installed, you can build the emulator using Cargo:
cargo build --release
To run the emulator, use the following command, specifying the path to a CHIP-8 ROM file. If no ROM file is specified, the emulator defaults to using rom/superpong.ch8.
cargo run --release <path-to-rom-file>
Replace <path-to-rom-file>
with the path to your desired CHIP-8 ROM.
You can donwload ROMs from John Earnest's Chip8 Community Archive.
CHIP-8 is an interpreted programming language developed by Joseph Weisbecker in the mid-1970s. It was designed for simplicity and ease of programming, primarily used on 8-bit microcomputers like the COSMAC VIP and Telmac 1800. CHIP-8 programs are typically games and demos, and the language has been implemented on various platforms, including modern computers, calculators, and mobile devices. For more information, visit the CHIP-8 Wikipedia page.
CHIP-8 has a total of 35 opcodes, each two bytes long. Below is a brief overview of some key instructions:
Opcode | Type | C Pseudo | Explanation |
---|---|---|---|
00E0 | Display | disp_clear() |
Clears the screen. |
00EE | Flow | return; |
Returns from a subroutine. |
1NNN | Flow | goto NNN; |
Jumps to address NNN. |
6XNN | Const | Vx = NN |
Sets VX to NN. |
7XNN | Const | Vx += NN |
Adds NN to VX (carry flag is not changed). |
ANNN | MEM | I = NNN |
Sets I to the address NNN. |
DXYN | Display | draw(Vx, Vy, N) |
Draws a sprite at coordinate (VX, VY) with a width of 8 pixels and height N. |
FX07 | Timer | Vx = get_delay() |
Sets VX to the value of the delay timer. |
FX1E | MEM | I += Vx |
Adds VX to I. VF is not affected. |
For a complete list of instructions, visit the CHIP-8 Instruction Set.