Skip to content

BlagoGunev/GBEmu

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

44 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Gameboy Emulator

Gameboy Emulator written in C, based on Low Level Devel's tutorials on YouTube. Tested and working on Fedora Linux, but should also be compatible with most other distros.

Progress

  • CPU Instruction set
  • CPU Interrupts
  • Timers
  • DMA
  • LCD
  • PPU
  • Gamepad

Rendered output

Building instructions

You will need the following build packages:

  • gcc
  • cmake
  • check
  • sdl2-compat
  • SDL2_ttf

To install all the necessary packages use the following command on Fedora Linux:

sudo dnf install -y gcc cmake sdl2-compat-devel SDL2_ttf-devel check-devel

To build the project, go into the code directory. From there

mkdir build
cd build
cmake ..
make

Using the emulator

To run the emulator from the build directory, use the following command:

gbemu/gbemu <path-to-rom-file>

In the roms directory are provided ROMs used for testing.

Folder structure

.
β”œβ”€β”€ code
β”‚Β Β  β”œβ”€β”€ cmake
β”‚Β Β  β”‚Β Β  β”œβ”€β”€ config.h.in
β”‚Β Β  β”‚Β Β  β”œβ”€β”€ COPYING-CMAKE-SCRIPTS.txt
β”‚Β Β  β”‚Β Β  β”œβ”€β”€ FindCheck.cmake
β”‚Β Β  β”‚Β Β  └── sdl2
β”‚Β Β  β”‚Β Β      β”œβ”€β”€ Copyright.txt
β”‚Β Β  β”‚Β Β      β”œβ”€β”€ FindSDL2.cmake
β”‚Β Β  β”‚Β Β      β”œβ”€β”€ FindSDL2_gfx.cmake
β”‚Β Β  β”‚Β Β      β”œβ”€β”€ FindSDL2_image.cmake
β”‚Β Β  β”‚Β Β      β”œβ”€β”€ FindSDL2_mixer.cmake
β”‚Β Β  β”‚Β Β      β”œβ”€β”€ FindSDL2_net.cmake
β”‚Β Β  β”‚Β Β      β”œβ”€β”€ FindSDL2_ttf.cmake
β”‚Β Β  β”‚Β Β      └── README.md
β”‚Β Β  β”œβ”€β”€ CMakeLists.txt
β”‚Β Β  β”œβ”€β”€ gbemu
β”‚Β Β  β”‚Β Β  β”œβ”€β”€ CMakeLists.txt
β”‚Β Β  β”‚Β Β  └── main.c
β”‚Β Β  β”œβ”€β”€ include
β”‚Β Β  β”‚Β Β  β”œβ”€β”€ bus.h
β”‚Β Β  β”‚Β Β  β”œβ”€β”€ cart.h
β”‚Β Β  β”‚Β Β  β”œβ”€β”€ common.h
β”‚Β Β  β”‚Β Β  β”œβ”€β”€ cpu.h
β”‚Β Β  β”‚Β Β  β”œβ”€β”€ dbg.h
β”‚Β Β  β”‚Β Β  β”œβ”€β”€ dma.h
β”‚Β Β  β”‚Β Β  β”œβ”€β”€ emu.h
β”‚Β Β  β”‚Β Β  β”œβ”€β”€ instructions.h
β”‚Β Β  β”‚Β Β  β”œβ”€β”€ interrupts.h
β”‚Β Β  β”‚Β Β  β”œβ”€β”€ io.h
β”‚Β Β  β”‚Β Β  β”œβ”€β”€ ppu.h
β”‚Β Β  β”‚Β Β  β”œβ”€β”€ ram.h
β”‚Β Β  β”‚Β Β  β”œβ”€β”€ stack.h
β”‚Β Β  β”‚Β Β  β”œβ”€β”€ timer.h
β”‚Β Β  β”‚Β Β  └── ui.h
β”‚Β Β  β”œβ”€β”€ lib
β”‚Β Β  β”‚Β Β  β”œβ”€β”€ bus.c
β”‚Β Β  β”‚Β Β  β”œβ”€β”€ cart.c
β”‚Β Β  β”‚Β Β  β”œβ”€β”€ CMakeLists.txt
β”‚Β Β  β”‚Β Β  β”œβ”€β”€ cpu.c
β”‚Β Β  β”‚Β Β  β”œβ”€β”€ cpu_fetch.c
β”‚Β Β  β”‚Β Β  β”œβ”€β”€ cpu_proc.c
β”‚Β Β  β”‚Β Β  β”œβ”€β”€ cpu_util.c
β”‚Β Β  β”‚Β Β  β”œβ”€β”€ dbg.c
β”‚Β Β  β”‚Β Β  β”œβ”€β”€ dma.c
β”‚Β Β  β”‚Β Β  β”œβ”€β”€ emu.c
β”‚Β Β  β”‚Β Β  β”œβ”€β”€ instructions.c
β”‚Β Β  β”‚Β Β  β”œβ”€β”€ interrupts.c
β”‚Β Β  β”‚Β Β  β”œβ”€β”€ io.c
β”‚Β Β  β”‚Β Β  β”œβ”€β”€ ppu.c
β”‚Β Β  β”‚Β Β  β”œβ”€β”€ ram.c
β”‚Β Β  β”‚Β Β  β”œβ”€β”€ stack.c
β”‚Β Β  β”‚Β Β  β”œβ”€β”€ timer.c
β”‚Β Β  β”‚Β Β  └── ui.c
β”‚Β Β  β”œβ”€β”€ NotoSansMono-Medium.ttf
β”‚Β Β  └── tests
β”‚Β Β      β”œβ”€β”€ check_gbe.c
β”‚Β Β      └── CMakeLists.txt
β”œβ”€β”€ docs
β”‚Β Β  β”œβ”€β”€ gbctr.pdf
β”‚Β Β  └── The Cycle-Accurate Game Boy Docs.pdf
β”œβ”€β”€ .gitignore
β”œβ”€β”€ Readme.md
└── roms
    β”œβ”€β”€ 01-special.gb
    β”œβ”€β”€ 02-interrupts.gb
    β”œβ”€β”€ 03-op sp,hl.gb
    β”œβ”€β”€ 04-op r,imm.gb
    β”œβ”€β”€ 05-op rp.gb
    β”œβ”€β”€ 06-ld r,r.gb
    β”œβ”€β”€ 07-jr,jp,call,ret,rst.gb
    β”œβ”€β”€ 08-misc instrs.gb
    β”œβ”€β”€ 09-op r,r.gb
    β”œβ”€β”€ 10-bit ops.gb
    β”œβ”€β”€ 11-op a,(hl).gb
    β”œβ”€β”€ cpu_instrs.gb
    β”œβ”€β”€ dmg-acid2.gb
    └── mem_timing.gb

10 directories, 68 files

About

Gameboy Emulator written in C

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published