Home

Awesome

C-Octo

Octode Demo

This project is a rewrite of the web-based Octo CHIP-8 development toolkit in C. This port can run on a wide variety of older or lower-powered devices which would struggle with a modern web browser. C-Octo also provides an enhanced CLI and offline experience for those who prefer to use an external text editor.

The C-Octo suite includes octo-cli, a command-line compiler, octo-run, a minimal runtime and debugger that can be executed from the command-line, octo-de, a self-contained "Fantasy Console"-style programming environment, and several reusable libraries. Why not give Octo a spin on the PocketCHIP gathering dust in your closet?

Project Structure

C-Octo is split into several files by function:

Installation

To build from source you will need a C compiler and (probably) SDL2. The provided Makefile will build everything, attempt to copy binaries to /usr/local/bin/, and create a configuration .octo.rc file in your home directory.

For detailed information about building and installing on different platforms, see the Build Guide.

Octo-CLI

$octo-cli
usage: ./octo-cli <source> [<destination>] [-s <symfile>]

The source file may be a .8o source file or a .gif octocart. If the destination has a .ch8 extension, a CHIP-8 binary will be produced. If the destination has a .gif extension, an octocart will be produced. If the destination has a .8o extension, the source text of an input octocart will be extracted. If no destination is specified, the resultant .ch8 binary will be piped to stdout.

if the -s flag is provided, the compiler will write out a CSV file containing all the symbols defined in the input program: breakpoints, constants (including labels), aliases, and monitors, for use with external debugging tools. For example:

$ cat symdemo.8o
:monitor v6 8
: main
	:alias acc v2
	acc += 1
	:breakpoint "wait, then go"
	acc := 0

$ octo-cli symdemo.8o temp.ch8 -s syms.csv && cat syms.csv
type,name,value
breakpoint,"wait, then go",514
constant,main,512
alias,unpack-hi,0
alias,unpack-lo,1
alias,acc,2
monitor,v6,8

The make testcli target will run a series of integration tests for this tool.

Octo-Run

$octo-run
octo-run v1.0
usage: ./octo-run <source> [-c <path>]
where <source> is a .ch8 or .8o

Octo-run will execute a .ch8 binary or compile and run an Octo program. While executing, the same basic debugging features are available as in web-octo: i toggles a user interrupt and the display of the register file, o single-steps while interrupted, and m toggles the display of memory monitors, if any are registered. Command-F or Ctrl-F toggle fullscreen mode and Escape or backtick quit.

If provided, the -c flag may be used to indicate a configuration file which should override the global .octo.rc file. This makes it easier to configure colors, speed, and other options for an individual program while working on multiple projects.

If a gamepad is detected, axes will be mapped to mirror A,S,W, and D on the keyboard and buttons will similarly be mapped to E and Q.

Octode

$octo-de

Octode includes a text editor, sprite editor, palette editor, and a runtime/debugger identical to octo-run. With the exception of the sprite editor, the user interface can be controlled entirely via the keyboard, and should work equally well with a mouse or touchscreen. For detailed information about Octode, see the Octode User Guide.

Configuration File

Octo-run and Octode look for a file named .octo.rc in the user's home directory. If present, it can be used to configure a variety of useful settings for the tools. The file has a traditional .INI structure- empty lines or lines beginning with # are ignored, and anything else consists of a key and value separated by =. Meaningful keys are as follows:

All colors are specified as 6-digit RGB in hexadecimal, like 996600. The default quirks settings, palette, and other options correspond to those of web-octo.