Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🎮 CHIP-8 Emulator

A lightweight and accurate CHIP-8 emulator written in C++ using SDL2 for graphics, input, and audio. Experience classic 8-bit games like Pong, Space Invaders, Tetris, and more!

📂 Project Structure


chip8-emulator/
├── .git/                  # Git version control directory
├── src/                   # Source code (.cpp and .h files)
│   └── chip8.cpp           # Main code
├── roms/                  # Place your .ch8 ROM files here
├── build/                 # Build output (created by CMake)
├── .gitignore            # Git ignore file for C++
├── CMakeLists.txt        # CMake build configuration
├── LICENSE               # MIT License
└── README.md            # Project documentation

🔧 Dependencies

Linux (Arch Linux)

sudo pacman -Syu base-devel cmake sdl2 pulseaudio

🚀 Building

Quick Start

# 1. Clone the repository
git clone https://github.com/Pratyush-gg/chip8-emulator.git
cd chip8-emulator

# 2. Create and enter build directory
mkdir build && cd build

# 3. Configure with CMake
cmake ..

# 4. Build the project
make

This will create the executable: build/chip8_emu

ROM files from roms/ will automatically be copied to build/roms/ during the build process.

▶️ Usage

Running Games

# Basic usage
./chip8_emu roms/Pong.ch8

🎮 Controls

The CHIP-8 system has a 16-key hexadecimal keypad. The mapping is:

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

🎲 ROM Collection

Popular CHIP-8 games you can find online:

  • Pong - Classic two-player paddle game
  • Space Invaders - Shoot the descending aliens
  • Tetris - Falling block puzzle game etc.

🔍 Technical Details

CHIP-8 Specifications

  • Memory: 4KB RAM (0x000-0xFFF)
  • Display: 64x32 monochrome pixels
  • Registers: 16 8-bit general purpose (V0-VF)
  • Stack: 16 levels for subroutines
  • Timers: 60Hz delay and sound timers
  • Input: 16-key hexadecimal keypad
  • Font Set: Built-in 16 character font (0-F)

🐛 Troubleshooting

Common Issues

Build fails with SDL2 not found

# Make sure SDL2 development libraries are installed
sudo apt install libsdl2-dev  # Ubuntu/Debian
sudo pacman -S sdl2           # Arch Linux

📚 Resources


If you enjoy this emulator, please give it a ⭐ on GitHub!

About

"A lightweight CHIP-8 emulator written in C++ using SDL2"

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages