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.
Pokemon Crystal | The Legend of Zelda: The Oracle of Ages |
---|---|
Shantae | Pokemon Blue (DMG compatibility) |
---|---|
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.
./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
-> UpA
-> LeftS
-> DownD
-> RightJ
-> AK
-> BB
-> StartV
-> SelectQ
-> Quit emulatorP
-> Volume upO
-> Volume down
The volume is on 11 levels (from 0% to 100%), the emulator starts with 100%.
- gbops, an accurate opcode table for the Game Boy;
- The EmuDev subreddit and the discord server;
- This DAA instruction write-up;
- This HALT-bug write-up;
- Gameboy-doctor, to run blargg tests before the display was active;
- This timer write-up;
- This PPU write-up;
- This APU write-up
- 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.