Classroom Glossary Public page

Week 5: Game Boy LR35902 Architecture

The Game Boy ran a Sharp LR35902, an 8-bit processor that overlaps with the Z80 but is not quite the Z80. This week you walk the open-source Game Boy core, trace a frame, and identify the LR35902-versus-Z80 instruction differences.


Reading

Lecture

Roughly three hours across two sessions. Key arc:

  • LR35902 register set. Compare to 6502 (Module 2) and to Z80 (briefly).
  • Game Boy memory map. ROM banks, VRAM, OAM, IO, HRAM, interrupts.
  • MBC1 versus MBC3 versus MBC5. Compare to NES MMC chips.
  • The Game Boy PPU. Different tile-and-sprite shape from the NES PPU.
  • Tracing a single frame in the community core: VRAM access pattern, LY counter, V-blank.

Lab pack

Lab Pack 5 traces a Game Boy core frame and documents the LR35902 vs Z80 differences. See Lab Pack 5: Game Boy Core Frame Trace.

Classroom tools

  • SameBoy or BGB for the cycle-accurate Game Boy debugger.
  • GBDK (Game Boy Development Kit) installed locally; the SETUP guide notes the install.
  • The community Game Boy core source mirrored in the student repo under cores/gb/.

Architecture comparison sidebar

The Game Boy LR35902 is 'a Z80 minus a few instructions plus a few additions.' This is the cousin-mapping discipline applied at the ISA level: same family, different choices. The point is to recognise the family resemblance and to be precise about the differences, which is the same skill RE-101 will ask you to apply to firmware variants of the SB6141.

Reflection prompts

  1. Name five LR35902 instructions that have no Z80 equivalent. Why did Sharp add them?
  2. Name five Z80 instructions the LR35902 dropped. Why did Sharp save the silicon?
  3. Compare the Game Boy's MBC1 to the NES's MMC1. The naming is parallel. Is the design parallel?

What is next

Module 6 picks up the 16-bit successor. The SNES 65C816 is a 16-bit extension of the 6502 family, and its PPU is a different shape from both NES and Game Boy.