binji/pokegb

A gameboy emulator that only plays Pokemon Blue, in ~50 lines of c++.

C++

1,396

54 commits

updated Feb 12, 2024

See the code

README

pokegb

A gameboy emulator that only plays Pokemon Blue, in ~50 lines of c++.

See the technical write-up.

Features

Plays Pokemon Blue (and Red).

Screenshots

1 2 3 4 5 6 7 8 9 10 11

Source Code

Building

Only builds on Linux and macOS AFAIK.

$ make

On macOS, you'll need to create a save file too (just the first time):

$ make rom.sav

Running

Get a Pokemon Blue (or Pokemon Red) ROM file. The files that are known to work have the following sha1s:

Namesha1
Pokemon - Blue Version (USA, Europe) (SGB Enhanced).gbd7037c83e1ae5b39bde3c30787637ba1d4c48ce2
Pokemon - Red Version (USA, Europe) (SGB Enhanced).gbea9bcae617fdf159b045185467ae58b2e4a48b9a

Others might work too, but these are the ones that I've tried.

Rename the file to rom.gb and put it in the current directory. Then run:

$ ./pokegb

The save file is written to rom.sav.

Keys:

ActionKey
DPAD-UP↑
DPAD-DOWN↓
DPAD-LEFT←
DPAD-RIGHT→
BZ
AX
STARTEnter
SELECTTab

Updating keys

Look for line 24 the source. The following table shows which numbers map to which keyboard keys:

numberdefault keygameboy button
27XA Button
29ZB Button
43TabSelect Button
40ReturnStart Button
79Arrow RightDPAD Right
80Arrow LeftDPAD Left
81Arrow DownDPAD Down
82Arrow UpDPAD Up

Replace the numbers on this line with one from the SDL scancode list.

emulator
gameboy
obfuscated
pokemon

binji/pokegb

A gameboy emulator that only plays Pokemon Blue, in ~50 lines of c++.

C++

1,396

54 commits

updated Feb 12, 2024

See the code

README

pokegb

A gameboy emulator that only plays Pokemon Blue, in ~50 lines of c++.

See the technical write-up.

Features

Plays Pokemon Blue (and Red).

Screenshots

1 2 3 4 5 6 7 8 9 10 11

Source Code

Building

Only builds on Linux and macOS AFAIK.

$ make

On macOS, you'll need to create a save file too (just the first time):

$ make rom.sav

Running

Get a Pokemon Blue (or Pokemon Red) ROM file. The files that are known to work have the following sha1s:

Namesha1
Pokemon - Blue Version (USA, Europe) (SGB Enhanced).gbd7037c83e1ae5b39bde3c30787637ba1d4c48ce2
Pokemon - Red Version (USA, Europe) (SGB Enhanced).gbea9bcae617fdf159b045185467ae58b2e4a48b9a

Others might work too, but these are the ones that I've tried.

Rename the file to rom.gb and put it in the current directory. Then run:

$ ./pokegb

The save file is written to rom.sav.

Keys:

ActionKey
DPAD-UP↑
DPAD-DOWN↓
DPAD-LEFT←
DPAD-RIGHT→
BZ
AX
STARTEnter
SELECTTab

Updating keys

Look for line 24 the source. The following table shows which numbers map to which keyboard keys:

numberdefault keygameboy button
27XA Button
29ZB Button
43TabSelect Button
40ReturnStart Button
79Arrow RightDPAD Right
80Arrow LeftDPAD Left
81Arrow DownDPAD Down
82Arrow UpDPAD Up

Replace the numbers on this line with one from the SDL scancode list.

emulator
gameboy
obfuscated
pokemon

Significant stargazers

Mathias Bynens

13,084 followers · starred Jun 2021

Francesco Mazzoli

328 followers · starred May 2021

Aaron Lichtman

515 followers · starred Mar 2024

Amaury

446 followers · starred Jun 2021