Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Chip-8 emulator written in Go with the help of Ebiten

License

Notifications You must be signed in to change notification settings

AzraelSec/chip-8

Folders and files

NameName
Last commit message
Last commit date

Latest commit

History

2 Commits

Repository files navigation

๐ŸŽฎ CHIP-8 Emulator

Go Version License

A high-performance CHIP-8 emulator written in Go, featuring pixel-perfect graphics rendering and authentic sound emulation. Experience classic 8-bit games exactly as they were meant to be played!

โœจ Features

  • ๐ŸŽฏ Complete CHIP-8 instruction set - All 35 opcodes implemented
  • ๐Ÿ–ฅ๏ธ Pixel-perfect display - Authentic 64x32 monochrome graphics
  • โŒจ๏ธ Intuitive keyboard mapping - Modern QWERTY layout support
  • ๐ŸŽต Configurable audio - Built-in beep sound system with volume control
  • ๐Ÿš€ High performance - Configurable CPU cycles at 60 FPS
  • ๐ŸŽฎ Game compatibility - Supports classic CHIP-8 ROMs
  • ๐Ÿ“ฆ Cross-platform - Runs on Windows, macOS, and Linux

๐Ÿ› ๏ธ Installation

Prerequisites

  • Go 1.24.5 or later
  • Git

Quick Start

# Clone the repository
git clone https://github.com/azraelsec/chip-8.git
cd chip-8
# Build the emulator
make build
# Run a game
./chip-8 -rom-path roms/pong.c8

๐ŸŽฎ Usage

Command Line Options

./chip-8 [OPTIONS]
Options:
 -rom-path string
 path to the rom you want to emulate (required)
 -cycles-per-update int
 number of cycles to run per update (default 10)
 -volume float
 audio volume (0.0 to 1.0) (default 0.7)

Basic Examples

# Play Pong with default settings
./chip-8 -rom-path roms/pong.c8
# Play Space Invaders
./chip-8 -rom-path roms/invaders.c8
# Play Breakout
./chip-8 -rom-path roms/pong.ch8

Advanced Examples

# Run with custom volume (quiet)
./chip-8 -rom-path roms/pong.c8 -volume 0.3
# Run with faster CPU cycles
./chip-8 -rom-path roms/pong.c8 -cycles-per-update 15
# Run with custom volume and CPU cycles
./chip-8 -rom-path roms/invaders.c8 -volume 0.5 -cycles-per-update 12
# Run silently (no audio)
./chip-8 -rom-path roms/pong.c8 -volume 0.0

Keyboard Controls

The CHIP-8 keypad is mapped to your keyboard as follows:

CHIP-8 Keypad Your Keyboard
โ”Œโ”€โ”ฌโ”€โ”ฌโ”€โ”ฌโ”€โ” โ”Œโ”€โ”ฌโ”€โ”ฌโ”€โ”ฌโ”€โ”
โ”‚1โ”‚2โ”‚3โ”‚Cโ”‚ โ†’ โ”‚1โ”‚2โ”‚3โ”‚4โ”‚
โ”œโ”€โ”ผโ”€โ”ผโ”€โ”ผโ”€โ”ค โ”œโ”€โ”ผโ”€โ”ผโ”€โ”ผโ”€โ”ค
โ”‚4โ”‚5โ”‚6โ”‚Dโ”‚ โ†’ โ”‚Qโ”‚Wโ”‚Eโ”‚Rโ”‚
โ”œโ”€โ”ผโ”€โ”ผโ”€โ”ผโ”€โ”ค โ”œโ”€โ”ผโ”€โ”ผโ”€โ”ผโ”€โ”ค
โ”‚7โ”‚8โ”‚9โ”‚Eโ”‚ โ†’ โ”‚Aโ”‚Sโ”‚Dโ”‚Fโ”‚
โ”œโ”€โ”ผโ”€โ”ผโ”€โ”ผโ”€โ”ค โ”œโ”€โ”ผโ”€โ”ผโ”€โ”ผโ”€โ”ค
โ”‚Aโ”‚0โ”‚Bโ”‚Fโ”‚ โ†’ โ”‚Zโ”‚Xโ”‚Cโ”‚Vโ”‚
โ””โ”€โ”ดโ”€โ”ดโ”€โ”ดโ”€โ”˜ โ””โ”€โ”ดโ”€โ”ดโ”€โ”ดโ”€โ”˜

๐Ÿ—๏ธ Architecture

The emulator follows a clean, modular architecture:

pkg/
โ”œโ”€โ”€ chip8/ # Core CHIP-8 system implementation
โ””โ”€โ”€ emulator/ # Ebiten game engine integration
internal/
โ”œโ”€โ”€ audio/ # Audio system and beep generation
โ”œโ”€โ”€ cpu/ # CPU registers and stack management
โ”œโ”€โ”€ display/ # Graphics buffer and rendering
โ”œโ”€โ”€ keys/ # Input handling
โ””โ”€โ”€ ram/ # Memory management and font data

๐ŸŽฏ Technical Specifications

  • Memory: 4KB RAM (0x000-0xFFF)
  • Display: 64x32 pixels, monochrome
  • CPU: 16 8-bit registers (V0-VF)
  • Stack: 16 levels for subroutines
  • Timers: 60Hz delay and sound timers
  • Clock Speed: ~540 Hz (configurable via -cycles-per-update)
  • Audio: 440Hz sine wave beep with configurable volume

๐Ÿ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.


Built with โค๏ธ in Go

About

Chip-8 emulator written in Go with the help of Ebiten

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

AltStyle ใซใ‚ˆใฃใฆๅค‰ๆ›ใ•ใ‚ŒใŸใƒšใƒผใ‚ธ (->ใ‚ชใƒชใ‚ธใƒŠใƒซ) /