Expand description

Encode and decode Octo cartridges or “Octocarts”, CHIP-8 game cartridges for the Octo environment.

Use cases:

  • Decoding: You can extract the program source code and runtime settings from an Octocart file. The source code can be assembled into CHIP-8 bytecode with Octo or decasm. The runtime settings can be given to a CHIP-8 interpreter like Octo or deca, or saved as JSON for the CHIP-8 Archive, as an .octo.rc file for C-Octo or termin-8, etc.
  • Encoding: TODO

Octo cartridge files are GIF89a images with a payload steganographically embedded in one or more animation frames. Data is stored in the least significant bits of colors, 1 from the red/blue channels and 2 from the green channel, allowing us to pack a hidden byte into every 2 successive pixels.

The payload consists of a 32-bit length, followed by a sequence of ASCII bytes consisting of the JSON-encoded options dictionary and source text.

An Octo cartridge contains the source code of an Octo program, and a set of options for the Octo runtime on how to run the program.

  • To compile/assemble the source code, check out the decasm crate.
  • To interpret an assembled program, check out the deca crate (backend) or a program like termin-8 (frontend and graphics).

Structs

Representation of the payload in the Octo cartridge.

Enums

Represents the types of errors that can occur during decoding of an Octocart.

Functions

Decodes an Octocart, and returns the decoded JSON payload as a string.

Read and decode Octocart from a file path