All Projects → geaz → emu-gameboy

geaz / emu-gameboy

Licence: MIT license
A Gameboy emulator written in C++

Programming Languages

C++
36643 projects - #6 most used programming language
c
50402 projects - #5 most used programming language

Projects that are alternatives of or similar to emu-gameboy

Goboy
Multi-platform Nintendo Game Boy Color emulator written in Go
Stars: ✭ 2,403 (+4269.09%)
Mutual labels:  gameboy, gameboy-emulator
Gbemu
WebAssembly based Gameboy Emulator
Stars: ✭ 120 (+118.18%)
Mutual labels:  gameboy, gameboy-emulator
Cryboy
A Game Boy (Color) emulator written in Crystal
Stars: ✭ 68 (+23.64%)
Mutual labels:  gameboy, gameboy-emulator
Mgba
mGBA Game Boy Advance Emulator
Stars: ✭ 3,355 (+6000%)
Mutual labels:  gameboy, gameboy-emulator
Awesome Gbdev
Contribute
Stars: ✭ 3,016 (+5383.64%)
Mutual labels:  gameboy, gameboy-emulator
Coffee Gb
Gameboy emulator in Java 8.
Stars: ✭ 953 (+1632.73%)
Mutual labels:  gameboy, gameboy-emulator
Jitboy
A Game Boy emulator with dynamic recompilation (JIT)
Stars: ✭ 190 (+245.45%)
Mutual labels:  gameboy, gameboy-emulator
Mooneye Gb
A Game Boy research project and emulator written in Rust
Stars: ✭ 557 (+912.73%)
Mutual labels:  gameboy, gameboy-emulator
Metroboy
MetroBoy - A playable, circuit-level simulation of an entire Game Boy
Stars: ✭ 169 (+207.27%)
Mutual labels:  gameboy, gameboy-emulator
Gbemu
A Gameboy emulator in modern C++
Stars: ✭ 149 (+170.91%)
Mutual labels:  gameboy, gameboy-emulator
Binjgb
Gameboy emulator implemented in C
Stars: ✭ 222 (+303.64%)
Mutual labels:  gameboy, gameboy-emulator
RGB
RGB (Rust Game Boy) is a simple emulator for the original game boy
Stars: ✭ 19 (-65.45%)
Mutual labels:  gameboy, gameboy-emulator
Vba M Nx
WIP full featured port of VBA-M for Nintendo Switch
Stars: ✭ 11 (-80%)
Mutual labels:  gameboy, gameboy-emulator
Wasmboy
Game Boy / Game Boy Color Emulator Library, 🎮written for WebAssembly using AssemblyScript. 🚀Demos built with Preact and Svelte. ⚛️
Stars: ✭ 963 (+1650.91%)
Mutual labels:  gameboy, gameboy-emulator
Gameboy
🎮 Game Boy emulator written in Rust
Stars: ✭ 17 (-69.09%)
Mutual labels:  gameboy, gameboy-emulator
Gopher Boy
🎮 A Game Boy emulator written in Go
Stars: ✭ 206 (+274.55%)
Mutual labels:  gameboy, gameboy-emulator
Worldwide
GameBoy Color emulator written in golang.
Stars: ✭ 300 (+445.45%)
Mutual labels:  gameboy, gameboy-emulator
Gearboy
Game Boy / Gameboy Color emulator for iOS, macOS, Raspberry Pi, Windows, Linux and RetroArch.
Stars: ✭ 528 (+860%)
Mutual labels:  gameboy, gameboy-emulator
Giibiiadvance
A GB, GBC and GBA emulator with GB Camera support.
Stars: ✭ 141 (+156.36%)
Mutual labels:  gameboy, gameboy-emulator
ostrich
A Game Boy Sound System player for macOS, written in Swift
Stars: ✭ 37 (-32.73%)
Mutual labels:  gameboy, gameboy-emulator

GGB - A Game Boy emulator written in C++

Compatibility

It is not intended to provide a full compatibility for all available cartridges or games. For example: I just did a naive bank switching implementation without ROM handling. Just enought to run Blarggs CPU test rom.

This is a programming experience project and it does not aim to be a daily use emulator to play with. Use other great emulators for this purpose. For example:

Screenshots

GGB

Zelda Tetris Tennis
Zelda Tetris Tennis
Blargg CPU Test Blargg Instr Timing
cpu_instrs instr_timing

Aims

Primary aims were:

  • get a common understanding of emulation and the interaction of the components
  • learn a bit about sound programming by implementing the APU

Further more I wanted to get the CPU to do its work correctly, but I did not want to get it as accurate as possible. Thats why this emulator uses a rather simple cycle count method to keep the components in sync (Components syned after each instruction). Which should be enough for most cases. There are more accurate methods like described here.

I also tried to get the timer implementation to behave like the real hardware. Most of the behaviours described in The Cycle-Accurate Game Boy Docs are working, passing most of Mooneyes Timer Tests. In contrast to other implementations, I let the timer use the correct internal clock in memory to increase the TIMA and DIV.

Given it was my first time doing sound programming, the APU works quite well, but not perfect.

Controls

SPACE = Select
ENTER = Start
Z = B
X = A
DIRECTIONS = Arrow Keys

P = Pause/Play
N = Next instruction
D = Open Debugger

Opcode Generator

After I started this project I used this table to create my opcode classes. Pretty fast I was frustrated by this tedious task. Therefore I created a python script to automate it. The script genOpcodes.py, in the gen folder, scrapes the table and creates C++ classes by using the templates in the gen/templates folder. By using this script I got great frame classes to work in.

The top instruction_set class contains two maps including all the different opcodes.

WARNING:

The Pastraiser OpCode Table has a few bugs. 0xE2 and 0xF2 are only one byte long! The Carry Flag indicator for the Right Shifting operations seems to be wrong, too. CBxBit 16 Bit operations are only 12 cycles, not 16! Just use this more accurate table by izik1, if you need it!

instruction_set

Furthermore the script creates frame classes for all opcode groups.

gen-group

Instruction struct

The top instruction_set class contains two arrays. Including all opcodes.

typedef uint8_t (*OpcodeFunc)(Cpu*);
struct Instruction
{
    uint8_t length;                 // Byte Length of the Instruction
    char* mnemonic;                 // Mnemonic of the Instruction
    OpcodeFunc executeInterpreter;  // Function Pointer to execute interpreter mode for given opcode
};

Ressources

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].