Skip to content

ZTOUF/CHIP8_C

Repository files navigation

CHIP-8 Emulator

A CHIP-8 emulator developed in C using the CodeLite IDE as part of an academic project at Polytech Tours.

About

CHIP-8 is an interpreted programming language developed in the 1970s, originally designed to run on the COSMAC VIP microcomputer. This project implements a CHIP-8 emulator capable of loading and running .ch8 ROM files.

Dependencies

This project relies on a pre-existing Display / Keyboard / Sprite library provided by the engineering school Polytech Tours. This library is built on top of SDL2 and handles:

  • Display – rendering the 64×32 pixel screen
  • Keyboard – mapping the CHIP-8 hexadecimal keypad to host keyboard input
  • Sprites – managing built-in font/sprite data

The provided library is located in chip8/libprovided/.

Build

The project uses a Makefile generated by CodeLite. To build, run:

make -f chip8/chip8.mk

Make sure SDL2 is installed on your system before building.

Usage

After building, run the emulator by passing a ROM path. The default ROM path can be changed in chip8/main.c:

const char* romPath = "path/to/your/rom.ch8";

Then launch the emulator:

./chip8

Press the window's close button to exit.

ROM Test Results

ROM Status
CHIP-8 Logo ✅ Validated
IBM Logo ✅ Validated
Corax+ ✅ Validated – all opcodes correctly implemented
Flags ✅ Validated – all opcodes correctly implemented
Quirks ✅ Validated – all quirk settings correctly implemented
Keypad ⚠️ Mostly validated – FX0A shows "NOT HALTING" (see below)
Beep ✅ Validated – sound works correctly

Note on FX0A (keyboard wait)

The FX0A opcode uses the keyboard_wait function from the provided library, which is blocking. This prevents the emulator from updating timers while waiting for input, causing the Keypad ROM to report the opcode as "not halting". Implementing a non-blocking alternative using raw SDL2 events was not completed due to time constraints.

Games

Several games were tested, including Pong. All tested games run correctly and are fully playable.

Project Structure

chip8/
├── collections/       # Core CHIP-8 data structures and processor logic
├── libprovided/       # Display / Keyboard / Sprite library from Polytech Tours (SDL2)
├── test/              # ROM test utilities
├── utils/             # Helper utilities (ROM loader, etc.)
└── main.c             # Entry point

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors