Skip to content

About

CHIP-8 interpreter written in D with SDL3.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

18 Commits

Folders and files

Repository files navigation

CHIP-8 Interpreter

Chip-8 Games Compilation

CHIP-8 is an interpreted programming language originally used on the COSMAC VIP and Telmac 1800 microcomputers in the 1970s.

This is a CHIP-8 interpreter written in D with SDL3 for the frontend (graphics, input and audio).

Run the interpreter

Download and run

Download for Windows.

Unzip, and from a terminal in the unzipped directory, run:

chip8-interpreter.exe path/to/game.ch8

Where to find games

You can find various sites holding CHIP-8 programs available for download.
Make sure to get CHIP-8 games, and not SCHIP or XO-CHIP ones!

Example sources:

Controls

CHIP-8 Key Mappings

This project uses a conventional key mapping from the original CHIP-8 keypad to the modern keyboard.

A lot of games don't specify their controls. Test each key if you're unsure!

Also:

  • ESC: Quit.
  • I, O, P: Toggle quirks.

Tests and quirks

This interpreter passes the CHIP-8 tests in Timendus' test suite.

There exist CHIP-8 interpreter variants which operate slightly differently to the original. The default settings in this project fit the quirks on the original COSMAC VIP (see test 5).

The I, O and P keys toggle some of these quirks.

  • I: I-Increment. The save and load opcodes (Fx55, Fx65) increment the index (I) register. Affects MEMORY in test 5.
  • O: SetVxToVy. Store the value of Vy into Vx at the beginning of shift opcodes (8xy6, 8xye). Affects SHIFTING in test 5.
  • P: SpriteInterrupt. Wait for an interrupt before drawing a sprite. An interrupt occurs once a frame, which means you are limited to one sprite-draw per frame. Affects DISPLAY WAIT in test 5.

Toggling I or O off might break programs expecting COSMAC VIP execution. Toggling P off might cause unintended execution speeds.

Build from source

Currently, I have only provided a direct download for a Windows executable. If you want to build the interpreter from the code for another platform, or for any other reason:

  • Clone this repository.
  • Download a D compiler. This provides the DUB package manager.
    The pinned compiler is DMD v2.113.0. Other versions are most likely fine.
  • Download the pinned SDL3 DLL (v3.4.16) and place it in the repository root. Other versions are most likely fine.
    This is required to use the SDL bindings, bindbc-sdl.

Build the project with dub build.

Technologies used

  • D
  • SDL3

Resources / References

Prospective To-Do

  • Pausing.
  • Tick speed adjustments in-app.
  • Colour schemes / customisation.
  • A menu which encompasses the above points.
  • App loads into a menu for selecting ROMs. Also enter this menu from the pause menu (or they are the same thing).

License

This project is licensed under the MIT license. See LICENSE.

About

CHIP-8 interpreter written in D with SDL3.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages