Skip to content

PortableBaka/chip8-emulator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CHIP-8 Emulator

A CHIP-8 emulator written in Rust.

Features

  • Full CHIP-8 instruction set
  • 64×32 display rendered with pixels + winit
  • 440 Hz beep audio via rodio
  • 60 Hz frame loop with 10 CPU cycles per frame
  • Standard QWERTY → CHIP-8 hex keypad mapping

Requirements

  • Rust (stable)

Build & Run

cargo build --release
cargo run --release -- path/to/rom.ch8

Pass the path to any .ch8 ROM file as the first argument.

Keyboard Layout

The original CHIP-8 used a 16-key hex keypad. This emulator maps it to QWERTY as follows:

QWERTY CHIP-8
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

Architecture

File Purpose
src/chip8.rs Core emulator — CPU, memory, display, timers
src/utils.rs Opcode nibble extraction helpers
src/main.rs Window setup, event loop, audio, key mapping

Memory layout:

  • 0x000–0x04F: Reserved
  • 0x050–0x09F: Built-in fontset (digits 0–F)
  • 0x200–0xFFF: ROM + program memory

Implementation notes:

  • op_store_regs / op_load_regs do not increment I (modern CHIP-8 behaviour)
  • RNG uses a simple LCG — no external rand crate
  • Timers decrement once per frame (tied to the 60 Hz loop, not a separate 60 Hz tick)

ROMs

This repository does not include any ROMs. The included Breakout.ch8 ROM used during development is not mine — it was sourced from the internet. Many public-domain CHIP-8 ROMs are available at places like chip8Archive or Zophar's Domain.

You can load any compatible .ch8 file by passing its path on the command line.

License

MIT

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages