Skip to content

zaymat/chip8

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

31 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CHIP 8 emulator

The goal of this project is to create a CHIP 8 emulator in C++ using SFML for graphics.

CHIP 8

CHIP-8 is an interpreted programming language, developed by Joseph Weisbecker. It was initially used on the COSMAC VIP and Telmac 1800 8-bit microcomputers in the mid-1970s. CHIP-8 programs are run on a CHIP-8 virtual machine. It was made to allow video games to be more easily programmed for said computers. (Wikipedia)

Structure

The emulator is represented by two classes : CPU and GPU (which treat Keyboard interrupt too, because the window is generated by this class).

The main function fetch and parse the opcode and call the right function whether a CPU or a GPU method.

Compilation

git clone https://github.com/zaymat/chip8
cd chip8
make
make clean
chmod +x chip 8

Execution

./chip8 path_to_game [-s] [-l]

Flags:

  • -s enable shift_quirk
  • -l enable load_quirk

Load_quirk and Shift_quirk

Explanation of the flags

Load/Store quirks - Instructions 0xFX55 and 0xFX65 increments value of Index register but some CHIP-8 programs assume that they don't. Enabling this quirk causes I register to become unchanged after the instruction.

Shift quirks - Shift instructions 0x8XY6 and 0x8XYE originally shift register VY and store results in register VX. Some CHIP-8 programs incorrectly assume that the VX register is shifted by this instruction, and VY remains unmodified. Enabling this quirk causes VX to become shifted and VY remain untouched.

[Diesel-Net/kiwi-8#9]

List of games needing those flags

Enabling load_quirk is recommended for:

  • Astro Dodge [Revival Studios, 2008]
  • Tic-Tac-Toe [David Winter]
  • Stars [Sergey Naydenov, 2010]
  • Connect 4 [David Winter]
  • Hidden [David Winter, 1996]

Enabling shift_quirk is recommended for:

  • BMP Viewer - Hello (C8 example) [Hap, 2005]
  • Space Invaders [David Winter]
  • Keypad Test [Hap, 2006]

Enabling both shift_quirk AND load_quirk is recommended for:

  • Blinky [Hans Christian Egeberg, 1991]

Improvements

  • Emulate sound to hear to BEEP sound of the machine
  • Do the opcode parsing outside the main function
  • Implement Super CHIP 8 opcodes (maybe I'll do another project because screen size is not the same)
  • Work on frequency emulation, as today games are not fluid

About

chip8 emulator

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published