This is a complete toolchain for the CHIP-8, mostly written in C.
A big part of the project is already done and tested.
But there is still a lot left to implement.
- emulator (DONE).
- toolchain backend: as, ld, objdump, bin2rom, rom2bim (DONE)
- debugger (TODO).
- compiler: Front/middle end done, backend (TODO).
- JIT x64 (TODO)
I only tested my programs on the following environment:
- Ubuntu 18.04 x64
- GCC 7.5
- python 3.6.9
- cmake 3.10.2
SDL2 needed to run the emulator application.
git submodule update --init
mkdir _build
cd _build
cmake ..
make
Usage: ./oc8-emu <file>
Take a CHIP-8 ROM or `.c8bin' file as input, and run the emulator.
GUI with SDL2, no sound.
Usage: ./oc8-as <input-file> [-o <output-file>]
.
Compile an assembly text file (.c8s) into object file (.c8o)
Usage: ./oc8-objdump <input-file>
.
Print binary file (.c8o / .c8bin) into human-readable form
Usage: ./oc8-ld <input-files> -o <output-file>
.
Takes many object files (.c8o) and combine them in one binary ROM (.c8bin)
Usage: ./oc8-bin2rom <input-bin-file> -o <output-rom-file>
.
Take a binary file (.c8bin), strip all symbol infos, and create a native CHIP-8 ROM file.
Usage: ./oc8-rom2bin <input-rom-file> -o <output-bin-file>
.
Take a CHIP-8 ROM file, and add some genric symbol infos (empty tables)
to save it to a binary file (.c8bin)
- Encoder: encode ins to binary from ins struct
- Decoder: decode ins to ins struct from binary
Emulate the CHIP-8 CPU and run instructions.
Can execute step by step, or with a loop and an editable clock speed.
Represent assembly code.
- API to build
as_sfile
struct - Reader: parse
.c8s
files and use API above to buildas_sfile
struct - Printer: Generate string (
.c8s
format) from theas_sfile
struct, that can be parsed again with the reader. - Assembler: build
bin_file
struct fromas_sfile
struct
Represent binary data (.c8o
and .c8bin
files)
- API to build
bin_fil
e struct - BinReader: Read binary
.c8o
/.c8bin
file and buildbin_file
struct - BinWriter: Write binary
.c8o
/.c8bin
file frombin_file
struct - Printer: Generate human-readable string from
bin_file
struct.
Take many object bin_file
structs, and combine them in one runnable bin_file
struct.
Really basic arguments parsers for CLI programs.
Used by most of the binaries of this projects
Basic implementation of a map<string, size_t>
.
Implementation based on linkled lists, will try to do best later.
Used by many libraries that need symbol tables.
The val size_t
can store any number or pointer.
make check
Python required