Bring the Sharp LR35902 back to life. Each opcode, flag, and pixel comes with a spec checked against known-good values, so bugs surface the day you write them - not hours into a game. You finish with a working core that boots a real ROM into its main loop and draws the screen.
Over the next 60 lessons you'll build a working Game Boy core in the language of your choice, one small piece at a time. You start with the CPU's registers and memory, teach it arithmetic and the flags that make games behave, then layer on control flow, bit operations, and the cartridge, then interrupts, timing, and the picture-processing unit that draws a frame, filling in enough of the instruction set that a real cartridge boots and reaches its main loop, and finally wiring the picture and input through their hardware registers so the ROM's own graphics and controls come alive.
Every lesson is a single ~20-minute session anchored to a concrete spec with known-good values, and each lesson's code runs. What you end with is a genuine, runnable DMG core that executes nearly the full instruction set, boots a real cartridge, renders the background it chooses (scrolled, palettised) with its sprites, and responds to the buttons, not a polished emulator that plays any commercial game front to back. The “Scope & extensions” section below is honest about where it stops and what to build next.
Today you build the CPU's register file, the eight one-byte slots that hold every value the processor works with. Every instruction you write for the rest of the project reads from and writes to these registers, so getting the container right first makes everything after it trivial.
Build a register file that stores and returns a single byte in any of the CPU's eight registers.
The heart of the Game Boy is the Sharp LR35902, an 8-bit CPU. Everything it
does flows through eight one-byte registers named A, B, C, D, E,
F, H, and L. A is the accumulator - most arithmetic lands there -
and F holds status flags we will meet on lesson 5. The rest are general
scratch space.
A register is just a byte of storage: you write a value in and read the same value back. Start here because every instruction you write for the rest of the project will move data into and out of these eight slots. Getting the container right first makes all of that trivial.
// eight 8-bit registers, all starting at zerotype Registers struct {A, B, C, D, E, F, H, L uint8}r := &Registers{}r.A = 0x12
The DMG CPU has eight 8-bit registers. Any "Game Boy CPU manual" register summary covers them.
Far more than a boot-loop core: the CPU opcode table is essentially complete, and the picture now scrolls and palettises with live sprites while the controller answers input and the timer and joypad raise their interrupts. It still stops short of a general-purpose Game Boy, there is no LCD STAT or window layer, no sprite priority or 8x16 mode, no OAM DMA, only MBC1, and no sound. Those are the next climb, not the core.
The community-maintained technical reference for Game Boy hardware - the closest thing to an official spec.
Every opcode with its operands, flag effects, and cycle counts laid out on a single page.
A 33c3 conference talk covering the CPU, PPU, and memory map end to end, the best single overview of the hardware.
Cycle-accurate test ROMs used to verify CPU and timing correctness against real hardware behavior.
The long-standing test suite for CPU instruction and timing correctness that most emulator projects validate against.