The skills you built on the NES transfer. The 6502 does not. This week you boot Game Boy and SNES ROMs, find their headers, and see what changes when the CPU is a Z80-style chip or a 65816 instead of a 6502.
Theme
The NES was not the only console of its era. Nintendo's own Game Boy (1989) used a Sharp LR35902 CPU (a chip very similar to the Zilog Z80; some people call it Z80-like, some call it 8080-like, the truth is in between). Nintendo's Super NES (1990) used a Western Design Center 65816, a 6502 designed to address 16 megabytes of memory and run 16-bit operations alongside the original 8-bit instructions.
This week you boot a Game Boy ROM in SameBoy and a SNES ROM in bsnes-plus. You find their headers (different from the NES's INES format, but the same idea of "structured prefix bytes"). You use each emulator's debugger to read a few instructions of game code. You see how the ROM-hacking loop from week 4 transfers: the bytes are different, but the steps are the same.
The week's purpose is not to teach you Z80 or 65816 assembly to fluency (that would take months). The purpose is to show you that ROM hacking generalizes: once you have the skill set for one platform, you can pick up another in days, not months.
Reading list (~60 minutes)
- Pan Docs ("Game Boy Programming Manual" community translation) at
gbdev.io/pandocs/, the canonical Game Boy technical reference. Read the introduction and the "Memory map" section. - SNES Development Wiki: "SNES memory map" at
wiki.superfamicom.org/memory-mapping, the SNES's memory layout. The SNES is more complex than the NES; reading the memory map will give you a flavor of why. - 6502.org "65816 introduction" at
6502.org/tutorials/65c816opcodes.html, a short introduction to the 65816 (the SNES CPU). Note how many instructions are inherited directly from the 6502.
Lecture outline (~1.5 hours)
Section 1: Game Boy, what changed from NES?
- CPU: Sharp LR35902 (Z80-like) instead of 6502 Ricoh 2A03. Different instruction set; similar simplicity (around 500 opcodes in a Z80-derived ISA vs 6502's 256-opcode space, but the working subset is comparable in size)
- Graphics: tile-based like the NES, but with a different PPU architecture and a smaller screen (160x144 vs NES's 256x240)
- Sound: 4 audio channels (2 pulse, 1 wave, 1 noise) similar in spirit to the NES APU but at a smaller scale
- ROM format: Game Boy ROMs start with a 0x150-byte header at the start of the file. Bytes 0x100-0x103 are the entry point; bytes 0x104-0x133 are the Nintendo logo (which the boot ROM verifies); bytes 0x134-0x143 are the game title; bytes 0x14D is a checksum the boot ROM verifies
- The Nintendo logo check: legendarily, the Game Boy's boot ROM verifies that the cartridge contains the Nintendo logo bytes correctly. This was Nintendo's anti-piracy measure: anyone selling unauthorized Game Boy cartridges had to include the Nintendo logo, which Nintendo could then sue them over as trademark infringement. The logo is in your ROM right now, between offsets 0x104 and 0x133
Section 2: SNES, what changed from NES?
- CPU: WDC 65816 (often called "65C816" or "65816") instead of 6502. The 65816 is a 16-bit successor to the 6502; it runs in two modes ("emulation mode" where it acts like a 6502, and "native mode" where it has 16-bit registers and instructions). SNES games run in native mode after a brief emulation-mode bootstrap
- Memory: up to 16 MB addressable (vs the 6502's 64 KB)
- Graphics: a much more capable PPU with 8 background layers, hardware sprite scaling and rotation, color math
- ROM format: SNES ROMs have a header at one of two possible offsets (LoROM at 0x7FB0, HiROM at 0xFFB0). The header is 32 bytes; bytes 0-20 are the game title; bytes 21-23 are mapping mode and ROM type; bytes 28-29 are a checksum
Section 3: What transfers from week 4?
- The ROM-hacking loop (identify byte; copy ROM; change byte; verify)
- The hex editor skills (navigation, search, byte editing)
- The "always make a copy of the original" discipline
- The "find sprites in graphics data" instinct (the formats differ but the idea is the same)
- The patience to track down what byte controls what behavior
Section 4: What does NOT transfer?
- The 6502 assembly knowledge (Z80 / 65816 use different opcodes)
- The INES header layout (Game Boy and SNES headers are entirely different)
- The PPU pattern table layout (tile encoding differs across platforms)
- Mesen's specific debugger UI (SameBoy and bsnes-plus have their own debuggers with their own conventions)
- The CHR-ROM / PRG-ROM split (Game Boy and SNES integrate code and graphics differently)
Section 5: Why three platforms?
- The course covers NES (Mesen), Game Boy (SameBoy), and SNES (bsnes-plus) on purpose. Each platform is a slightly different point in the design space of 1980s and early-1990s game hardware
- After the course you will have seen three distinct CPU families (6502, Z80-derived, 65816), three distinct PPU architectures, three distinct ROM formats
- This gives you the "I can pick up a new platform" instinct. The skill is generalizable; the specifics are platform-by-platform
- CSA-101 builds on this generalization: you will see RV32I-Lite (a RISC-V variant), and you will recognize that RISC-V is "another point in the design space" rather than "a totally new thing you have to start from scratch on"
Labs (~4 hours)
Two labs this week.
Lab 5.1: Boot a Game Boy ROM in SameBoy and find the header (labs/lab-5-1-gameboy-header.md)
- Goal: Install SameBoy; download a Game Boy homebrew ROM; boot it; open the ROM in your hex editor; identify the Nintendo logo bytes, the game title bytes, the entry-point bytes
- Time: ~90 minutes
- Artifact: annotated screenshot of the Game Boy ROM's first 0x150 bytes with the key fields labeled
Lab 5.2: Boot a SNES ROM in bsnes-plus and read the header (labs/lab-5-2-snes-header.md)
- Goal: Install bsnes-plus; download a SNES homebrew ROM; boot it; locate the SNES header (LoROM or HiROM offset); decode the game title and mapping mode bytes
- Time: ~90 minutes
- Artifact: annotated screenshot of the SNES ROM's header bytes with each field labeled; a note in your journal saying which mapping mode (LoROM or HiROM) the ROM uses
Tier-1 companion (re-encounter from Week 4): Bitplane Decomposer Workout (worksheets/spk-101/lab-bitplane-decomposer.md)
- The same NES-format worksheet introduced in Week 4. If you skipped it then, do it now: the Game Boy's 2-plane layout is structurally identical (1 bit each, low + high) and the same
Color = (PlaneB << 1) | PlaneAformula applies - For SNES tiles using 4 or 8 bitplanes, the formula generalizes to
Color = (P_n << n-1) | ... | (P1 << 1) | P0; the academy visualizer covers the 2-plane case only
Independent practice (~2.5 hours)
Pick any one or two:
- Game Boy palette swap. The Game Boy Color has a 4-color palette per tile. Find the palette bytes in a Game Boy ROM (use SameBoy's debugger PPU viewer). Change one. Verify in SameBoy.
- SNES color math experiment. The SNES PPU supports color math (transparency, additive blending). Use bsnes-plus's PPU viewer to inspect what color math is active in your homebrew ROM. Change one color math register byte. See what happens.
- Read the first 20 instructions of the Game Boy ROM in SameBoy's debugger. You will not know the LR35902 ISA, but you will be able to read the disassembly the debugger produces. Compare the assembly mnemonics to 6502 mnemonics. What is similar? What is different?
- Read the first 20 instructions of the SNES ROM in bsnes-plus's debugger. The 65816 mnemonics are mostly identical to 6502 mnemonics; you will recognize most of them. Note the new instructions you do not recognize (typically the 16-bit variants).
Reflection prompts (~30 minutes)
- You spent week 4 modifying a NES ROM. This week you booted Game Boy and SNES ROMs. What surprised you about how similar (or different) the platforms felt?
- The Game Boy's boot ROM verifies the Nintendo logo bytes. Why do you think Nintendo did this in 1989?
- The SNES has a "LoROM" and "HiROM" choice for where the header lives. Why do you think the designers built in two options rather than picking one?
- The 65816 is a 16-bit successor to the 6502; the Game Boy LR35902 is Z80-like. Which transition felt more like a step up to you, and why?
- Looking ahead to week 6 (capstone): you will pick one ROM (any platform) and make a documented modification. Which platform are you leaning toward, and why?
Visual Helpers
Each new platform introduces its own header layout and its own addressing conventions. The skills from Weeks 2-4 transfer; the specific numbers do not.
New headers, same idea: Game Boy and SNES headers use different byte offsets for the same kinds of information (title, ROM size, checksum). If you find yourself confused about which bytes mean what, treat the Lab 5.1 and 5.2 header worksheets the same way you treated the INES header in Lab 2.1: decompose each byte one at a time, label it, and do not move on until the label makes sense.
Addressing in a new ISA: The 65816 (SNES) inherits its addressing modes from the 6502. The # rule from the Addressing Mode Flowchart still applies: LDA #$01 is still an immediate load. The new modes (24-bit absolute, long indexed) extend the pattern rather than replacing it. If you print the Flowchart from curriculum-supplements/spk-101-younger-learner-tools.md and keep it nearby during Lab 5.2, you will find it still answers most of your "what mode is this?" questions.
What comes next
Week 6 is the capstone. You pick a ROM from any of the three platforms (NES, Game Boy, or SNES); you make a real change to it; you write up what you did and why. You also get the closing lecture that maps everything you learned in SPK-101 to what CSA-101 builds. The bridge from this gateway course into the academy's main curriculum.