- Zig 99.4%
- Nix 0.6%
| roms | update readme & clean up roms | |
| src | update to SDL3, use Zig v0.14.0, & add nix-shell | |
| .gitignore | better json config loading | |
| build.zig | update to SDL3, use Zig v0.14.0, & add nix-shell | |
| build.zig.zon | update to SDL3, use Zig v0.14.0, & add nix-shell | |
| config.json.example | config file used as an example | |
| demo1.png | add demo image to readme | |
| demo2.png | demo pict added to readme | |
| LICENSE | Initial commit | |
| README.md | better json config loading | |
| shell.nix | update to SDL3, use Zig v0.14.0, & add nix-shell | |
Chipzzzzzzzz (Chip with 8 Zs)
Chipzzzzzzzz Interpreter displaying the IBM logo in pink color Chipzzzzzzzz Interpreter displaying the Test Opcode results in pink color
A CHIP-8 Interpreter written in Zig (currently working on v0.14.0). This was my first project using Zig after working through Ziglings.
Building
Assuming zig executable lives in your PATH, simply run zig build. This will result in an executable file chipzzzzzzzz in the ./zig-out/bin/ folder. You can move it to where ever you store executable for your OS (ex. /usr/local/bin/) or run it from this repo directly if you don't want to install it.
Starting a ROM
To load a ROM, simply pass in the file path as a CLI argument:
./zig-out/bin/chipzzzzzzzz <path to ROM file>
There are several ROMs included in the ./roms/ folder in this repo to get started:
./zig-out/bin/chipzzzzzzzz roms/test_opcode.ch8
Important Keys
- Pressing
ESCwill quit the program - Pressing
Pwill pause the execution of the program. PressingPagain will resume execution.
Setting Custom Config
If it exists, a config.json file placed in the root of this repo can be used to configure many parameters of CHIP8 system. The parameters end-users can configure are:
debug(bool): Controls if debugging output (instruction values, register values, etc) should be printed to the console. Defaults to FALSE.font_color: (struct Rgb { r: u8, g: u8, b: u8 }): Change the font color with passed red, green, and blue values (0-255). Defaults to white pixels.display_scale: (u4) Starting scale of display length/width by a factor of N set here. Defaults to 10.
NOTE: You can copy the config.json.example file to config.json as a starting point and then modify or remove fields to suit your needs.
Helpful Resources
Here is a running list of helpful tutorials, resources, etc that I utilized while building out this project: