Skip to content

A cycle accurate Nintendo Gameboy emulator with focus on code quality and readability

License

Notifications You must be signed in to change notification settings

CraftyChimera/GGBE

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

62 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

GGBE

Generic Game Boy Emulator, abbreviated as GGBE, is a cycle accurate Game Boy emulator which strives to not compromise code quality and readability for the sake of performance. This is a hobby project written as a learning opportunity to balance readability and performance.

In its current state, the emulator can run DMG games and some CGB games,i.e. it functions as a DMG emulator and a partial CGB emulator at the moment.

Working Games

[Alt text] Alt text Alt text Alt text Alt text Alt text Alt text Alt text Alt text Alt text Alt text Alt text Alt text Alt text Alt text Alt text

Running GGBE

Requirements:

  • A compiler which can compile C++17
  • SDL2 development libraries
  • CMake should be installed

Move to src directory using

cd src

The GGBE executable can be generated by running the following commands in terminal

chmod u+x run.sh
./run.sh

This should generate the build directory.

The emulator can then be launched by the following command

 ./build/GGBE <absolute-path-to-rom>/<relative-path-from-root>

For example if tetris.gb were in roms directory, the command

 ./build/GGBE roms/tetris.gb

should start up tetris.

The boot rom is taken from https://github.com/Hacktix/Bootix.

Key Mapping

Game Boy Key
Dpad Arrow Keys
A Z
B X
Select A
Start S

Project Structure

The Emulator is planned to be divided into 4 major components as of now:

  • CPU : Deals with everything related to instructions and interrupts.
  • GPU/PPU : Deals with everything related to getting pixels onto the screen
  • APU (work in progress) : Deals with everything related to Audio generation and Mixing
  • MMU : Takes care of Memory Mapping and Bank Switching

These components are represented as classes and are consolidated as member objects of a class Console, which represents the Console itself. This modular approach makes it easy to write and test code.

Test Suite

Blargg's tests

Test GGBE
cpu instrs 👍
dmg sound
instr timing 👍
mem timing 👍
mem timing 2 👍

Mooneye's tests

Timer

Test GGBE
div_write 👍
rapid_toggle 👍
tim00 div trigger 👍
tim00 👍
tim01 div trigger 👍
tim01 👍
tim10 div trigger 👍
tim10 👍
tim01 div trigger 👍
tim01 👍
tim11 div trigger 👍
tim11 👍
tima_reload 👍
tima_write_reloading 👍
tma_write_reloading 👍

MBC

MBC1

Test GGBE
bits bank1 👍
bits bank2 👍
bits mode 👍
bits ramg 👍
rom 512kb 👍
rom 1Mb 👍
rom 2Mb 👍
rom 4Mb 👍
rom 8Mb 👍
rom 16Mb 👍
ram 64kb 👍
ram 256kb 👍
multicart rom 8Mb

MBC2

Test GGBE
bits ramg 👍
bits romb 👍
bits unused 👍
rom 512kb 👍
rom 1Mb 👍
rom 2Mb 👍
ram 👍

MBC5

Test GGBE
rom 512kb 👍
rom 1Mb 👍
rom 2Mb 👍
rom 4Mb 👍
rom 8Mb 👍
rom 16Mb 👍
rom 32Mb 👍
rom 64Mb 👍

About

A cycle accurate Nintendo Gameboy emulator with focus on code quality and readability

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published