This emulator is written in C++, using SDL2 for graphics, audio and keyboard input handling. My motivation for developing this emulator was mainly as an introductory project to learn C++, as well as gaining experience with how emulation works, which I've been interested in for some time.
-
MSBuild, included in all Visual Studio editions.
-
CMake added to path.
-
SDL2 Development path added in CMAKE_PREFIX_PATH environment variable. Also add a sdl2-config.cmake file in the SDL2/ folder, see here for an example on how to do this.
- CMake
- SDL2
- C++ compiler.
$ sudo apt install cmake libsdl2-dev g++
# Build
$ cmake -S . -B build
# Compile
$ cmake --build build --config Release
OR just launch the project in any IDE and it will recognize the cmake file ¯\_(ツ)_/¯
After compiling the executable and roms can be found in the bin/ folder. There's only 4 roms included, but more can be found by googling.
The emulator takes a few optional parameters: rom name, instruction cycles per second, window size. The default values for these parameters are breakout.ch8, 600 and 10 respectively.
Chip8 [filename] [-S cycles-per-second] [-W window-size]
$ cd bin
# Example 1: Default values
$ Chip8
# Example 2: Custom parameters
$ Chip8 Tetris.ch8 -S 1000 -W 15
While playing the emulator you can press m to mute the game, and p to pause the game.
- High level Chip8 guide.
- Kiwi8, used for SDL2 audio inspiration.
- Using SDL2 with CMake.
This Chip8 emulator is available under the MIT license. See the LICENSE file for more info.