Skip to content

LarssonOliver/zhip8

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

32 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ZHIP8 - Zig CHIP-8 Emulator

I built this project with the intention of learning Zig. I used the following CHIP-8 references during the implementation process:

Started in Zig 0.10.0, left for a while and then ported to, and finished in Zig 0.13.0.

The current implementation is lackluster in the graphics department, but this project is not about implementing OpenGL graphics, it is about understanding Zig as a language.

Compilation and Testing

Compilation using zig build produces a ./zig-out/bin/zhip8 binary.

zig build

Help page:

$ ./zig-out/bin/zhip8 --help
[-h] [-f <INT>] <ROM>...

    -h, --help
            Display this help and exit.

    -f, --frequency <INT>
            CPU frequency in Hz, default 700.

    <ROM>...

Unit Tests

Running the unit tests is done with:

zig build test --summary all

Input

The inputs are very rudimentary, but the mapping of keys are as follows:

1 2 3 4     1 2 3 c
q w e r  \  4 5 6 d
a s d f  /  7 8 9 e
z x c v     a 0 b f

Exiting the Emulator

Exiting the program is done by hitting <ESC>.