Coffee GB

July 23, 2026 · View on GitHub

A highly compatible Game Boy and Game Boy Color emulator for the desktop.

Java CI Latest release MIT License

Coffee GB running Tetris DX

Coffee GB emulates the original Game Boy (GB/DMG) and Game Boy Color (GBC/CGB). It is built for high compatibility across the historic game library, unusual cartridges and accessories, and modern homebrew, demos, and diagnostic ROMs. The reusable emulation core is written in Java; the desktop application and its orchestration layer use Kotlin and Java.

Download and play

Coffee GB is distributed as a single executable JAR. It requires a desktop Java 16 or newer runtime; Java 21 LTS is recommended and is the version used by CI and release builds.

  1. Download the JAR from the latest Coffee GB release.

  2. Open it through your desktop's Java launcher, or start it from a terminal:

    java -jar coffee-gb-VERSION.jar
    
  3. Choose File > Load ROM, or pass a ROM on the command line:

    java -jar coffee-gb-VERSION.jar path/to/game.gb
    

ROMs are not included. Coffee GB accepts .gb, .gbc, and .rom files, as well as ZIP and 7z archives containing a ROM. On macOS, game-controller support also requires SDL2 (brew install sdl2); keyboard input works without it.

For netplay, one player chooses Link > Start server and the other chooses Link > Connect to server.

Default controls

ActionKey
D-padArrow keys
A / BZ / X
Start / SelectEnter / Shift
PauseSpace
Save / load stateF5 / F7
RewindHold Backspace

In single-player mode, there are ten save-state slots. Battery saves (.sav) and save states (.sn0.sn9) are stored next to the ROM. Pause, save states, and rewind are disabled during netplay.

Custom keyboard mapping

Edit ~/.coffeegb.properties and use KeyEvent constant names:

btn_up=VK_UP
btn_down=VK_DOWN
btn_left=VK_LEFT
btn_right=VK_RIGHT
btn_a=VK_Z
btn_b=VK_X
btn_start=VK_ENTER
btn_select=VK_SHIFT

Features

  • Systems: full DMG and CGB emulation, plus Super Game Boy borders and palettes.
  • Hardware-focused accuracy: a cycle-stepped CPU and high-accuracy PPU, APU, timer, DMA, serial, and infrared behavior.
  • Everyday play: battery-backed saves, ten save-state slots, pause/reset, hold-to-rewind, recent ROMs, and ZIP/7z archive loading.
  • Rollback netplay: TCP multiplayer for link-cable games, with local rollback hiding normal network latency and synchronized infrared communication.
  • Broad cartridge support: MBC1/1M, MBC2, MBC3 with RTC and MBC30, MBC5, MBC6 with flash, MBC7 with EEPROM/accelerometer, MMM01, HuC1, HuC3, TAMA5, Pocket Camera, and numerous unlicensed and multicart mappers.
  • Accessories: webcam-backed Game Boy Camera, Game Boy Printer with PNG export, Barcode Boy, Full Changer infrared, Datel Action Replay pass-through, cartridge rumble, and tilt input.
  • Desktop controls and display: keyboard and game-controller input, scaling, rotation, grayscale, CGB color correction, LCD ghosting, and an SGB-border toggle.
  • Cheats: Game Genie and GameShark codes, plus a bundled searchable libretro cheat database.

Compatibility

Compatibility is a defining feature of Coffee GB. Its test profiles exercise 5,696 automated verdicts from 16 suite families, covering all popular Game Boy and Game Boy Color test suites, and every verdict passes. Coffee GB also earns the maximum score in GBEmulatorShootout.

Compatibility status: all popular GB/GBC test suites pass, and every exact-reference image suite is pixel-perfect: both Acid2 tests, CGB-ACID-HELL, Strikethrough, all four CasualPokePlayer tests, and all 24 Mealybug Tearoom tests.

Test suiteCases exercisedCurrent result
Blargg5454 / 54 pass*
Mooneye Test Suite130130 / 130 selected cases pass
RTC3Test33 / 3 menus pass
SameSuite7171 / 71 later-revision cases pass
Gambatte HWTests4,6744,674 / 4,674 canonical DMG/CGB verdicts match hardware
BullyGB22 / 2 DMG and CGB cases pass
MBC30Test11 / 1 ROM banking and SRAM case passes
GBEmulatorShootout - specific tests9Maximum score; 8 / 8 images and the ROM+RAM test pass
DMG-ACID2 and CGB-ACID222 / 2 are pixel-perfect
CGB-ACID-HELL11 / 1 is pixel-perfect
Strikethrough11 / 1 is pixel-perfect
CasualPokePlayer test ROMs44 / 4 are pixel-perfect
Mealybug Tearoom2424 / 24 are pixel-perfect
GBMicrotest482482 / 482 machine-readable verdicts pass; 31 additional diagnostics are inventoried but have no automated verdict
gbc-hw-tests221221 / 221 selected hardware-reference verdicts match exactly
Misc.-GB-Tests1717 / 17 pass verdicts match
Total5,6965,696 / 5,696 automated verdicts pass

