A chip-8 interpreter in python (pyglet)
Find a file
2023-01-14 22:55:30 +02:00
.gitignore First commit 2018-09-20 23:56:27 +03:00
CC0 First commit 2018-09-20 23:56:27 +03:00
README.md Update README.md 2023-01-14 22:55:30 +02:00
sipsi-8.py Make CPU speed configurable when running program 2023-01-14 22:18:42 +02:00

Name

"Sipsi" is Finnish for a potato chip.

Usage

python3 sipsi-8.py path/to/chip-8/file [instructions-per-second]

Input

Hardcoded (sorry)

1 2 3 4
Q W E R
A S D F
Z X C V

which maps to

1 2 3 C
4 5 6 D
7 8 9 E
A 0 B F

Games

Get some here or here

Code quality

Pretty bad

Emulation speed

Instructions are run 500 times a second by default. This can be changed by passing in a second argument to sipsi-8.

Draw sprint

To reduce sprite flicker, sipsi-8 can run upto two ticks' worth of cycles after a draw call. This is since chip-8 often does drawing in pairs, where the first in the pair erases the old sprite and the next one draws it back. If they happen on different frames, this results in very back flickering.

To avoid an issue of pairing one sprite's draw to other's erase, a sprint is invalidated if it hits a jump, call, or a return.

Games improved by draw sprint:

  • Brix and its descendants
  • UFO

Games unaffected by draw sprint:

  • Pong and Pong2 (Draws are too far from each other)
  • Tetris (Does jumps inbetween)
  • Blitz (Does jumps inbetween. If invalidation upon jump is disabled, ends up pairing wrong draw calls)

Issues

  • Keyboard can't be changed
  • FPS can't be changed
  • Window size can't be changed
  • No error handing on opening a file

Requirements

  • pyglet (pip3 install pyglet)

License

Creative Commons Zero 1.0