Skip to content

pcineverdies/gameboy_emulator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

75 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Game Boy Color Emulator

It's been a while since I wanted to build a CGB emulator. It was a nice ride. This CGB emulator is retro-compatible with DMG (different hardware is emulated depending on the cartridge header). The accuracy of the emulator is not 100%, thus some games might crash.

Pictures

Pokemon Crystal The Legend of Zelda: The Oracle of Ages
Shantae Pokemon Blue (DMG compatibility)

How to compile

git clone https://github.com/pcineverdies/gameboy_emulator
cd gameboy_emulator
mkdir build
cd build
cmake .. [-DDEBUG=1] [-DPROFILE=1]
make

By adding the macro DEBUG, some debug information are displayed from the console. By adding the macro PROFILE, the binary is compiled so that gprof can be used for profiling.

How to use

./build/gameboy --rom ./path/to/rom [--fixed_fps]

The argument --rom path is required for the emulator to run.

The argument --fixed_fps is optional, and fixes the fps to ~59.7. This is done using audio synch, which means this is the only way to also enable audio in the emulator.

The argument --help shows an help message for usage.

During the game, the following keybiding is used

  • W -> Up
  • A -> Left
  • S -> Down
  • D -> Right
  • J -> A
  • K -> B
  • B -> Start
  • V -> Select
  • Q -> Quit emulator
  • P -> Volume up
  • O -> Volume down

The volume is on 11 levels (from 0% to 100%), the emulator starts with 100%.

Resources

What is currently missing

  • The PPU is implemented using scan-line, which is fine for 99.99% of the games. A proper FIFO PPU should be implemented to increase overall accuracy of the system.
  • The APU works while not passing the relative blargg tests. As the APU has many corner cases to be handled, this would require a bit of work.
  • Not all the MBCs are implemented (only NO-ROM, 1, 3 and 5).
  • Some general emulator capabilities (which are console-agnostic) are missing: there is no save state and no rewind.