Skip to content

Latest commit

 

History

24 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

zigboy logo

zigboy

Zig License Status

Game Boy emulator built from scratch in Zig. CPU, PPU, memory, and cartridge subsystems.

Running Pokemon

Build

zig build run

Requires Zig 0.13+.

Features

  • CPU emulation (Sharp LR35902 instruction set)
  • Memory management (VRAM, WRAM, HRAM, I/O registers)
  • Cartridge loading (ROM banks)
  • PPU (pixel processing, scanlines)
  • Sound (audio channels)
  • Input (joypad)
  • WebAssembly compilation target

Architecture

┌─────────────────────────────────────┐
│  CPU (Sharp LR35902)                │
│  • 8-bit registers (A,F,B,C,D,E,H,L)│
│  • 16-bit SP, PC                    │
│  • 512 opcodes + CB prefix          │
└──────────────┬──────────────────────┘
               │
┌──────────────▼──────────────────────┐
│  Memory (64KB address space)        │
│  • 0x0000-0x7FFF: ROM (cartridge)   │
│  • 0x8000-0x9FFF: VRAM (tiles)      │
│  • 0xC000-0xDFFF: WRAM              │
│  • 0xFF80-0xFFFE: HRAM              │
└──────────────┬──────────────────────┘
               │
┌──────────────▼──────────────────────┐
│  PPU (Picture Processing Unit)      │
│  • 160x144 LCD                      │
│  • Tile-based rendering             │
│  • 4 shades of gray                 │
└─────────────────────────────────────┘

References

Usage

Load a Game Boy ROM and run:

zig build run -- path/to/rom.gb

Compiles to WebAssembly for browser deployment.

License

MIT

About

Game Boy emulator built from scratch in Zig, CPU, PPU, memory, and cartridge subsystems

Resources

Stars

3 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages