Files
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
..

Baseball (UE) — Game Flow from Power-On

This document describes the execution flow of the disassembled Baseball (UE) PRG bank (16 KB, mapped at CPU $C000–$FFFF), starting from power-on. It is based entirely on prg.s in this project folder. The rebuild is verified byte-identical to the original rom.nes.

Status

Pass 3 data-table work complete. prg.s is a hand-annotated, byte-identical disassembly of the whole 16 KB PRG: every routine, every inline data block and every data table carries a symbolic name, and no Label_Cxxxx placeholder remains. The Pass 3 data-table inventory is the section "Pass 3 data-table inventory" below — it lists all 120 named tables and all 93 inline data blocks, with the structure of each and the instruction that reads it.

Two categories of block are still uninterpreted, and the inventory says so rather than guessing:

  • The rendering / animation array at $ED00-$F94C is read as a whole by the renderer; the individual 256-byte pages are named but the record format inside a page is not yet established.
  • The music / audio data at $FE40-$FFE1 and the audio lookup data at $FA00-$FA5F are named by region; the exact record boundaries inside them are not yet established.

1. ROM and Memory Layout

Property Value
Format iNES / NES 2.0
PRG 1 × 16 KB (mapped at CPU $C000–$FFFF)
CHR 1 × 8 KB
Mirroring Horizontal
PRG bank start CPU $C000 (.org $C000)
Linker output reconstructed.nes, byte-identical to rom.nes

Interrupt vectors (CPU $FFFA–$FFFF)

Vector Address Handler Notes
NMI $C046 NMI Runs once per frame; the primary frame driver
RESET $C40B Reset Cold-start initialization
IRQ / BRK $C43E IRQ Just rti (unused)

2. Reset — CPU $FFFC → $C40B

Reset ($C40B)

On power-on or reset:

  1. sei / cld — disable maskable interrupts, clear decimal mode.
  2. Clear CPU RAM $0000–$07FF — one 256-byte page at a time using the indirect pointer at $00/$01, repeatedly writing $2000 to PPUCTRL during the clear.
  3. jsr InitializeSpriteSortTables ($C7B1) — set up the sprite sort/index tables at $0377, $038C, $0399.
  4. jsr DisablePpuRendering ($E96C) — turn off PPU output.
  5. Disable APU — write $00 to APUSTATUS ($4015) to silence all channels, then select the five-step frame-counter mode and inhibit frame-counter IRQ via JOY2 ($4017).
  6. jsr ExpandRecordPointerList ($C8BB) with inline data — builds record pointer structures.
  7. lda #$1A / sta PpuMaskShadow — initial PPU mask shadow value.
  8. jmp InitializeTitleScreen ($C74A) — RESET does not return; it transfers directly to the title screen.

3. NMI / Frame Heartbeat — NMI ($C046)

The NMI fires once per frame and is the central frame driver. It does not simply return; it performs substantial per-frame work:

  1. Save X and Y into NmiSavedX ($0D) / NmiSavedY ($0E).
  2. Read PPUSTATUS ($2002) to reset the PPU address latch.
  3. OAM DMA — write $02 to OAMDMA ($4014) to copy $0200–$02FF to sprite memory.
  4. Process the PPU command queue at $0300 — walk variable-length packets (write packets to $2007, read packets discarded), terminating on a zero-length entry, then reset the queue head (stx $0300).
  5. Apply scroll — write ScrollX ($DF) and ScrollY ($E0) to $2005.
  6. Apply PPU registers — write PpuMaskShadow ($DE) to $2001 and PpuCtrlShadow ($DD) to $2000.
  7. jsr InitializeAudioEngine ($F9D0) — initialize/advance the audio engine.
  8. Latch controllers — strobe JOY1 ($4016) with $01 then $00.
  9. Read both controllers — sample JOY1/JOY2 eight times each, shifting button states into ControllerPressed1 ($15) / ControllerPressed2 ($16).
  10. Update controller state — compute newly-pressed edges (Pressed = (Pressed & ~Held) | raw) and update ControllerHeld1/2 ($11/$12).
  11. START-button branch:
    • If START pressed and SessionActive ($1E) is set → jsr ProcessQueuedObjectEvent with command $0B.
    • If START pressed and session is not active → set TransitionActive ($1D) and GameplaySuspended ($EF), then jmp InitializeNewSession ($C49C).
  12. NMI_CheckState — if NmiStateFlag ($1F) is nonzero, skip ahead and restore registers.
  13. Otherwise jsr QueueInlineObjectEvent ($EB55) with inline command bytes $05,$21,$C1, then jsr ProcessQueuedObjectEvent ($EB2A) with command $0B.
  14. inc FrameCounter ($E3).
  15. jsr CalculateControllerAssignments ($C87E) — derive per-player control state.
  16. Store derived input into InputState1/2 ($13/$14) and InputAux1/2 ($17/$18).
  17. Restore X, Y, A, rti.

Because the NMI does controller reading and event dispatch, the main loop largely waits on the NMI-driven queued-event system rather than polling hardware directly.


4. Title Screen — InitializeTitleScreen ($C74A)

Shared entry point used by RESET and by post-match/transition paths:

  1. jsr InitializeQueuedEventSystem ($EB9D) — clear the $0600–$06FF event page, the queue count ($E2), active-event slots, and set CurrentObjectIndex ($E1) = 1.
  2. GameplaySuspended ($EF) = 0; TransitionActive ($1D) = 1.
  3. PpuCtrlShadow = $80; disable PPU rendering; fill PPU memory (FillPpuMemoryAfterValueSaved at $E985 with value $25).
  4. jsr ProcessInlinePpuStream ($EA63) twice — streams title PPU data (inline records $8D,$F8 and $00,$C0).
  5. jsr EnableNmiAndWaitForFrame ($E978) — enable NMI and synchronize to a frame.
  6. Enable APU channels ($4015 = $0F), set timing byte $FD = $08.
  7. RefreshTitleScreen ($C77A) loop:
    • Update ModeFlags ($40).
    • jsr QueueModeIndicatorTiles ($E5CF).
    • Wait for controller input release (SELECT/$20) and for the frame counter / delay byte $1B to elapse.
  8. On exit: TransitionActive = 0, GameplaySuspended = 1, clear audio ($4015), re-init the event system, queue an inline command $03,$88,$C4, then jmp InitializeSessionDisplay ($C4AA).

Attract mode — RunAttractMessageLoop ($C43F)

Before reaching the title input loop, Reset can flow into RunAttractMessageLoop, which:

  • Clears NmiStateFlag, selects object event bank 1.
  • Draws encoded six-character messages via CopyInlineDisplayRecord ($EA17) with inline text bytes.
  • Exchanges the object event bank ($EB4E), increments NmiStateFlag, and loops back to itself — this is the idle attract display until the player presses START.

5. Session and Match Initialization

InitializeSessionDisplay ($C4AA)

PPU shadow setup, disable rendering, fill PPU memory with $26, then process an inline PPU stream ($F2,$F4).

InitializeMatchState ($C4B9)

  • Clears base position and acceleration fields ($C94F/$C943).
  • Sets $053B and PositionSignState ($B7) to $80.
  • jsr EnableNmiAndWaitForFrame.
  • Player/team selection:
    • Random0To5 ($C850) → PlayerOneSelection ($34).
    • Repeatedly Random0To5 until a value different from player one → PlayerTwoSelection ($35).
  • If GameplaySuspended is set, skip side selection; otherwise derive ActivePlayerSide ($4B) from mode flags or a random bit.
  • Queue inline object events $03,$19,$C8 and $02,$19,$C8, set PlayerSelectionActive ($44) = 1.
  • WaitForPlayerSelection ($C4FF) spins until $43 (SelectionState) becomes negative, then queues $03,$3E,$C4 and falls into CompleteMatchSetup ($C50C).

CompleteMatchSetup ($C50C)

  • FillSelectionBackgroundBlocks ($C85A), QueuePlayerSelectionDisplay ($C7DD), InitializeRandomBitfields ($C8E8), QueuePlayerValueDisplay ($CF8B).
  • Queue inline command $09,$37,$CE, then enter InitializeRoundState ($C51E).

6. Round / Gameplay State Machine

InitializeRoundState ($C51E)

Round-setup entry point:

  • If gameplay is not suspended and RoundStateIndex ($33) < $12, select round music cue; otherwise reset round counters.
  • EnableRoundAudio ($C52A): enable APU channels ($4015 = $0F), set $FD = $08.
  • ResetRoundCounters ($C536): clear scores ($67/$68) and RoundStateIndex.
  • jsr InitializeObjectsFromTable ($D06B) — initialize objects from the table at $D0A0–$D125.
  • Set $053B / PositionSignState = $80.
  • Store a $3C-tick delay, draw an 8-character message, store another $3C delay.
  • SelectRoundMusicCue ($C566): choose a music delay value ($20 or $40) based on RoundStateIndex parity → store in $FD.
  • PrepareRoundObjects ($C573): queue player-selection display, queue random-state record, clear MatchCompleteFlag ($45) and SecondarySequenceState ($64).

ResetGameplayState ($C57F)

  • Clear InningOrSharedScore ($66), BaseMotionActive ($5C).
  • Mark four state entries ($0598–$059B) inactive ($FF).
  • jsr QueueRoundNumberDisplay ($CF67), re-init objects, set sign state to $80.
  • Store a $B4-tick delay.

Round setup continuation points

  • ResumeRoundSetupAtRandomDirection ($C5A4): queue random-direction record, clear primary/transition sequence state, set StateSequenceActive ($46) = 1, clear state field pairs ($03,$23 via $CF51).
  • ResumeRoundSetupAtSelectionDisplay ($C5BA): clear the 8-character field, clear $0597–$05A6, clear the 38-byte motion field range $056F–$0594.
  • Based on RoundStateIndex and score comparison ($67 vs $68), either jump to CompleteMatchState ($C6F7) or finish the reset.

FinishGameplayReset ($C5F1)

  • InitializeDefaultObjects ($D030), clear sign state, select event bank 1 → enter RunRoundStateLoop ($C5FE).

RunRoundStateLoop ($C5FE) — main per-round loop

This is the core gameplay loop:

  • If PendingStateTransition ($60) is set → InitializeObjectStateLookup ($C8A2).
  • If either PendingStateTransition or StateSequenceActive ($46) is nonzero → dispatch state-specific handlers via queued inline commands ($0D,$77,$D4, $0F,$81,$D3).
  • RunPrimaryRoundHandlers ($C619):
    • InitializeSecondaryActors ($D610), InitializeConditionalObject ($D126).
    • Clear working state: PendingScoreIncrement, BaseMotionPhase, BaseMotionEventCount, TrajectoryResult, PendingStateTransition, SpecialSequenceState, ObjectTransitionState, BaseMotionActive, ActionSequenceCounter, TrajectoryEvaluationEnabled, and several others.
    • Clear base acceleration and position fields.
    • Queue three inline object events ($25,$5A,$D8, $0E,$66,$D1, $1F,$76,$CA).
    • jsr UpdateObjectEventBank_Exchange with command $08.
    • Walk the 22-entry RoundEventSlotTable ($C6E1) in reverse, dispatching each via DispatchNextQueuedEvent ($EB66).
    • Write one inline character ($3F, value $28) to the PPU.
  • ApplyPendingScoreUpdate ($C67E): if a score increment is pending and no state transition, jsr UpdateCountersAndDisplay ($CFA6), clear the increment.
  • StartPostRoundDelay ($C68D): wait for PendingEvent ($6F) to clear, then count down delay counter $48.
  • If match is not complete and no sequence is active → jmp ResumeRoundSetupAtSelectionDisplay ($C5BA) to start the next round.
  • ProcessPostRoundEvents ($C6A5): dispatch event slots $0D and $0F, store a $0A-tick delay, decrement a counter based on RoundStateIndex parity.
  • CheckPostRoundContinuation ($C6C5): if match complete → AdvanceRoundNumber ($C6CC); otherwise jmp ResumeRoundSetupAtRandomDirection ($C5A4).
  • AdvanceRoundNumber ($C6CC): update counters/display, increment RoundStateIndex; if index reaches $12 → InitializeResultsPosition ($C708); otherwise SelectRoundMusicCue ($C566) to begin the next round.

7. Per-Frame Object and Motion Updates

UpdateFrameObjectsAndTimers ($C122)

Called each frame to drive object motion:

  • Reset PPU queue offset, OAM write offset, and FrameState20 ($20).
  • Queue/process inline object events ($07,$64,$C2 via bank, then command $01).
  • Decrement per-object timers at $063F,X (30 slots); when a timer reaches zero, queue a decoded object event.
  • Decrement four short countdowns at $05AD,X.
  • If a transition is active, jump to CommonEngineExit ($EB6A); otherwise IntegrateAllObjectPositions ($C15B).

IntegrateAllObjectPositions ($C15B)

  • For 36 object slots (X stepping by 2, each logical object uses two indices):
    • Sign-extend and add horizontal delta ($050B/$050C,X from $056F/$0570,X).
    • Sign-extend and add vertical delta ($053C/$053D,X from $0570/$0571,X).

UpdateBaseMotionSequence ($C18D)

  • Integrate velocity/position for three base object indices ($00, $31, $62).
  • Reflect base motion values when $056C is negative (negate $056B/$056C and halve $0569/$056A).
  • Apply doubled horizontal/vertical velocity adjustments to $0507/$0508 and $0538/$0539.
  • jsr EvaluateTrajectoryResult ($CAD2).
  • Advance BaseMotionPhase ($5D); when motion settles, clear base acceleration/position fields.
  • UpdatePositionSignState ($C228): compute a signed position delta relative to a $0A threshold, track sign changes in PositionSignState ($B7), and update rendering flags.

IntegrateObjectVelocityAndPosition ($C3CA)

Signed fixed-point position integration used by the three base motion call sites: shifts the signed 16-bit velocity right twice (sign-preserving), adds to position ($0507/$0508), then adds the result to the secondary position ($0509/$050A).


8. Rendering and OAM

BuildFrameOam ($C2DE)

  • If TransitionActive is set: copy an 88-byte sprite/OAM template from $F94D into shadow OAM at $0200, set OamWriteOffset ($3F), and jump to TerminatePpuUpdateQueue.
  • Otherwise, if PlayerSelectionActive ($44) is set: copy an 8-byte OAM template from $C331, position two sprites from player selection coordinates (scaled ×16 + $50), choose tiles based on ModeFlags.
  • Otherwise: SortObjectsByY ($C339) — sort object indices by signed 16-bit Y coordinates ($0538/$0539) using the index table at $0377/$0378, then render each sorted object via RenderSpriteRecordList ($E77B).

FinalizeOamAndPpuQueue ($C386)

  • If ObjectListFlag ($C7) is set, skip status OAM; otherwise copy 20 bytes from $EBC2 into shadow OAM and select two extra bytes from $EBBC based on player selections.
  • TerminatePpuUpdateQueue ($C3AA): write $00 to terminate the PPU command queue at $0300,Y.
  • Hide unused sprites by writing $F0 to each remaining OAM Y coordinate (stepping by 4).
  • jsr AdvanceRandomState ($E5F4), then jmp CommonEngineExit ($EB6A).

9. Batting and Pitching

Pitching (RunPitcherWindupSequence, $D18B)

  • RunPitcherWindupSequence animates the pitcher windup (frames selected via SetWindupFrame, $D1A2).
  • SelectPitchAction ($D1D0): reads controller input to choose the pitch action.
  • SelectPitchType ($D1EA): searches PitchTypeThresholdTable / PitchDirectionThresholdTable ($D15D/$D14B) to determine pitch type and direction.
  • AnimatePitchStart ($D212), UpdatePitchMovement ($D265): apply pitch trajectory and controller-based horizontal/vertical input.
  • Pitch tables: PitchVelocityBiasTable ($D2A4), PitchDelayTable ($D2A7), PitchRenderFlagTable ($D2AA).

Batting (SelectBatterAction, $D2AD)

  • WaitForBatterAction ($D2B2): wait for batter input.
  • UseBatterControllerInput ($D2D4): map controller to batter action slot.
  • SelectActionFromObjectState ($D32A) with ObjectActionLookupTable ($D339).
  • DispatchActionType ($D33C): route to the appropriate action handler.

Object motion and collision

  • MoveControlledObject ($D382): apply controlled horizontal/vertical offsets (ControlledHorizontalOffsetTable / ControlledVerticalOffsetTable at $D3F0/$D3F3).
  • TestObjectCollision ($CBEC): object-vs-object collision testing.
  • TestCurrentObjectInput ($DB18): resolve controller input for the current object.
  • Geometry helpers: CalculateCurrentObjectGeometry ($DF45), CalculateGeometryDifference ($E4DD), BuildGeometryVector ($E513), extensive trigonometry/vector math routines ($E4xx–$E8xx).

10. Audio Engine

InitializeAudioEngine ($F9D0)

Initialize the APU: write DMC settings, configure pulse/triangle/noise channel presets, write pulse periods from tables ($FA00–), set up audio lookup data.

UpdateAudioEngine ($FB05)

Per-frame audio update:

  • Clear/finalize primary audio effects.
  • Update pulse 1 and pulse 2 effects (preset effects, descending effects, state-change effects, phase effects).
  • Update triangle pitch sweeps.
  • Dispatch music and noise (DispatchMusicAndNoise at $FC60): update music sequencer, noise envelope, timed triangle effects, DMC output.

Music

  • StartMusicSequence ($FD34): initialize a music sequence by finding its bank and copying the descriptor.
  • Channels: pulse 1 ($FD96), pulse 2 ($FDCF), triangle ($FE0B).
  • Music sequence data tables at $FE40–$FFE1 (MusicSequenceData … MusicSequenceData_FFD0).
  • Sound effect presets and noise/triangle envelopes throughout the $F9xx–$FE2x region.

Audio is advanced from the NMI via jsr InitializeAudioEngine ($F9D0) each frame; the broader UpdateAudioEngine ($FB05) is called from the event system.


11. Object Event System (the main-loop engine)

The game is driven by a queued event system rather than a simple polling loop:

  • InitializeQueuedEventSystem ($EB9D): clear $0600–$06FF, queue count $E2, active slots, set current object index.
  • QueueInlineObjectEvent ($EB0A) / QueueDecodedObjectEvent ($EB2A): push an event onto the queue.
  • ProcessQueuedObjectEvent ($EB2A): walk the queue and process active events.
  • DispatchNextQueuedEvent ($EB66): pop the newest event, save its continuation address on the hardware stack (SP = $FF), and rts into it — this is how control transfers between event handlers.
  • CommonEngineExit ($EB6A): mark the current object inactive; if the queue is empty, wait (beq DispatchNextQueuedEvent_Wait) polling $E2; otherwise disable NMI bit 7 and dispatch the next entry.

The main gameplay loop (RunRoundStateLoop) and most state handlers ultimately pass through CommonEngineExit, which blocks until the NMI or another producer queues the next event. This makes the NMI the real-time heartbeat and the main loop an event consumer.


12. PPU Streaming Helpers ($E9xx–$EBxx)

A family of routines drives PPU updates from inline byte streams embedded in the code:

  • DisablePpuRendering ($E96C), EnableNmiAndWaitForFrame ($E978).
  • FillPpuMemoryWith26 / FillPpuMemoryAfterValueSaved ($E983/$E985): fill PPU memory with a byte value.
  • DecodeInlineParameters ($E99A), ReadInlineWord ($E9B4), CopyInlineBytesToZeroPage ($E9C2).
  • WritePpuControlFromCarry ($E9D2), SetPpuAddressFromInlineRecord ($E9DB), WritePendingPpuByte ($E9FC), WriteInlinePpuBlock ($EA02), PPUWriteString.
  • CopyInlineDisplayRecord ($EA17): draw an encoded text record (count byte followed by character data) — used heavily for titles, scores, round numbers, and announcements.
  • ProcessInlinePpuStream ($EA63): process a stream of PPU commands.

Many routines are followed by .byte inline data that must not be disassembled as instructions; the disassembly marks these explicitly.


13. Match Completion and Results

CompleteMatchState ($C6F7)

  • Increment RoundStateIndex.
  • If InningOrSharedScore ($66) is nonzero → InitializeResultsPosition; otherwise draw a single encoded character ($32).
  • InitializeResultsPosition ($C708): set sign state to $80, draw a 10-character message ($25,$10,$0A,$16,$0E,$25,$1C,$0E,$1D,$25), set timing $FD = $4, dispatch event slot 2, queue inline $02,$88,$C4.
  • ResultsDelayLoop ($C737): repeat a $3C-tick delay 10 times.
  • Disable APU ($4015 = $00), clear SessionActive ($1E), then fall into InitializeTitleScreen ($C74A) to return to the title.

14. Summary of Execution Flow

Power On / Reset
    │
    ▼
Reset ($C40B) ───► clear RAM $0000-$07FF, init sprite sort, disable PPU/APU
    │
    ▼
jmp InitializeTitleScreen ($C74A)
    │
    ├─ init event system, draw title screen
    ├─ EnableNmiAndWaitForFrame   (NMI now runs each frame)
    ├─ WaitForTitleInputRelease   (wait for START + input release)
    ▼
jmp InitializeSessionDisplay ($C4AA)
    │
    ▼
jmp InitializeMatchState ($C4B9)
    │
    ├─ Random0To5 → PlayerOneSelection ($34)
    ├─ Random0To5 (≠ P1) → PlayerTwoSelection ($35)
    ├─ derive ActivePlayerSide ($4B)
    └─ WaitForPlayerSelection (spin until $43 < 0)
    │
    ▼
CompleteMatchSetup ($C50C)
    │
    ▼
InitializeRoundState ($C51E)
    │
    ├─ enable audio, reset counters, init objects from table ($D06B)
    ├─ draw messages, select music cue
    ▼
ResetGameplayState ($C57F) → FinishGameplayReset ($C5F1)
    │
    ▼
RunRoundStateLoop ($C5FE)  ◄───────────────────┐
    │                                          │
    ├─ InitializeObjectStateLookup             │
    ├─ RunPrimaryRoundHandlers                 │
    │     ├─ InitializeSecondaryActors         │
    │     ├─ InitializeConditionalObject       │
    │     ├─ walk RoundEventSlotTable          │
    │     └─ dispatch queued events            │
    ├─ ApplyPendingScoreUpdate                 │
    ├─ StartPostRoundDelay (wait $48 ticks)    │
    ├─ ProcessPostRoundEvents                  │
    ├─ CheckPostRoundContinuation              │
    │     ├─ match complete → results → title  │
    │     └─ AdvanceRoundNumber → next round   │
    └─ eventually → CommonEngineExit ($EB6A)   │
              wait for queued event ($E2)      │
              dispatch next event (rts into it)│
              └────────────────────────────────┘

NMI ($C046) [every frame]
    ├─ PPU command queue flush ($0300)
    ├─ OAM DMA ($4014)
    ├─ scroll ($2005), PPU mask/ctrl ($2001/$2000)
    ├─ InitializeAudioEngine ($F9D0)
    ├─ controller latch + read (JOY1/JOY2)
    ├─ controller state (pressed/held edges)
    ├─ START branch → new session or command $0B
    ├─ QueueInlineObjectEvent + ProcessQueuedObjectEvent
    ├─ FrameCounter++, CalculateControllerAssignments
    └─ restore registers, rti

15. Key Zero-Page / RAM Symbols

Address Symbol Use
$00–$01 IndirectPtrLo/Hi RAM-clear indirect pointer
$0D–$0E NmiSavedX/Y NMI register save
$0F DerivedControl0 Derived control input
$11–$12 ControllerHeld1/2 Currently held buttons
$13–$14 InputState1/2 Current input state
$15–$16 ControllerPressed1/2 Newly pressed buttons
$17–$18 InputAux1/2 Auxiliary input
$19–$1A RandomStateLo/Hi PRNG state
$1B TransitionCounter Transition delay
$1D TransitionActive Transition in progress
$1E SessionActive Session/game active flag
$1F NmiStateFlag NMI state flag
$20 FrameState20 Frame state
$21 SelectedPitchAction Current pitch action
$33 RoundStateIndex Current round/inning index
$34–$35 PlayerOne/TwoSelection Selected teams
$36–$39 ObjectScreenX/Y (+Hi) Object screen coordinates
$3E–$3F PpuQueueOffset / OamWriteOffset PPU/OAM write positions
$40 ModeFlags Display/mode flags
$42 CurrentObjectArrayOffset Current object slot
$43 SelectionState Selection state
$44 PlayerSelectionActive Player selection active
$45 MatchCompleteFlag Match finished
$46 StateSequenceActive State sequence running
$48 DelayCounter General delay
$4B ActivePlayerSide Active player (0/1)
$4D–$50 RandomState0/1, RandomBits0/1 Randomization state
$53–$56 SavedBaseX/Y (Lo/Hi) Saved base coordinates
$5C BaseMotionActive Base motion active
$5D BaseMotionPhase Base motion phase
$5E BaseMotionEventCount Base motion event count
$5F TrajectoryResult Trajectory result
$60 PendingStateTransition Pending state change
$66 InningOrSharedScore Inning / shared score
$67–$68 PlayerOne/TwoScore Scores
$69–$6A EventWrite/ReadIndex Event queue indices
$6F PendingEvent Pending event
$7E ActionSequenceCounter Action sequence counter
$83 ObjectApproachCount Approach counter
$86 TrajectoryEvaluationEnabled Trajectory eval enabled
$8E–$90 RandomHorizontal/VerticalMotion Random motion
$9D CurrentActionState Current action
$9F–$A1 SecondaryActorState0–2 Secondary actor states
$A2 ObjectSequenceState Object sequence state
$B7 PositionSignState Position sign tracking
$C7 ObjectListFlag Object list flag
$C9–$CA SpriteSortBaseIndex / SpriteArrayEnd Sort table bounds
$DD–$E0 PpuCtrl/MaskShadow, ScrollX/Y PPU/shadow/scroll state
$E1 CurrentObjectIndex Current object being processed
$E2 ScriptDepth / queue count Queued event count
$E3 FrameCounter Frame tick counter
$EF GameplaySuspended Gameplay suspended
$F6–$F7 SoundPtrLo/Hi Sound pointer
$FE PendingAudioFlags Pending audio flags
$FF RenderStateFlags Render state flags

Pass 3 data-table inventory

Every data block in the PRG, what its bytes are, and the instruction in this dump that reads it. The PRG is a single 16 KB bank at $C000-$FFFF, so every address below is both the CPU address and the PRG offset plus $C000.

Two kinds of block exist in this project:

  • Named tables — a labelled run of .byte rows in prg.s. All 120 are listed below.
  • Inline data blocks — bytes that sit inside a routine and are consumed by the jsr immediately above them (the queued-event system pulls its arguments straight out of the return address). All 93 are listed in the second table.

Named tables

