A Chip-8 Emulator made in C++
This project has been an experiment in creating an emulator from the Chip8 assembly-like language into a working GUI application, while also being a test of multiple build systems, due to my desire to have a build that can be easily replicated across multiple different systems, though it has been a challenge.
Note that the built file, usually called 'chip8' or 'chip8.exe', will currently need a 'games/' folder in order to run, or call chip [game]
Currently, I have these build systems working in a Arch-based Linux environment:
- Modify
include/window.h
andsrc/window.cpp
to swap the commented#include
with the#include
below it - Run
make
- Create a folder, call it 'build'
- Either go inside the folder, and run the command:
cmake -S ..
or outside the folder, runcmake -B build
- Inside the 'build' folder, run the
make
command to create the application - (Move 'chip8' outside of directory where 'games/' is to run)
- Start by running
meson setup builddir
- Inside 'builddir', either run
ninja
ORmeson compile
OR outside of 'builddir', runmeson compile -C builddir
- (Move 'chip8' outside of directory where 'games/' is to run)
- Run
zig build run
to build and run, or justzig build
to build, where the file will be in 'zig-out/bin/' (doing will will need the file in the same folder as 'games/')
Currently, I haven't had much success in windows. In the past I had some complicated solutions with CMake, and possibly a complicated clang command, but never liked the solutions and have since tried meson, which I will note a command that differs between windows and linux, which is creating a 'subprojects' folder, and running: meson wrap install sdl2
and other commands needed, but I haven't had SDL2_ttf working as of yet.
However, I did get Zig to work!
You will need to make sure Zig is installed, which will be downloading the Zig .zip file from their website, extracting the contents where you would like (my suggestions: C:\zig
), then type in the Windows search bar 'environment' to edit system environment variables. Click Environment Variables on the bottom, click Path then Edit, press New then Browse, and choose where you put Zig (for me, C:\zig
). You can confirm it works via restarting all terminals/powershells, and typing zig version
.
Simply run zig build run
to run, or do zig build
and move the .exe AND the .dll files to where a 'games/' folder is play on linux and windows!
yeah im not yet rich enough for this