* Blargg's aggregate and individual checks overlap by design.

How strict compatibility results are interpreted

Every automated case must produce its documented pass value, match its selected external hardware reference, or satisfy its upstream image oracle. Daid uses the shootout suite's luminance tolerance; CGB-ACID-HELL, Strikethrough, CasualPokePlayer, Acid2, and Mealybug are compared pixel for pixel with their upstream references. All 4,674 Gambatte model cases match their canonical hardware verdicts. Source revisions, archive membership, and selected hardware models or ROM revisions are fixed for reproducibility. GBMicrotest's 31 non-verdict diagnostics are inventoried but are not included in the 5,696 exercised cases because they provide no machine-readable pass/fail result.

Running the exhaustive Gambatte profile

The profile evaluates all 4,674 canonical hexadecimal DMG/CGB verdicts from 3,077 ROMs with two parameter workers by default in a test JVM capped at 1 GiB. It passes only when every case matches hardware:

mvn clean test -f core/pom.xml -Ptest-gambatte-hw

For bounded local runs, set both gambatte.batchCount and the zero-based gambatte.batchIndex. Every index must run; batching partitions the hardware-verdict matrix and does not suppress failures:

mvn test -f core/pom.xml -Ptest-gambatte-hw \
  -Dgambatte.batchCount=64 -Dgambatte.batchIndex=0

AI-assisted compatibility work

Since 2026, Coffee GB has used AI coding agents as compatibility research tools. A purpose-built controller.Agent API lets an agent run a ROM headlessly under scripted control, inject input, capture frames and audio, inspect registers and memory, and disassemble execution without driving the desktop UI.

The working loop is deliberately evidence-based:

  1. Reproduce a reported problem with scripted input and capture the first point where emulation diverges.
  2. Diagnose it against hardware-backed test ROMs, hardware captures, schematics, and targeted comparisons with reference emulators.
  3. Make a focused change, add a regression test where practical, and run the focused checks; CI runs the full compatibility matrix before merge.

This makes AI useful for exploring difficult timing and cartridge edge cases, while hardware evidence, automated tests, and maintainer review remain the standard for correctness.

Project history

Coffee GB began as a six-week deep dive into how a small computer works. The 2017 origin story covers the CPU, pixel pipeline, audio, early compatibility testing, and first GBC implementation. The later rollback-netplay article explains how per-frame snapshots made high-latency link play practical.

DateMilestone
31 Dec 2016The project starts.
14 Jan 2017The first playable version runs Tetris, two weeks after the initial commit.
5–7 Feb 2017Game Boy Color support lands with double-speed mode, banked RAM/VRAM, color graphics, and the GBC boot path.
22 Dec 2017Coffee GB 1.0.0 is released.
29 Feb 2024Save-state support is added.
Jul 2025Fast mementos enable rollback netplay, released in 1.5.0.
Aug 2025Super Game Boy borders and palettes arrive alongside command support and predefined game palettes.
Feb 2026The headless agent interface begins the AI-assisted compatibility workflow.

Architecture

Coffee GB is a Maven reactor with three modules. The dependency flow is swingcontrollercore; the desktop module also uses the core directly.

ModuleRoleDepends on
coreReusable Java emulation engine: CPU, graphics, audio, memory, cartridges, serial/IR, SGB, and peripherals.
controllerKotlin orchestration: sessions, timing, save states, rewind, rollback history, and networking.core
swingKotlin/Java desktop UI, video/audio/input adapters, webcam and printer integration, and executable-JAR packaging.controller, core

The root pom.xml defines the reactor and shared build configuration.

Build from source

Use a JDK 16 or newer and Maven to build. JDK 21 is recommended and is used by CI.

git clone https://github.com/trekawek/coffee-gb.git
cd coffee-gb
mvn clean package

The executable fat JAR is created in swing/target/. On a development snapshot, run it with:

java -jar swing/target/coffee-gb-*-SNAPSHOT.jar

Kudos

Special thanks to @ScottNash042, whose thorough compatibility testing, hard-to-find edge-case reports, and thoughtful feature proposals have provided enormous value to Coffee GB.

Coffee GB also owes a great deal to the Game Boy hardware research community and to the authors of every test suite linked above.

License

Coffee GB is available under the MIT License.