The Hello World
of Emulation, made in your favourite memory-safe Rust.
You need only SDL2
package and Cargo
to run the project!
Run sudo apt-get install libsdl2-dev
to install SDL2
and follow this guide to install Cargo!
After the above setup, you can start playing the games with the following commands:
cd desktop
cargo run ../roms/[GAME_NAME]
- A
64x32 monochrome display
, drawn to via sprites that are always8 pixels wide
andbetween 1 and 16 pixels tall
- Sixteen
18-bit general purpose registers
, referred to asV0
throughVF
. (VF
also doubles as the flag register for overflow operations) 16-bit program counter
- Single
16-bit register
used as a pointer for memory access, called theI Register
- An unstandardised amount of
RAM
(most emulators allocate4 KB
) 16-bit stack
used for calling and returning from subroutines16-key keyboard
input
Two special registers which decrease each frame and trigger upon reaching zero are also present:
Delay timer
: Used for time-based game eventsSound timer
: Used to trigger the audio beep
The project has two main directories.
chip8
: This is a library package with holds all the code for theCHIP8 Emulator
desktop
: This is a binary application package which would be using thechip8
emulator to run games!
- Add better comments for all the OP Codes
- Rename classes and variables to standard CPU names
- Add more ROMS
- Add WASM integration
- Add tests for each of the OP Codes and methods
- Add frontend to play the games