Skip to content

sambrla/chip8

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

47 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Chip-8 Interpreter

A simple Chip-8 interpreter written as an exercise in learning more about emulation, Git(Hub), and the C++ language in general. The project uses SFML for graphics/audio and cxxopts for option parsing.

Currently, only base Chip-8 programs are supported (i.e. no Super Chip-8).

Screenshot

Screenshot of the interpreter

Building

Building the project requires the following:

  • C++11 compiler
  • SFML (developed with 2.4.2)
  • CMake 3.11+

macOS/Linux

$ git clone --recurse-submodules https://github.com/sambrla/chip-8.git
$ cd chip-8
$ mkdir build
$ cd build
$ cmake -D CMAKE_BUILD_TYPE=Release ..
$ make

Windows (Visual Studio)

> git clone --recurse-submodules https://github.com/sambrla/chip-8.git
> cd chip-8
> mkdir build
> cd build
> cmake -D SFML_ROOT=<path\to\SFML> ..
> cmake --build . --config Release

Usage

Run the interpreter by passing it a ROM file, e.g.

$ ./chip8 roms/myRom.ch8

Optional arguments may be specified to control execution speed (IPC), support high DPI displays, and toggle compatibility.

-i, --ipc IPC   Instructions to execute per cycle (default: 9)
-r, --high-dpi  Scale window for high DPI displays
-c, --compat    Enable alternative shift and load behaviour. May be
                required for some ROMs to work correctly
-h, --help      Print help

Key map

The hex-based keypad used on OG hardware has been mapped as follows:

1  2  3  C                   1  2  3  4
4  5  6  D     Mapped to     Q  W  E  R
7  8  9  E        -->        A  S  D  F
A  0  B  F                   Z  X  C  V

The interpreter can be paused by pressing Ctrl+P and reset by pressing Ctrl+R.

Resources

About

A Chip-8 interpreter written in C++11

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published