chip8

Version, currently main branch1 version
  • main branchlatestMay 6, 2026

github.com/whtsht/chip-8

No description declared in shard.yml.

0 stars
0 dependents
License: MIT

Installation

# Add this to your shard.yml
dependencies:
  chip8:
    github: whtsht/chip-8
    branch: main

main is a branch, not a release, so this tracks it rather than pinning a version.

Then run:

shards install

shard.yml

Crystal
no constraint declared
License
MIT
Target
  • chip8 from src/main.cr

Dependencies

Runtime Dependencies

  • sdl*github: ysbaddaden/sdl.cr

README

chip-8

A CHIP-8 interpreter written in Crystal.

Requirements

  • Crystal and Shards
  • SDL2 (the system library that sdl.cr binds to)

Build & Run

shards install
shards build              # produces ./bin/chip8
shards run -- <rom-path>  # or: crystal run src/main.cr -- <rom-path>

The ROM path is required. Example ROMs are bundled under ./roms/:

shards run -- ./roms/test/IBM_Logo.ch8
shards run -- ./roms/game/Tic_Tac_Toe.ch8

Options

FlagDefaultDescription
--legacy-shift=BOOLtrue8XY6 / 8XYE copy Vy into Vx before shifting (original COSMAC VIP behavior).
--legacy-memory-inst=BOOLfalseWhen true, Fx55 / Fx65 increment I after the transfer.

Any value other than the literal string true is treated as false.

Keypad

The CHIP-8 hex keypad is mapped to the left-hand side of a QWERTY keyboard:

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

Specifications

  • Display: 64 × 32, monochrome
  • Memory: 4 KB; font sprites at 0x50, ROM loaded at 0x200
  • CPU target: ~700 Hz; timers (delay / sound) tick at 60 Hz
  • Sound: square-wave beeper driven by SDL audio (44.1 kHz, mono, S16)

References

License

MIT