Address Size Name Structure Read by
$C000-$C007 8 TitleCopyrightPpuStream PPU command stream for the title-screen copyright line: three-byte records of PPU address high, PPU address low, data ($23,$45,$05, $AF,$01,$09,$08,$04, $23,$65,$18). Written into the PPU by ProcessInlinePpuStream ProcessInlinePpuStream at $C008 (the stream is handed to the inline-stream walker; no absolute operand names it)
$C024-$C029 6 TeamInitialTileTable One tile index per selectable team initial, in the order A, C, D, P, R, Y: $0A,$0C,$0D,$19,$1B,$22 lda $C024,y at $CF97 and $CF9F, indexed by the player's team selection
$C02A-$C02F 6 TeamSelectionSpriteTileTable Sprite tile used for the selection marker of each of the six teams lda $C02A,y at $C7F9 and $C80D
$C030-$C035 6 TeamSelectionSpriteXTable Screen X of each team's selection marker sprite: $30,$21,$10,$30,$21,$10 lda $C030,y at $C7FF and $C813
$C331-$C338 8 OAMTemplate_C331 8-byte OAM template (two sprites' Y, tile, attribute, X) copied into the shadow OAM when the player-selection screen is drawn lda $C331,x at $C2FB
$C6E1-$C6F6 22 RoundEventSlotTable 22 event-slot indices, ascending by two ($04,$06,$08,$0A,$0C,$0E,$10,$12, …); the loop at $C66A walks it in reverse and dispatches each slot ldy RoundEventSlotTable,x at $C66A
$CB35-$CB38 4 TrajectoryResultTable 4 signed result bytes, indexed by the two-bit value computed at $CAFC-$CAFF lda TrajectoryResultTable,x at $CB00
$CD22-$CD24 3 StateHorizontalLowTable Low byte of the horizontal displacement applied to the animated object, one entry per state ($00,$80,$00). The code's base is $CD21, one byte below the table, so entry 0 as read is the operand byte $2F of the bne at $CD20 lda $CD21,x at $CD54 (stored to $050B)
$CD25-$CD27 3 StateHorizontalHighTable High byte of the same displacement ($09,$FF,$F7); code base $CD24 lda $CD24,x at $CD5A (stored to $050C)
$CD28-$CD2A 3 StateVerticalLowTable Low byte of the vertical displacement ($00,$00,$00); code base $CD27 lda $CD27,x at $CD60 (stored to $053C)
$CD2B-$CD2D 3 StateVerticalHighTable High byte of the vertical displacement ($02,$0A,$02); code base $CD2A lda $CD2A,x at $CD66 (stored to $053D)
$CE1A-$CE21 8 CelebrationPaletteSequence 8 palette bytes appended one at a time during the home-run celebration lda CelebrationPaletteSequence,y at $CE0F
$CEC9-$CECE 6 AnnouncementTextBlank Entry $00 of the 12-entry announcement table: six encoded characters, all $25 (a blank) lda AnnouncementTextTable,y at $CEBC, with A = the entry offset chosen by DisplayAnnouncementPair at $CEA5
$CECF-$CED4 6 AnnouncementTextFoul Entry $06 of the announcement table ($25,$0F,$18,$1E,$15,$25) lda AnnouncementTextTable,y at $CEBC
$CED5-$CEDA 6 AnnouncementTextStrike Entry $0C ($1C,$1D,$1B,$12,$14,$0E) lda AnnouncementTextTable,y at $CEBC
$CEDB-$CEE0 6 AnnouncementTextOut Entry $12 lda AnnouncementTextTable,y at $CEBC
$CEE1-$CEE6 6 AnnouncementTextBall Entry $18 lda AnnouncementTextTable,y at $CEBC
$CEE7-$CEEC 6 AnnouncementTextWalk Entry $1E lda AnnouncementTextTable,y at $CEBC
$CEED-$CEF2 6 AnnouncementTextSingle Entry $24 lda AnnouncementTextTable,y at $CEBC
$CEF3-$CEF8 6 AnnouncementTextTwoBase Entry $2A lda AnnouncementTextTable,y at $CEBC
$CEF9-$CFE6 6 AnnouncementTextThreeBase Entry $30 lda AnnouncementTextTable,y at $CEBC
$CEFF-$CF04 6 AnnouncementTextDeadBall Entry $36 lda AnnouncementTextTable,y at $CEBC
$CF05-$CF0A 6 AnnouncementTextChange Entry $3C lda AnnouncementTextTable,y at $CEBC
$CF0B-$CF10 6 AnnouncementTextSafe Entry $42 lda AnnouncementTextTable,y at $CEBC
$D0A0-$D0A6 7 ObjectInit_D0A0 Record 0 of the object-initialisation table: object-array offset $06, sprite index $7A ($039B), attribute $7A ($03B0), X = $FECD, Y = $F84C ldx ObjectInitializationTable,y at $D06C; the fields are read by lda ObjectInitFrameField,y at $D08C, lda ObjectInitAttributeField,y at $D092, lda ObjectInitXLowField,y at $D071, lda ObjectInitXHighField,y at $D077, lda ObjectInitYLowField,y at $D07D, lda ObjectInitYHighField,y at $D083
$D0A7-$D0AD 7 ObjectInit_D0A7 Record 1 (object-array offset $08) as above
$D0AE-$D0B4 7 ObjectInit_D0AE Record 2 as above
$D0B5-$D0BB 7 ObjectInit_D0B5 Record 3 as above
$D0BC-$D0C2 7 ObjectInit_D0BC Record 4 as above
$D0C3-$D0C9 7 ObjectInit_D0C3 Record 5 as above
$D0CA-$D0D0 7 ObjectInit_D0CA Record 6 as above
$D0D1-$D0D7 7 ObjectInit_D0D1 Record 7 as above
$D0D8-$D0DE 7 ObjectInit_D0D8 Record 8 as above
$D0DF-$D0E5 7 ObjectInit_D0DF Record 9 as above
$D0E6-$D0EC 7 ObjectInit_D0E6 Record 10 as above
$D0ED-$D0F3 7 ObjectInit_D0ED Record 11 as above
$D0F4-$D0FA 7 ObjectInit_D0F4 Record 12 as above
$D0FB-$D101 7 ObjectInit_D0FB Record 13 as above
$D102-$D108 7 ObjectInit_D102 Record 14 as above
$D109-$D10F 7 ObjectInit_D109 Record 15 as above
$D110-$D116 7 ObjectInit_D110 Record 16 as above
$D117-$D11D 7 ObjectInit_D117 Record 17 as above
$D11E-$D124 7 ObjectInit_D11E Record 18 as above
$D125 1 ObjectInitTable_End Zero byte that terminates the object-initialisation table ldx ObjectInitializationTable,y at $D06C → beq ObjectInitializationReturn at $D06F
$D14B-$D153 9 PitchDirectionThresholdTable 9 ascending thresholds compared against the player's horizontal input to choose the pitch direction cmp PitchDirectionThresholdTable,x at $D1FE
$D154-$D15C 9 PitchDirectionResultTable The 9 direction values returned when a threshold matches lda PitchDirectionResultTable,x at $D203
$D15D-$D161 5 PitchTypeThresholdTable 5 thresholds compared against the player's vertical input to choose the pitch type cmp PitchTypeThresholdTable,x at $D1EE
$D162-$D166 5 PitchTypeResultTable The 5 pitch types returned when a threshold matches lda PitchTypeResultTable,x at $D1F3
$D2A4-$D2A6 3 PitchVelocityBiasTable 3-byte velocity bias, one entry per pitch type sbc PitchVelocityBiasTable,x at $D245
$D2A7-$D2A9 3 PitchDelayTable 3-byte delay, one entry per pitch type lda PitchDelayTable,x at $D249
$D2AA-$D2AC 3 PitchRenderFlagTable 3-byte render flag, one entry per pitch type lda PitchRenderFlagTable,x at $D23B
$D339-$D33B 3 ObjectActionLookupTable Action/control byte for the selected batter action; the code's base is $D338, one byte below the label lda $D338,x at $D334
$D3F0-$D3F2 3 ControlledHorizontalOffsetTable 3 signed horizontal offsets applied to a controlled object lda ControlledHorizontalOffsetTable,y at $D393
$D3F3-$D3F7 5 ControlledVerticalOffsetTable 5 signed vertical offsets applied to a controlled object lda ControlledVerticalOffsetTable,y at $D3C5
$D5B9-$D5BD 5 RandomMotionBaseTable 5 randomised base values ($C0,$E0,$00,$40,$60); the code's base is $D5B8, one byte below the label adc $D5B8,x at $D517
$D5BE-$D5C2 5 RandomMotionThresholdTable 5 thresholds ($00,$4B,$85,$BC,$F0); the code's base is $D5BD, one byte below the label cmp $D5BD,x at $D504
$D5C3-$D5CC 10 RandomMotionAngleTable 10 offset/result values added to the randomised motion angle adc $D5C3,x at $D532
$D5CD 1 RandomMotionAnglePadding One standalone byte between the angle table and the angle thresholds; its role is not established nothing in the dump reads it
$D5CE-$D5D7 10 RandomMotionAngleThresholdTable 10 thresholds; the search starts at X = $0A and decrements before comparing, so the first read is $D5D7 cmp $D5CE,x at $D528
$D837-$D842 12 AnimationFrameBaseTable 12 replacement / lower animation frames, one per animation range cmp AnimationFrameBaseTable,y at $D826; lda AnimationFrameBaseTable,y at $D82B
$D843-$D84E 12 AnimationFrameLimitTable 12 upper animation-frame thresholds, one per range cmp AnimationFrameLimitTable,y at $D821
$D84F-$D85A 12 AnimationFrameDelayTable 12 delays, one per range (most are six ticks; range four waits nine) lda AnimationFrameDelayTable,y at $D831
$DA9C-$DA9F 4 ObjectAnimationAttributeTable 4 animation attribute bytes; the code's base is $DA9B, one byte below the label, so Y = $01-$04 lda $DA9B,y at $DA8F
$DAA0-$DAA3 4 ObjectAnimationFrameTable 4 animation frame bytes; the code's base is $DA9F, one byte below the label lda $DA9F,y at $DA95
$DBB0-$DBB7 8 InputMaskTable 8 controller-input masks, one per object selector; adjacent entries repeat in pairs because neighbouring selectors accept the same buttons and InputMaskTable,y at $DB25
$DBF6-$DBFD 8 SecondaryAnimationBaseTable 8 base / reset animation frames for the secondary (fielding) objects cmp SecondaryAnimationBaseTable,y at $DBE8; lda SecondaryAnimationBaseTable,y at $DBED
$DBFE-$DC05 8 SecondaryAnimationLimitTable 8 upper animation-frame limits for the secondary objects cmp SecondaryAnimationLimitTable,y at $DBE3
$DC29 1 VerticalAdjustmentTable Single signed vertical adjustment byte; the tables that follow overlap it adc VerticalAdjustmentTable,y at $DC20
$DC2A-$DC30 7 HorizontalAdjustmentTable 7 signed horizontal adjustment bytes, overlapping the vertical table adc HorizontalAdjustmentTable,y at $DC0F
$DC88-$DC90 9 ObjectEventSlotTable 9 event-slot indices, each an even object-array offset; halving each gives the compact object-state index ldy ObjectEventSlotTable,x at $DC62; ldx ObjectEventSlotTable,y at $DC74 and $DCA6
$DF12-$DF14 3 SetupCurrentObjectGeometry Three raw bytes that copy the saved base coordinates into the geometry argument structure; the original ROM uses absolute addressing for zero-page $53-$56, and raw bytes keep CA65 from shortening the instruction read as part of the surrounding routine; nothing in the dump names it directly
$DFC4-$DFD3 16 SignedCoordinateOffsetTable 8 little-endian signed 16-bit offsets ($F800, $0800, $F800, $0000, $00F9, $0007, $00F9, $FE00); later routines index the region through nearby or overlapping bases read through the overlapping bases in the geometry routines; no single absolute operand names it
$DFEB-$DFEE 4 ObjectDisplayAttributeTable 4 display attribute bytes; the load at $DFDA intentionally uses base $DFEA, so Y = $01-$04 lda $DFEA,y at $DFDA
$E01D-$E020 4 ObjectStateLookupData 4 bytes of lookup data for the object-state routines lda $E01D,x at $E111
$E021-$E026 6 ObjectStateThresholdTable 6 thresholds compared against the object's state value cmp $E021,y at $DB6A and $E0E0
$E027-$E036 16 ObjectStateResultTable 16 result bytes selected by the state lookup eor $E027,y at $E0D8; lda $E027,y at $E0ED
$E295-$E29A 6 CandidateObjectOffsetTable 6 even object-array offsets searched by FindNearestCandidateObject; halving each gives the compact index ldy CandidateObjectOffsetTable,x at $E266 and $E291
$E319-$E320 8 CurrentObjectAnimationBaseTable 8 base / reset frames for the current object's animation ranges cmp CurrentObjectAnimationBaseTable,y at $E301; lda CurrentObjectAnimationBaseTable,y at $E306
$E321-$E328 8 CurrentObjectAnimationLimitTable 8 exclusive upper frame limits cmp CurrentObjectAnimationLimitTable,y at $E2FC
$E329-$E330 8 CurrentObjectAnimationDelayTable 8 delays, one per range lda CurrentObjectAnimationDelayTable,y at $E30C
$E413-$E432 32 GeometryParameterData First 32 bytes of the geometry parameter block; later routines index it with calculated and overlapping offsets lda GeometryParameterData,y at $E4C2
$E433-$E452 32 GeometryParameterData_Block2 Second 32 bytes of the same structure lda $E433,y at $E4C7
$E453-$E46A 24 GeometryParameterData_Block3 Third (24-byte) block of the same structure lda $E453,y at $E4C8
$E761-$E76D 13 RenderingStateTable_Default First 13-byte rendering state record lda $E761,y at $E75A; the code's base is $E761
$E76E-$E77A 13 RenderingStateTable_Alternate Second 13-byte rendering state record lda $E76E,y at $E75A
$EBBC-$EBDB 32 RenderingData_EBBC Compact rendering / animation records (repeating $41 fields and control bytes); the block starts with $D6 $E1, which is not a plausible entry point lda $EBBC,y at $C39A and $C3A2
$EBDC-$EBFB 32 RenderingData_EBDC The same record pattern continued; the exact record boundaries are not yet established lda $EBDC,y at $C3A4
$EBFC-$EC1B 32 RenderingData_EBFC The same record pattern continued lda $EBFC,y at $C3A6
$ED00-$EDFF 256 RenderingAnimationData_ED00 One 256-byte page of rendering / animation data. The pages $ED00-$F8FF are read as a single array by the renderer, so each 256-byte page is one page of sprite/attribute records the renderer indexes the whole $ED00-$F8FF array; no single absolute operand names this page
$EE00-$EEFF 256 RenderingAnimationData_EE00 Second page of the same array as above
$EF00-$EFFF 256 RenderingAnimationData_EF00 Third page as above
$F000-$F0FF 256 RenderingAnimationData_F000 Fourth page as above
$F100-$F1FF 256 RenderingAnimationData_F100 Fifth page as above
$F200-$F2FF 256 RenderingAnimationData_F200 Sixth page as above
$F300-$F3FF 256 RenderingAnimationData_F300 Seventh page as above
$F400-$F4FF 256 RenderingAnimationData_F400 Eighth page as above
$F500-$F5FF 256 RenderingAnimationData_F500 Ninth page as above
$F600-$F6FF 256 RenderingAnimationData_F600 Tenth page as above
$F700-$F7FF 256 RenderingAnimationData_F700 Eleventh page as above
$F800-$F8FF 256 RenderingAnimationData_F800 Twelfth page as above
$F900-$F94C 77 RenderingAnimationData_F900 Last partial page of the array as above
$F9A5-$F9CF 43 RenderingAnimationData_F9A5 Trailing animation data after the $FF padding at $F94D-$F9F4 nothing in the dump names it
$F9F4-$F9FF 12 AudioPadding_F9F4 $FF padding between the rendering data and the audio data nothing in the dump reads it
$FA00-$FA5F 96 AudioLookupData_FA00 Adjacent audio tables: 20 little-endian APU timer periods ($F007, $6900, $0000, $D400, …) up to $FA41, then the note-duration table at $FA4A ($00,$20,$05,$0A,$14,$28,$0D,$21) and a rhythm table at $FA50 lda $FA00,y at $FA9A (timer high bytes); the low-byte base $FA01 and the duration base $FA4A are referenced directly by the audio routines
$FD0C-$FD13 8 NoiseEnvelopeSequence 8 envelope values; the routine at $FD14 derives a three-bit index from it lda NoiseEnvelopeSequence,y at $FD1F
$FE40-$FE5F 32 MusicSequenceData First 32 bytes of the music sequence / note / duration / envelope data consumed by the sequence engine at $FD14-$FE3F lda $FE40,y at $FD49 and $FD51
$FE60-$FE7F 32 MusicSequenceData_FE60 Continuation of the music data lda $FE60,y at $FD53
$FE80-$FE9F 32 MusicSequenceData_FE80 Continuation of the music data lda $FE80,y at $FD55
$FEA0-$FEBF 32 MusicSequenceData_FEA0 Continuation of the music data lda $FEA0,y at $FD57
$FEC0-$FEDF 32 MusicSequenceData_FEC0 Continuation of the music data lda $FEC0,y at $FD59
$FEE0-$FEFF 32 MusicSequenceData_FEE0 Continuation of the music data lda $FEE0,y at $FD5B
$FF00-$FF1F 32 MusicSequenceData_FF00 Continuation of the music data lda $FF00,y at $FD5D
$FF20-$FF3F 32 MusicSequenceData_FF20 Continuation of the music data lda $FF20,y at $FD5F
$FF40-$FF5F 32 MusicSequenceData_FF40 Continuation of the music data lda $FF40,y at $FD61
$FF60-$FF7F 32 MusicSequenceData_FF60 Continuation of the music data lda $FF60,y at $FD63
$FF80-$FF9F 32 MusicSequenceData_FF80 Continuation of the music data lda $FF80,y at $FD65
$FFA0-$FFBF 32 MusicSequenceData_FFA0 Continuation of the music data lda $FFA0,y at $FD67
$FFC0-$FFCF 16 MusicSequenceData_FFC0 Continuation of the music data lda $FFC0,y at $FD69
$FFD0-$FFE1 18 MusicSequenceData_FFD0 Final music / audio sequence data lda $FFD0,y at $FD6B
$FFE2-$FFF9 24 UnusedRomPadding $52,$00 finish the audio data above; the rest through $FFF9 is $FF padding nothing in the dump reads it

Inline data blocks

These are the bytes that sit inside a routine and are pulled out of the return address by the helper that the jsr above them names. They are listed here so that the inventory covers every byte of the PRG that is not an instruction.

Address Size Name Structure Read by
$C01B 27 inline after TitleCopyrightPpuStream 4 .byte row(s) of inline data that follow the call the routine it follows
$C023 1 inline after TitleCopyrightPpuStream 1 .byte row(s) of inline data that follow the call the routine it follows
$C0F3 3 inline after NMI_CheckState 1 .byte row(s) of inline data that follow the call QueueInlineObjectEvent at $C0F0
$C12D 3 inline after UpdateFrameObjectsAndTimers 1 .byte row(s) of inline data that follow the call QueueInlineObjectEvent at $C12A
$C246 3 inline after SaveSignedPositionDelta 1 .byte row(s) of inline data that follow the call QueueInlineObjectEvent at $C243
$C434 3 inline after Reset_ClearPageLoop 1 .byte row(s) of inline data that follow the call ExpandRecordPointerList at $C431
$C456 7 inline after RunAttractMessageLoop 3 .byte row(s) of inline data that follow the call CopyInlineDisplayRecord at $C44F
$C475 7 inline after RunAttractMessageLoop 3 .byte row(s) of inline data that follow the call CopyInlineDisplayRecord at $C46E
$C4B7 2 inline after InitializeSessionDisplay 1 .byte row(s) of inline data that follow the call ProcessInlinePpuStream at $C4B4
$C4F2 3 inline after DeriveSelectedSideFromMode 1 .byte row(s) of inline data that follow the call QueueInlineObjectEvent at $C4EF
$C4F8 3 inline after StartPlayerSelection 1 .byte row(s) of inline data that follow the call QueueInlineObjectEvent at $C4F5
$C509 3 inline after WaitForPlayerSelection 1 .byte row(s) of inline data that follow the call QueueInlineObjectEvent at $C506
$C51B 3 inline after CompleteMatchSetup 1 .byte row(s) of inline data that follow the call QueueInlineObjectEvent at $C518
$C55D 9 inline after ResetRoundCounters 3 .byte row(s) of inline data that follow the call CopyInlineDisplayRecord at $C555
$C610 3 inline after CheckRoundTransitionState 1 .byte row(s) of inline data that follow the call QueueInlineObjectEvent at $C60D
$C616 3 inline after CheckRoundTransitionState 1 .byte row(s) of inline data that follow the call QueueInlineObjectEvent at $C613
$C654 3 inline after RunPrimaryRoundHandlers 1 .byte row(s) of inline data that follow the call QueueInlineObjectEvent at $C651
$C65A 3 inline after RunPrimaryRoundHandlers 1 .byte row(s) of inline data that follow the call QueueInlineObjectEvent at $C657
$C660 3 inline after RunPrimaryRoundHandlers 1 .byte row(s) of inline data that follow the call QueueInlineObjectEvent at $C65D
$C67C 2 inline after ProcessRoundEventSlotTable 1 .byte row(s) of inline data that follow the call CopyInlineDisplayRecord at $C679
$C706 2 inline after CompleteMatchState 1 .byte row(s) of inline data that follow the call CopyInlineDisplayRecord at $C703
$C71F 11 inline after InitializeResultsPosition 3 .byte row(s) of inline data that follow the call CopyInlineDisplayRecord at $C716
$C730 3 inline after InitializeResultsPosition 1 .byte row(s) of inline data that follow the call QueueInlineObjectEvent at $C72D
$C762 2 inline after InitializeTitleScreen 1 .byte row(s) of inline data that follow the call ProcessInlinePpuStream at $C75F
$C767 2 inline after InitializeTitleScreen 1 .byte row(s) of inline data that follow the call ProcessInlinePpuStream at $C764
$C7AB 3 inline after WaitForTitleInputRelease 1 .byte row(s) of inline data that follow the call QueueInlineObjectEvent at $C7A8
$C7D8 9 inline after ClearEightCharacterField 3 .byte row(s) of inline data that follow the call CopyInlineDisplayRecord at $C7D0
$C7EC 8 inline after QueuePlayerSelectionDisplay 3 .byte row(s) of inline data that follow the call CopyInlineDisplayRecord at $C7E4
$C910 3 inline after QueueRandomStateRecord 1 .byte row(s) of inline data that follow the call ExpandRecordPointerList at $C90D
$C917 3 inline after QueueAlternateRandomStateRecord 1 .byte row(s) of inline data that follow the call ExpandRecordPointerList at $C914
$C936 3 inline after SaveDirectionSelection 1 .byte row(s) of inline data that follow the call ExpandRecordPointerList at $C933
$C93F 3 inline after QueueAlternateDirectionRecord 1 .byte row(s) of inline data that follow the call ExpandRecordPointerList at $C93C
$CA9B 3 inline after UpdateTrajectoryFrame 1 .byte row(s) of inline data that follow the call QueueInlineObjectEvent at $CA98
$CAA4 3 inline after QueueNegativeTrajectoryCommand 1 .byte row(s) of inline data that follow the call QueueInlineObjectEvent at $CAA1
$CAAD 3 inline after QueueLaterTrajectoryCommand 1 .byte row(s) of inline data that follow the call QueueInlineObjectEvent at $CAAA
$CB2A 3 inline after ApplyNegativeTrajectoryResult 1 .byte row(s) of inline data that follow the call QueueInlineObjectEvent at $CB27
$CB31 3 inline after QueueNegativeResultCommand 1 .byte row(s) of inline data that follow the call QueueInlineObjectEvent at $CB2E
$CC16 3 inline after AdvancePrimaryStateSequence 1 .byte row(s) of inline data that follow the call QueueInlineObjectEvent at $CC13
$CC38 3 inline after QueuePrimaryStateEvent 1 .byte row(s) of inline data that follow the call QueueInlineObjectEvent at $CC35
$CCB5 3 inline after Routine_CCAA_OneTimeCommand 1 .byte row(s) of inline data that follow the call QueueInlineObjectEvent at $CCB2
$CD14 3 inline after Routine_CD09_OneTimeCommand 1 .byte row(s) of inline data that follow the call QueueInlineObjectEvent at $CD11
$CD3E 3 inline after QueueSelectedStateMarker 1 .byte row(s) of inline data that follow the call QueueInlineObjectEvent at $CD3B
$CD84 5 inline after WaitForStateAnimation 2 .byte row(s) of inline data that follow the call LoadObjectPositionInline at $CD80
$CDAF 3 inline after RunHomeRunCelebration 1 .byte row(s) of inline data that follow the call QueueInlineObjectEvent at $CDAC
$CDE8 9 inline after HomeRunAnimationLoop 3 .byte row(s) of inline data that follow the call CopyInlineDisplayRecord at $CDE0
$CF63 4 inline after QueueThreeBlanks 2 .byte row(s) of inline data that follow the call CopyInlineDisplayRecord at $CF5F
$D033 6 inline after DisplaySharedCounter 2 .byte row(s) of inline data that follow the call CopyInlineDisplayRecord at $D02F
$D061 6 inline after ConvertSharedCounterToDigits 2 .byte row(s) of inline data that follow the call CopyInlineDisplayRecord at $D05D
$D138 5 inline after InitializeConditionalObject 2 .byte row(s) of inline data that follow the call LoadObjectPositionInline at $D134
$D16E 3 inline after InitializePrimaryGameplayActor 1 .byte row(s) of inline data that follow the call QueueInlineObjectEvent at $D16B
$D184 6 inline after ClearPrimaryActorState 3 .byte row(s) of inline data that follow the call LoadBasePositionFieldsInline at $D17D
$D1CB 3 inline after FinishWindupSequence 1 .byte row(s) of inline data that follow the call QueueInlineObjectEvent at $D1C8
$D21D 3 inline after AnimatePitchStart 1 .byte row(s) of inline data that follow the call QueueInlineObjectEvent at $D21A
$D262 3 inline after PitchStartAnimationLoop 1 .byte row(s) of inline data that follow the call QueueInlineObjectEvent at $D25F
$D29E 3 inline after CheckPitchVerticalLimit 1 .byte row(s) of inline data that follow the call QueueInlineObjectEvent at $D29B
$D31A 3 inline after SaveBatterAction 1 .byte row(s) of inline data that follow the call QueueInlineObjectEvent at $D317
$D35D 3 inline after Routine_D355_State1 1 .byte row(s) of inline data that follow the call QueueInlineObjectEvent at $D35A
$D36F 3 inline after Routine_D367_State2 1 .byte row(s) of inline data that follow the call QueueInlineObjectEvent at $D36C
$D37B 3 inline after Routine_D373_State3 1 .byte row(s) of inline data that follow the call QueueInlineObjectEvent at $D378
$D480 5 inline after RunFielderAnimationSequence 2 .byte row(s) of inline data that follow the call LoadObjectPositionInline at $D47C
$D572 3 inline after SelectRandomMotionOffset 1 .byte row(s) of inline data that follow the call QueueInlineObjectEvent at $D56F
$D578 3 inline after SelectRandomMotionOffset 1 .byte row(s) of inline data that follow the call QueueInlineObjectEvent at $D575
$D5A6 3 inline after FinishRandomMotionSequence 1 .byte row(s) of inline data that follow the call QueueInlineObjectEvent at $D5A3
$D5AC 3 inline after FinishRandomMotionSequence 1 .byte row(s) of inline data that follow the call QueueInlineObjectEvent at $D5A9
$D628 5 inline after InitializeSecondaryActors 2 .byte row(s) of inline data that follow the call LoadObjectPositionInline at $D624
$D630 5 inline after InitializeSecondaryActors 2 .byte row(s) of inline data that follow the call LoadObjectPositionInline at $D62C
$D638 5 inline after InitializeSecondaryActors 2 .byte row(s) of inline data that follow the call LoadObjectPositionInline at $D634
$D65A 5 inline after InitializeState6Actor 2 .byte row(s) of inline data that follow the call LoadObjectPositionInline at $D656
$D68D 5 inline after InitializeState4Actor 2 .byte row(s) of inline data that follow the call LoadObjectPositionInline at $D689
$D6BB 5 inline after InitializeState2Actor 2 .byte row(s) of inline data that follow the call LoadObjectPositionInline at $D6B7
$D79F 3 inline after WaitForVerticalPositionF6 1 .byte row(s) of inline data that follow the call QueueInlineObjectEvent at $D79C
$D7A5 3 inline after WaitForVerticalPositionF6 1 .byte row(s) of inline data that follow the call QueueInlineObjectEvent at $D7A2
$D804 3 inline after WaitForVerticalPosition02 1 .byte row(s) of inline data that follow the call QueueInlineObjectEvent at $D801
$D80A 3 inline after WaitForVerticalPosition02 1 .byte row(s) of inline data that follow the call QueueInlineObjectEvent at $D807
$D863 3 inline after ProcessSecondaryObjectStates 1 .byte row(s) of inline data that follow the call QueueInlineObjectEvent at $D860
$D871 3 inline after CheckObjectState059A 1 .byte row(s) of inline data that follow the call QueueInlineObjectEvent at $D86E
$D87F 3 inline after CheckObjectState059B 1 .byte row(s) of inline data that follow the call QueueInlineObjectEvent at $D87C
$D9F2 5 inline after SecondaryObject_TransitionHandler 2 .byte row(s) of inline data that follow the call LoadObjectPositionInline at $D9EE
$DC7A 3 inline after InitializeObjectEventSequence_DispatchLoop 1 .byte row(s) of inline data that follow the call DispatchInlineObjectCommand at $DC77
$DCAC 1 inline after DispatchSixObjectEvents_Loop 1 .byte row(s) of inline data that follow the call the routine it follows
$DF17 3 inline after SetupCurrentObjectGeometry 1 .byte row(s) of inline data that follow the call the routine it follows
$DF1C 3 inline after SetupCurrentObjectGeometry 1 .byte row(s) of inline data that follow the call the routine it follows
$DF21 3 inline after SetupCurrentObjectGeometry 1 .byte row(s) of inline data that follow the call the routine it follows
$E17B 3 inline after ObjectStateDispatch_DifferentObject 1 .byte row(s) of inline data that follow the call DispatchInlineObjectCommand at $E178
$E989 2 inline after FillPpuMemoryAfterValueSaved 1 .byte row(s) of inline data that follow the call SetPpuAddressFromInlineRecord at $E986
$EAC0 2 inline after RunDisplayTransition 1 .byte row(s) of inline data that follow the call SetPpuAddressFromInlineRecord at $EABD
$EACA 2 inline after RunDisplayTransition 1 .byte row(s) of inline data that follow the call SetPpuAddressFromInlineRecord at $EAC7
$EAD4 2 inline after RunDisplayTransition 1 .byte row(s) of inline data that follow the call SetPpuAddressFromInlineRecord at $EAD1
$EADC 2 inline after RunDisplayTransition 1 .byte row(s) of inline data that follow the call SetPpuAddressFromInlineRecord at $EAD9
$EAF8 1 inline after WriteFixedPpuSequence 1 .byte row(s) of inline data that follow the call the routine it follows
$EAFC 6 inline after WriteFixedPpuSequence 2 .byte row(s) of inline data that follow the call the routine it follows
$ECFC 228 inline after RenderingAndAnimationData_EC1C 15 .byte row(s) of inline data that follow the call the routine it follows
$F99D 88 inline after FrameOamTemplate_F94D 6 .byte row(s) of inline data that follow the call the routine it follows

16. Notes on the Disassembly

  • The source is 21,626 lines and thoroughly annotated with symbolic names for nearly every routine, table, and data block — there are no generic Label_Cxxxx placeholders.
  • Numerous routines are followed by inline .byte data blocks consumed by QueueInlineObjectEvent, CopyInlineDisplayRecord, or ProcessInlinePpuStream; these are intentionally left as raw bytes and marked in comments.
  • The PRG is a single 16 KB bank at $C000–$FFFF; calls to $Dxxx/$Exxx/$Fxxx targets are all within the same bank (no bank switching).
  • Build verification: make in this folder produces reconstructed.nes, compared whole-ROM against rom.nes.

Power-on flow analysis

Derived from the disassembly by _tools/derive_poweron.py; the call graph is walked from the reset entry.


Entry-point naming

Every jsr/jmp target in this project now carries a semantic name; none is left in the address-derived Sub_CXXX form. The last one, Sub_C036, was a second label at $C036 sitting on top of the project's own CalculateRandomizedPitchMotion label; the duplicate definition is gone and the one call site (jsr at $D256) now names the routine directly. The routine computes a randomized signed pitch-motion value from the random state at $0539.