Learning Low-Level Computing and C++ by Making a Game Boy Emulator (opens in new tab)

I’ve decided to split this blog post into four main sections - “The Why”, “The How”, “What’s Missing” and “What’s Next”. If you just want to see the source code and get your hands dirty with GameByte, click here to go to the GitHub repo.

The Why

I have always been fascinated by the vast amounts of open-source projects that dive deep into the nitty-gritty of hardware and software. Things like the LEGO Island decompilation project and especially the Bad Update exploit for Xbox 360 and its associated further efforts to open the (sort of) softmodding floodgates for the Xbox 360 (shoutout to my homie InvoxiPlayGames!). The passion and drive behind these projects is something I’ve always admired, and I’ve always wanted to be a part of it in some way, shape or form. Problem is, I had a shoddy background on how low-level computing works or how to use lower-level languages like C and C++, despite working on various pieces of code for years at this point using languages like C#, Golang and JavaScript/TypeScript. Therefore, I set out to learn through what is, in my opinion, the best method: actually making a small project that needs these skills.

In this vein, I decided that an emulator would be a cool end result for a project and a goal that would keep me motivated, while also allowing me to learn some low-level computing skills AND begin learning how to use C++ at the same time. This seemed like a win-win to me! I specifically decided on the original Game Boy as the piece of hardware to emulate because not only is it extremely well documented, especially compared to many other game consoles, but it is also a piece of hardware that is very easy to emulate in comparison to other consoles as well.

The How

The (barely) beginnings

I initially started this project back in June 2025. I did some initial research mainly using Pan Docs as my guide on the Game Boy’s hardware, alongside a great blog post by CTurt where he describes the creation of his very own C-based minimal Game Boy emulator. I started with only a very basic CMakeLists.txt, and started a small amount of boilerplating, such as adding variables to represent the Game Boy CPU’s registers and basic functions to handle the Game Boy’s 16-bit register pairs, which are made up of a pairing of two 8-bit registers.

// A small sampling of the initial cpu.cpp file.
class CPU {
public:
// 8-bit general purpose registers
uint8_t a, b, c, d, e, h, l;

// Flag register
uint8_t f;

// 16-bit registers
uint16_t sp; // Stack pointer
uint16_t pc; // Program counter

/**
* Getter/setter methods for 16-bit register pairs
*/

Loading more...

Keyboard Shortcuts

Navigation
Next / previous item
j/k
Open post
oorEnter
Preview post
v
Post Actions
Love post
a
Like post
l
Dislike post
d
Undo reaction
u
Save / unsave
s
Recommendations
Add interest / feed
Enter
Not interested
x
Go to
Home
gh
Interests
gi
Feeds
gf
Likes
gl
History
gy
Changelog
gc
Settings
gs
Browse
gb
Search
/
General
Show this help
?
Submit feedback
!
Close modal / unfocus
Esc

Press ? anytime to show this help