Skip to content

sourav4243/CHIP8-Emulator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 

Repository files navigation

CHIP-8 Emulator (C++ / SDL3)

A simple CHIP-8 emulator written in C++ using SDL3 for graphics and input. The emulator implements the standard CHIP-8 instruction set and runs classic ROMs such as Pong, Invaders, and Tetris.


Image Image

Requirements

  • Linux (tested on Arch Linux)
  • g++ (C++ compiler)
  • pkg-config
  • SDL3

Install Dependencies

On Arch Linux:

sudo pacman -S sdl3

Verify SDL3 installation:

pkg-config --modversion sdl3

Project Structure

CHIP8-emulator/
├── src/
│   ├── main.cpp
│   ├── chip8.cpp
│   └── chip8.h
├── roms/
│   ├── invaders.c8
│   ├── pong2.c8
│   └── tetris.c8
└── README.md

Build

From the project root directory:

g++ src/main.cpp src/chip8.cpp -o chip8 `pkg-config --cflags --libs sdl3`

Run

Run the emulator by passing a CHIP-8 ROM file:

./chip8 roms/invaders.c8

Other examples:

./chip8 roms/pong2.c8
./chip8 roms/tetris.c8

Controls (CHIP-8 Keypad Mapping)

1 2 3 4        →  1 2 3 C
Q W E R        →  4 5 6 D
A S D F        →  7 8 9 E
Z X C V        →  A 0 B F

ESC → Quit emulator


Notes

  • Emulator core is independent of SDL.
  • Display resolution is 64×32, scaled for visibility.
  • ROMs are loaded starting at memory address 0x200.
  • Fontset is loaded at memory address 0x50.
  • Detailed comments are provided for all CHIP-8 opcodes to explain instruction behavior and implementation logic.

Helpful Resources

The following references were used while implementing the emulator:


Public Domain ROMs

Public domain CHIP-8 games can be found here:


License

This project is intended for educational use. ROM licenses depend on their respective authors.

About

A CHIP8 Emulator in C++

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages