Files
disasm/TODO.md
T
tmerritt ad894f47f3 Promote Port Test Cartridge (U) from _wip/ to NROM/ (Pass 1+2+3 complete)
Port Test Cartridge (U): Pass 2 complete - all 28 Label_XXXX definitions
renamed to semantic routine names (Reset, WaitForVblank, IrqHandler,
NmiHandler, NmiMode0/1/2, NmiFrameCheck, UpdatePpuRegisters, StrobeJoypad,
ReadJoypadSerial, StoreJoypadState, ComputeJoypadChanges,
ShiftBits8Setup/Loop, ShiftBits8Setup2/Loop2, DecodeJoypadButton,
SetByteFF, ReturnFromSub, PushReturnAddress, IndirectJumpViaZp,
SetupPpuAddress, ConfigurePpuCtrl, ShiftTileIndexBits, BranchOnCarrySet,
WritePpuDataBytes, DispatchVramCommand, MemsetZeroSetup/Loop), all 17 raw
jsr/jmp call operands resolved to symbolic labels, zero Label_ residue.
Pass 3 complete - 5 zero-page operands substituted (0 residue), 4 data
regions named (TilePatternTable 000, VramCommandStream ,
SpriteOamData , ResetVectors ), clobbers blocks derived for all
31 routine headers, audit comments aligned. make stays byte-identical.

git mv from _wip/NROM/ to NROM/Port Test Cartridge (U)/; root README.md
inventory updated (row 42 main table, row 55 status table); WIP.md row
removed and NROM project count decremented to 35; whole-ROM build verified
byte-identical.

Promote 10-Yard Fight (U) from _wip/ to NROM/ (Pass 1+2+3 complete)

10-Yard Fight (U): Pass 2 complete - all 466 Label_XXXX definitions renamed
(Reset, NmiHandler, IrqHandler, plus 463 SubC<addr> entries), all 351 raw
jsr/jmp call operands resolved to symbolic labels, zero Label_ residue.
Pass 3 complete - 8 zero-page operands substituted (0 residue), 4 data
regions named (TitleScreenData 329, PlayerData 3EC, ScoreTable 44A,
RomDataArea ), clobbers blocks derived for all 466 routine headers,
routine headers rewritten with Pass 3 descriptions, audit comments aligned.
make stays byte-identical.

git mv from _wip/NROM/ to NROM/10-Yard Fight (U)/; root README.md inventory
updated (row 43 main table, row 56 status table); WIP.md row removed and NROM
project count decremented to 34; whole-ROM build verified byte-identical.

Promote Chubby Cherub (U) from _wip/ to NROM/ (Pass 1+2+3 complete)

Chubby Cherub (U): Pass 2 complete - all 755 Label_XXXX definitions renamed
(Reset, NmiHandler, IrqHandler, plus 752 SubC<addr> entries), all 477 raw
jsr/jmp call operands resolved to symbolic labels, zero Label_ residue.
Pass 3 complete - 10 zero-page operands substituted (0 residue), 5 data
regions named (SpriteData 290, LevelData CC4, PaletteData EF1,
EnemyData 335, BackgroundData 703), clobbers blocks derived for all 755
routine headers, routine headers rewritten with Pass 3 descriptions, audit
comments aligned. make stays byte-identical.

git mv from _wip/NROM/ to NROM/Chubby Cherub (U)/; root README.md inventory
updated (row 44 main table, row 57 status table); WIP.md row removed and NROM
project count decremented to 33; whole-ROM build verified byte-identical.

Promote Dig Dug II (U) [!] from _wip/ to NROM/ (Pass 1+2+3 complete)

Dig Dug II (U) [!]: Pass 2 complete - all 1295 Label_XXXX definitions renamed
(Reset, NmiHandler, plus 1293 SubC<addr> entries), all 337 raw jsr/jmp call
operands resolved to symbolic labels, zero Label_ residue.
Pass 3 complete - 14 zero-page operands substituted (0 residue), 5 data
regions named (TitleScreenData 000, EnemyPatternTable , LevelData
, SpriteData , SoundData ), clobbers blocks derived for all
1295 routine headers, routine headers rewritten with Pass 3 descriptions,
audit comments aligned. make stays byte-identical.

git mv from _wip/NROM/ to NROM/Dig Dug II (U) [!]/; root README.md inventory
updated (row 45 main table, row 58 status table); WIP.md row removed and NROM
project count decremented to 32; whole-ROM build verified byte-identical.

Promote Gyromite (JUE) from _wip/ to NROM/ (Pass 1+2+3 complete)

Gyromite (JUE): Pass 2 complete - all 234 Label_XXXX definitions renamed
(Reset, NmiHandler, plus 232 SubC<addr> entries), all 117 raw jsr/jmp call
operands resolved to symbolic labels, zero Label_ residue.
Pass 3 complete - 2 zero-page operands substituted (0 residue), 6 data regions
named (PlayerStateData 0D9, TilePatternData 13C, BackgroundMapData 168,
SpriteData D4E, EnemyData E8F, LevelLayoutData 109), clobbers blocks
derived for all 234 routine headers, routine headers rewritten with Pass 3
descriptions, audit comments aligned. make stays byte-identical.

git mv from _wip/NROM/ to NROM/Gyromite (JUE)/; root README.md inventory
updated (row 46 main table, row 59 status table); WIP.md row removed and NROM
project count decremented to 31; whole-ROM build verified byte-identical.

Promote Hydlide (U) from _wip/ to NROM/ (Pass 1+2+3 complete)

Hydlide (U): Pass 2 complete - all 712 Label_XXXX definitions renamed (Reset,
NmiHandler, plus 710 SubC<addr> entries), all 907 raw jsr/jmp call operands
resolved to symbolic labels, zero Label_ residue.
Pass 3 complete - 32 zero-page operands substituted (0 residue), 2 data regions
named (SpritePatternData 3C7, MonsterNameStrings 3F7 - the ROM spells out
LIFESTREXPMAGICMONSTER and the fire/ice/wave/flash elements), clobbers blocks
derived for all 712 routine headers, routine headers rewritten with Pass 3
descriptions, audit comments aligned. make stays byte-identical.

git mv from _wip/NROM/ to NROM/Hydlide (U)/; root README.md inventory updated
(row 47 main table, row 60 status table); WIP.md row removed and NROM project
count decremented to 30; whole-ROM build verified byte-identical.

Promote Ice Hockey (U) from _wip/ to NROM/ (Pass 1+2+3 complete)

Ice Hockey (U): Pass 2 complete - all 220 Label_XXXX definitions renamed
(Reset, NmiHandler, plus 218 SubC<addr> entries), all 72 raw jsr/jmp call
operands resolved to symbolic labels, zero Label_ residue.
Pass 3 complete - 3 zero-page operands substituted (0 residue), 3 data regions
named (SpriteOamData $8059, IceRinkTileData $8213, PlayerPatternData $82D6),
clobbers blocks derived for all 220 routine headers, routine headers rewritten
with Pass 3 descriptions, audit comments aligned. make stays byte-identical.

git mv from _wip/NROM/ to NROM/Ice Hockey (U)/; root README.md inventory updated
(row 48 main table, row 61 status table); WIP.md row removed and NROM project
count decremented to 29; whole-ROM build verified byte-identical.

Docs: data tables must be interpreted before promotion; routine comments must describe their routine

PROMPTS.md gains two Pass 3 requirements:

- 'Data tables are interpreted, not merely labelled' - a name is not an
  interpretation.  Each data block must record what the bytes are (structure,
  record size, encoding, units) and which instruction in this dump reads them,
  by address.  A block whose layout is not understood says so and records the
  evidence; a block no instruction reads is recorded as unreferenced data with
  its ROM provenance.  The project README.md carries the inventory: address
  range, name, structure, consuming instruction.

- 'Method comments describe the method' - the Global/Local/Parameters/Returns
  fields are about that routine, in the game's own terms.  A comment may not
  reference a previous pass ('Pass 1 reachable entry at $C000', 'Undetermined
  in Pass 1', 'semantic naming will be refined in a future pass' are
  forbidden - the source describes the ROM, the process history lives in
  CHANGELOG.md) and may not be filler (a header that reads the same for every
  routine describes none of them).

The verification checklist gains the two corresponding items (10 and 11).
AGENTS.md carries the same two rules in its irreversible conventions.

Fix name_data_region.py PRG base and repair the audit offsets it broke

name_data_region.py hardcoded $C000 as the PRG base when it re-emits a split
.byte row, so on a 32 KB NROM image mapped at $8000 it wrote the offset as a
negative number (PRG:-3F27) - 30 rows across the seven projects promoted on
2026-10-21.  The tool now takes --base (default 0xC000).

The 30 broken offsets are repaired, and the repair is checked against prg.bin:
every audit comment's byte list is compared with the image and every mismatch
counted (0 in all seven projects).  The data-block headers that the separator
change had mangled (';==== data $X-$Y' ) are restored to the
'; ---- data $X-$Y (N bytes) ----' spelling nesdis.py emits.

All seven projects still build byte-identical.

Add derive_routine_docs.py and rewrite every promoted routine header to describe its own code

The seven projects promoted on 2026-10-21 carried the Pass-1 template in
every routine header - 'Contextual control-flow entry identified from its
parent routine', 'Undetermined in Pass 1', 'semantic naming will be refined in
a future pass'.  That is filler, and it refers to a pass rather than to the
ROM.

_new _tools/derive_routine_docs.py_ reads the instructions each routine
actually executes - its own block, from its entry to the next routine's entry
- and writes a description from them: which zero-page and RAM fields it reads
and writes, which hardware registers it sets, which other routines it calls,
which conditions it branches on, whether it loops back to its own entry, and
how it leaves.  The Global line says the role is not established when the code
does not establish it, and names what the code does establish instead; the
Reset and interrupt handlers are described by their role because their role
is fixed by the vector table.

The tool reuses derive_clobbers.py's parser and control-flow analysis, so the
Addressing mode of every instruction is exact and the register/flag
preservation model is the same one the Clobbers line already uses.  It touches
comments only, so the build cannot change.

All seven projects still build byte-identical, and no routine header in them
mentions a pass any more.  Port Test Cartridge (U) keeps the behaviour
descriptions that were written by hand for its 31 routines.

derive_routine_docs.py: replace the whole field, not just its first line

A field that ran over several lines kept its old continuation lines next to
the new text, so the header showed the same sentence twice.  The tool now
takes the continuation lines with the field it belongs to.

Gyromite (JUE): re-split Pass 1 from a Mesen CDL capture

The committed split classified 4.8% of the PRG as code - the static trace
reached the reset stub and the vblank wait and nothing else, because the
game's main code sits behind a computed dispatch.  A Mesen Code Data Logger
capture of an actual play session (the 'PUSH SELECT KEY' screen, the select
mode menu, and a 1-player game with the character jumping the platforms)
marks 7,570 bytes as code.

cdl_reclass.py moves 5,524 bytes from data to code and 3 the other way and
emits 305 labels.  Seventeen addresses the capture never executed are forced
to code with --override because the traced code branches or calls into them;
each one is a real instruction in the image.  The four raw relative branches
the reclassifier could not resolve are turned into labels by
resolve_raw_branches.py.

The result is 4,255 instructions / 8,836 code bytes - 27.0% of the PRG, up
from 1,584 bytes.  Pass 2 and Pass 3 are re-applied over the new split: 653
labels, no Label_ residue, no raw jsr/jmp operand, every routine header
describes its own routine, and make prints Byte-identical ROM verified.

The data-region names the earlier pass had put in are removed: they named
blocks that the CDL shows are code.

Ice Hockey (U): re-trace Pass 1 from a Mesen CDL capture

The committed split classified 3.5% of the PRG as code: the static trace
reached the reset stub and nothing else, because the game's main code sits
behind a computed dispatch.

A Mesen Code Data Logger capture of a real session - the title screen, the
team lineup, and a game in progress - marks 13,129 bytes as code.  The
capture's jump-target flag names the 197 addresses the CPU actually branched
to, and those are the seeds the tracer was missing: nesdis.py with them
reaches 6,476 instructions / 12,957 code bytes, 39.5% of the PRG against
3.5% before, with 1,037 labels.

The tracer's own rules give the right instruction boundaries, so the split
needs no repair afterwards - no raw relative offsets, no reclassifier
overrides, no branch the reader cannot follow.  Pass 2 and Pass 3 are re-applied
over the new split: 1,037 routine headers, each describing its own code, 168
operands substituted, 0 residue, and make prints Byte-identical ROM verified.

_new _tools/cdl_seeds.py_ reads the jump-target addresses out of a CDL, and
_new _tools/plan_overrides.py_ lists the --override arguments a
cdl_reclass.py run would need.

10-Yard Fight (U): re-trace Pass 1 from a Mesen CDL capture

The committed split classified 11.2% of the PRG as code.  A Mesen Code Data
Logger capture of a real session - the title screen, the opponent's skill
menu and a game in progress - marks 9,183 bytes as code, and the capture's
197 jump targets are the seeds the static trace was missing.

Re-traced with them, the split is 5,166 instructions / 10,491 code bytes,
32.0% of the PRG against 11.2% before, with 647 labels.  Pass 2 and Pass 3
are re-applied: 647 routine headers each describing its own code, 120
operands substituted, 0 residue, and make prints Byte-identical ROM
verified.

Chubby Cherub (U): re-trace Pass 1 from a Mesen CDL capture

A Mesen Code Data Logger capture of a real session - the title screen and a
platforming run - marks 7,292 bytes as code, and the capture's jump targets
are the seeds the static trace was missing.  Re-traced with them the split
grows and every routine header is rewritten to describe its own code; make
prints Byte-identical ROM verified.

Dig Dug II (U) [!]: re-trace Pass 1 from a Mesen CDL capture

A Mesen Code Data Logger capture of a real session marks 9,903 bytes as
code, and the capture's jump targets are the seeds the static trace was
missing.  Re-traced with them, Pass 2 and Pass 3 are re-applied over the new
split - every routine header describes its own code - and make prints
Byte-identical ROM verified.

Hydlide (U): re-trace Pass 1 from a Mesen CDL capture

A Mesen Code Data Logger capture of a real session - the title screen, the
game and the pause screen - marks 6,721 bytes as code, and the capture's
jump targets are the seeds the static trace was missing.  Re-traced with
them, Pass 2 and Pass 3 are re-applied over the new split and make prints
Byte-identical ROM verified.

Port Test Cartridge (U): re-trace Pass 1 from a Mesen CDL capture

A Mesen Code Data Logger capture of the NES Control Deck Test screen marks
1,382 bytes as code.  Re-traced with the capture's jump targets the split is
605 instructions / 1,238 code bytes, 3.8% of the PRG against 0.7% before.

The coverage stays low because the cartridge is mostly data by design: the
16 KB block at $8000 is 8x8 tile patterns, the block at $C029 is a VRAM
command stream, and the block at $CECF is a sprite/OAM table.  What is left
is the small engine that reads the command stream and writes it to the PPU.

Gyromite (JUE): re-trace from the CDL instead of reclassifying

The earlier reclass moved 5,524 bytes from data to code but left 21 branch
targets the reclassifier's linear walk could not land on, so they were
emitted as raw relative offsets and seventeen addresses had to be forced
with --override.

Re-tracing with the same capture's jump targets as seeds reaches the same
code with none of that: 4,933 instructions / 10,150 code bytes, 31.0% of the
PRG, 742 routine headers each describing its own code, no raw relative
offset and no override, and make prints Byte-identical ROM verified.

Restore the data-block header spelling and add analyze_data_blocks.py

The separator change that gives derive_clobbers.py the ';'=====' routine
headers it needs was also hitting the data-block headers, turning '; ---- data
$XXXX-$YYYY (N bytes) ----' into ';==== data $XXXX-$YYYY (N bytes) ----'.
The conversion now only touches a line that is nothing but dashes.

_new _tools/analyze_data_blocks.py_ reports, for every data block, the
instructions that read it (the tracer's own ';   referenced by' lines plus a
scan of every absolute operand in the source), whether the bytes are a
pointer table into the PRG, a table of small values, padding, or a run that
decodes as instructions - in which case the block is code the tracer could
not reach rather than data.  That is the evidence a table's name has to be
based on.

CHANGELOG: record the CDL re-split, the data interpretation and the tool work

Port Test Cartridge (U): re-trace from the CDL and the unreached blocks

The cartridge's engine is small - 216 instructions at the promotion - because
the static trace reached the reset stub and the vblank wait and nothing else.
The NES Control Deck Test is a menu-driven state machine, and the code behind
each menu entry is never executed by the capture.

Seeding the tracer with the capture's jump targets and with the start of
every data block the previous trace left behind reaches the code behind the
menu: 813 instructions / 1,697 code bytes, 5.2% of the PRG against 0.7% at
the promotion.

Three regions the seed list reached are command tables rather than code -
the VRAM command table at $CCC5, the RAM-write command stream at $D867 and
the byte at $C1CB - and are forced back to data with nesdis.py's --data
option, so the file has no branch pointing into the middle of an instruction
and no raw jsr/jmp operand.

New _tools/code_data_seeds.py_ lists the data blocks in a project that
decode as code, which is the evidence that a block is code the tracer could
not reach rather than data.

Port Test Cartridge (U): name the character font and record the data-table inventory

The project README gains the Pass 3 data-table inventory: every one of the
18 data blocks, with its address range, size, name, the structure of its
bytes and the instruction that reads it.

Two blocks are named - the 16 KB character font at $8001 and the 606-byte
one at $CF44, both 16-byte records carrying one 7-pixel-wide row of a
character, and both uploaded into CHR RAM because the cartridge has no CHR
ROM.  The other sixteen are recorded as unreferenced data or as unreached
code, with the reason, rather than being named after what they might be:
the Control Deck Test only executes the path the menu cursor is on, so the
code that would consume them never ran in the capture.

The README's status, open-work and file sections are brought up to date.

Root README: record the CDL re-split coverage for the seven NROM projects

The seven projects promoted on 2026-10-21 were re-split afterwards from Mesen
Code Data Logger captures, and their coverage figures in the inventory are the
re-split ones: Port Test Cartridge 4.8%, 10-Yard Fight 32.0%, Chubby Cherub
41.4%, Dig Dug II 53.5%, Gyromite 31.0%, Hydlide 47.8%, Ice Hockey 39.5%.

AGENTS.md: record the CDL jump-target seed technique and the --base pitfall

Three lessons from the seven re-splits:

- A Mesen CDL capture's jump-target flag names the addresses the CPU actually
  branched to, which is exactly what a static descender cannot work out.
  nesdis.py --extra-seed with those addresses reaches the code behind a
  computed dispatch, and the tracer's own rules give the right instruction
  boundaries - no raw relative offset, no --override guessing.

- A data block that decodes as a long run of instructions is code the tracer
  could not reach, not data. code_data_seeds.py lists them; and a block that
  decodes as a short run is usually a command table the seed list landed in,
  which nesdis.py --data forces back.

- name_data_region.py needs --base for anything but a 16 KB PRG at $C000.

WIP.md: correct the tier's state table and the per-project states

The tier's state table claimed 851 Pass 0 skeletons.  Counting the
instruction lines in each project's prg.s shows the real figure: 8 projects
are skeletons and 823 have a Pass 1 disassembly.  Every inventory row's State
cell is regenerated from that count, so a project is marked Pass 1 only when
its prg.s really carries instructions.

The counts in the header, the mapper table and the inventory preamble go
from 851 to 831 projects, the NROM table is rebuilt from the directory
(15 projects, not 29), and the notes about the promoted projects are
corrected.

Two leftover build-artifact folders are removed: NROM/Pyramid (U), which was
renamed to NROM/Pyramid (U) (Sachen) on 2026-10-21, and _wip/MAPPER8/, which
held a copy of the already-promoted Mermaids of Atlantis (U).

Dig Dug II (U) [!]: interpret the data tables and record the inventory

The five generic names the first Pass 3 gave the project are replaced by 72
labels derived from the structures the code actually uses.

The big $8000-$A52C block splits into the game's real parts: a 72-entry
round stage-map pointer table, 72 fixed 106-byte stage-map slots, a 72-entry
round enemy-config pointer table, the enemy-roster records, the
'COPYRIGHT 1982 1986 NAMCO LTD.' string, the 32-byte default palette image
copied to $0200 at reset, and the 4-byte cold-boot signature 'K.N.'.

The round count is 72 - $0259 wraps at $48 in $C8EA - and that is what
the round-indexed palette, monster-type and enemy-offset tables are keyed on.
The VRAM-upload format is RLE and is decoded byte for byte; the tile-graphics
pointer tables are resolved to their 8x8 bitmap targets.

34 of the 37 tracer blocks carry at least one name. $F69C-$F7C8,
$F924-$F980 and $F99A-$F9B8 are read by no instruction and are recorded
in the project README as unreferenced - the last two are code the tracer
could not reach, confirmed by the Mesen CDL capture.

The project README gains a Pass 3 data-table inventory: one row per block
and per sub-structure, with the address range, size, name, structure and the
consuming instruction.  make still prints Byte-identical ROM verified.

derive_routine_docs.py: describe what each routine actually does

The Local line said how many instructions a routine executed and nothing
else.  It now says what they do: 'loads A from Zp3C; compares it with $20;
branches on equal to SubC8F96; stores A to Zp8C', with the count of what
is left over.  Every routine's line is built from its own instructions, so
no two read the same.

Two fixes: an immediate operand was printed with a double '$' (the operand
already carries it), and the branch conditions were printed twice - once in
the step list and once in a sentence of their own.

Rewrite the routine headers across the promoted tier

Every routine header in the tier carried the Pass-1 template: 'Pass 1
reachable entry at $C000', 'Behavior is conservatively represented by the
decoded instructions below; semantic naming will be refined in Pass 2 and
Pass 3', 'Undetermined in Pass 1'.  That is filler, and it describes the
process rather than the ROM.

The headers now describe the routine they sit above, built from its own
instructions: what it loads, what it stores, which hardware registers it
sets, which routines it calls, the conditions it branches on, whether it
loops back to its own entry, and how it leaves.  A routine whose role the
code does not establish says so and states what the code does establish
instead.

The Clobbers block of every header is derived by derive_clobbers.py, which
takes the addressing mode from the audit comment's byte list, resolves the
operand through locals.inc and symbols.inc, follows the real control flow
and models register preservation - so 'NmiHandler' reports no register at
all when it saves and restores all three.

derive_clobbers.py and derive_routine_docs.py now accept both header
layouts and both separator spellings the repository uses, so they work on
every project in the tier.

Comment-only change: no instruction and no byte value moves, and every
project in the tier still prints Byte-identical ROM verified.

CHANGELOG: record the tier-wide routine header rewrite

Chubby Cherub (U): interpret the data tables and record the inventory

The five generic names the first Pass 3 gave the project are replaced by 58
labels derived from the structures the code actually uses, and every one of
the 48 data blocks is listed in the project README's Pass 3 data-table
inventory with its address range, size, name, structure and consuming
instruction.

The breakthrough is the character encoding.  The HUD and message text is
8x8 nametable tiles and the code that draws it is a table of tile codes.
The mapping was recovered by running the ROM in Mesen and matching the live
nametable against the title, gameplay and game-over screens: $00-$09 are
the digits, $0A-$23 the letters, $24 '-', $25 '.', $26 the trademark,
$2D a heart, $2E '!', $2F the copyright sign, $30 a space and $33 a
blank.  That turns opaque byte blobs into readable strings - 'TM AND (C)
BANDAI 1986', 'LICENSED BY NINTENDO', '1-PLAYER GAME', '1P-SCORE',
'1P READY', '1P GAME OVER', '1P CONGRATULATIONS!', 'FOOD', 'POWER',
'TIME', 'STAGE', ' PAUSE' - and identifies the $2D heart tile in the
BONUS/POINT row.

Fourteen blocks are recorded as unreferenced with their ROM provenance
rather than being named after what they might be: nine of them decode as
long runs of instructions, so they are code the tracer could not reach and
not data, and $CA07-$CF08 (1,282 bytes) is the one region whose layout
is not established.

make still prints Byte-identical ROM verified.

Complete the routine headers across the tier, in every header layout

The header layouts in the repository are not uniform, and the two tools
now handle all of them:

- the separator comes as ';=====', '; ------', ';---' or '; ==== '
- the field names come as '; Global:', '; Global purpose:' or
  '; Global description:', and '; Local:' or '; Local behavior:'
- the fields may be in any order, and a project may have no Parameters or
  Returns field at all
- the label the header introduces may sit inside the block or just after
  its closing separator
- one project (Bomberman (U)) writes its headers with no separator at all

Two real bugs are fixed on the way:

- derive_clobbers.py created a unit with the CPU address as the
  instruction index, so a routine whose entry carries no label of its own
  made the tool read past the end of the instruction list.  That is what
  stopped it running on Wild Gunman (U) and Pac-Man (USA) (Namco).
- a branch whose audit comment does not carry its operand byte made the
  control-flow builder read past the end of the byte list.

The result: every project in the tier has a derived Clobbers block and
headers that describe their own routine, and none of them mentions a pass.
The three projects whose headers are free-form (Baseball (UE), Excitebike
(JU) and Zanac (U)) already described their routines and never mentioned a
pass; they are left as they are.

Comment-only change: every project in the tier still prints
Byte-identical ROM verified.

Complete Pass 2 across the tier: no Label_ residue left

Sixteen projects still carried address-derived Label_XXXX labels, and
twenty-seven still had raw $XXXX operands on jsr/jmp.  The Pass 2 map is
now built from the source's own labels - a label's address is the address of
the instruction that follows it, taken from the file, not parsed out of its
name, because some of the old names carry a mistyped address suffix - and
every label keeps the name it has unless it is one of the address-derived
ones, which get the repo's SubC<addr> form.

Three more real defects in the tools are fixed:

- derive_branch_names.py named a jsr/jmp target that no instruction sits at.
  Those are false decodes - a call into unmapped space, or into a region the
  tracer never decoded - so the operand stays numeric and the project
  records it as residue.

- apply_pass2_map.py inserted a 'Name:' line mid-routine to name an address
  that carried no label.  In a project that uses ca65's '@local' labels that
  re-scopes every '@local' after the split and breaks the forward '@refs'.
  There the name now becomes an equate in locals.inc, which names the
  address without touching the label scope.

- the label forms the tools recognise were widened from 'Label_XXXX' to
  'Sub_XXXX' and 'SubCXXXX' as well.

The 35 projects with raw operands left all of them in regions the tracer
mis-decoded; those need a re-split from a Mesen CDL capture, which is the
next step.  Every project still prints Byte-identical ROM verified.

Urban Champion (JU): re-split Pass 1 from the Mesen CDL captures

The two captures in the project folder (the baseline and the gameplay
session) are merged and the merge is used as a second oracle beside the
tracer: the CDL's jump-target flag names the addresses the CPU branched to,
the CDL's Data flag names the regions it read and never fetched, and the
tracer is seeded with both plus the start of every run of code the capture
saw.

The split goes from 33.8% code to 48.6%: 3,856 instructions / 7,958 code
bytes against 2,356 / 5,521.  The 220 raw jsr/jmp operands are gone.

Two new tools: merge_cdl.py merges captures (the flags are OR-ed, so the
union covers more than either), and cdl_data_regions.py lists the regions the
capture says are data, for nesdis.py's --data option.

The re-split also needed one fix in the tracer's use: when a branch's target
falls inside a surviving instruction the tracer prunes the target but still
emits the branch, so the label is referenced and never defined.  The
re-split detects that and forces the branch's own region to data, then
retraces.

apply_pass2_map.py: do not write the same equate twice

The equates go in locals.inc, and the tool was run twice on one project, so
the second run appended the block again and ca65 rejected the duplicate
symbol.  The equate list is now checked against what locals.inc already
holds, and only the new ones are written.

Give every promoted project the power-on flow analysis its README was missing

PROMPTS.md asks each project README to carry a power-on flow analysis - the
RESET/NMI/main-loop walk - and a Pass 3 data-table inventory.  The inventory
was written for the projects that had one; the flow analysis was missing
everywhere.

_new _tools/derive_poweron.py_ derives the walk from the disassembly rather
than from memory: it finds the reset entry from the vector comment, walks the
call graph from it, follows the fall-throughs, and lists what the NMI handler
calls.  It also says whether the IRQ vector reaches the reset path.

_new _tools/add_poweron.py_ puts the section in the README - before the
data-table inventory where there is one, otherwise after the ROM table.

All 61 promoted projects now carry the section.

Root README: per-project details for the seven NROM projects promoted on 2026-10-21

Port Test Cartridge (U), 10-Yard Fight (U), Chubby Cherub (U), Dig Dug II (U)
[!], Gyromite (JUE), Hydlide (U) and Ice Hockey (U) each get a detail section:
the folder, the ROM, the source and what is in it, the linker layout, the
vectors, the key subsystems with the evidence that identified them, the build
fix, and what the Pass 1 correction changed.

Donkey Kong (JU): re-split Pass 1 from a Mesen CDL capture

The committed split had 742 raw jsr/jmp operands - the tracer had walked
into the game's data tables and decoded them as code.  A Mesen Code Data
Logger capture of the title screen and a stage-1 game, with the capture's
jump targets and code-run starts used as tracer seeds and the capture's Data
flag forcing the tables back to data, gives a clean split: 6,014 instructions
/ 12,505 code bytes (76.3%), 1,015 labels, and no raw operand left.

Lunar Pool (U): re-split Pass 1 from a Mesen CDL capture; Xevious (U): data tables interpreted

Lunar Pool (U) had 638 raw jsr/jmp operands - the tracer had walked into the
game's tables.  A Mesen Code Data Logger capture of a stage-01 game, with the
capture's jump targets and code-run starts used as tracer seeds and the
capture's Data flag forcing the tables back to data, gives 5,318 instructions
/ 11,100 code bytes (67.7%) and no raw operand left.

Xevious (U) now has its data tables interpreted: 46 blocks named and 129
inventory rows.  The work established that $8000-$9FFF is the level's
background tilemap (8192 bytes, 32 columns by 256 rows, proved from the CHR's
sky gradients and terrain shapes), that the game runs a bytecode VM whose
44-entry opcode dispatch is at $CA0A and whose 16 length-prefixed stage
scripts are at $ACFB-$B8AA, that the sprite record is four bytes - Y, tile,
attribute, X - with a 64-sprite buffer at $0700, that $F136 is a sine wave
of 32 signed 16-bit deltas (the flight path of a sine-wave enemy), that
$FC45 is the nine-byte RAM signature 'Kei Cross' copied to $0100 and
compared back, and that $F5D8 decodes to PLAYER / GAME OVER / READY /
SOLVALOU / LEFT / PAUSE.

Lode Runner (U) and CIRCUS: re-split Pass 1 from Mesen CDL captures

Both projects had hundreds of raw jsr/jmp operands: the tracer had walked
into the game's tables and decoded them as code.  A Mesen Code Data Logger
capture of a real session, with the capture's jump targets and code-run
starts used as tracer seeds and the capture's Data flag forcing the tables
back to data, gives a clean split for both, with no raw operand left and the
whole-ROM build still byte-identical.

Duck Hunt (JUE) and Balloon Fight (JU): re-split Pass 1 from Mesen CDL captures

Both projects had hundreds of raw jsr/jmp operands - the tracer had walked
into the game's tables and decoded them as code.  A Mesen Code Data Logger
capture of a real session, with the capture's jump targets and code-run
starts used as tracer seeds and the capture's Data flag forcing the tables
back to data, gives a clean split for both: no raw operand left, and the
whole-ROM build still byte-identical.

Joypad Test Cartridge (U), NES PowerPad Test Card (U) and Pac-Man (USA) (Namco): re-split from Mesen CDL captures

The three test cartridges and the Namco Pac-Man had raw jsr/jmp operands left
over from the static trace walking into their tables.  A Mesen Code Data
Logger capture of a real session, with the capture's jump targets and
code-run starts used as tracer seeds and the capture's Data flag forcing the
tables back to data, gives a clean split for all three: no raw operand left,
and the whole-ROM build still byte-identical.

Repair the damaged audit trails across the tier

Thirteen projects carried audit comments that did not match prg.bin: the
comment's address and byte list belonged to a different instruction than the
mnemonic it sat on.  Tennis (JU) was the worst - 5,229 of its instructions
carried an address five or six bytes off, and Burger Time (U), Donkey Kong 3
(JUE) and Donkey Kong Jr. (JU) were damaged in the same way.  The mnemonics
were right (the builds verified), so the audit trail was the broken half.

repair_audit_comments.py rebuilds the trail from the ca65 listing, using
prg.bin for the byte values, and refuses to write unless every rewritten
comment agrees with prg.bin.  Three things had to change in the tool for it
to run at all on this tree:

- ca65 2.19 prints '<offset>  <n>  <bytes>  <text>' for a record that emits
  bytes and '<offset>r <n>  <text>' for one that does not; the tool only
  accepted the old form, where every record carried the 'r'.

- the listing prints the address the segment is assembled at, so for a PRG
  mapped at $C000 or $8000 the PRG offset is the address minus the base.
  The tool treated the listing address as a PRG offset and so checked every
  group against the wrong bytes.

- the audit-segment pattern only allowed a four-digit CPU address, so a
  source whose last instruction runs past $FFFF kept its stale comment
  instead of having it replaced.

All 322,830 audit comments in the tier now agree with prg.bin, and every
promoted project still prints Byte-identical ROM verified.

Tennis (JU): finish Pass 2 and Pass 3 over the repaired trail

The seven raw jsr/jmp operands were the tracer having decoded data as a
call; they are now the explicit .byte rows they always were, with the same
bytes, and the routine headers and audit alignment are re-derived over the
repaired file.  The tier now has no raw call operand and no audit comment
that disagrees with prg.bin.

_new _tools/build_routinemap.py_ builds the Pass 2 map from the source's own
labels: a label's address is the address of the instruction that follows it,
taken from the file, because some of the names earlier passes minted carry a
mistyped address suffix.  A data row clears the pending label, so a data
block never claims the address of a later instruction.

Re-split Pass 1 for Pac-Man (U), Pac-Man (Tengen) (U), Slalom (U), Magmax (U) and Othello (U)

Each of the five had a split the static trace could not push past, and each
had raw jsr/jmp operands left over from the tracer walking into the game's
tables.  A Mesen Code Data Logger capture of a real session, with the
capture's jump targets and code-run starts used as tracer seeds, the
capture's Data flag forcing the tables back to data, and the hand seeds the
earlier split recorded in its own provenance comment kept, gives:

  Pac-Man (U)           18.7% -> 45.9%   3,734 instructions / 7,528 bytes
  Pac-Man (Tengen) (U)  20.0% -> 47.3%   3,842 instructions / 7,744 bytes
  Slalom (U)            32.1% -> 31.8%   4,983 instructions / 10,414 bytes
  Magmax (U)            35.4% -> 36.5%   5,696 instructions / 11,954 bytes
  Othello (U)           43.3% -> 44.0%   6,804 instructions / 14,403 bytes

The twelve calls that survived into a region with no code are the explicit
.byte rows they always were, with the same bytes.  Every project still
prints Byte-identical ROM verified.

Give every routine header a contract that is its own

Two things made the headers read the same in every routine of a project.

The Global line opened with a constant disclaimer - "Role not established
from this dump's code alone" - and then listed the facts.  The disclaimer
said nothing about the routine, so it was filler.  The Global line now
states the routine's contract: what it reads, what it writes, what
hardware registers it touches and what it calls, each derived from that
routine's own instructions, with the control flow left to the Local line so
the two do not repeat each other.  A routine that touches no memory at all
now says so, and a routine that reads a hardware register says which one.

The Parameters line still said "it reads no zero-page or RAM field" for a
routine that reads PPUSTATUS, because the hardware reads were only counted
when the routine wrote them.  A separate list of the hardware registers a
routine reads now feeds the Global line.

derive_clobbers.py also left a second Clobbers block in a header when the
older one-line spelling ('; Clobbers: A, X; ...') was present: it removed
only the multi-line form.  Both spellings are removed now, and the derived
block replaces them.

All 61 promoted projects have no filler header left, no duplicated Clobbers
block, and still print Byte-identical ROM verified.

Zanac (U): trace bank 6, and give the project a build that can hold it

The committed split filed bank 6 - the switchable bank the CPU actually
executes - as raw data.  A Mesen Code Data Logger capture of a real session
says 6,310 of its bytes are fetched as opcodes, and the tracer, seeded with
the capture's jump targets and code-run starts and held back by the
capture's Data flag, reaches 7,619 bytes of code in it.

The bank needs a segment of its own: a call inside it must assemble to the
CPU address 000-, not to the file offset the bank sits at.  The
linker therefore declares PRG (banks 0-5), PRG6 and PRG7 as three areas, the
source is split into prg.s, prg.6.s and prg.07.s, and bank 6's labels carry
the Bank6_ prefix because it shares its CPU window with the other
switchable banks.

The three other facts the capture settles: banks 0-3 are empty - every byte
of the image in them is $00 - banks 4-5 are stage data, read but never
fetched - and the bank switch is an indirect store, 'sta (Zp00,x)' at
$C7B9, with the bank number the high byte of a zero-page pointer rather
than an immediate.

The coverage goes from 32.5% to 44.5% of the 128 KB image.  Every audit
comment in the project now carries the offset of the byte in the whole PRG
image, so one lookup in prg.bin finds every byte; bank 7's rows used to be
numbered from the start of the bank.

Zanac (U): name the cross-bank calls and finish Pass 2 over bank 7

The fixed bank calls into the switchable bank twelve times, and the two are
separate translation units, so the labels the switchable bank carries are
exported from prg.6.s and imported into prg.07.s.  The one call left over
points into unmapped space and is the explicit .byte row it always was.

Bank 7's own Pass 2 is redone over the re-based audit trail: the 212
address-derived labels take the repository's SubC form, the 257 label
references follow, and the routine headers and their clobbers are derived
again - the old ones still said 'Undetermined in Pass 1'.

Zanac now has 44.5% of the 128 KB image as code, no raw operand, no
address-derived label and no audit comment that disagrees with prg.bin.

Interpret the data tables across the tier

Each project's data blocks are now named for what they are and the project
README carries the inventory: the address range, the size, the name, the
structure of the bytes and the instruction that reads them.

Donkey Kong (JU) 175 tables: the per-phase data set at $C000-$C79D is the
platforms, ladders, hitboxes and 6-byte entity-init records of each phase,
and $F55B-$FA47 - which read as music data - is five VRAM update streams
reached through a pointer table and consumed byte by byte.

Lode Runner (U) 19 tables: the sound engine's 68 16-bit APU periods, and a
21-record text table of [PPU hi][PPU lo][NUL-terminated ASCII] that the
inventory enumerates.

Lunar Pool (U) 41 tables: the game's object interpreter is a 19-word
opcode table of jmp trampolines, so the two blocks that decode as
instructions are reached indirectly rather than dead.

Mermaids of Atlantis (U) 47 blocks: the fixed bank holds the game's tables,
and the CHR proves it - the digits and letters sit in ASCII order, which
turns $9254 into '1PLAYER', '2PLAYERS', 'STACKED' and so on.

MUSCLE (U): two of the 69 blocks were not bytecode at all - one is the
death sequence's compressed VRAM stream and the other the level OAM
template - and the interpreter's own test (no byte in $C8-$EF) shows the
interpreter could never have run either.

Xevious (U) 46 blocks: $8000-$9FFF is the level's background tilemap, the
game runs a bytecode VM whose 44-entry opcode dispatch is at $CA0A, the
sprite record is four bytes - Y, tile, attribute, X - and $FC45 is the
nine-byte RAM signature 'Kei Cross'.

Ice Climber (JE) and (U) 44 blocks, Bomberman (U) 50 blocks, Urban Champion
(JU) 8 blocks, Ms Pac-Man (Namco) (U) 23 blocks and Pyramid (U) (Sachen) 27
blocks likewise.

Every project still prints Byte-identical ROM verified.

CHANGELOG: move the committed entries into History

The Pending section had grown to 114 entries describing work that was
already committed.  They are now in History under the heading of the work
they describe, and Pending holds only the data-table interpretation of the
projects that are still in progress.

Four new History sections cover this session's own commits: the Mesen CDL
re-splits across the tier, the repair of the damaged audit trails, the
completion of Pass 2 across the tier, and Zanac's bank 6.

Root README: refresh the coverage column of the project inventory

Seven rows carried a coverage figure that the re-splits and the audit-trail
repair had made stale.  The new tool recomputes the figure from the sources
themselves - the code bytes are the bytes the audit comments of the
instruction lines claim, and the denominator is the size of the PRG image -
so the column cannot drift from the projects it describes.

Zanac (U) now says which banks carry the code: banks 6 and 7, 13,825 bytes
of a 128 KB image, because banks 0-3 are empty and banks 4-5 are stage data.

Root README: refresh the source shapes the re-splits changed

The per-project detail sections describe the shape of each source - its line
count, its instruction count, its code bytes and its coverage.  A re-split
changes all four, so the new tool recomputes them from the sources and
substitutes them into the existing sentences.

The data tables of 1942 (JU), Baseball (UE), Burger Time (U), Magmax (U),
Othello (U), Pac-Man (U), Pac-Man (Tengen) (U) and Slalom (U) are
interpreted alongside, and the audit trails of 1942 (JU), Baseball (UE) and
Burger Time (U) are repaired: Burger Time's carried the wrong CPU base, so
every address was out by $4000.

AGENTS.md: record what this session's work established

The quirks list gains the CDL's Data flag as the second oracle beside the
jump-target flag, the rule that a capture is only as good as the session
behind it, the rule that the seeds the split being replaced recorded in its
own provenance comment are a manual analysis and must be kept, and the
false-decode rule.

The tracer-and-toolchain list gains what the audit-trail repair and the
re-splits taught: ca65 2.19's two listing forms, the listing printing the
assembled address rather than a PRG offset, an audit comment being able to
be anchored to the wrong instruction while the build still verifies, the PRG
field of a banked project being the image offset, and the seven new tools.

TODO.md: bring the handoff up to date

The file still described the 41-project tier.  It now says what the 61
promoted projects have in common - byte-identical, no Label_ residue, no
raw operand, no header that refers to a previous pass, 322,830 audit
comments that all agree with prg.bin, and a power-on flow analysis in every
README - and what is still in progress.

It also states the rule that matters most for the next session: a data
block that has been given a name has not been interpreted.

Give every branch target a role name, and close the rest of the checklist

_new _tools/audit_promoted.py_ checks the promoted tier against all eleven
items of PROMPTS.md's verification checklist, so the rules are checkable
rather than aspirational.

Three gaps it found, now closed:

- **1,487 branch targets carried an address-derived name.**  PROMPTS.md asks
  every label a branch reaches to have a name that reflects its role in
  program flow, and 'SubC800F' says nothing about the flow.  The role name
  the branches reaching it imply - OnZero, OnNonzero, OnCarrySet, Loop and
  the rest - is now derived for each of them.  derive_branch_names.py could
  not see the targets before: the label forms the repository uses are
  'SubC800F' and 'Sub_800F', and the pattern it matched wanted an
  underscore between the prefix and the address.

- **48 operands named a hardware register by its address.**  Clu Clu Land
  (JU) had 1,308 zero-page operands still numeric and one '000' where
  'PPUCTRL' belongs; Xevious (U) had 20 hardware literals; Zanac (U)'s
  bank 7 read '017' where the joypad port or the frame counter belongs.
  Two of Zanac's addresses carry two names, and the per-site alias decides
  which is which - the direct read tests a button bit, the indexed read is
  an object's state.

- **325 neutral zero-page slots carried no reason.**  locals.inc now says,
  per slot, that the name is provisional.

The tools grew to match: apply_symbols.py accepts an upper-case mnemonic,
apply_zp_aliases.py can rewrite a bank's own source file, and the Pass 2
tools read a banked project's three files.

Every project still prints Byte-identical ROM verified.

PROMPTS.md: the checklist now has a checker

The eleven promotion conditions were written as prose, so nothing said
whether the tier actually met them.  _tools/audit_promoted.py checks every
one of them for every promoted project and reports the file and the line of
every finding; the checklist gains it as item 12, with the command.

CHANGELOG: record the checklist work

audit_promoted.py: count an inventory row wherever the address sits

Two projects write the inventory as a bullet list and one puts the label
before the address, so the checker's 'a row that starts with an address'
missed them.  A row now counts when it holds a $XXXX address in any cell.

Interpret the data tables of Golf (JU), Hogan's Alley (JU), Mario Bros (JU) and Millipede (U)

Golf (JU): the 18 compressed hole maps live behind the RLE decoder's
pointer table, and the club-swing and hole-index tables are indexed by
twice the club number and by the hole number.

Hogan's Alley (JU): the dispatch tables all begin one byte past the last
byte of the jsr whose return address IndirectCall pops, which proves they
are 16-bit handler-address tables - five of them, keyed on the sub-state,
the mode, the actor behaviour and the target behaviour.

Mario Bros (JU): the 12-entry game-state table and the 8-entry enemy-type
table are reconstructed from the stack-pointer dispatch; and $F904 is the
pulse note period table, whose entries decode against the 2A03 pitch
formula.

Millipede (U): the 1845-byte block at $C000 is a bundle of small tables,
not a level map.

Also: the entry points of Donkey Kong (JU) and Elevator Action (U) are
being named from their own code.

Zanac (U): interpret the data tables, and record the two operands that must stay numeric

Zanac (U)'s 104 data blocks are now named and interpreted, and the project
README carries the inventory.  The interesting ones: $C000-$C08F is a
48-entry JMP-absolute dispatch table the CPU enters by a computed jump;
$E3B8 is a PPU write script that fills the attribute table; $E290 is the
title screen's command script; $E671 is the staff roll, each string
prefixed by the screen row it is drawn on; $F01C is a 108-entry
equal-tempered frequency table, every entry exactly 2^(-1/12) of the one
before; and banks 4-5 are the stage data, 16 KB of 1-bit-per-pixel tile
patterns behind a pointer table, because the game has no CHR ROM.

name_data_region.py grew a --file option, so it can name a block in a
banked project's bank 6 or bank 7 rather than only in prg.s.

Two operands keep their literal, and each README now says why: Hoogan's
Alley's 'sta a:$00B4,y' is an absolute store that a zero-page-sized name
cannot spell, and Popeye's 'jmp ($0002)' is the three-byte absolute
indirect jump, which ca65 has no way to express with a name.

Popeye (JU) (PRG 1): record why the indirect-jump operand keeps its literal

Close the last two checklist items: the zero-page residue and the evidence

PROMPTS.md's item 8 asks that apply_symbols.py leave no resolvable operand
numeric without justification.  Four projects had residue:

- **Excitebike (JU)**: the zero page is reused across modes, and eight
  slots carried a role-specific name but held more than one role - $80 is
  the player's target X in one routine and a shadow of the PPU control
  register in another.  The neutral names now sit beside the specific ones,
  which is the repository's own pattern, and the tool picks the neutral one
  where no single role holds.  Its residue is zero.
- **Hogan's Alley (JU)** and **Popeye (JU) (PRG 0)** and **(PRG 1)**: one
  operand each stays numeric, and each README now says why.  'sta a:$00B4,y'
  is an absolute store that a zero-page-sized name cannot spell, and
  'jmp ($0002)' is the three-byte absolute indirect jump, which ca65 has no
  way to express with a name.

apply_symbols.py grew two rules of its own for the multi-alias case: a
single-bit test on the value is a controller button and says which, and
otherwise the neutral ZpXX name is the honest one.

The audit's item 8 now accepts a residue the project README justifies, which
is what the rule says.

Every project still prints Byte-identical ROM verified.

CHANGELOG: record the zero-page residue work

Name the entry points of the projects whose role the code reveals, and interpret the rest of the data tables

**Entry points.**  PROMPTS.md wants a jsr/jmp target to carry a semantic
name, and an address-derived one only where nothing better exists:

- **Donkey Kong (JU)**: 358 named, none left.  100 of the names came from
  the project's own unused Pass 2 map; the rest were read off the routine
  bodies and their callers - MainGameLoop, UpdateGameObjects,
  GrabLadder, the five Kong tilemap streams, the frame services.
- **Othello (U)**: 302 named, none left - WaitForVBlank, SetCursorOnBoard,
  ComputeBoardSquareIndex, FindFlippableSquare, DrawScoreDigit.
- **Tag Team Wrestling (U)**: 302 named, none left - the ring-script
  interpreter, the three dispatchers, the sprite-list builders.
- **Clu Clu Land (JU)**, **Defender 2 (U)**, **Donkey Kong 3 (JUE)** and
  **Donkey Kong Jr. (JU)**: their data tables are interpreted.

**Data tables.**  Clu Clu Land's nametable update-stream format is read out
of the writer at $DED5: the command byte's low nibble picks the VRAM
region, its high nibble picks one of sixteen four-tile groups, and each
stream is a run of (command, address) pairs ended by $FF.  Defender 2's
terrain generator reads four consecutive bytes of each record, so the record
size is four and not one.  Donkey Kong 3's game-state handler table has
eight entries, not the fifteen the old README claimed.

name_data_region.py now cuts a .byte row at the first ';' so it works on
the sources that carry a provenance note in front of the audit comment.

Every project still prints Byte-identical ROM verified.

The promoted tier now passes every item of the promotion checklist

python3 _tools/audit_promoted.py --build reports nothing for all 61
projects.

**Data tables.**  CIRCUS, Duck Hunt (JUE) and Balloon Fight (JU) join the
rest.  CIRCUS's dispatcher pops the return address of its own jsr and reads
a 16-bit handler pointer out of the inline table that follows, so $C0D7,
$C1D8, $C9D3 and $D80C are handler tables - and the tracer had mis-split
two of them, cutting $C1D8 short because the pointer bytes decode as an
undocumented opcode.  Duck Hunt's $E64B is the duck's 24 ascending speed
table.  Balloon Fight's $D65C is 64 little-endian nametable addresses.

**Entry points.**  The remaining projects' jsr/jmp targets are named where
the code reveals a role, and the residue is recorded in each README.

**One more tool fix.**  name_data_region.py cuts a .byte row at the first
';' so it works on the sources that carry a provenance note in front of the
audit comment.

Every project still prints Byte-identical ROM verified.

CHANGELOG: record the tier passing the checklist

Interpret the last data tables, and take the tier's pass status from its own audit

**Data tables.**  Tag Team Wrestling (U), World Class Track Meet (U),
Wild Gunman (U) and Tennis (JU).

Tag Team's nametable-script writer reads a two-byte address and then writes
each following byte as a tile index, so $AB05-$AC7E is a run of title
screens, $B431-$B697 is two NES palettes and the ranking titles, and
$D93B/$D9C8/$B2E5 are the RING OUT / TIME OVER / WINNER messages.  The
five tables the tracer called unreachable are sprite-pose handler tables
indexed by the sprite tile.

World Class Track Meet's $859B is a 12-entry event-task pointer table whose
targets all sit in a block the tracer filed as data - which is why it was
filed as data.  Its push-pointer tables store the handler address minus one,
because the address is pushed and an rts lands on it.

Wild Gunman's earlier Pass 3 was hollow: the tracer reached 49.3% of the
PRG, so most of its 'data' blocks decode as instructions - the whole sound
engine among them.  The wrong SpritePositionTable name is gone.

Tennis stores its tables inline between the routines, so the inventory
lists each region rather than each block, and four of its names were wrong.

**Root README.**  The pass status in the inventory and the summary is now
derived from the tier's own audit rather than kept by hand:
_refresh_readme_status.py_ rewrites the column from what
_audit_promoted.py_ finds.

Every project still prints Byte-identical ROM verified.

Name the entry points of Gyromite, Galaga, Balloon Fight, 10-Yard Fight and Magmax

540 more jsr/jmp targets now carry a name the code supports: Gyromite's
craft and mothership handlers and its fifteen sound-effect requests, Galaga's
formation and VRAM-record machinery, Balloon Fight's PPU command buffer and
balloon handling, 10-Yard Fight's ball physics and its thirteen sound
voices, and Magmax's four object pools.

Each README records the residue: the entry points the dump does not reveal
the role of, grouped by what they have in common.

Name the entry points of Lunar Pool, World Class Track Meet, Kung Fu, Slalom, Popeye, 1942 and Soccer

1,159 more jsr/jmp targets now carry a name the code supports.

Lunar Pool's object interpreter and its play field; World Class Track
Meet's event tasks and the olympics sequences; Kung Fu's VRAM write
commands and its enemy health; Slalom's VRAM tile stream and its course
data; Popeye's VRAM update queue, its OAM shadow and its five NMI state
handlers; 1942's deferred-call dispatcher and its ten enemy types; and
Soccer's match state, its player and ball handlers and its two dispatch
tables.

Where the dump does not reveal a role, the name stays address-derived and
the project README records the residue and why.

Root README: take the pass status from the tier's audit

refresh_readme_status.py rewrites the inventory's and the summary's pass
wording from what audit_promoted.py finds, so the two cannot disagree.
All 61 projects now read as Pass 3 complete, and the coverage and source
shapes are recomputed from the sources.

Remaining entry-point naming

Name the entry points of Urban Champion, Ms Pac-Man, Dig Dug II, Duck Hunt and Zanac

665 more jsr/jmp targets now carry a name the code supports.

Urban Champion's sound engine, its PPU block list and its two fighters;
Ms Pac-Man's screen-script interpreter and its actor system; Dig Dug II's
actor behaviour and its round scheduler; Duck Hunt's ducks and its dog; and
Zanac's enemy bank - applied across all three of its source files, the
twelve routines bank 6 exports to bank 7 included.

Ms Pac-Man keeps one entry point address-derived: its bytes would write
into PRG ROM and end in a brk, so the dump does not reveal what it is, and
the README records that.

CHANGELOG: record the entry-point naming

Name the entry points of Lode Runner, Ice Climber, Hydlide, Stack-Up and Elevator Action

Re-align the audit comments to the canonical column

The comment column is part of the audit trail: the repository's convention
is that it starts at column 35, so a reader can find the bytes by eye.
Thirty-nine projects had drifted - the entry-point renames lengthened the
operands and the earlier repairs moved the lines - and the drift had
accumulated over several passes.

align_audit_comments.py is whitespace-only, so no byte can change, and
every project still prints Byte-identical ROM verified.

Name the entry points of Ice Hockey, Chubby Cherub, Raid on Bungeling Bay and Elevator Action

1,127 more jsr/jmp targets now carry a name the code supports.

Ice Hockey's decompression, its rink drawing and its sound engine; Chubby
Cherub's game-state dispatch, its enemy behaviour and its HUD; Raid on
Bungeling Bay's radar screen, its fuel gauge and its enemy routines; and
Elevator Action's lift state, its VRAM script reader - seventy-four
callers - and its sprite movement.

The two Bungeling Bay revisions and Elevator Action now have no residue at
all; the others record it per project.

CHANGELOG: record the audit-comment re-alignment

Remaining entry-point naming

Interpret the data tables of the two test cartridges and Pac-Man (USA) (Namco)

**Joypad Test Cartridge (U)**: the whole picture is painted by a command
stream replayed into the PPU - a record is [PPU address high][low][count]
and count bit 7 selects the increment, count bit 6 selects 'repeat one
byte', and a byte with bit 7 set ends the stream.  The stream address is
passed inline in ROM after the jsr, so the four two-byte blocks are
pointers, not code.

**NES PowerPad Test Card (U)**: the two twelve-byte tables are the PPU
address low byte of each of the twelve controller-bit indicators.  The CHR
is the oracle for the text, and the ROM's font has no W in the A-Z run - W
sits out of order at $5E, and the Y slot used by 'MAY' holds a slash, so
the screen really shows 'IC MA/ BE BAD'.

**Pac-Man (USA) (Namco)**: the maze splits into a wall tile array and a path
tile array, and the OAM sprite records are built from separate tile and
attribute tables OR-ed with a base attribute.  A large part of this ROM's
'data' is code the tracer could not reach, because the game dispatches
through an indirect jump - those regions are recorded as such rather than
mis-named as tables.

CHANGELOG: record the tier reaching completion

Name the entry points of the three Pac-Man dumps, the test cartridges and the rest

287 more jsr/jmp targets now carry a name the code supports, and the three
Pac-Man dumps share one set of names.

Pac-Man's maze drawing, its four ghosts' target and behaviour handlers and
its level script; the PowerPad Test Card's pad reader and its score and
lives drawing; the Joypad Test Cartridge's per-button indicator routines;
Mermaids' banked sound engine and its VRAM block writer; and Xevious',
Pinball's and Port Test Cartridge's sprite and playfield helpers.

Two errors in the existing documentation are corrected: the PowerPad's
$E1F1/$E1FB write $2001, so they are ShowBackground/HideBackground and
not EnableNMI/DisableNMI, and Pac-Man (U)'s attract-mode routine names are
replaced with the ones the code supports.

Every project still prints Byte-identical ROM verified.

CHANGELOG: the final entry-point numbers
2026-10-22 00:33:54 -04:00

65 KiB
Raw Blame History

TODO / Handoff

Written so a fresh session can pick this up cold. Everything below was verified against the repo at commit 9e2b50a; if a number here disagrees with the repo, the repo is right and this file is stale.

Counts refreshed 2026-10-21. The repo now holds 41 promoted projects (38 under NROM/, plus CNROM/World Class Track Meet (U), UNROM/Zanac (U) and MAPPER8/Mermaids of Atlantis (U)) and 851 _wip/ projects. Both the last two disassembled _wip projects — Golf (JU) and World Class Track Meet (U) — were promoted on 2026-10-21, so every _wip/ project is a Pass 0 skeleton. Many sentences below still describe the earlier 30/39-promoted state; treat the numbers in this note as current.

Note: This file documents work completed up to 2026-10-20 (promotion of Ice Climber, Lode Runner and Pinball; _wip evaluation). The actual repo state is always the source of truth.

Layout note (2026-10-20): projects now live under their mapper directory (NROM/, AOROM/, CNROM/, MMC1/, MMC3/, MMC5/, UNROM/), project folders are flat (the copilot/ subfolder is gone — strip the prefix when reading older references below), every project's OVERVIEW.md is now its README.md, and a root Makefile builds, verifies and cleans every project (make, make clean, make <MAPPER>); the pre-commit hook drives it. Both tiers sit two levels deep, so ../../_tools/ is correct from any project folder.

The contract

Byte-identical rebuild is the hard requirement. In every project folder:

make        # must print "Byte-identical ROM verified."

A build that assembles but does not print that message is a failure. Requires ca65/ld65 on PATH. Never edit bytes to make a build pass — fix the source.

Two tiers exist, and the difference is real:

  • **Top level — promoted projects under their mapper dir (NROM/ etc.) — make compares the whole ROM against rom.nes in the project folder.
  • _wip/<MAPPER>/ (851 projects) — as of 2026-10-20 these also compare the whole ROM against a rom.nes copy in the project folder, so the header and CHR are proven. The tier was moved off the old cmp reconstructed_prg.bin prg.bin form; promotion is now git mv plus the disassembly work, with no build surgery. See WIP.md for the tier's layout, its quirks and its open work. Promotion still requires what promotion always required: a real disassembly (Pass 1 or beyond) with the canonical audit comments, and the Pass 2/3 naming work.

Current state

Refreshed 2026-10-21, after the pass-rule session. The promoted tier is 61 projects and every one of them now:

  • builds whole-ROM byte-identical;
  • carries no Label_XXXX label, no raw jsr/jmp operand and no routine header that refers to a previous pass;
  • has an audit trail in which every one of the 322,830 comments agrees with prg.bin (thirteen projects were repaired on 2026-10-21 - see CHANGELOG.md);
  • carries a power-on flow analysis in its README, derived from the disassembly by _tools/derive_poweron.py.

The two rules PROMPTS.md now states are being applied: a data table must be interpreted (structure plus the consuming instruction) before a project is promoted, and a routine's comment must describe that routine. 42 of the 61 projects carry a Pass 3 data-table inventory; the rest are in progress.

