trekawek / coffee-gb

Gameboy emulator in Java 8.
MIT License
1.11k stars 81 forks source link
emulator gameboy gameboy-emulator z80

Coffee GB

Coffee GB is a Gameboy Color emulator written in Java 8. It's meant to be a development exercise. More info can be found in the blog post Why did I spend 1.5 months creating a Gameboy emulator?

Coffee GB running game

Building

The emulator can be build with Maven:

mvn clean package

The coffee-gb-*-complete.jar executable file will be available in the ./target directory.

Usage

  1. Download the most recent release.
  2. Double-click the JAR or launch it with java -jar coffee-gb-*.jar command.
  3. Load a game.

Play with , , , , Z, X, Enter, Backspace.

Features

Running Blargg's tests

The Blargg's test ROMs are used for testing the compatibility. Tests can be launched from Maven using appropriate profile:

mvn clean test -Ptest-blargg
mvn clean test -Ptest-blargg-individual # for running "single" tests providing more diagnostic info

They are also part of the Travis-based CI.

The tests output (normally displayed on the Gameboy screen) is redirected to the stdout:

cpu_instrs

01:ok  02:ok  03:ok  04:ok  05:ok  06:ok  07:ok  08:ok  09:ok  10:ok  11:ok

Passed all tests

Coffee GB passes all the tests:

Mooneye tests

The Mooneye GB emulator comes with a great set of test ROMs. They can be used to test the Coffee GB as well. Use -Ptest-mooneye profile:

mvn clean test -Ptest-mooneye

Screenshots

Coffee GB running game Coffee GB running game Coffee GB running game Coffee GB running game Coffee GB running game Coffee GB running game Coffee GB running game Coffee GB running game Coffee GB running game Coffee GB running game

Key bindings

The default key bindings can be changed with the ~/.coffeegb.properties file. The file has following format:

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_BACK_SPACE

The key list can be found in the KeyEvent JavaDoc.

Resources