CHIP-8 is an interpreted programming language, developed by Joseph Weisbecker. Initially used on the COSMAC VIP and Telmac 1800 8-bit microcomputers in the mid-1970s, it allowed video games to be easily programmable.
The project uses CMake as a build system and has the following dependencies:
- SDL (required, version >= 1.2.0)
- SDL_mixer (required, version >= 1.2.0)
- ncurses (optional)
To build the project, be sure to have CMake installed and run:
cmake . make
However, running cmake .
at the project root directory will result in a lot of cruft files needed by the CMake build process. If you plan to hack on the project, a better idea is to run:
cd build cmake .. make
That will keep the CMake specific files in a convenient location, so they can be easily pruned. Once make
has been run, use sudo make install
to install it.
Installing source packages with make install
is not always a great idea. If you are running some Unix flavour you may want to utilize your system packaging tools. An utility named CheckInstall is pretty convenient in those situations. You can use it to generate and install a package, that is suitable for you. This package will be named chip8.c
and will be easily uninstallable through your package system.
I’m going to guide you through the process of installing CheckInstall on Ubuntu Linux. The process will be similar for other Linux distributions or your favorite Unix-like operating system.
On Ubuntu Linux CheckInstall is not installed by the default and you can install it with:
sudo apt-get install checkinstall
Asuming that you have already built the project in the build
directory, run:
sudo checkinstall --pkgname=chip8.c
Just follow the instructions and if everything went successful, you should see a message like the following:
********************************************************************** Done. The new package has been installed and saved to /home/user/chip8.c/build/chip8.c_20130428-1_amd64.deb You can remove it from your system anytime using: dpkg -r chip8.c **********************************************************************
Usage: chip8 [OPTION...] FILE... Options: -s, --sdl use SDL for input and output (default) -t, --terminal use the terminal for output (experimental) -n, --ncurses use ncurses for output (experimental)
SDL is the default backend, you don’t need to explicitly specify it. It uses the SDL library to display the CHIP-8 graphics and feed it with input from the keyboard.
The CHIP-8 uses a hexadecimal keyboard, which maps rather well to the layout of the current generation keyboard numeric pad.
C | D | E | |
1 | 2 | 3 | F |
4 | 5 | 6 | |
7 | 8 | 9 | B |
A | 0 |
Use following keys to reset or quit the emulator.
Key | Action |
---|---|
Backspace | Reset |
Escape | Quit |
This is the only backend that supports input.
The terminal backend uses escape symbols to render dynamic content straight to the terminal. It requires a terminal that is at least 64×32 to render the content correctly.
The ncurses backend uses the ncurses library to display dynamic content to the terminal. It is faster than the --terminal
backend, but requires the use of an external (ncurses) library.
The following games are distributed with the interpreter:
- 15PUZZLE
- BLINKY
- BLITZ
- BRIX
- CAVE
- CONNECT4
- GUESS
- HIDDEN
- INVADERS
- KALEID
- MAZE
- MERLIN
- MISSILE
- PONG
- PONG2
- PUZZLE
- SYZYGY
- TANK
- TETRIS
- TICTAC
- UFO
- VBRIX
- VERS
- WALL
- WIPEOFF
You can find them in the roms
folder.
The code is available under the MIT license.