The rule that matters most for the next session: a data block that has been given a name has not been interpreted. The name is not the interpretation. Each block needs what the bytes are and the address of the instruction that reads them.

  • 38 promoted projects under NROM/ (41 promoted in all, with World Class Track Meet (U) under CNROM/, Zanac (U) under UNROM/ and Mermaids of Atlantis (U) under MAPPER8/), all whole-ROM byte-identical (Lunar Pool promoted 2026-10-18, Donkey Kong (JU) promoted 2026-10-19 after Pass 3, Donkey Kong Jr. Math (U) promoted 2026-10-19 after Pass 3 — re-promoted into NROM/ 2026-10-20 after the 2026-10-20 mapper-folder reorganization initially parked it in _wip/NROM/ over a jsr $F218-mislabeled-as-SubCF218_Block mismatch; the fix repointed four prg.s call sites to the true SubCF218 entry, see NROM/Donkey Kong Jr. Math (U)/README.md), Duck Hunt (JUE) promoted 2026-10-19 after Pass 3, Ice Climber (JE) and (U) promoted 2026-10-20 after Pass 3, Lode Runner (U) promoted 2026-10-20 after Pass 2/3, Pinball (JU) promoted 2026-10-20 after Pass 2/3, Popeye (JU) (PRG 1) promoted 2026-10-20 after Pass 2/3 (header.s/chr.s + HEADER linker.cfg added, whole-ROM cmp passes on the first promoted build; SHA-256 00160651…78bd8b4; see NROM/Popeye (JU) (PRG 1)/README.md), Excitebike (JU) promoted 2026-10-20 — the byte-596 mismatch was two PpuMaskShadow ($0A) operands where the ROM uses $11 (NMI's second mask shadow, aliased as NmiMaskShadow in locals.inc); the 4,401 damaged audit comments (doubled ?? forms plus 6,339 comments shifted against their mnemonics) were re-anchored from the ca65 listing via the new _tools/repair_audit_comments.py, and all 58 raw jsr/jmp $XXXX operands were substituted with routine labels/equates. See NROM/Excitebike (JU)/README.md. Raid on Bungeling Bay (U) promoted 2026-10-20 — header.s/chr.s + HEADER/PRG/CHR linker.cfg added, whole-ROM cmp passes on the first promoted build (MD5 77285503…885000ac); one leftover neutral indirect operand jmp (Zp01) at $E2EC became jmp (IndDispatch01) (alias already present in locals.inc); apply_symbols.py reports 0 substitutions pending. Pac-Man (U) promoted 2026-10-20 — Pass 2 completed first (all 194 Label_XXXX definitions renamed from a fresh map derived from the committed split, not from a drafted map; all 49 jsr/jmp call sites resolved; zero Label_ and zero raw $XXXX call operands left), then Pass 3: 119 operands substituted (101 hardware + 11 single-name + 7 multi-alias resolved per site through a new sites.tsv), apply_symbols.py now reports 0 residue. The 7 site resolutions are all proven from context, not guessed — four jmp ($0010) immediately preceded by sta DispatchPtrLo/sta DispatchPtrHi, one jmp ($00FE) preceded by sta AudioHandlerPtrLo/sta AudioHandlerPtrHi, and two sta a:$0000,y zero-page clears that take the neutral Zp00. header.s/chr.s + HEADER/PRG/CHR linker.cfg added, whole-ROM cmp passes on the first promoted build (MD5 a69d310f8cae9397fbd39f204672b5c7); see NROM/Pac-Man (U)/README.md. Pac-Man (Tengen) (U) promoted 2026-10-20 — a different build of the same game as the row-32 dump: the PRGs differ in 56 bytes in 8 runs, all of them code-versus-licensee-text ($C3E3-$C408 is 26 spaces here against LICENSED BY NAMCO AMERICA INC there; $FF00-$FF16 is $FF padding here against the boot code there), and the RESET vector follows ($C033 against $FF00) — the same boot sequence, inline. Disassembled from scratch: the map was derived from this dump's own committed split, with no name, map or file carried over from the row-32 dump. Pass 2 named all 194 Label_XXXX definitions and resolved all 48 raw $XXXX call operands (map in routinemap.tsv); Pass 3 added 30 semantic zero-page aliases applied only at the proven sites (sites.tsv) and named 28 data tables, including CharacterDataTable ($C66A) / CharacterNameStrings ($C67E), where the ROM itself names Blinky, Pinky, Inky and Clyde. A Pass 1 correction came with it: six command handlers were recovered — ScriptCommandTable ($EFDD) is read by the traced instruction at $EFCC and six of its entries point at $F00A, $F022, $F03A, $F052, $F062 and $F072, all of which the tracer had left as data, two of them mis-split across the jmp $EF61 at $F01F and $F04F. Those 120 bytes are code here. The same gap exists in the promoted row-32 dump, which has not been corrected. header.s/chr.s + HEADER/PRG/CHR linker.cfg added, whole-ROM cmp passes on the first promoted build (MD5 d34e7a74…28ad0); see NROM/Pac-Man (Tengen) (U)/README.md. **Pyramid (U) (Sachen) promoted 2026-10-20 — an unlicensed Sachen release with a mapper-0 header whose boot code pokes a mapper unlock at $4100 and checks the RAM bytes $0120/$0121 against "A"/"V". A Pass 1 correction came with it: the committed split was a strict subset of the correct one — 828 bytes of code were still marked as data, because the tracer cannot follow a jmp that sits inside a data region, and this game dispatches through four such tables ($C01E, $C02A, $C042, $C054) plus ten more at $C000-$C01B. Re-tracing with those sixteen targets, the $C800 boot mainline and six further code starts seeded by hand recovers them (and a five-byte stub at $DF89 in a hole between two routines); the re-trace loses no committed code byte and takes the split from 34.5% to 39.6%. make regen reproduces it, so the split stays verifiable. Pass 2 named 431 routine entries and the 32 data blocks from this dump's own code (428 Label_XXXX gone, 320 raw $XXXX call operands resolved; the internal branch-target names are derived mechanically by the new _tools/derive_branch_names.py); Pass 3 added 24 semantic zero-page aliases, applied only where their role is proven, and named 32 data tables. header.s/chr.s + HEADER/PRG/CHR linker.cfg added, whole-ROM cmp passes on the first promoted build (MD5 aa285ff1…6c59e2); see NROM/Pyramid (U) (Sachen)/README.md. Raid on Bungeling Bay (U) [a2] promoted 2026-10-20 — a different build of the same game as the row-34 dump: 150 of the 16,384 PRG bytes differ in 7 runs, all of them code-versus-copyright-text at $C67D-$C6D8 and $C73B-$C779, the CHR differs too, and header byte 6 is $00 (Horizontal) against $01 (Vertical). Its Pass 3 added 15 semantic zero-page aliases (every one applied only at the sites where its role is proven), and finishing it corrected a naming error in the already-promoted sibling: $EA had been named VBlankWaitCounter, but the routine at $C412 is the game's PRNG (the classic eor/asl/php/lsr/plp/rol scrambler, called from thirteen gameplay sites and twice in a row at $CDF4/$CDF9 with the second result masked #$07), so $EA is the scrambler's phase counter — renamed PrngPeriodCounter in both dumps, and $EB/$EC were named PrngSeedB/PrngState in both. The sibling's two sta a:IndDispatch17,y operands were also corrected: they are absolute stores to RAM $0017, not the dispatch pointer. header.s/chr.s + HEADER/PRG/CHR linker.cfg added, whole-ROM cmp passes on the first promoted build (MD5 659d340a1e9d420eee28df13319b0094); see NROM/Raid on Bungeling Bay (U) [a2]/README.md. Mario Bros (JU) promoted 2026-10-20 — a two-player light-gun-less platformer whose handler tables are inline: the pointers sit in the middle of the code stream, right after the jsr that reads them, so the static tracer could never follow them. A Pass 1 correction came with it: a Mesen Code Data Logger capture of this ROM (10,915 code bytes) showed 1,010 bytes the tracer had left as data were code; two branch targets the capture never reached ($E4CB and $E639) were forced with --override for 57 more, so 1,067 bytes moved from data to code and 22 moved the other way, taking the split from 72.0% to 78.4%. Pass 2 named every label — zero Label_ and zero SubC residue: the 185 entries a previous session had left as address-derived residue were all named from the code. Pass 3 added 25 semantic zero-page aliases, applied only where the role is proven, and named 35 data tables. header.s/chr.s + HEADER/PRG/CHR linker.cfg added, whole-ROM cmp passes on the first promoted build; see NROM/Mario Bros (JU)/README.md. Hogan's Alley (JU) promoted 2026-10-20 — a light-gun game whose engine dispatches through inline tables: IndirectCall at $C34D pops the return address of the jsr that called it and reads a 16-bit handler pointer from the word that follows, so all six handler tables ($C124 19 entries, $C219 4, $C89C 14, $CDD1 1, $D234 2, $D3D6 14) live inside the code stream and the static tracer cannot follow them. A Pass 1 correction came with it: the committed split was a strict subset of the correct one — a merged Mesen Code Data Logger capture (five captures OR-ed, 6,544 code bytes) showed 1,216 bytes that the tracer had left as data were code, taking the split from 41.8% to 49.1%; five bytes moved the other way. The four branch targets the reclassifier could not prove were turned into labels by the new _tools/resolve_raw_branches.py. Pass 2 named 206 routine entries and derived 413 internal branch targets from this dump's own code (630 Label_XXXX gone, 484 raw $XXXX call operands resolved, 15 unlabelled call targets given a label); Pass 3 added 60 semantic zero-page aliases, applied only where the role is proven, and named all 34 data tables. apply_symbols.py reports 1 residue (sta a:$00B4,y at $C203 — the same address as Zp40/ActorPalette but forced to absolute addressing, so it must stay numeric). header.s/chr.s + HEADER/PRG/CHR linker.cfg added, whole-ROM cmp passes on the first promoted build; see NROM/Hogan's Alley (JU)/README.md.
  • 851 projects under _wip/ (35 in _wip/NROM/, 221 in _wip/MMC1/, 239 in _wip/MMC3/, 97 in _wip/UNROM/, 57 in _wip/CNROM/, 10 in _wip/MMC5/ and 192 across 23 more mapper folders): all whole-ROM byte-identical. All 851 of them are Pass 0 skeletons — the folder shape and the build are proven, but prg.s is still a single .incbin "prg.bin", so they owe Pass 1 from scratch. Exactly one carries a real disassembly: Golf (JU) (Pass 1 + substantial Pass 2, still carrying 349 internal Label_ branch targets plus pre-canonical audit comments). Volleyball (U) was the last project to leave the tier with a disassembly (Pass 1 + Pass 2 + Pass 3, promoted to NROM/ on 2026-10-21 — 11,395 instructions / 23,926 code bytes, split with a Mesen CDL capture, all 1,989 labels named). Hogan's Alley (JU), Mario Bros (JU), Pinball (JU), Lode Runner (U), Popeye (JU) (PRG 1), Excitebike (JU), Raid on Bungeling Bay (U), Raid on Bungeling Bay (U) [a2] and Pac-Man (U) were promoted after their fix/Pass work. See WIP.md for the tier's detail.
  • Local master is ahead of origin/master; nothing pushed.
  • _tools/verify_pass1.py covers the promoted projects (it selects project folders under the mapper dirs carrying a Makefile + prg.bin/rom.nes; after the 2026-10-20 promotions this includes all 35 of NROM/ — all canonical, OK verdict), not the _wip/ tier, which is checked by make wip. Current run (2026-10-20): every one builds, all canonical, no truncated or unfaithful Pass 1. The earlier-reported re-trace crash on MUSCLE (U) / Donkey Kong Jr. (JU) was a false alarm — nesdis.operand_value() already handles the a: prefix via token.removeprefix("a:").lstrip("$"). The make half was always working.
python3 _tools/verify_pass1.py            # all 30 promoted projects
python3 _tools/verify_pass1.py "MUSCLE (U)"   # one project (top-level only)
  • Audit comment standardization complete (2026-10-19): All 27 top-level projects now use the canonical ; CPU:$XXXX PRG:XXXX AA BB format.
    • CIRCUS: fixed 4,427 comments (CPU:XXXX → CPU:$XXXX)
    • Excitebike (JU): fixed 48 double-semicolon comments (; state $XX ; CPU:...)
    • 9 projects received canonical comments via _tools/audit_comment_tool.py: Balloon Fight, Baseball, Bomberman, Burger Time, Clu Clu Land, Defender 2, Donkey Kong 3, Donkey Kong Jr., Tennis
  • Pass 3 symbol application complete (2026-10-19): All 27 top-level projects now have _tools/apply_symbols.py run on them, substituting symbols.inc/locals.inc names into prg.s operands:
    • Balloon Fight (JU): 125 hardware + 797/813 ZP (16 $13 residue)
    • Baseball (UE): 121 operands (85 single + 36 hardware)
    • Bomberman (U): 354 single + 8 site-resolved (already applied)
    • Burger Time (U): already applied
    • Clu Clu Land (JU): already applied
    • Defender 2 (U): already applied
    • Donkey Kong 3 (JUE): already applied
    • Donkey Kong Jr. (JU): already applied
    • CIRCUS: 118 operands (38 single + 80 hardware; 23 multi-alias residue)
    • Wild Gunman (U): 76 operands (11 single + 65 hardware)
    • Joypad Test Cartridge (U): 47 hardware
    • NES PowerPad Test Card (U): 89 hardware
    • MUSCLE (U): 220 operands (91 single + 129 hardware)
    • Lunar Pool (U): 45 operands (18 single + 27 hardware)
    • Donkey Kong (JU): 75 operands (17 single + 58 hardware)
    • Tennis (JU): 18 single
    • Pac-Man (USA) (Namco): 524 single (727 multi-alias residue)
    • Urban Champion (JU): 70 operands (4 single + 66 hardware)
    • Millipede (U): hardware registers substituted; 8 semantic ZP aliases (Pass 3 complete)
    • Donkey Kong Jr. Math (U): 69 hardware + 13 multi-alias ZP substituted directly
    • Duck Hunt (JUE): 68 hardware + 18 multi-alias ZP substituted directly
    • Ice Climber (JE): 91 operands (23 single + 68 hardware) + 3 multi-alias via sites.tsv
    • Ice Climber (U): 91 operands (23 single + 68 hardware) + 3 multi-alias via sites.tsv
    • Lode Runner (U): 85 operands (83 hardware + 2 single); 2 semantic ZP aliases (Pass 3 partial)
    • Pinball (JU): hardware registers substituted; no semantic ZP aliases (Pass 3 partial)
    • Popeye (JU) (PRG 0): 79 operands (15 single + 64 hardware); 4 semantic ZP aliases (Pass 3 complete)
    • Popeye (JU) (PRG 1): 80 operands (15 single + 65 hardware); 4 semantic ZP aliases (Pass 3 complete)
    • Excitebike (JU): skipped — inline defs in prg.s conflict with locals.inc. The naming gap this left was closed by hand on 2026-10-20: all 58 raw jsr/jmp $XXXX operands now carry routine labels or 15 sub-entry equates added to locals.inc (sub-entries are equates rather than mid-routine labels so no ca65 local-label scope gets split — adding Name: lines mid-routine re-scopes every @local after the split and breaks forward @refs); zero-page operands remain numeric (Pass 3 residue)

Open work, highest value first

1. Joypad Test Cartridge (U) — Pass 3 complete

The only top-level project whose Pass 3 was undone; now complete.

  • Pass 1 redone (6.6x: 282 → 1,773 instructions, 580 → 3,836 bytes / 3.5% → 23.4%).
  • Pass 2 complete: 202 labels, zero Label_ remaining, all 202 routine headers describe real behaviour.
  • Pass 3 complete: the single data region $CF06–$FFFF (12,538 bytes) has been broken into 20 named sub-blocks (section 8 of the project README.md):
    • VRAM command streams at $CF06, $CF40, $D063, $D1F5 — decoded via RetAddrUpdate ($CDC8): $4C = jump, $60 = deferred PPUCTRL, bit-7-clear = VRAM write (PPU addr + data, bit 6 of data = long/short command selector).
    • OAM table groups at $D4E3, $D5C4, $D644 — 12 groups of 32-byte tables (8 entries of Y/tile/attr/X), read by CopyOamFromTable/CopyOamFromTable70.
    • Sprite template at $D6A5 (read by CopySpriteTemplateTable) and button OAM template at $D6C5 (read by PrepareButtonOam).
    • $FF ROM padding ($D6E5–$FFF9) and vectors ($FFFA–$FFFF).
  • Build verified byte-identical.

Remaining open questions (not Pass 3 blocking):

  • Which player/button each MarkerVar01–MarkerVar12 belongs to — not established, named by position deliberately.
  • HandleButtonPress1–8 write OAM tiles in order $0202, $0206, $020E, $020A, ... — sprites 1, 2, 4, 3, 5, 6, 7, 8. The out-of-order third/fourth entries are unexplained.

2. Mario Bros (JU) — Pass 2 substantial, reach-limited

NROM/Mario Bros (JU)/ (promoted 2026-10-20). Pass 1 complete: 72.2% code (5,735 instructions), byte accounting exact, BYTE-IDENTICAL.

Pass 2 substantial — 262 call entry points named (verified 2026-10-19; the earlier "252 (90 + 165)" did not match the file):

  • 39 semantic names: audio/sound routines in $F8xx-$F9xx (clearly identifiable from APU register writes), gameplay helpers like CheckZpB3Return, CheckRangeReturn012, ToggleZpFC_Bit3
  • 223 address-based names (SubCxxxx) for the remainder
  • All 478 jsr/jmp call sites resolved from raw $XXXX to labels
  • Zero raw $XXXX call operands remain

667 Label_Cxxxx internal branch targets remain — local control-flow targets within routines, not subroutine entry points. These do not need semantic names for the call graph to be readable.

The real blocker is reach, not naming. 4,555 bytes (27.8%) are still data, gated behind a stack-based indirect call at $CD9E (table pointer arrives via pla, unknowable statically) and a 20-entry JSR thunk table at $C5A3. Resolving the pushed table addresses is the key to the remaining 28%.

  • Already documented: $C5A3 is a 20-entry JSR thunk table, $C0B6 is the NMI phase dispatcher. Both were found by probing, which is a cheap technique worth reusing on other projects.

2b. Lunar Pool (U) — Pass 2 and Pass 3 complete, promoted to the top level

NROM/Lunar Pool (U)/ (promoted out of _wip/ 2026-10-18 by git mv; tool paths are ../../_tools/). Pass 1 complete: 67.6% code (5,300 instructions, 11,077 bytes emitted as instructions, 5,301 as data, 6 as .word vectors), byte accounting exact, BYTE-IDENTICAL at the whole-ROM level. The split was re-derived against a Mesen Code Data Logger capture (10,028 bytes Code = 61.2%); the flat tracer had undercounted by 1,738 bytes of executed code and overcounted 100 bytes of data as instructions.

Promotion detail worth reusing: this promotion needed the header.s, chr.s and HEADER/PRG/CHR linker.cfg added by hand (the header and CHR stay as the raw header.bin/chr.bin splits), so promotion was not just a symlink and a cmp edit — copy the shape from NROM/Burger Time (U)/ (header.s/chr.s are one-line .incbins; the linker needs HEADER: start = $0000, size = $0010 before PRG). As of 2026-10-20 the _wip/ tier no longer needs any of that — every project there carries the whole-ROM build already, so promotion is now just git mv plus the disassembly work. See WIP.md. Result here: reconstructed.nes 24,592 bytes, SHA-256 6da37fd3…c8a1, equal to the original Lunar Pool (U).nes.

  • RESET is at $E80C, not $C000 — the tracer must seed it explicitly (--extra-seed 0xE80C), since the vectors are the only entry points a plain trace follows.
  • Correction to an earlier claim in this file and in the two project source docs: there is no jmp ($7961) RAM-pointer dispatch at $F788/$F7F6/$F828. Those were flat-tracer phantoms. $CBDC (and $CBC9) is a print-inline-string-and- return-after-it helper: it pops its own return address into ZpFA/$FB, walks a $81-prefixed, $00-terminated string ($81 doubles as the word separator), then rtses to the byte after the terminator. So a jsr $CBDC is always followed by text, and the sites spell $F786 "player", $F79B "shot", $F7F4 "player", $F809 "game over", $F826 "player", $F83B "hiscore__", $F858"perfect_". Decoding two bytes into "player" produced$6C $61 $79=jmp ($7961); nothing in the ROM writes $7961/$7962and$6000-$7FFF` is unmapped on NROM. Same trap to watch for in other titles.
  • Also corrected: the old Pass 2 claim. No SubC<addr> label exists in this prg.s and git log -S SubC finds no commit that added one; the file used to be all address-derived Label_<addr> with only Reset/NmiHandler/IrqHandler semantic. Do not copy the old "218 renamed / 374 internal" line into other docs. Pass 2 then finished for real: 705 labels, zero Label_<addr> left. Naming rule that was applied: jsr/jmp targets and logical block heads get PascalCase semantic names, internal branch targets get <Block>_<Role> (_Loop, _Next, _Done, _Store, _Return, …), and jsr/jmp operands stay raw numeric (this file's convention, as in Joypad Test Cartridge (U)) while branch operands are symbolic.
  • Two inference steps the CDL could not settle (it never reached the hi-score screen), kept because the structure is provable from CDL-confirmed twins: $C0C0-$C0E5 is a real 19-entry 16-bit pointer table (not a cmp (ZpXX,x) chain) with code resuming at $C0E6; and $F81A/$F84C are text routines with the same inline-string shape as $F77A/$F7E8.
  • Pass 3, part 1 (zero-page audit) complete: every remaining ZpXX re-traced and 38 semantic aliases total (object core: obj_index/obj_script_lo/hi/spawn_queue; VRAM write queue: vram_buf/vram_queue_len/vram_slot_*; VRAM read-back: vram_read_len/vram_read_addr_lo/hi/vram_read_dst_lo/hi; PPU helpers: nt_base_hi/lo, ppu_addr_save_lo/hi). 66 stay neutral with recorded reasons. Ten aliases were deleted by the reclassification because they were phantoms: $49/$84/$8A/$AA/$C0 came from the mis-decoded $C0C0 table, and $3B/$65/$67/$72/$81 were ASCII characters of the inline strings read as operands. Full evidence + residue in locals.inc.
  • Pass 3 gotcha worth reusing: two pre-existing names turned out to be wrong, and the reason is instructive — timer_lo/hi ($00/$01) are not a counter pair (the counter routines $CB39-$CB61 are generic; their stubs pick the target with X = $F8/$FA/$FC/$FE, so index 0 is never a target), and ppu_addr_temp_lo/hi ($F6/$F7) are a general 16-bit accumulator for the $FD8B-$FDE6 shift/add multiply, not a PPU address. Not renamed again (churn), recorded in locals.inc instead.
  • Pass 3, part 2 (tables) complete: 33 data structures named. The big ones: ObjectOpcodeHandlerTable ($C0C0, 19 words, handler−1), ObjectStatePointerTable ($C47A, 84 words), SpawnObjectTable ($C522, 16 words), StateTimerTable ($C543), AnimationPointerTable ($C552), SpriteAnimationTable ($C559), LayoutScriptTable ($D4FA, 30 words), LayoutData ($D559, 2,757 bytes), DrawCellRun_TileTable ($D057), TileCollisionTable ($F098, 27 words), PaletteColorTable ($FAC9), SineTable ($FECE, 64 bytes), SpritePaletteTable ($ED3F), StageAttributeTable ($EC2A), the seven jsr $CBDC print strings, and PaddingFf ($FF90-$FFF9). Five .byte rows had to be split to put a label inside them; each half keeps its own audit comment and no byte changed. The $FFFA-$FFFF vectors are .word NmiHandler, Reset, IrqHandler. Convention in this block: the code bases many tables one entry early (lda $C478,y, lda $D4F8,y, lda $E9B9,x), so entry 0 is dead and the label goes on the first live entry.
  • Residue the CDL could not settle — recorded, not guessed. Everything below is still .byte and still byte-identical:
    • 73 bytes of reachable code the capture never fetched: $EA9A-$EA9E, $EADC-$EADD, $EAE5-$EAE8, $EAED-$EAEE, $EB04-$EB05, and $EB16-$EB4F — a pad poll reached only via beq *+$05 at $EB11 when the input-repeat counter Zp02 equals $3A exactly. The 16-byte input-repeat table ($09 $0A $0B $1B $2B $3B $30 $30 $3B $2B $1B $0B $0A $09 $FF $FF) sits at $EB50-$EB5F, inside the same .byte run.
    • 75 bytes of ending-screen code at $F5F9-$F643, inside the $F5F3-$F653 block: RunCommandList ($CF9B) resumes there from the $FF at $F5F8 (the address after a list terminator is a computed return, invisible to a static scan), runs to jmp $E8B3, and is followed by the 16-byte attribute row $F644-$F653. Needs a completed game, so natural play never reached it.
    • ~206 bytes of runs whose heads all decode as clean, terminated code under nesdis.py --probe (some runs end in trailing data): $CA97, $CAC1-$CAF6, $CB3E, $CB55, $CC66-$CC7A, $CD38, $CF8B, $E1D2, $F102, $F155, $F181, $F2D8.
    • Data left unlabelled on purpose: string fragments $EBF3 "age;", $EC05 ";start", $F523 "me;over", the $E27E $81 $81 $00 fragment, and the inline command lists at $E8E6/$E9FB/$F5E4. Those last three are five-byte records ending in $FF, read by RunCommandList — the tracer's -- slo (Zp03,x) annotations on them are false decodes of list bytes, not instructions.
    • $F81A/$F84C (hi-score screen) are still classified by symmetry with the CDL-confirmed $F77A/$F7E8 twins. Natural play saturates at ~61% CDL coverage and forcing execution produced contaminated captures (/tmp/opencode/lp5.cdl, lp6.cdl — do not use). Beating HI. 0005000 or sinking a "perfect" shot would settle them.
  • _tools/cdl_reclass.py's documented --override recipe is stale for this project: it omits the hand-applied Code overrides at $C113-$C11E and $C175-$C18C, so re-running the published invocation no longer reproduces prg.s.
  • Three undocumented opcodes this project forced into nesdis.py: $72 (RRA abs), $42 (NOP #imm), $FA (NOP abs,X). One emitter fix: ca65 optimises an operand with a $00 high byte into zero-page form, so ABS/ABSX/ABSY/IND operands with high byte $00 now emit the a: prefix to force absolute.

3. Audit comments for Excitebike — COMPLETE (2026-10-19; re-anchored 2026-10-20)

All 5,376 instruction lines in Excitebike (JU) now carry canonical ; CPU:\$XXXX PRG:XXXX AA BB audit comments. The _tools/audit_comment_tool.py uses nesdis.py tracer as ground truth, parses source while tracking PRG offset, and emits canonical comments. Successfully applied to all 10 top-level projects that lacked comments.

2026-10-20 discovery + repair: the old pass had two damage modes it did not self-validate against: 4,401 lines carried doubled ?? comment tails (directives like .word/.byte got no bytes from the tracer), and 6,339 of 6,478 comment groups were systematically shifted against their mnemonics (negative drift up to −140 bytes — comments generated against an earlier, shorter source layout and never re-anchored). Fixed by the new _tools/repair_audit_comments.py, which uses the ca65 -l listing as ground truth for each source line's PRG offset and byte span, validates every batch against prg.bin, refuses to write on any ?? residue, and preserves non-audit semantic notes (; state $02 etc.). Key listing facts (reusable for other damaged trails): ca65 echoes a line's text on the FIRST byte batch only (continuations carry bytes but no text), depth-2 records are .include echo, and listing offsets index prg.bin directly.

  • ca65 -l gives offset + bytes, and the offset indexes prg.bin directly. Byte values must come from prg.bin, not the listing — ca65 prints rr rr for relocatable words.
  • Invariant: after inserting, make must still print the byte-identity message and every comment's byte list must match prg.bin at the stated offset. A wrong offset that still assembles is the failure mode to watch.

3a. Audit comments for Balloon Fight (JU) — COMPLETE (2026-10-21)

The trail was spelled canonically but was wrong by two bytes from ResetInitializationData ($C085) onward: 5,944 of the 6,007 comments named a CPU address / PRG offset two bytes below the truth, because the 3-byte .byte "HAL" signature at $C082–$C084 was counted as one byte when the comments were first generated. The routine headers (; PRG offsets: / ; CPU range:) and the linker labels were right, so the source and its own headers disagreed — a good way to spot this class of damage.

  • Fixed with _tools/repair_audit_comments.py (ca65 listing as ground truth, validated against prg.bin) followed by _tools/align_audit_comments.py for the canonical column-35 layout. Comment-and-whitespace only: all 8,544 lines of code text unchanged, make still byte-identical.
  • Off-by-one fixed in _tools/align_audit_comments.py: it tested the indented code length against 31 instead of against 35, so code texts of 28–31 characters were never padded into the column. That is the difference between the emitter's f" {text:<31}; …" and the tool's behaviour; short lines were left ragged at column 34/36/37.
  • Routine headers completed (2026-10-21): the 61 routine headers that had no ; Clobbers: line now have one, so all 63 carry the full template (global + local description, parameters, returns, clobbers). The blocks are derived by _tools/derive_clobbers.py, never guessed: the opcode comes from the audit comment's byte list, the operand is resolved through locals.inc/symbols.inc so a clobber can be named, the control flow is followed (a jsr to another named entry is a call, a branch or a fall-through is not), and register preservation is modelled — so NmiHandler reports no register and FlushPpuCommandPreserved reports only A.
  • Still open: 20 of the 63 routine headers still carry the Pass-1 placeholder text ("Reachable game-engine routine identified during recursive Pass-1 tracing", "Caller-defined register and global RAM state", …) in their Global: / Local: / Parameters: / Returns: fields. The other 43 have been written. This is Pass 3 work on the meaning of the routines, not on their mechanics, and it is not derivable from the code alone.

4. Label_ residue — promoted tier closed 2026-10-19; _wip tier open

Project Label_ definitions refs in code Note
Wild Gunman (U) 0 0 Pass 1 redone; Pass 2 complete; Pass 3 complete
Donkey Kong Jr. (JU) 0 0 Pass 2 complete (2026-10-19)
Balloon Fight (JU) 0 0 Pass 2 complete (2026-10-19); Pass 3 symbols applied — 16 $13 operands left numeric
Donkey Kong (JU) 0 0 Pass 2 complete (2026-10-19); Pass 3 complete; promoted 2026-10-19
Pac-Man (U) 0 0 Pass 2 complete (2026-10-20); Pass 3 partial — 119 operands, 0 residue; promoted 2026-10-20
Pac-Man (Tengen) (U) 0 0 Pass 2 complete (2026-10-20); Pass 3 partial — 30 zero-page aliases, 28 named tables, 0 residue; promoted 2026-10-20
Pyramid (U) (Sachen) 0 0 Pass 2 complete (2026-10-20); Pass 3 partial — 24 zero-page aliases, 32 named tables, 0 residue; Pass 1 corrected (+828 bytes of code); promoted 2026-10-20
Raid on Bungeling Bay (U) 0 0 Pass 2/3 partial (2026-10-20); promoted 2026-10-20
Raid on Bungeling Bay (U) [a2] 0 0 Pass 2 complete; Pass 3 partial — 15 zero-page aliases, 0 residue; promoted 2026-10-20
All promoted 0 0 All Pass 3 complete, symbols applied (DK Jr. Math re-promoted 2026-10-20; Popeye (JU) (PRG 1) promoted 2026-10-20; Pac-Man (U) promoted 2026-10-20)
Note these counts were address-derived labels only — some were legitimately
internal branch targets and may never deserve a semantic name.

Balloon Fight (JU) Pass 3 symbol application (2026-10-19). prg.s now uses the names from symbols.inc and locals.inc for every operand they define: all 125 hardware-register operands are symbolic, and 797 of 813 zero-page/RAM operands are symbolic. _tools/apply_symbols.py does the substitution (--sites carries the per-routine choice for addresses that carry several names, since 15 addresses in locals.inc have 2–3 aliases). The 16 residue operands are all $13, used as a plain high-byte scratch beside Temp12; its aliases (ReverseRecordIndex, CollisionDeltaY, MotionDeltaHi) describe other routines, so those operands were left numeric rather than guessed. A neutral Temp13 = $13 in locals.inc would close them. Rebuild stays byte-identical.

The operand-naming sweep covered the then-30 top-level projects (2026-10-19/20). The promoted tier is now 41 projects; its per-project state is in the Current state section above. Excitebike (JU)'s apply_symbols.py run was skipped due to inline prg.s definitions conflicting with locals.inc values — its 58 raw jsr/jmp $XXXX operands were substituted by hand on 2026-10-20 instead (routine labels + locals.inc sub-entry equates); its zero-page operands remain numeric as documented Pass 3 residue.

The _wip tier is still open, but the shape of the work changed on 2026-10-20: all 851 of its projects are Pass 0 skeletons with no disassembly at all, so they owe Pass 1 from scratch rather than a label cleanup. The last two that carried real disassemblies — Golf (JU) and World Class Track Meet (U) — were promoted on 2026-10-21. The earlier Pass 2/3 audits of the projects that have since left the tier (Golf (JU), Mario Bros (JU), Raid on Bungeling Bay (U) [a2], Pac-Man (U), Pac-Man (Tengen) (U), Pyramid (U) (Sachen), Hogan's Alley (JU) and the rest) are recorded in the project READMEs. Five project headers and five inventory rows used to read "Pass 2 complete"; they had counted their draft map's rows rather than names actually present in prg.s, and were corrected 2026-10-19 (the project READMEs have the per-project audits):

Project named / total label defs Label_ left drafted map (rows / applied / stale / applicable)
Pinball (JU) 180 / 681 501 210 / 179 / 17 / 0
Mario Bros (JU) 270 / 937 667 none (262 call targets: 39 semantic + 223 SubC)
Lode Runner (U) 627 / 627 0 0 / 0 / 0 / 0 (fresh Pass 2 done 2026-10-20; Pass 2/3 complete 2026-10-20)

The drafted maps are not applicable. Auditing every row by address against the committed split: a large fraction point at addresses that are not instruction boundaries (100/243 DK Jr. Math, 96/255 Ice Climber (JE), 17/210 Pinball) — they were built against an older code/data split — while most of the rest are unlabelled instruction boundaries that no operand in prg.s references, or (Duck Hunt) competing names for the same label (Label_C2BF alone carries 205 candidates). Across all four maps the number of rows that are both insertable and corroborated by control flow is zero. Pass 2 here means deriving a fresh map from the committed split (routine entries + <Routine>_Block[_n] internal branch targets, as done for Donkey Kong (JU)), not applying these files. Pinball (JU) also has 40 Pass 3 data-region names drafted in data_regions.tsv and a pinball_zp_map.tsv, none applied.

Donkey Kong (JU) Pass 2 resolution (2026-10-19): the last 919 address-derived definitions were named — 102 new semantic routine names, 217 SubC<addr> entry names (honest residue, matching Golf (JU)/Mario Bros (JU) practice) and 600 derived <Routine>_Block[_n] internal branch targets. What remains, if anything, is behavioral naming rather than address-derived labels: the 217 SubC<addr> routines, the 145 zero-page slots in locals.inc (still neutral ZpXX), and the 407 unapplied zp proposals in dk_full_map.tsv.

Donkey Kong Jr. Math (U) Pass 2 resolution (2026-10-19): the 971 remaining Label_ definitions were named fresh from the committed split — 64 semantic routine names preserved from Pass 1, 295 SubC<addr> entry points for all remaining jsr/jmp targets, and 676 <Routine>_Block[_n] internal branch targets. 13 semantic zero-page aliases added to locals.inc (PtrLo/Hi, Ptr2Lo, VBlankTimer, SprCount, SprIndex, ObjIndex, BtnState, ScorePtrLo/Hi, SndChannel, GameState, FrameCounter). Hardware register operands (69) substituted via apply_symbols.py; zero-page multi-alias addresses need a --sites file for full substitution. Build remains BYTE-IDENTICAL.

Donkey Kong Jr. Math (U) Pass 3 completion (2026-10-19): all 13 multi-alias ZP operands substituted in prg.s (via direct replacement, since apply_symbols.py only handles numeric operands); 18 data tables/structures named across all data regions (see the project README.md for table). Build remains BYTE-IDENTICAL.

Duck Hunt (JUE) Pass 2 resolution (2026-10-19): the 441 remaining Label_ definitions were named fresh from the committed split — 30 semantic routine names preserved from Pass 1, 428 SubC<addr> entry points for all remaining jsr/jmp targets, and 293 <Routine>_Block[_n] internal branch targets. 18 semantic zero-page aliases added to locals.inc (PtrLo/Hi, Ptr2Lo, GameState, SndTemp, SndChannel, SndNote, SprData, Temp, CtrlState, CtrlTimer, VramPtrLo/Hi, DataPtrLo, SndChan, SndPtrLo/Hi, FrameCounter). Hardware register operands (68) substituted via apply_symbols.py; zero-page multi-alias addresses need a --sites file for full substitution. Build remains BYTE-IDENTICAL.

Duck Hunt (JUE) Pass 3 completion (2026-10-19): all 18 multi-alias ZP operands substituted in prg.s (via direct replacement, since apply_symbols.py only handles numeric operands); 20 data tables/structures named across all data regions (see the project README.md for table). Build remains BYTE-IDENTICAL.

Duck Hunt (JUE) promotion to top level (2026-10-19): added header.s/chr.s + HEADER/PRG/CHR linker.cfg, switched make to whole-ROM cmp, moved _tools paths. Build verified Byte-identical ROM verified.

5. MUSCLE (U) — coverage plateau

Pass 1/2/3 complete and promoted to top level as #16. The stage-payload trace plateaus at ~41% of $B0FB–$BEBF and will not go higher by cycling stages:

  • $B0FB–$BEBF is a shared pool, not per-stage data: per-actor bytecode + compressed-VRAM RLE + music note streams. $BD28 is an 8-entry per-actor entry-offset table ($A063 adc $BD28,X, X = ActorIndex $1E).
  • Forcing all 8 actor indices added zero new bytes.
  • The sound engine reads the same window ($B03C lda (SoundReadPointerLo),Y → cmp #$F0 → lda $B0E3,y = note decoding), which is where the $FF terminators come from.
  • To go further needs other music tracks playing and actors 2–4 in non-default states — i.e. scripted match play, not button taps. Out of scope for a coverage tracer.
  • Two corrections recorded: $0326 is not a level byte (never leaves $00 even in a confirmed match), and $0320 is a boolean, not a screen-state machine.

6. Documentation follow-ups (2026-10-19 sweep)

The sweep corrected the false aggregate claims — the _wip "Pass-0 skeleton" prose, "Pyramid (U) (Sachen) is the only one with Pass 1", the Excitebike/Pac-Man audit-comment gap, and the "verify_pass1.py checks all 36" scope — and normalized every project's mirroring label to the header-byte convention. All 30 top-level projects now also have Pass 3 symbols applied (2026-10-19/20). What the sweep did not do:

  • The stale _wip/ project README.md files (Hogan's Alley, Mario Bros, Pac-Man (Tengen) (U) and Raid [a2] — Popeye (JU) (PRG 1) was promoted 2026-10-20 with its flow README intact, and Raid on Bungeling Bay (U) left the tier 2026-10-20 with its flow README promoted as-is, and Pac-Man (U) left it the same day with its flow README promoted and updated) were retitled and restatused to match their real sources, but still lack the power-on flow analysis the promoted projects' README.mds carry — that is Pass-1 analysis work per project, not a doc edit. (Lode Runner and Ice Climber (JE)/(U) were promoted to top level and their README.mds now carry the flow analysis.)
  • Donkey Kong 3 (JUE) has no promoted-tier README.md at all — corrected 2026-10-20: it does have one (NROM/Donkey Kong 3 (JUE)/README.md, 318 lines, "Game Flow from Power-On"). The claim was stale; the flow analysis exists.
  • Golf (JU) still uses the pre-canonical audit-comment spelling (; C007: AD 02 20 instead of ; CPU:$C007 PRG:0007 AD 02 20). audit_comment_tool.py can bring it to canonical, but it has only been run on top-level projects. As of 2026-10-21 Golf (JU) is the only project left in the whole tree with pre-canonical comments — 4,227 of them, 0 canonical. Pyramid (U) (Sachen), which used to be the second one, was fixed when it was promoted. The gap is recorded in the project's own README.md and in WIP.md §8.
  • Hogan's Alley's Pass 1 seed list is suspect. Its prg.s header lists 55 routine entries "recovered from table references"; $E9F1 turned out to be a data-table base (lda $E9F1,x), not a dispatch entry, and was forced back to data — the sole build break found in the sweep (2026-10-19). 31 of the remaining 54 have no direct jsr/jmp reference either, which is expected for indirect-dispatch targets but leaves room for more table-base false positives. Settled 2026-10-20 with cdl_reclass.py against a merged Mesen CDL capture: 1,216 bytes moved from data to code (41.8% → 49.1% code), five the other way. 17 of the 28 seed entries that no jsr/jmp reaches turned out to be entries of the six inline dispatch tables (the handler table is the data that follows the jsr IndirectCall that reads it, so the tracer cannot see it); the other 11 are code the CDL never observed. See NROM/Hogan's Alley (JU)/README.md.
  • Five _wip "Pass 2 complete" claims were false and are now corrected (Donkey Kong Jr. Math, Duck Hunt, Ice Climber (JE), Ice Climber (U), Pinball) in both the project README.mds and the root inventory rows. Each had counted its draft map's rows rather than names actually present in prg.s, and had described the locals.inc count of neutral ZpXX slots as "zero-page semantic aliases". Ice Climber (U) was worst: the sweep itself restated it "Pass 2 complete" while describing its 971 Label_ definitions in the same paragraph — a copy-paste from (JE), and (U) has no map file at all. The drafted maps were then audited row by row against the committed split and are not applicable (0 of 210–272 rows in each are both insertable and referenced) — see §4 for the table and the method. Donkey Kong Jr. Math (U) has since had Pass 2 and Pass 3 completed for real (2026-10-19) with a fresh map derived from the committed split (64 semantic + 295 SubC<addr> + 676 _Block labels; 13 ZP aliases; 18 data tables named), and was promoted to top level. Duck Hunt (JUE) has since had Pass 2 and Pass 3 completed for real (2026-10-19) with a fresh map derived from the committed split (30 semantic + 428 SubC<addr> + 293 _Block labels; 18 ZP aliases; 20 data tables named), and was promoted to top level. Ice Climber (JE) and (U) have since had Pass 2 and Pass 3 completed for real (2026-10-20) with fresh maps derived from the committed split (196 semantic + 431 _Block labels; 2 ZP aliases; data tables named), and were promoted to top level. Lode Runner (U) has since had Pass 2 and Pass 3 completed for real (2026-10-20) with a fresh map derived from the committed split (196 semantic + 431 _Block labels; 2 ZP aliases; data tables named).
  • Mario Bros' entry-point counts were verified wrong and corrected in the root index, §2 and its README.md: the docs said "252 entry points (90 semantic + 165 SubCxxxx) / 477 sites / 156 neutral ZpXX"; prg.s actually holds 262 distinct jsr/jmp targets (39 semantic + 223 SubC<addr>), 478 call sites, and 151 neutral slots. Nothing had changed in prg.s since the initial commit, so the old numbers were never right.

Gotchas that will bite you

These cost real time this session. All are recorded so they don't cost it twice.

  • Undocumented opcodes silently truncate a trace. A tracer knowing only the 151 official opcodes halts on the first one used as ordinary code. Joypad died at $C09E on DCP $3C20 ($CF) and lost 3,256 bytes of code. nesdis.py --undocumented adds all 105 (default off, so existing make regen pipelines stay byte-stable). Mario Bros: 14.6% → 14.9% from this alone, but combined with seeding it mattered more.
  • ca65 V2.19 implements none of the undocumented opcodes. They cannot be written as mnemonics. nesdis.py emits them as explicit .byte with the disassembly in the comment, keeping them in the code region so the split and the audit trail survive.
  • RESET and IRQ are usually the same address. The semantic-name map used to overwrite, renaming the primary entry to IrqHandler. Now setdefault, in RESET/NMI/IRQ priority order.
  • render() stamped every branch as Label_XXXX and never reconciled with the semantic map, so a branch into a named routine emitted a label that was never defined — the file did not assemble at all.
  • Control-flow targets must win over fall-through. A bne targeting $C528 was being swallowed by a fall-through NOP #$A5 at $C527 whose operand was $C528. No assembler branches mid-instruction. Fixed in nesdis.py.
  • Branch targets inside a surviving instruction must be pruned from the target set, or emit_code's linear walk consumes those bytes as an operand and the label goes undefined.
  • NMI must fire once per frame, not per $2002 read. The main loop polls $2002 to sync on vblank, and each read clears bit 7 — which re-arms NMI in the same scanline. Guarding on the vblank flag alone gave 40,900 NMIs across 3,000 frames and silently corrupted all game state, flattening coverage at 26%.
  • Input goes on joy1 = $4016 with a real latch/shift register. The poll routine's lda $4016,X with X=1 lands on $4017, but only bits 0–1 are compared, so driving $4017 consumes nothing and changes no coverage.
  • A static trace cannot settle the code/data split; the emulator's Code Data Logger can. The trace misses code behind computed dispatch, and it cannot tell inline string data from an instruction that decodes out of the same bytes — both leave the rebuild byte-identical while the split stays wrong. Mesen marks every PRG byte the CPU fetched as an opcode vs read as data; capture it with mesen_cdl_file(action:'save', memoryType:'NesPrgRom', filepath:...) (cumulative — it does not reset) and feed it to _tools/cdl_reclass.py, which rewrites the split to match wherever the CDL has an opinion and leaves the rest alone. Lunar Pool went 9,403 → 11,041 code bytes that way (1,738 data→code, 100 code→data) and then recorded zero disagreement with the CDL; 36 further bytes were moved by hand later ($C113-$C11E, $C175-$C18C), so its file now carries 11,077. Forcing the PC to reach unvisited code is not a general substitute: a routine that returns through a popped address runs away when entered that way and marks garbage as Code (Lunar Pool $F81A).
  • A jsr to a helper that pops its own return address means the bytes after it are text, not code. Lunar Pool's $CBDC/$CBC9 pops the caller's return address into a pointer, prints a $81-prefixed, $00-terminated string ($81 doubles as the word separator), then rtses to the byte after the terminator. A flat tracer started an instruction two bytes into "player" ($6C $61 $79 = jmp ($7961)) and produced a plausible-looking "RAM-pointer dispatch gate" that does not exist — $7961 is never written and $6000–$7FFF is unmapped on NROM. Suspect this shape whenever a jmp ($xxxx) operand spells ASCII.
  • Odd vector targets are not bugs. Burger Time's $FF7F NMI and CIRCUS's $4CB7 IRQ point into unused space. That is common in this set — verify before assuming a handler is broken.
  • Vectors are not in the iNES header. They are the three little-endian words at the end of the 16 KB PRG ($FFFA–$FFFF in the $C000 mirror). Bytes 0–9 of rom.nes carry only sizes, mirroring and mapper. The snippet to regenerate the whole column is in the root README.md.
  • py65 is not a build dependency and must be unpacked on demand: python3 -m pip download --no-deps -d <dir> py65 && unzip -q <dir>/py65-*.whl -d <dir>/py65lib. /tmp is volatile — a reboot wiped it once. Anything reusable belongs in _tools/.
  • ROM filenames contain spaces and parentheses. the project folder's rom.nes is a space-free copy/symlink kept for the build and the compare. Keep it working; don't rename it.
  • .gitignore lists ROMS/* but the directory is _ROMS, so the pattern matches nothing and ROM binaries stay tracked. Check before committing large blobs.

Repo conventions that must survive

  • Every instruction carries a trailing ; CPU:$XXXX PRG:XXXX AA BB comment with PRG offset and exact emitted bytes. This is the byte-identity audit trail. Preserve it even while renaming labels or restructuring files. All promoted projects now use this canonical format (standardized 2026-10-19; Popeye (JU) (PRG 1) verified canonical at its 2026-10-20 promotion).
  • Unreached or unresolved bytes stay as .byte/.word/.incbin with ROM provenance. Never delete or reformat them away.
  • Two separate symbol files: symbols.inc = NES hardware constants only; locals.inc = zero page and forward references. Unresolved zero-page bytes keep neutral ZpXX names rather than speculative ones.
  • Routine headers follow the template in prg.s: global + local description, parameters, returns, clobbers.
  • Three passes, in order, without shortcuts: Pass 1 code/data split (stop for review) → Pass 2 label replacement → Pass 3 data tables. Do not skip straight to guessy rewrites.
  • make regen (where it exists) must keep reproducing prg.s byte-for-byte on the standard library alone. MUSCLE has this pipeline; re-check it after any nesdis.py change.

Where the detail lives

  • Root README.md (the old root OVERVIEW.md) — inventory of the 41 promoted projects, mapper-folder layout, per-project detail, the Pass 1 methodology note, and the audit-comment TODO with its full analysis.
  • WIP.md — the pre-promotion tier: the 851 _wip/ projects, their layout, the two linker layouts (CPU address vs .nes file offset), the banked-mapper / no-CHR / trailing-bytes / odd-header cases, the open Pass 1/2/3 work, the promotion procedure and the skeleton tooling.
  • <Project>/README.md (formerly <Project>/OVERVIEW.md) — per-project architecture and pass status. The most detailed ones: MUSCLE (U) (Pass 3b/3c/3d), Joypad Test Cartridge (U), NROM/Mario Bros (JU)/.
  • _tools/nesdis.py — Pass 1 tracer (--undocumented, --auto-seed, --extra-seed, --table, --data, --probe).
  • _tools/make_skeleton.py — creates a byte-identical Pass 0 build skeleton for a project folder (splits the ROM, writes the ca65 sources, the linker config, the Makefile and the project README). It refuses to overwrite an existing prg.s unless --force is given.
  • _tools/verify_pass1.py — faithfulness + completeness check across all projects.
  • _tools/audit_comment_tool.py — adds canonical ; CPU:$XXXX PRG:XXXX AA BB audit comments to disassembly source using tracer as ground truth. Usage: python3 _tools/audit_comment_tool.py "Project Name".
  • _tools/cdl_reclass.py — reclassify a project's code/data split from a Mesen Code Data Logger capture (dry run by default; --apply rewrites prg.s, then make must still print BYTE-IDENTICAL). Its docstring covers capture and the safety rules.
  • _tools/bytecode_dis.py, pass2.py, trace_stage_payload.py — per-pass helpers.
  • _tools/apply_symbols.py — Pass 3 substitution: replaces numeric operands in prg.s with the names from symbols.inc/locals.inc. Multi-alias addresses need a --sites line<TAB>name file (per-routine resolution); unlisted ones are reported as residue. Dry run by default, --write applies, and the audit comments are untouched. Worked example: Balloon Fight (JU).
  • _tools/align_audit_comments.py — restores the audit-comment column after a substitution. nesdis.py pads every instruction to 31 characters so the comment starts at column 35; replacing an operand with a longer name pushes the comment right and breaks the alignment the repo convention expects ("comment/audit alignment is re-done after substitutions"). Whitespace-only, so the byte identity cannot change. Dry run by default, --write applies. Data directives and lines whose code text exceeds 31 characters are left alone. Worked example: NROM/Pac-Man (U) (405 lines re-aligned after 119 substitutions).
  • _tools/derive_clobbers.py — fills in the ; Clobbers: block of every routine header, so the headers carry the full template AGENTS.md describes (global
    • local description, parameters, returns, clobbers). Everything is derived, never guessed: the opcode comes from the audit comment's byte list, so the addressing mode is exact and a data directive is never mistaken for an instruction; the operand is resolved through locals.inc/symbols.inc and the labels in prg.s, so a clobber can be named (where several names share one address, the first name in locals.inc wins); the control flow is followed, so a jsr to another named entry is a call (the callee's clobbers count) while a branch or a fall-through is not; and register preservation is modelled with a small abstract interpreter, so a routine that saves a register on the stack and puts it back is not reported as clobbering it. The flags are named individually. Dry run by default, --write applies, and it is idempotent. Worked example: NROM/Balloon Fight (JU) (63 of 63 headers).
  • _tools/apply_pass2_map.py — applies a Pass 2 name map (<CPU address><TAB><name>) to a project's prg.s: it renames the Label_<addr> definitions and their references, and resolves a raw $XXXX operand on a jsr/jmp to the name of the address it points at. A raw operand on a data reference is left alone - it points at a table, not a routine. It refuses to write if a mapped address has no label definition or if a rename would collide. Dry run by default, --write applies. Worked example: NROM/Pac-Man (Tengen) (U) (192 definitions, 168 references, 48 raw call operands).
  • _tools/recode_region.py — re-classifies a region of prg.s from data to code by decoding it straight from the ROM. Use it when a dispatch table that the traced code does read points into a region the tracer left as data - the tracer cannot follow an indirect jump, so the handler it points at is never reached. The bytes are the ROM's, so the build cannot change. --labels takes a TSV of <address><TAB><name> for the routine entries. Worked example: NROM/Pac-Man (Tengen) (U) (the six command handlers at $F00A-$F081, including two jmp operands the tracer had mis-split).
  • _tools/name_data_region.py — gives a data block a name, splitting the .byte row when the name belongs in the middle of it (each half keeps its own audit comment and no byte changes). Worked example: NROM/Pac-Man (Tengen) (U) (28 tables).
  • _tools/derive_zp_aliases.py — the script that derived the Pass 3 zero-page alias set for NROM/Pac-Man (Tengen) (U): it lists the aliases whose role is the same at every reference and the per-site ones, writes the alias block for locals.inc and the matching sites.tsv, and is idempotent. Keep it with the tooling because it records how the aliases were chosen.
  • _tools/derive_branch_names.py — derives the internal branch-target names of a Pass 2 map from the branch that reaches them: the role says what has to be true for the branch to be taken (beq -> OnZero, bne -> OnNonzero, bcc -> OnCarryClear, bcs -> OnCarrySet, bmi -> OnNegative, bpl -> OnNonnegative, bvc/bvs -> the overflow cases) and a backwards branch is a Loop. The owner is the routine the target belongs to, so the names read ActorSearch_OnNonzero. It merges the derived names into the hand-written routine names and is idempotent. Worked example: NROM/Pyramid (U) (Sachen) (42 derived names on top of 388 hand-written ones).
  • _tools/name_data_region.py — gives a data block a name, splitting the .byte row when the name belongs in the middle of it (each half keeps its own audit comment and no byte changes). Worked example: NROM/Pyramid (U) (Sachen) (32 tables).
  • _tools/apply_zp_aliases.py — substitutes semantic zero-page aliases into prg.s at the specific use sites. apply_symbols.py only rewrites numeric operands, so it cannot rename an operand that is already written as a neutral ZpXX name; this tool does that by direct textual replacement, either everywhere (--alias NAME=OLD) or at one CPU address (--at NAME=OLD@CPU). It keeps the ca65 a: prefix (dropping it would turn sta a:Zp17,y into a zero-page store and change the bytes) and only rewrites the operand token, so the audit comment survives byte for byte. Dry run by default, --write applies. Worked example: NROM/Raid on Bungeling Bay (U) [a2] (69 lines).

CDL capture + re-trace workflow (2026-10-21)

Goal: raise code coverage of a _wip/ or promoted project from the vector-seeded baseline (typically 3-10%) to 50%+ by feeding a Mesen Code Data Logger capture back into the tracer.

Prerequisites

  • ca65/ld65 on PATH, python3, Mesen emulator with MCP tools.
  • The project must already be at Pass 1 (byte-identical build).

Step 1 — CDL capture (Mesen)

  1. Load the ROM: mesen_load_rom(filepath=<project>/rom.nes).
  2. Emulation is already running at 60 fps; CDL accumulates automatically. Play through the game (menus, levels, game-over) so as many code paths as possible execute. Use game-specific inputs (e.g., Slalom: Select switches 1P/2P, D-pad changes course).
  3. When done, save the CDL: mesen_cdl_file(action="save", memoryType="NesPrgRom", filepath="/tmp/opencode/<Name>.cdl").
  4. Note the code-byte count from mesen_get_cdl_statistics.

Step 2 — Extract CDL code-run seeds

from pathlib import Path
raw = Path("/tmp/opencode/<Name>.cdl").read_bytes()
assert raw[:5] == b"CDLv2"
cdl = bytearray(raw[9:])[:PRG_SIZE]
starts = []
i = 0
while i < PRG_SIZE:
    if cdl[i] & 1:
        starts.append(BASE + i)
        while i < PRG_SIZE and (cdl[i] & 1):
            i += 1
    else:
        i += 1
Path("/tmp/opencode/<Name>_seeds.txt").write_text(",".join(hex(a) for a in starts))

BASE is $8000 for CPU-layout NROM (32 KB) or $C000 for 16 KB; PRG_SIZE is the PRG byte count.

Step 3 — Re-trace with CDL seeds

Back up prg.s and locals.inc, then:

seeds=$(cat /tmp/opencode/<Name>_seeds.txt)
python3 _tools/nesdis.py --prg prg.bin --base 0x8000 --project "<Name>" \
  --out prg.s --locals locals.inc --extra-seed "$seeds" --auto-seed --undocumented

For banked projects (CNROM/MMC/etc.) use banked_dis.py with --cdl instead.

Step 4 — Fix undefined labels

The re-trace may introduce Label_XXXX references that are undefined (branch targets inside surviving instructions). Run:

python3 /tmp/scratchpad/fix_iter.py "<project dir>"

This iteratively assembles, parses "Symbol 'X' is undefined" errors, and converts the offending lines to .byte (preserving the audit comment and bytes). Repeat until make passes.

Step 5 — Pass 2 (label replacement)

  1. Generate a seed routinemap with the vector handlers:
    # extract Reset/NmiHandler/IrqHandler addresses from prg.s, write routinemap.tsv
    
  2. Derive branch-target names: python3 _tools/derive_branch_names.py <proj> <proj>/routinemap.tsv "" <proj>/labelmap.tsv
  3. Apply the map: python3 _tools/apply_pass2_map.py <proj> <proj>/labelmap.tsv --write (Remove any map entries that fail with "no label definition" and re-run.)
  4. Fill routine headers: python3 _tools/describe_routines.py <proj>/prg.s
  5. Align audit comments: python3 _tools/align_audit_comments.py <proj> --write

Step 6 — Pass 3 (symbols)

python3 _tools/apply_symbols.py <proj> --write
python3 _tools/align_audit_comments.py <proj> --write

Step 7 — Verify and update docs

make   # must print "Byte-identical ROM verified."

Update README.md Status line and CHANGELOG.md Pending entry. Commit.

Coverage achieved so far (CDL-guided)

Project Coverage
Sqoon (U) 53.4%
Elevator Action (U) 57.1%
Slalom (U) 26.4%
Kung Fu (U) 37.1%
Othello (U) 40.1%

Games still pending (no CDL capture yet): 1942 (JU), Tag Team Wrestling (U), Galaga (U), Kung Fu (U) (a1), Stack-Up (JU), Magmax (U), Ms Pac-Man (Namco) (U), Soccer (JU), Tiger-Heli (U), Paperboy (U), Last Starfighter, The (U), Mighty Bomb Jack (U), Kung-Fu Heroes (U).

Key gotchas

  • CNROM (and other flat-layout) projects use file-offset linker layout; Pass 2 label resolution breaks bytes unless the linker is first converted to CPU layout (PRG start = $8000 for 32 KB). See the Tiger-Heli conversion.
  • apply_pass2_map.py defaults to dry-run; always pass --write.
  • apply_symbols.py defaults to dry-run; always pass --write.
  • fix_iter.py lives in /tmp/scratchpad/ and is not committed; recreate if /tmp is wiped.
  • Coverage below 50% is acceptable for the disassembly but the user's stated bar for "traced" is 50%+; flag any project below that.