This is a C library for interpreting, assembling, and disassembling CHIP-8 and SCHIP code, optionally utilizing the SDL2 library for graphics.
An example assembler, disassembler, and
interpreter is located in tools/.
cmake -S . -B build
cmake --build build
sudo cmake --install buildThis will build libc8 as well as the example tools.
SDL2 support is enabled by default. To disable it to use another graphics
library, run cmake with -DSDL2=OFF. If simulate() is ever called in your
code, you must implement these functions with your preferred graphics library:
void c8_beep(void)void c8_deinit_graphics(void)int c8_init_graphics(void)void c8_render(c8_display_t *, int *)int c8_tick(int *, int)
Note: the all and tools targets require SDL2 to be ON.
Testing is done using ctest and Unity.
git submodule update
cmake -S . -B build -DTARGET_GROUP=test -DSDL2=OFF
cmake --build build
cd build
ctest --verboseNote: When built with tests enabled (-DTARGET_GROUP=test),
libc8 will not halt execution after encountering an error, potentially leading
to undefined behavior.
The libc8 CHIP-8 interpreter running Outlaw by John Earnest:
Library documentation for libc8 is available on the GitHub pages site.
If you find a bug, submit an issue, PR, or email me with a description and/or patch.
Copyright (c) 2019-2026 Ben O'Neill ben@oneill.sh. This work is released under the terms of the MIT License. See LICENSE for the license terms.
