tobiasvl / termin-8

Octo-compliant CHIP-8 emulator frontend that runs in your terminal
https://crates.io/crates/termin-8
0 stars 0 forks source link
chip-8 chip-8-debugger chip-8-emulator chip-8-interpreter chip8 chip8-emulator chip8-interpreter

Termin-8

crates.io dependency status

CHIP-8 emulator that runs in your terminal and is Octo compliant.

Powered by deca, it supports CHIP-8, SUPER-CHIP (SCHIP) and XO-CHIP programs.

It will also auto-resize its display to fit your terminal (at the cost of widespread font support and XO-CHIP color in the smallest sizes).

Installation

First, install Rust. Then, in your terminal:

cargo install termin-8

Usage

Termin-8 should work on Windows, Linux, and macOS. If it doesn't, please file an issue.

Download CHIP-8 ROMs from the internet, like the Chip8 Community Archive, or make your own in Octo.

Then run Termin-8 in your terminal:

termin-8 ROM

There are some command line options:

termin-8 --help

The hexadecimal CHIP-8 keypad is customarily mapped to the following keyboard keys:

1 2 3 4
q w e r
a s d f
z x c v

In addition, the arrow keys are bound to WASD.

You can press Esc to exit.

Debugging capabilities

Termin-8 can be used for testing while developing CHIP-8 games, as an alternative to Octo (web) and C-Octo (SDL).

However, Termin-8 can't yet compile Octo code on its own. In an all-terminal workflow, use C-Octo's octo-cli tool to compile your code. octo-cli can output a symbol file alongside the CHIP-8 binary if you use the -s command line option, and -s is likewise supported by Termin-8 for reading such a symbol file.

If a symbol file containing breakpoints is loaded, hitting those breakpoints will interrupt execution and display the contents of all registers.

Press the following keys while Termin-8 is running for further debugging:

Terminal requirements

Note that the terminal requirements vary depending on what kind of program you attempt to run.

Here's a table with the required terminal size and Unicode support needed to get features such as XO-CHIP color support, depending on the resolution of the CHIP-8 program you're running and the Unicode Block Elements support of your font:

CHIP-8 resolution Unicode version Minimum terminal size Pixel size XO-CHIP colors
64x32 (lores)
CHIP-8, SCHIP, XO-CHIP
1.0.0 128x32 ██
64x32
64x16
3.2 32x16
128x64 (hires)
SCHIP, XO-CHIP
1.0.0 256x64 ██
128x64
128x32
3.2 64x32
CHIP-8 resolution Unicode version Minimum terminal size Pixel size XO-CHIP colors
64x32 (lores)
CHIP-8, SCHIP, XO-CHIP
1.0.0 128x32 ██
64x32
64x16
3.2 32x16
3.0 32x8
128x64 (hires)
SCHIP, XO-CHIP
1.0.0 256x64 ██
128x64
128x32
3.2 64x32
3.0 64x16

Notes:

Limitations

Configuration file

Termin-8 will look for a file named .octo.rc in the user's home directory, which can be used to configure some useful settings. This file is also used by C-Octo.

You can also supply a configuration file with the -c command line option. This can be useful for setting some options for specific games – colors, to match the author's artistic vision, or "quirky" behavior, to make the game run correctly.

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.