|
Some checks failed
/ Build roms with c-octo (push) Successful in 1m22s
/ Deploy web page (push) Has been skipped
/ Build and run tests (push) Successful in 1m20s
/ Build desktop for Linux x64 (push) Successful in 1m22s
/ Build desktop for Windows x64 (push) Successful in 1m4s
/ Build desktop for Linux ARM64 (push) Successful in 1m15s
/ Build for web (push) Failing after 4m13s
|
||
|---|---|---|
| .forgejo/workflows | ||
| roms | ||
| src | ||
| .gitignore | ||
| build.zig | ||
| build.zig.zon | ||
| flake.lock | ||
| flake.nix | ||
| LICENSE | ||
| README.md | ||
| treefmt.nix | ||
Chipz
A CHIP8 emulator written in Zig.
Features
- Supports CHIP-8, SuperCHIP and XO-CHIP
- CHIP8 database integration: automatically apply known quirks and settings to your game
- Signature, custom hand-made font
- Can run in your browser
Build and use
Common build parameters
There are a few common build parameters that you might find useful:
-Dno-bin: Do not emit a binary forchipz, useful for a clean web build or for incremental compilation-Dstrip:true/false, enables or disables stripping the executable-Drom_path: Path to the rom to include as the rom to play by default (when no argument is given). This rom should be located insrc.
Desktop
This will produce the simplest, cleanest build:
zig build -Doptimize=ReleaseFast -Dstrip=true
And to use, you can play the default game, or pass an URI to a game as the first argument:
# Just plays the default game
./chipz
# Plays a local game
# Go download this one: https://johnearnest.github.io/chip8Archive/roms/slipperyslope.ch8
./chipz slipperyslope.ch8
# Plays a game downloaded directly from the internet
./chipz https://johnearnest.github.io/chip8Archive/roms/snake.ch8
Use the --help parameter to print out an exhaustive help.
Web
Note: build in Debug mode doesn't work yet
# Build for web
zig build -Dtarget=wasm32-emscripten -Doptimize=ReleaseFast -Dno-bin
You will need to host the resulting build on a server, or alternatively, use emrun which is integrated to the build script:
# Build and run for web
zig build -Dtarget=wasm32-emscripten -Doptimize=ReleaseFast -Dno-bin emrun
This will open a page in your browser, showing the default game included during the build. To load a game from any URL, add it as parameter to chipz URL under the game key. For example:
http://127.0.0.1:6931/chipz.html?game=https://johnearnest.github.io/chip8Archive/roms/turnover77.ch8
Roms
This repository contains a few roms source code used to print all possible characters in all possible resolutions:
small_font_display.8o: print characters from 0 to F with the small fontbig_font_display.8o: print characters from 0 to F with the big fonthires_both_display.8o: print characters from 0 to F in both formats, in hi-res mode
You can build them with zig build roms.
The build script uses c-octo to build the roms and you can reuse it to build your own roms! Just add them to the roms directory and re-build.
In-game keyboard shortcuts
| Key | Action |
|---|---|
F1 |
Open the rom information panel |
F2 |
Open the quirks list panel |
F3 |
Open the emulator internals panel |
F4 |
Open the instructions view |
O |
Pause/Resume execution |
Space |
Step through one instruction |
L |
Next platform |
K |
Previous platform |
Escape |
Exit current dialog or window |