chip-8

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

Flag Default Description
--legacy-shift=BOOL true 8XY6 / 8XYE copy Vy into Vx before shifting (original COSMAC VIP behavior).
--legacy-memory-inst=BOOL false When 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

Repository

chip-8

Owner
Statistic
  • 0
  • 0
  • 0
  • 0
  • 1
  • about 4 hours ago
  • May 6, 2026
License

MIT License

Links
Synced at

Wed, 06 May 2026 08:47:42 GMT

Languages