(back to project list)

Metroid Disassembly

Metroid is a hugely popular side-scrolling action adventure game developed and published by Nintendo for the NES.

This disassembly project is a quick experiment to see how the Metroid cartridge would work with SourceGen. This is not a finished disassembly. The original code upon which this project is based can be found at metroid-database.com and nicholasmikstas.com.

Metroid is copyright 1986 Nintendo, Inc.


Metroid presents an interesting challenge for a disassembler. In memory, the ROM has two 16KB segments, from $8000-bfff and $c000-ffff. However, the cartridge actually has 8 16KB segments, 7 of which are mapped to the same place:

# Addr Name
7$C000Game Engine

While SourceGen is designed to handle multi-segment files, Metroid presents an awkward situation. Segments 1-5 have code that is called directly from the game engine, at a specific address that isn't part of a jump table. For example, the instruction at $f503 is JSR $80b0, where $80b0 is a small subroutine in segments 1-5. Unfortunately, in segment 0 $80b0 is actually the middle of an instruction, and without guidance that's where SourceGen tries to map it.

Another issue is the fact that a 128KB file is a bit large to display as a single document. The approach used in the original disassembly -- splitting each segment into a separate source listing -- works better. (Plus, most of the cross-assemblers choked on the generated sources because they exceeded the 64KB bank limit... dividing it into separate source files and linking the output together would solve that.)

Copyright 2021 by Andy McFadden