From 62866563ba564bbf1a83a1b3a55e95da78fc3124 Mon Sep 17 00:00:00 2001 From: Trevor Merritt Date: Sun, 18 Oct 2026 16:47:03 -0400 Subject: [PATCH] Promotes Lunar Pool --- AGENTS.md | 7 +- .../Lunar Pool (U).nes | Bin Lunar Pool (U)/OVERVIEW.md | 268 + Lunar Pool (U)/copilot/Makefile | 25 + .../copilot/chr.bin | Bin Lunar Pool (U)/copilot/chr.s | 2 + .../copilot/header.bin | Bin Lunar Pool (U)/copilot/header.s | 2 + Lunar Pool (U)/copilot/linker.cfg | 10 + Lunar Pool (U)/copilot/locals.inc | 209 + .../copilot/prg.bin | Bin .../copilot/prg.s | 7939 +++++---- Lunar Pool (U)/copilot/reconstructed.lbl | 705 + .../copilot/reconstructed.map | 6 + .../copilot/reconstructed.nes | Bin 16384 -> 24592 bytes Lunar Pool (U)/copilot/rom.nes | 1 + .../copilot/symbols.inc | 0 OVERVIEW.md | 64 +- TODO.md | 166 +- _tools/cdl_reclass.py | 498 + _tools/verify_pass1.py | 5 +- _wip/Golf (JU)/OVERVIEW.md | 25 +- .../copilot/COMPRESSED_PARSER_AUDIT.md | 152 + _wip/Golf (JU)/copilot/Makefile | 2 +- .../copilot/Makefile.pass0} | 0 _wip/Golf (JU)/copilot/NMI_CALLBACK_AUDIT.md | 109 + _wip/Golf (JU)/copilot/OVERLAP_AUDIT.md | 44 + _wip/Golf (JU)/copilot/PASS1_STATUS.md | 59 + _wip/Golf (JU)/copilot/PASS2_PLAN.md | 59 + .../copilot/SPRITE_OBJECT_TABLE_AUDIT.md | 201 + .../copilot/annotation_reconstructed_prg.bin | Bin 0 -> 16384 bytes _wip/Golf (JU)/copilot/course_streams.inc | 38 + _wip/Golf (JU)/copilot/locals.inc | 49 +- _wip/Golf (JU)/copilot/locals.inc.bak | 2 + .../Golf (JU)/copilot/locals.inc.pass2-batch1 | 26 + .../Golf (JU)/copilot/locals.inc.pass2-batch2 | 37 + .../copilot/locals.inc.pass2-batch2-verified | 37 + _wip/Golf (JU)/copilot/prg.s | 13543 +++++++++++++++- _wip/Golf (JU)/copilot/prg.s.pass0 | 13159 +++++++++++++++ _wip/Golf (JU)/copilot/prg.s.pass1-complete | 13488 +++++++++++++++ _wip/Golf (JU)/copilot/prg.s.pass2-batch1 | 13490 +++++++++++++++ _wip/Golf (JU)/copilot/prg.s.pass2-batch2 | 13493 +++++++++++++++ .../copilot/prg.s.pass2-batch2-verified | 13493 +++++++++++++++ _wip/Golf (JU)/copilot/prg_pass1.s | 13505 +++++++++++++++ .../copilot/prg_pass1.s.pass1-complete | 13488 +++++++++++++++ _wip/Golf (JU)/copilot/reconstructed.lbl | 576 + .../copilot/sprite_object_tables.inc | 3 + _wip/Hogan's Alley (JU)/GeminiNotes.md | 30 + _wip/Lunar Pool (U)/OVERVIEW.md | 100 - _wip/Lunar Pool (U)/copilot/linker.cfg | 6 - _wip/Lunar Pool (U)/copilot/locals.inc | 120 - _wip/Lunar Pool (U)/copilot/reconstructed.lbl | 595 - opencode.json | 10 + 53 files changed, 115746 insertions(+), 4100 deletions(-) rename {_wip/Lunar Pool (U) => Lunar Pool (U)}/Lunar Pool (U).nes (100%) create mode 100644 Lunar Pool (U)/OVERVIEW.md create mode 100644 Lunar Pool (U)/copilot/Makefile rename {_wip/Lunar Pool (U) => Lunar Pool (U)}/copilot/chr.bin (100%) create mode 100644 Lunar Pool (U)/copilot/chr.s rename {_wip/Lunar Pool (U) => Lunar Pool (U)}/copilot/header.bin (100%) create mode 100644 Lunar Pool (U)/copilot/header.s create mode 100644 Lunar Pool (U)/copilot/linker.cfg create mode 100644 Lunar Pool (U)/copilot/locals.inc rename {_wip/Lunar Pool (U) => Lunar Pool (U)}/copilot/prg.bin (100%) rename {_wip/Lunar Pool (U) => Lunar Pool (U)}/copilot/prg.s (70%) create mode 100644 Lunar Pool (U)/copilot/reconstructed.lbl rename {_wip/Lunar Pool (U) => Lunar Pool (U)}/copilot/reconstructed.map (61%) rename _wip/Lunar Pool (U)/copilot/reconstructed_prg.bin => Lunar Pool (U)/copilot/reconstructed.nes (65%) create mode 120000 Lunar Pool (U)/copilot/rom.nes rename {_wip/Lunar Pool (U) => Lunar Pool (U)}/copilot/symbols.inc (100%) create mode 100644 _tools/cdl_reclass.py create mode 100644 _wip/Golf (JU)/copilot/COMPRESSED_PARSER_AUDIT.md rename _wip/{Lunar Pool (U)/copilot/Makefile => Golf (JU)/copilot/Makefile.pass0} (100%) create mode 100644 _wip/Golf (JU)/copilot/NMI_CALLBACK_AUDIT.md create mode 100644 _wip/Golf (JU)/copilot/OVERLAP_AUDIT.md create mode 100644 _wip/Golf (JU)/copilot/PASS1_STATUS.md create mode 100644 _wip/Golf (JU)/copilot/PASS2_PLAN.md create mode 100644 _wip/Golf (JU)/copilot/SPRITE_OBJECT_TABLE_AUDIT.md create mode 100644 _wip/Golf (JU)/copilot/annotation_reconstructed_prg.bin create mode 100644 _wip/Golf (JU)/copilot/course_streams.inc create mode 100644 _wip/Golf (JU)/copilot/locals.inc.bak create mode 100644 _wip/Golf (JU)/copilot/locals.inc.pass2-batch1 create mode 100644 _wip/Golf (JU)/copilot/locals.inc.pass2-batch2 create mode 100644 _wip/Golf (JU)/copilot/locals.inc.pass2-batch2-verified create mode 100644 _wip/Golf (JU)/copilot/prg.s.pass0 create mode 100644 _wip/Golf (JU)/copilot/prg.s.pass1-complete create mode 100644 _wip/Golf (JU)/copilot/prg.s.pass2-batch1 create mode 100644 _wip/Golf (JU)/copilot/prg.s.pass2-batch2 create mode 100644 _wip/Golf (JU)/copilot/prg.s.pass2-batch2-verified create mode 100644 _wip/Golf (JU)/copilot/prg_pass1.s create mode 100644 _wip/Golf (JU)/copilot/prg_pass1.s.pass1-complete create mode 100644 _wip/Golf (JU)/copilot/sprite_object_tables.inc create mode 100644 _wip/Hogan's Alley (JU)/GeminiNotes.md delete mode 100644 _wip/Lunar Pool (U)/OVERVIEW.md delete mode 100644 _wip/Lunar Pool (U)/copilot/linker.cfg delete mode 100644 _wip/Lunar Pool (U)/copilot/locals.inc delete mode 100644 _wip/Lunar Pool (U)/copilot/reconstructed.lbl create mode 100644 opencode.json diff --git a/AGENTS.md b/AGENTS.md index 042ca60..b5b4f76 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -2,7 +2,7 @@ ## What this repo is -Thirty-six AI-generated disassemblies of NES ROMs: 16 promoted to top-level folders and 20 skeletons still under `_wip/`. The contract (stated in `PROMPTS.md` and verified by `make` in every `copilot/` folder) is **byte-identical rebuilds**: `reconstructed.nes` must match the original ROM exactly. Not for distribution (`README.md`). +Thirty-six AI-generated disassemblies of NES ROMs: 17 promoted to top-level folders and 19 skeletons still under `_wip/`. The contract (stated in `PROMPTS.md` and verified by `make` in every `copilot/` folder) is **byte-identical rebuilds**: `reconstructed.nes` must match the original ROM exactly. Not for distribution (`README.md`). ## Layout @@ -10,7 +10,7 @@ Thirty-six AI-generated disassemblies of NES ROMs: 16 promoted to top-level fold - Root `OVERVIEW.md` is the index: vectors, build fixes, and summary for all 36 projects. **Keep it in sync** when a project changes — its DK Jr. entries drifted badly before being corrected, and its vector column later turned out to have five rows wrong from copy-paste duplication. - `TODO.md` is the handoff: open work per project, plus the gotchas that cost real time. Read it before starting anything non-trivial. - `PROMPTS.md` is the workflow contract. `default_project.tar.gz` is the empty-project skeleton (prg.s, symbols.inc, linker.cfg, Makefile, locals.inc). `_ROMS/` is the master ROM store. -- `_tools/`: `nesdis.py` (Pass 1 tracer), `pass2.py` and `bytecode_dis.py` (Pass 2/3 emitters), `trace_stage_payload.py` (py65-based runtime tracer), `verify_pass1.py` (rebuild + re-trace check across all projects), `splitnes.py`, `chr2gif.py`. +- `_tools/`: `nesdis.py` (Pass 1 tracer), `pass2.py` and `bytecode_dis.py` (Pass 2/3 emitters), `trace_stage_payload.py` (py65-based runtime tracer), `cdl_reclass.py` (Mesen-CDL-driven code/data split fix), `verify_pass1.py` (rebuild + re-trace check across all projects), `splitnes.py`, `chr2gif.py`. ## Commands @@ -27,6 +27,7 @@ python3 _tools/verify_pass1.py # rebuilds and re-traces every project 1. `git mv "_wip/" ""` — the relative `copilot/rom.nes -> ../.nes` symlink survives untouched. 2. Add `copilot/rom.nes` (a space-free copy or symlink of the original) and switch the Makefile from `cmp reconstructed_prg.bin prg.bin` to `cmp reconstructed.nes rom.nes`. +2b. A Pass-0 skeleton has no `header.s`/`chr.s` and its `linker.cfg` declares only the PRG memory area, so add all three (copy the shape from `Burger Time (U)/copilot/`: two one-line `.incbin`s and `HEADER: start = $0000, size = $0010` ahead of PRG) or the whole-ROM compare has nothing to link. `Lunar Pool (U)` is the worked example (2026-10-18). 3. Change `../../../_tools/` to `../../_tools/` in the Makefile — the depth changed by one. 4. Verify `make`, then `make regen` if a regen pipeline exists. 5. Add it to the root inventory table and re-number the `_wip` rows. @@ -34,7 +35,7 @@ python3 _tools/verify_pass1.py # rebuilds and re-traces every project ## Irreversible conventions (do not "clean up" past these) -- Every instruction carries a trailing audit comment with its CPU address, PRG offset and exact emitted bytes. The dominant spelling is `; CPU:$C123 PRG:0123 AD 21 03`, but **five other spellings are in use across the repo** and Excitebike and Pac-Man have no byte comments at all. This is the byte-identity audit trail — preserve whatever spelling a file uses even while renaming labels or restructuring files. See the TODO in root `OVERVIEW.md` for closing the gap. +- Every instruction carries a trailing audit comment with its CPU address, PRG offset and exact emitted bytes. The dominant spelling is `; CPU:$C123 PRG:0123 AD 21 03` — 8 of the 17 top-level projects use exactly it — but **six other spellings are in use across the repo** and 1,013 of Excitebike's 5,376 instruction lines carry no comment at all (`_tools/verify_pass1.py` reports the split; it needs `re.M` on the canonical pattern, fixed 2026-10-18, or it misreports every project). This is the byte-identity audit trail — preserve whatever spelling a file uses even while renaming labels or restructuring files. See the TODO in root `OVERVIEW.md` for closing the gap. - Unreached/unresolved bytes stay as data (`Label_/Data/` `.byte` or `.incbin` blocks with ROM provenance), never deleted or reformatted. - Routine headers follow the template in `prg.s`: global + local description, parameters, returns, clobbers. - Two separate symbol files: `symbols.inc` = NES hardware constants only; `locals.inc` = zero-page and forward references. Unresolved zero-page bytes keep neutral `ZpXX` names rather than speculative names. Proven semantic names may sit *beside* the generated `ZpXX` entries as aliases. diff --git a/_wip/Lunar Pool (U)/Lunar Pool (U).nes b/Lunar Pool (U)/Lunar Pool (U).nes similarity index 100% rename from _wip/Lunar Pool (U)/Lunar Pool (U).nes rename to Lunar Pool (U)/Lunar Pool (U).nes diff --git a/Lunar Pool (U)/OVERVIEW.md b/Lunar Pool (U)/OVERVIEW.md new file mode 100644 index 0000000..f3c9aad --- /dev/null +++ b/Lunar Pool (U)/OVERVIEW.md @@ -0,0 +1,268 @@ +# Lunar Pool (U) + +ROM: `Lunar Pool (U).nes` (24,592 bytes, iNES). Status: **PASSES 1-3 COMPLETE; PROMOTED TO THE TOP LEVEL 2026-10-18** — 5,300 instructions / **11,077 code bytes (67.6%)** / 5,301 data bytes / the 6 vector bytes as `.word`, byte accounting exact (11,077 + 5,301 + 6 = 16,384), and **BYTE-IDENTICAL for the whole ROM** (header + PRG + CHR) via `cmp reconstructed.nes rom.nes`. Pass 2 named all **705** labels — `Label_` is gone — and Pass 3 named 33 data structures and finished the zero-page audit (38 semantic aliases, 66 deliberately neutral `ZpXX`, ten former phantom aliases deleted). The ~354 bytes the CDL could not settle stay `.byte` on purpose; they are itemised under *Known remaining gaps*. + + +## ROM Facts + +| Property | Value | +|----------|-------| +| Mapper | 0 (NROM) — from the iNES header | +| PRG | 16 KB (header claims map at CPU $C000–$FFFF) | +| CHR | 8 KB | +| Mirroring | Vertical | +| Battery-backed flag | clear | +| ROM SHA-256 | `6da37fd34e8f4eb3df34e9f446726a193db77d0e0bba32aa328ef225993fc8a1` | +| PRG SHA-256 | `43a2f54cd48b38fc1e4a33051e019528e9789a774ace773fa7549c33dc9492c9` | + +## Interrupt Vectors (taken from PRG $3FFA–$3FFF) + +| Vector | Target | Note | +|--------|--------|------| +| NMI | `$FF65` | per-frame heartbeat | +| RESET | `$E80C` | non-$C000 entry — the tracer has to seed it explicitly (`--extra-seed 0xE80C`) | +| IRQ | `$FF64` | a bare `rti` sitting immediately before the NMI handler, so IRQs are effectively ignored | + +## Pass Status + +| Pass | Status | Description | +|------|--------|-------------| +| Pass 0 | Superseded | `prg.s` was a 12-line `.incbin` of the whole PRG — no disassembly at all | +| Pass 1 | **Complete** | Static code/data split, then reclassified against a Mesen Code Data Logger capture (see below). As Pass 1 delivered it: 5,285 instructions / **11,041 bytes emitted as instructions (67.4%)** / 5,343 bytes emitted as data (`.byte`, plus the six vector bytes as `.word`); 11,041 + 5,343 = 16,384 exactly. Labels: 640 `Label_` plus `Reset`/`NmiHandler`/`IrqHandler`. | +| Pass 2 | **Complete** | NES hardware constants in `symbols.inc`; zero-page aliases in `locals.inc`; and **all 705 labels named — `Label_` is gone from the file**. 17 dispatch targets that carried no label at all (`UpdateObjects_Render_Sound` `$C05C`, `SetupRound` `$EB60`, `PrintStageNumber` `$E21A`, `SetPpuAddr` `$F989`, …) were given labels and routine headers. Naming rule used: PascalCase for `jsr`/`jmp` targets and logical block heads, `_` (`_Loop`, `_Next`, `_Alt`, `_Done`, `_Skip`, `_Return`, `_Store`, …) for targets *inside* a routine; `jsr`/`jmp` operands stay raw numeric — this file's convention, as in `Joypad Test Cartridge (U)` — while branch operands are symbolic. (Earlier revisions claimed 218 entries renamed, 195 of them `SubC`; no `SubC` label ever existed — `git log -S SubC` finds no commit that added one.) | +| Pass 3 | **Complete** | Zero-page audit: **38 semantic aliases** (object core, VRAM write queue, VRAM read-back, PPU helpers) and **66 neutral `ZpXX`** whose roles are documented as deliberately unproven in `locals.inc`. Data structures: **33 tables/blocks named** (table below). Vectors are `.word NmiHandler, Reset, IrqHandler`. What is still unnamed is the residue listed under *Known remaining gaps* — it stays `.byte` on purpose. | + +## Pass 3 — the named data structures + +33 tables and blocks were named. The code in this ROM bases several tables one entry +early (`lda $C478,y`, `lda $D4F8,y`, `lda $E9B9,x`), so entry 0 is dead and the label +sits on the first *live* entry; that is noted per table in `prg.s`. + +| Address | Label | What it is | +|---------|-------|-----------| +| `$C000` | `ResetStub` | Unreachable three-byte `jmp Reset` — the reset vector points at `$E80C` directly | +| `$C0C0` | `ObjectOpcodeHandlerTable` | 19 words: object-script opcodes `$80`-`$92` → handler address − 1 | +| `$C3B4` | `SoundChannelMask` | `01 02 04 08 FE FD FB F7` — APU channel mask/enable bytes | +| `$C47A` | `ObjectStatePointerTable` | 84 words: per-object state pointers, indexed by `(obj_ptr_lo + $0519,x) * 2` | +| `$C522` | `SpawnObjectTable` | 16 words: spawn-record pointers for ids 1-15 (id 0 dead), picked from the `$0060-$0067` queue | +| `$C543` | `StateTimerTable` | Per-state timers `1,2,3,4,6,8,12,16,24,32,48,64,96,128,192,0`, indexed by script opcode − `$DF` | +| `$C552` | `AnimationPointerTable` | Frame-sequence pointers | +| `$C559` | `SpriteAnimationTable` | Per-sprite animation descriptors used by the draw path | +| `$CF40` | `VsCommandList` | Inline `RunCommandList` script issued when loading a VS-COMP scene | +| `$D057` | `DrawCellRun_TileTable` | Corner tiles `$3C $69 $C3 $96` selected by row bits in `DrawCellRun` | +| `$D4FA` | `LayoutScriptTable` | 30 words: per-stage layout-script pointers | +| `$D559` | `LayoutData` | 2,757 bytes of per-stage layout records | +| `$E862` | `BootSignatureText` | `"JEMINI DAZO!!"` plus the warm-boot signature compared against the RAM copy at `$0440-$044F`; the title attribute row at `$E870-$E87F` overlaps its tail | +| `$E9A3` | `TitleColorCycleTable` | 22 colour codes cycled into the `$0085-$0087` palette shadow each frame | +| `$E9B9` | `StartGameAttributeRow` | 16 attribute bytes copied to the `$0140-$014F` shadow when a game starts | +| `$EA00` | `TitleCommandList` | Inline `RunCommandList` script for the title screen | +| `$EC2A` | `StageAttributeTable` | 16 per-stage attribute bytes copied to the attribute shadow | +| `$ED3F` | `SpritePaletteTable` | 4 × 4 sprite palettes, copied to the `$0090-$009F` palette shadow by `Reset_LoadSpritePalettes` | +| `$EEE9` | `BallAppearTiles` | Tiles for the ball-appear step animation (indexed by the step at `$0340`) | +| `$EF2A` | `BallSinkTiles` | Tiles for the ball-sink step animation | +| `$F098` | `TileCollisionTable` | 27 words: collision flags per tile | +| `$F5E4` | `EndingCommandList` | Inline `RunCommandList` script for the ending screen | +| `$F762` | `AimPhaseTable0` | Three parallel 8-byte colour sequences shimmered into the `$008B`/`$008F`/`$0092` palette shadow while aiming | +| `$F786` | `StrPlayer1`, `StrShot`, `StrPlayer2`, `StrGameOver`, `StrPlayer3`, `StrHiScore`, `StrPerfect` | The seven `jsr $CBDC` inline strings ($F786-$F861) | +| `$FAC9` | `PaletteColorTable` | 12 rows of 4 colour codes → PPU palette entries (`MapColorCodeToPalette`) | +| `$FECE` | `SineTable` | 64 entries read by `GetSine` | +| `$FF90` | `PaddingFf` | 106 bytes of `$FF` filler between the last table and the vectors | + + + +The Pass 1 split came from a static trace only, and a static trace cannot see code that +is reached through computed dispatch, nor can it tell inline string data from an +instruction that happens to decode from the same bytes. Both errors were present. + +Ground truth came from the emulator: Mesen's Code Data Logger marks every byte the CPU +**fetched as an opcode** (Code) and every byte it **read as data** (Data). Playing the +ROM through title → 1P → game over → VS COMP marked 10,028 PRG bytes Code (61.2%) and +1,534 Data; that is the classification oracle for every byte it observed. Where the CDL +is silent the previous classification is kept, never guessed. + +| | code bytes | data bytes | +|---|---|---| +| As originally emitted by Pass 1 | 9,403 | 6,981 | +| After the CDL reclassification | **11,041** | **5,343** | + +1,738 bytes that Pass 1 had emitted as `.byte` are executed code and are now +instructions; 100 bytes it had emitted as instructions are read as data and are now +`.byte`. + +The result reconciles with the CDL exactly, with no disagreement in either direction: + +| emitted as | CDL says Code | CDL says Data | CDL never saw it | +|---|---:|---:|---:| +| instructions | 10,028 | **0** | 1,013 | +| data (`.byte`/`.word`) | **0** | 1,534 | 3,809 | + +Every byte the CDL observed is therefore classified the way the CPU used it. The 1,013 +instruction bytes the CDL never saw are Pass 1 static code plus the two inference steps +below; the 3,809 unseen data bytes are the residue — 45 of them carry an undocumented +opcode's disassembly in the audit comment (Pass 1 read them as code statically, but the +CDL never watched the session fetch them, and ca65 V2.19 cannot encode those opcodes +anyway, so they stay `.byte` with the disassembly recorded). + +As an independent structural check, all 1,183 control-flow targets in the file — 633 +`jsr`/`jmp` operands and 550 branch targets — land exactly on an instruction boundary; +none points into an operand or a `.byte` run. + +The rewrite is reproducible with `_tools/cdl_reclass.py` (dry run by default). Capture a +CDL from the Mesen MCP with +`mesen_cdl_file(action:'save', memoryType:'NesPrgRom', filepath:'lunar.cdl')` — the +capture is cumulative, so it does not reset — then: + +```bash +python3 _tools/cdl_reclass.py --dir "copilot" --cdl lunar.cdl \ + --override 0xC0C0-0xC0E5:D \ + --override 0xF81A-0xF825:C --override 0xF826-0xF82E:D --override 0xF82F-0xF83A:C \ + --override 0xF83B-0xF846:D --override 0xF847-0xF84B:C --override 0xF84C-0xF857:C \ + --override 0xF858-0xF861:D --override 0xF862-0xF866:C +``` + +Its output differs from this `prg.s` only in this provenance header, the `.word` vector +split, and three `jsr Label_CAA3` → `jsr $CAA3` operand spellings (this file spells +`jsr`/`jmp` operands as raw addresses and branch operands as `Label_`). Always run +`make` afterwards. + +Two inference steps were needed beyond the CDL because the capture never reached the +hi-score screen. They are marked as inference, not ground truth: + +* `$C0C0–$C0E5` is a 19-entry little-endian 16-bit pointer table (read as + `lda $C0C0,y` / `lda $C0C1,y`). Pass 1 had decoded it as a `cmp (ZpXX,x)` chain; the + CDL only observed the few entries the current game state walked. Code resumes at + `$C0E6` (`tax`), which is a real branch target from `$C101`. +* `$F81A` (hi-score) and `$F84C` ("perfect") are text routines. They are never reached + in normal play until a hi-score is beaten, so the CDL is silent; their inline-string + structure is inferred from the CDL-confirmed twins `$F77A` and `$F7E8`. + +### The inline-string dispatcher (this is not a jump gate) + +`$CBDC` (and its variant `$CBC9`, which also clears the PPU destination first) is a +**print-inline-string-and-return-after-it** helper: + +``` +$CBDC pla / sta ptr_lo ; pop the caller's return address = the string address +$CBDF pla / sta ptr_hi +$CBE2 jsr $CB5A ; prepare the PPU destination +$CBE5 ldy #$00 +$CBE7 lda (ptr_lo),y ; next character +$CBE9 beq $CBF4 ; $00 terminates +$CBEB jsr $CC29 ; emit it (advances ptr_lo/hi) +$CBEE jsr $CB5A +$CBF1 jmp $CBE5 +$CBF4 lda ptr_hi / pha ; push the address of the byte after the $00 ... +$CBF7 lda ptr_lo / pha +$CBFA rts ; ... and rts to it +``` + +So every `jsr $CBDC` in the image is immediately followed by a `$00`-terminated string +that begins with the control byte `$81` (`$81` also acts as the word separator), and +execution resumes after the terminator: + +| site | bytes | text | +|------|-------|------| +| `$F786` | `$81player$81$00` | player | +| `$F79B` | `$81shot$81$00` | shot | +| `$F7F4` | `$81player$81$00` | player | +| `$F809` | `$81game$81over$81$00` | game over | +| `$F826` | `$81player$81$00` | player | +| `$F83B` | ``$81hi`score__$00`` | hi`score__ | +| `$F858` | `$81perfect_$00` | perfect_ | + +**Earlier revisions of this document claimed a `jmp ($7961)` RAM-pointer dispatch at +`$F788`/`$F7F6`/`$F828`. That was a flat-tracer phantom.** The bytes after `jsr $CBDC` +are the strings above; the decoder happened to start an instruction two bytes into +`player`, reading `$6C $61 $79` as `jmp ($7961)` — the operand is the middle of the word +"player". Nothing in the ROM ever writes `$7961`/`$7962`, and `$6000–$7FFF` is unmapped +on NROM, so such a jump could not work. The three sites are gone from the classification; +no instruction in the corrected file is an indirect `jmp`. + +The genuine computed dispatch that remains is small and resolved. `$CBE5` re-reads its +string pointer through `ptr_lo`/`ptr_hi` and re-enters its loop with it — plain code. +`$F193` does the reverse: it pushes `Zp17`/`Zp16` and `rts`es, so a caller sets that pair +and the `rts` transfers control to it; the pattern is named in `locals.inc` and every +target is inside CDL-covered code. + +### Code the CDL proved but Pass 1 missed (largest runs) + +| Range | Bytes | What it is | +|-------|------:|-----------| +| `$EA00–$EBAF` | 432 | VS-COMP / select-screen logic (`$EB16` is still unreached and stays data) | +| `$EBF3–$ED4E` | 348 | menu/round state machine | +| `$CE35–$CF9A` | 358 | collision/entity maths | +| `$D4FA–$E01D` | 2,852 | `$D4FA` 30-entry pointer table (`$D4FA–$D535`), the 35-byte code helper at `$D536–$D558`, then variable-length records from `$D559` | +| `$F897–$F98F` | 249 | high-score / attract handling | +| `$C0F2–$C18C` | 155 | object update chain (branches back to `$C0E6`) | +| `$D325–$D391`, `$D2A0–$D2D3`, `$D1BB–$D209` | 240 | further record/table walkers | + +### Tracer fixes required during Pass 1 + +Three undocumented opcodes were missing from `_tools/nesdis.py` and were added, with the +`--undocumented` switch (default off, so existing `make regen` pipelines stay byte-stable): + +* `$72` — `RRA abs` (the `RRA` family had `$63`/`$67`/`$6F`/`$73`/`$77`/`$7B`/`$7F` but not `$72`). +* `$42` — `NOP #imm` (the family had `$80`/`$82`/`$89`/`$C2`/`$E2` but not `$42`). +* `$FA` — `NOP abs,X` (the family had `$1C`/`$3C`/`$5C`/`$7C`/`$DC`/`$FC` but not `$FA`). + +One emitter fix: ca65 silently rewrites an operand whose high byte is `$00` into the +shorter zero-page form (`sta $00FF,x` becomes `sta $FF,x`, emitting `$95` instead of +`$9D`). `render()` now emits the `a:` prefix for ABS/ABSX/ABSY/IND operands with a high +byte of `$00`, forcing the absolute form so the bytes match the ROM. `operand_value()` +strips the prefix when parsing. + +## Known remaining gaps + +* The static tracer reported two overlaps (`$C3BB` — resolved with `--data 0xC3BB:1` — + and `$F0EF`) and three rejected mis-aligned stubs. The residue that remains is the + CDL's: 5,343 bytes (32.6%) are still emitted as data (`.byte`, plus the six vector + bytes as `.word`). +* Unreached in the CDL session, therefore still unclassified: the hi-score entry screen + (`$F81A`+ / `$F84C`+ are inferred by symmetry, above), the 2-player-only branches, and + `$EB16` (a poll loop behind `beq` at `$EB11`, emitted as a raw `beq *+$05`). +* `locals.inc` carries 104 aliases: **38 semantic** (see the Pass 3 notes at the foot of + the file) and 66 neutral `ZpXX`. Ten further aliases were deleted by the + reclassification: they were phantoms — `$49`/`$84`/`$8A`/`$AA`/`$C0` came from the + mis-decoded `$C0C0` table, and `$3B`/`$65`/`$67`/`$72`/`$81` were ASCII characters of + the inline strings read as operands. + +## `copilot/` Contents + +| File | Purpose | +|------|---------| +| `Lunar Pool (U).nes` | original ROM image (reference) | +| `prg.bin` / `header.bin` / `chr.bin` | split image, produced by `_tools/splitnes.py` | +| `prg.s` | disassembly: 5,285 instructions with per-instruction address/byte audit comments, unclassified bytes kept as `.byte`/`.word` | +| `symbols.inc` | shared NES hardware constants (PPU/APU/controller, from the skeleton) | +| `locals.inc` | project-local zero-page aliases — 38 semantic, 66 neutral `ZpXX`; Pass 3 evidence notes at the foot of the file | +| `linker.cfg` | PRG at $C000, 16 KB, `fill = yes` | +| `Makefile` | links `reconstructed_prg.bin` and `cmp`s it against `prg.bin` | +| `reconstructed_prg.bin` | build output from the last verified build | + +Header/CHR are reproduced verbatim from `header.bin`/`chr.bin` (not linked): `make` +verifies **PRG bytes only** at this stage, which is exactly what a skeleton proves. When +this project is promoted to a full disassembly, `header.s` / `chr.s` (as e.g. +`Burger Time (U)`) and a full-ROM `make` target get added. + +## Build + +```bash +cd "_wip/Lunar Pool (U)/copilot" +make # → cmp reconstructed_prg.bin prg.bin → "BYTE-IDENTICAL" +``` + +## Next Steps (per `PROMPTS.md`) + +1. **Pass 1** — complete. The split is CDL-verified; the remaining `.byte` runs are either + data (string/table/record bytes) or CDL-unreached code (above). +2. **Pass 2** — partial: the hardware constants and the zero-page aliases are named. The + remaining Pass 2 work is routine-label renaming — all 640 entries are address-derived + `Label_`, and `git log -S SubC` shows this was never done for this project. +3. **Pass 3** — in progress. Zero-page audit complete (38 semantic + 66 neutral), and the + `$FFFA–$FFFF` vectors are now `.word NmiHandler, Reset, IrqHandler`. + Remaining: name the data tables and structures — the `$D4FA` 30-entry pointer table and + the variable-length records at `$D559+`, the `$C0C0` entry-point table, the + `$C47A–$CA20` block. +4. **Promotion** — move to a top-level `/copilot/` folder, add a full-ROM build + (header.s + chr.s + vectors), and write the power-on flow `OVERVIEW.md` in the + established style; then it joins the root index's numbered inventory. diff --git a/Lunar Pool (U)/copilot/Makefile b/Lunar Pool (U)/copilot/Makefile new file mode 100644 index 0000000..58607b1 --- /dev/null +++ b/Lunar Pool (U)/copilot/Makefile @@ -0,0 +1,25 @@ +CA65 ?= ca65 +LD65 ?= ld65 + +all: reconstructed.nes verify + +prg.o: prg.s symbols.inc locals.inc + $(CA65) -g -o $@ $< + +header.o: header.s header.bin + $(CA65) -g -o $@ $< + +chr.o: chr.s chr.bin + $(CA65) -g -o $@ $< + +reconstructed.nes: header.o prg.o chr.o linker.cfg + $(LD65) -C linker.cfg -m reconstructed.map -Ln reconstructed.lbl -o $@ header.o prg.o chr.o + +verify: reconstructed.nes rom.nes + cmp reconstructed.nes rom.nes + @echo "Byte-identical ROM verified." + +clean: + rm -f *.o reconstructed.nes reconstructed.map reconstructed.lbl + +.PHONY: all verify clean diff --git a/_wip/Lunar Pool (U)/copilot/chr.bin b/Lunar Pool (U)/copilot/chr.bin similarity index 100% rename from _wip/Lunar Pool (U)/copilot/chr.bin rename to Lunar Pool (U)/copilot/chr.bin diff --git a/Lunar Pool (U)/copilot/chr.s b/Lunar Pool (U)/copilot/chr.s new file mode 100644 index 0000000..a5c5801 --- /dev/null +++ b/Lunar Pool (U)/copilot/chr.s @@ -0,0 +1,2 @@ +.segment "CHR" + .incbin "chr.bin" diff --git a/_wip/Lunar Pool (U)/copilot/header.bin b/Lunar Pool (U)/copilot/header.bin similarity index 100% rename from _wip/Lunar Pool (U)/copilot/header.bin rename to Lunar Pool (U)/copilot/header.bin diff --git a/Lunar Pool (U)/copilot/header.s b/Lunar Pool (U)/copilot/header.s new file mode 100644 index 0000000..6091055 --- /dev/null +++ b/Lunar Pool (U)/copilot/header.s @@ -0,0 +1,2 @@ +.segment "HEADER" + .incbin "header.bin" diff --git a/Lunar Pool (U)/copilot/linker.cfg b/Lunar Pool (U)/copilot/linker.cfg new file mode 100644 index 0000000..cd279fa --- /dev/null +++ b/Lunar Pool (U)/copilot/linker.cfg @@ -0,0 +1,10 @@ +MEMORY { + HEADER: start = $0000, size = $0010, file = %O, fill = yes; + PRG: start = $C000, size = $4000, file = %O, fill = yes; + CHR: start = $0000, size = $2000, file = %O, fill = yes; +} +SEGMENTS { + HEADER: load = HEADER, type = ro; + PRG: load = PRG, type = ro; + CHR: load = CHR, type = ro; +} diff --git a/Lunar Pool (U)/copilot/locals.inc b/Lunar Pool (U)/copilot/locals.inc new file mode 100644 index 0000000..b54e51e --- /dev/null +++ b/Lunar Pool (U)/copilot/locals.inc @@ -0,0 +1,209 @@ +; Lunar Pool (U) application-specific RAM aliases +; Generated from every direct zero-page operand in reachable code. +; ref counts are reads+writes; `used at` lists up to four distinct CPU addresses. +; A reference is an operand-position mention in the disassembled instruction stream, +; including the "-- " comment of a .byte line that stands in for an +; undocumented opcode. sta/stx/sty write; inc/dec/asl/lsr/rol/ror and the +; undocumented read-modify-write set slo/rla/sre/rra/dcp/isc read and write; +; everything else reads. The counts were refreshed after the Pass 3 +; reclassification below, so they describe the current prg.s, not the Pass 1 trace. +; ZpXX names indicate storage with a role not yet unique enough for a behavioral name. +; Pass 2 named the entries whose role was already unambiguous. +; Pass 3 re-traced every remaining ZpXX and named the ones whose behaviour is provable +; from the instruction contexts that touch them; the rest stay neutral on purpose. +; See the Pass 3 notes at the bottom of this file for the evidence and the residue. + +timer_lo = $00 ; 28 refs; reads=16 writes=12; used at $CB45, CB49, CB52, CB61, +21 more +timer_hi = $01 ; 32 refs; reads=17 writes=15; used at $CA79, CB4D, CB50, CB66, +26 more +Zp02 = $02 ; 6 refs; reads=4 writes=2; used at $E295, E844, EAFA, EB0D, +1 more +Zp03 = $03 ; 8 refs; reads=4 writes=4; used at $E8E6, E9FB, EE48, EE4A, +1 more +Zp04 = $04 ; 3 refs; reads=2 writes=1; used at $F68F, F725 +Zp05 = $05 ; 12 refs; reads=6 writes=6; used at $E8EB, EE3C, F211, F2AF, +5 more +Zp06 = $06 ; 3 refs; reads=1 writes=2; used at $EE32, F2E5 +Zp07 = $07 ; 22 refs; reads=16 writes=6; used at $EE55, EE57, EEC7, EF04, +16 more +Zp08 = $08 ; 7 refs; reads=5 writes=2; used at $F032, F236, F287, F2BC, +2 more +Zp09 = $09 ; 3 refs; reads=1 writes=2; used at $CFC4, D2BC, D2E7 +Zp0C = $0C ; 4 refs; reads=2 writes=2; used at $E29A, E300, E309 +Zp0D = $0D ; 7 refs; reads=4 writes=3; used at $E240, E302, E314, E8F0, +1 more +Zp0E = $0E ; 5 refs; reads=3 writes=2; used at $E245, E31A, EBFD, F5EE +Zp0F = $0F ; 1 refs; reads=0 writes=1; used at $E8A1 +Zp10 = $10 ; 3 refs; reads=1 writes=2; used at $E3FF, E655, FBC8 +Zp11 = $11 ; 4 refs; reads=2 writes=2; used at $E405, E659, E6F8, FBCA +Zp12 = $12 ; 4 refs; reads=3 writes=1; used at $E666, F2A0, FBCC, FC8E +Zp13 = $13 ; 6 refs; reads=5 writes=1; used at $E66A, E6FC, E70F, F2A4, +2 more +Zp15 = $15 ; 2 refs; reads=1 writes=1; used at $F5F0 +Zp16 = $16 ; 4 refs; reads=2 writes=2; used at $F080, F14E, F196, F29D +Zp17 = $17 ; 4 refs; reads=2 writes=2; used at $F084, F152, F193, F2A2 +Zp18 = $18 ; 4 refs; reads=2 writes=2; used at $E698, E6CA, FC79, FCB3 +Zp19 = $19 ; 4 refs; reads=2 writes=2; used at $E696, E6ED, FC7B, FCB7 +Zp1A = $1A ; 2 refs; reads=1 writes=1; used at $FC99, FCCA +Zp1B = $1B ; 2 refs; reads=1 writes=1; used at $FC9B, FCCE +Zp1C = $1C ; 8 refs; reads=4 writes=4; used at $E61E, E662, EF5A, F1E2, +4 more +Zp1D = $1D ; 8 refs; reads=5 writes=3; used at $EF62, EF8A, EFDF, F1E7, +4 more +Zp1E = $1E ; 9 refs; reads=5 writes=4; used at $E625, E673, EF6C, F1EC, +5 more +Zp1F = $1F ; 9 refs; reads=6 writes=3; used at $EF74, EF84, EFD9, F1F1, +5 more +Zp20 = $20 ; 5 refs; reads=4 writes=1; used at $FBAD, FBEC, FC3A, FC7D, +1 more +Zp21 = $21 ; 5 refs; reads=4 writes=1; used at $FBA8, FBF0, FC3E, FC81, +1 more +Zp22 = $22 ; 5 refs; reads=4 writes=1; used at $FBBE, FC18, FC51, FC9D, +1 more +Zp23 = $23 ; 5 refs; reads=4 writes=1; used at $FBB9, FC1C, FC55, FCA1, +1 more +Zp24 = $24 ; 26 refs; reads=10 writes=16; used at $E3D6, E3EF, E6AB, E6BC, +20 more +Zp25 = $25 ; 23 refs; reads=11 writes=12; used at $E3D4, E3F5, E6A9, E6C1, +18 more +Zp26 = $26 ; 20 refs; reads=11 writes=9; used at $E3C4, E443, E51A, E59F, +15 more +Zp27 = $27 ; 5 refs; reads=1 writes=4; used at $E3DD, E448, E51F, E5A4, +1 more +Zp28 = $28 ; 8 refs; reads=6 writes=2; used at $E3CE, E67A, E68E, E694, +4 more +Zp29 = $29 ; 5 refs; reads=3 writes=2; used at $E3E7, E683, E6AD, F268, +1 more +Zp2A = $2A ; 5 refs; reads=2 writes=3; used at $E31F, E34D, E373, E3BB, +1 more +Zp2B = $2B ; 4 refs; reads=2 writes=2; used at $E360, E53E, E55D, E57D +Zp2C = $2C ; 9 refs; reads=2 writes=7; used at $E3C1, E43E, E50E, E515, +4 more +Zp2D = $2D ; 9 refs; reads=2 writes=7; used at $E3DA, E43B, E502, E509, +4 more +Zp2E = $2E ; 10 refs; reads=5 writes=5; used at $E487, E4B2, E4D5, E4DE, +6 more +Zp2F = $2F ; 6 refs; reads=2 writes=4; used at $E485, E4BB, E4FB, E529, +2 more +Zp30 = $30 ; 4 refs; reads=2 writes=2; used at $E39D, E555, E55B, E57B +Zp31 = $31 ; 8 refs; reads=4 writes=4; used at $E384, E527, E540, E550, +4 more +Zp32 = $32 ; 23 refs; reads=17 writes=6; used at $E413, E417, E457, E46C, +16 more +Zp33 = $33 ; 17 refs; reads=12 writes=5; used at $E415, E41B, E429, E455, +10 more +Zp34 = $34 ; 17 refs; reads=11 writes=6; used at $E71F, E721, E74F, E763, +11 more +Zp35 = $35 ; 14 refs; reads=7 writes=7; used at $E4E0, E4E4, E55F, E56A, +6 more +Zp36 = $36 ; 2 refs; reads=1 writes=1; used at $E5F8, E617 +Zp37 = $37 ; 5 refs; reads=2 writes=3; used at $EBC1, F321, F41B, F41D +Zp5F = $5F ; 6 refs; reads=3 writes=3; used at $C3C0, E85D, E8A6, F2EF, +1 more +spawn_queue = $60 ; 4 refs; reads=2 writes=2; used at $C00E, C019, C3E0, C3E6 +Zp61 = $61 ; 2 refs; reads=1 writes=1; used at $F521 +game_flag = $68 ; 3 refs; reads=1 writes=2; used at $C003, C3F7, CE37 +obj_script_lo = $69 ; 17 refs; reads=13 writes=4; used at $C085, C096, C0BD, C0E9, +12 more +obj_script_hi = $6A ; 6 refs; reads=2 writes=4; used at $C08A, C0EB, C1E7, C401, +1 more +obj_ptr_lo = $6B ; 35 refs; reads=20 writes=15; used at $C0F8, C13D, C141, C146, +30 more +obj_ptr_hi = $6C ; 12 refs; reads=4 writes=8; used at $C199, C1AD, C209, C217, +7 more +obj_index = $6D ; 17 refs; reads=14 writes=3; used at $C00C, C015, C02C, C02E, +12 more +Zp6E = $6E ; 5 refs; reads=2 writes=3; used at $C231, C283, C39F, C404, +1 more +Zp6F = $6F ; 19 refs; reads=9 writes=10; used at $C024, C150, C156, C15E, +14 more +Zp70 = $70 ; 1 refs; reads=1 writes=0; used at $C072 +Zp74 = $74 ; 2 refs; reads=1 writes=1; used at $EBF1 +Zp7F = $7F ; 2 refs; reads=0 writes=2; used at $E832, FA93 +; --- palette shadow $0080-$009F ------------------------------------------------ +; The 32 bytes FlushPaletteToPpu writes to PPU $3F00-$3F1F at the end of every NMI. +; $0080-$008F are the four background palettes and $0090-$009F the four sprite +; palettes; Reset_LoadSpritePalettes fills the sprite half from the ROM table at +; $ED3F. The ZpXX entries below are the individual slots that reachable code +; touches directly (the title colour cycle writes $85-$87, the aiming display +; writes $8B/$8F/$92). +palette_shadow = $80 +sprite_palette_shadow = $90 +Zp85 = $85 ; 1 refs; reads=0 writes=1; used at $E9A0 +Zp86 = $86 ; 1 refs; reads=0 writes=1; used at $E995 +Zp87 = $87 ; 1 refs; reads=0 writes=1; used at $E98A +Zp89 = $89 ; 1 refs; reads=0 writes=1; used at $E963 +Zp8B = $8B ; 1 refs; reads=0 writes=1; used at $EDE2 +Zp8F = $8F ; 2 refs; reads=0 writes=2; used at $E84B, EDDD +Zp92 = $92 ; 2 refs; reads=0 writes=2; used at $EABF, EDD8 +vram_buf = $A0 ; 1 refs; reads=0 writes=1; used at $CC50 +ZpA5 = $A5 ; 1 refs; reads=1 writes=0; used at $F0CF +vram_slot_len = $D0 ; 5 refs; reads=3 writes=2; used at $CC05, CC36, CC4B, CC7F +vram_slot_ofs = $D1 ; 2 refs; reads=0 writes=2; used at $CC19, CC47 +vram_slot_addr_lo = $D2 ; 1 refs; reads=0 writes=1; used at $CC3C +vram_slot_addr_hi = $D3 ; 1 refs; reads=0 writes=1; used at $CC40 +vram_read_len = $E8 ; 4 refs; reads=2 writes=2; used at $CCC5, CCE2, F7BA, F7BC +vram_read_addr_lo = $E9 ; 4 refs; reads=3 writes=1; used at $CCCF, F7AB, F7C2, F7D0 +vram_read_addr_hi = $EA ; 4 refs; reads=3 writes=1; used at $CCCA, F7A9, F7C0, F7CE +vram_read_dst_lo = $EB ; 2 refs; reads=0 writes=2; used at $CCDC, F7B6 +vram_read_dst_hi = $EC ; 1 refs; reads=0 writes=1; used at $F7B2 +vram_slot_idx = $ED ; 3 refs; reads=1 writes=2; used at $CC12, CC34, CC8A +vram_queue_len = $EE ; 9 refs; reads=6 writes=3; used at $CBFD, CC17, CC2E, CC45, +4 more +vram_update_checksum = $EF ; 5 refs; reads=3 writes=2; used at $CAB4, CAB6, CDBB, CDC9, +1 more +ppu_ctrl_shadow = $F0 ; 14 refs; reads=9 writes=5; used at $CA38, CA3F, CA48, CA4C, +8 more +ppu_mask_shadow = $F1 ; 7 refs; reads=4 writes=3; used at $CA24, CA2B, CA2E, CA32, +3 more +nt_base_hi = $F2 ; 6 refs; reads=3 writes=3; used at $CA68, CA7F, CA88, CB19, +2 more +nt_base_lo = $F3 ; 5 refs; reads=2 writes=3; used at $CA6C, CA83, CA8C, CD4B, +1 more +ppu_addr_save_lo = $F4 ; 2 refs; reads=1 writes=1; used at $CC20, CC3A +ppu_addr_save_hi = $F5 ; 2 refs; reads=1 writes=1; used at $CC24, CC3E +ppu_addr_temp_lo = $F6 ; 68 refs; reads=35 writes=33; used at $CAFB, CAFD, CB01, CB05, +52 more +ppu_addr_temp_hi = $F7 ; 42 refs; reads=20 writes=22; used at $CAF9, CAFF, CB03, CB07, +29 more +ppu_src_lo = $F8 ; 55 refs; reads=28 writes=27; used at $CE4E, CE7A, CEB4, CEE7, +46 more +ppu_src_hi = $F9 ; 41 refs; reads=20 writes=21; used at $CE4C, CE7E, CEB8, CEE5, +36 more +ptr_lo = $FA ; 68 refs; reads=24 writes=44; used at $CB71, CB87, CB95, CB9B, +61 more +ptr_hi = $FB ; 67 refs; reads=25 writes=42; used at $CB9D, CBA3, CBCD, CBD5, +58 more +ppu_addr_lo = $FC ; 153 refs; reads=63 writes=90; used at $CAA8, CB97, CB99, CBAB, +129 more +ppu_addr_hi = $FD ; 111 refs; reads=45 writes=66; used at $CAA3, CB9F, CBA1, CBA9, +94 more +ppu_addr_src_lo = $FE ; 40 refs; reads=23 writes=17; used at $CDD8, CE19, CE83, CECB, +36 more +ppu_addr_src_hi = $FF ; 22 refs; reads=9 writes=13; used at $CDD6, CE14, CE86, CEC8, +18 more + +; ================================================================================= +; Pass 3 notes - zero-page audit (rebuild re-verified byte-identical after the pass) +; +; Named in Pass 3 (20 entries; the proof is the instruction context on each line): +; +; Object core ($C000-$C4FF) +; obj_index $6D current object slot 0..4; indexes the $0500/$0514/$056E +; per-object arrays and is saved/restored around jsr $C404. +; obj_script_lo $69 per-object behaviour-script pointer. Copied from the +; obj_script_hi $6A $0528/$052D pointer tables, read with (..),y to fetch the +; next script byte, advanced by $C3FC/$C401, saved per object +; in $0546/$054B. +; spawn_queue $60 8-slot FIFO of entity-type spawn requests: filled by $C3DA +; (`lda #imm / jsr $C3DA`), drained by the $C00C loop which +; hands each entry to $C404 and clears the slot. +; +; VRAM write queue ($CBFD-$CC91) +; vram_buf $A0 staging buffer base; queued bytes land in vram_buf,x where +; x is the running queue length. +; vram_queue_len $EE bytes currently staged, 0..$30. $CC49 increments it per +; byte, $CC7B/$CCC3 reset it, and the guards at $CBFD/$CC2E +; spin while it equals $30 (buffer full). +; vram_slot_idx $ED descriptor slot being filled (stride 4), set at $CC12/$CC8A. +; vram_slot_len $D0 per-slot byte count ) +; vram_slot_ofs $D1 buffer offset for the slot ) four-byte descriptor at $D0+slot, +; vram_slot_addr_lo $D2 VRAM destination low ) consumed by the drain at $CC91 +; vram_slot_addr_hi $D3 VRAM destination high ) (PPUADDR hi then lo, then copy). +; +; VRAM read-back ($CCBA-$CCE5, $F7A7) +; vram_read_len $E8 transfer length; nonzero while a read is pending, and the +; busy flag the callers spin on at $F7BC. +; vram_read_addr_lo $E9 PPU source address, written to PPUADDR second (low byte). +; vram_read_addr_hi $EA PPU source address, written to PPUADDR first (high byte). +; vram_read_dst_lo $EB destination pointer for the copied bytes ($0420 in $F7A7). +; vram_read_dst_hi $EC +; +; PPU helpers +; nt_base_hi $F2 screen/nametable base address, $2000 or $2440 depending on +; nt_base_lo $F3 the select tested at $CA77; added to row offsets at +; $CB19/$CD4B and used to fetch tiles at $CD94/$CD9D/$CDAC. +; ppu_addr_save_lo $F4 running PPU write address, captured from ppu_addr_lo/hi when +; ppu_addr_save_hi $F5 a slot opens ($CC20/$CC24) and copied into the descriptor at +; $CC3A/$CC3E; advanced by the $CB61 counter. +; +; Left neutral on purpose - role not provable from static context: +; * $10-$37, $61, $7F, $A5 (the $E3xx-$E98x +; and $EFxx-$FBxx engines): scratch operands of the collision/scoring/entity maths. +; They are written and consumed inside single routines and reused across routines, +; so any behavioural name would be a guess. Examples: $2C/$2D hold a computed pair +; only between $E3C1 and $E43B; $16/$17 serves as a push/rts jump vector at $F193 yet +; is compared as a 16-bit value at $F29D. +; * $02-$0F, $5F, $6E, $6F, $70, $74, $09: layout/name-table bytes and further +; single-routine temporaries with no repeating, self-describing pattern. +; +; Named in Pass 3 by the table audit: $85-$8F and $92 are not general scratch. They +; are slots of the $0080-$009F palette shadow that FlushPaletteToPpu sends to $3F00-$3F1F +; every NMI - $85/$86/$87 come from the title colour cycle, $8B/$8F/$92 from the three +; aiming-display colour sequences at $F762/$F76A/$F772. See palette_shadow above. +; +; Removed by the Pass 3 reclassification (the aliases are gone from the list above). +; These ten addresses had NO real reference: every one of them was produced by the +; flat tracer decoding data as code, and the bytes it "operated on" are the characters +; of the inline text strings and the values of the lookup tables. +; * $49, $84, $8A, $AA, $C0: the 16-bit pointer table at $C0C0-$C0E5, decoded as a +; `cmp (ZpXX,x)` chain. $C0C0-$C0E5 is now .byte and $C0E6 resumes as `tax`. +; * $3B, $65, $67, $72: ASCII ";" "e" "g" "r" read as operands inside the $F7xx and +; $EBxx text/table data ($F85C ror Zp65, $F85A adc Zp72, ...). +; * $81: the string delimiter $81 of "$81player$81$00", read as `sta (Zp81,x)`. +; +; Existing Pass 1/2 names this audit found imprecise. Not renamed again (to avoid +; churn), recorded here instead: +; * timer_lo/timer_hi ($00/$01): not a 16-bit counter pair in practice. The counter +; routines at $CB39-$CB61 are generic - their stubs pick the target with X = +; $F8/$FA/$FC/$FE, so index 0 is never a target. $00 is a frame/sub-phase counter +; tested with and #$01/#$04/#$08/#$10; $01 is a status/flag byte (and #$7F/#$90/#$F7, +; ora #$08/#$20/#$30). +; * ppu_addr_temp_lo/hi ($F6/$F7): a general 16-bit accumulator used by the +; $FD8B-$FDE6 shift/add multiply and many address builders, not a PPU address. +; * obj_ptr_lo/hi ($6B/$6C): a scratch 16-bit pointer (also used at $C22F/$C3DA), not +; exclusively an object pointer. diff --git a/_wip/Lunar Pool (U)/copilot/prg.bin b/Lunar Pool (U)/copilot/prg.bin similarity index 100% rename from _wip/Lunar Pool (U)/copilot/prg.bin rename to Lunar Pool (U)/copilot/prg.bin diff --git a/_wip/Lunar Pool (U)/copilot/prg.s b/Lunar Pool (U)/copilot/prg.s similarity index 70% rename from _wip/Lunar Pool (U)/copilot/prg.s rename to Lunar Pool (U)/copilot/prg.s index 0237187..f4f032f 100644 --- a/_wip/Lunar Pool (U)/copilot/prg.s +++ b/Lunar Pool (U)/copilot/prg.s @@ -9,15 +9,35 @@ ; PRG mapped at $C000-$FFFF (NROM, mirrored to the upper half) ; ; Pass 1 trace provenance (the audit trail behind every classification below): -; 48 further routine entries recovered from table references elsewhere in the image: -; $C0C0, $CA6F, $CA77, $CA8F, $CAAE, $CB69, $CB7F, $CB92, $CBC9, $CBDC, $D00D, $D20A, $D222, $D392, $D3D3, $D48F, $D4AF, $D4E4, $E24F, $E286, $E2FE, $E370, $E3BF, $E3FB, $E405, $E6D0, $E6D9, $E802, $F0CE, $F125, $F149, $F19A, $F7A5, $FB4C, $FB69, $FB90, $FBA5, $FD8B, $FDA8, $FDD8, $FDFE, $FE37, $FE4A, $FE5A, $FEA8, $FEFE, $FF11, $FF18 +; 45 further routine entries recovered from table references elsewhere in the image: +; $CA6F, $CA77, $CA8F, $CAAE, $CB69, $CB7F, $CB92, $CBC9, $CBDC, $D00D, $D20A, $D222, $D392, $D3D3, $D48F, $D4AF, $D4E4, $E24F, $E286, $E2FE, $E370, $E3BF, $E3FB, $E405, $E6D0, $E6D9, $E802, $F0CE, $F125, $F149, $F19A, $FB4C, $FB69, $FB90, $FBA5, $FD8B, $FDA8, $FDD8, $FDFE, $FE37, $FE4A, $FE5A, $FEA8, $FF11, $FF18 +; Three entries in the original 48-entry list were wrong and are now data: +; $C0C0 is a 16-bit pointer table (code resumes at $C0E6), not a routine; +; $F7A5 is the operand of the jmp $F7CB at $F7A4; $FEFE is an angle/step table. ; entries seeded by hand after inspecting code-shaped but unreferenced blocks: ; $E80C ; $C3BB-$C3BB forced back to data: the only path into it is a branch that is always taken -; indirect dispatch through zero page (not followed statically): -; jmp ($7961) at $F788 -; jmp ($7961) at $F7F6 -; jmp ($7961) at $F828 +; +; Reclassified against a Mesen Code Data Logger capture of a played session +; (title -> 1P -> game over -> VS COMP): 10,028 PRG bytes were fetched as opcodes and +; 1,534 were read as data. The reclassification sets the file to exactly that +; classification wherever the CDL has an opinion, and leaves the rest alone: +; instructions: 10,028 CDL-Code + 1,013 never-observed = 11,041 +; .byte : 1,534 CDL-Data + 3,809 never-observed = 5,343 +; 1,738 bytes the flat tracer had emitted as .byte are executed code and are now +; instructions; 100 bytes it had emitted as instructions are read as data and are +; now .byte. No byte disagrees with the CDL in either direction. All 1,183 +; jsr/jmp and branch targets land on instruction boundaries. +; The flat tracer's three "jmp ($7961)" gates at $F788/$F7F6/$F828 were +; phantoms: $CBDC/$CBC9 is an inline-string printer (pop the return address, emit +; until a $00, resume at the byte after it), so the bytes that follow it are the +; strings "$81player$81$00", "$81shot$81$00", "$81game$81over$81$00" etc. +; $6C $61 $79 spells "lay" -- an indirect JMP whose operand is inside the word +; "player". Nothing in the ROM writes $7961/$7962, and $6000-$7FFF is unmapped +; on NROM. +; $F81A (hi-score) and $F84C ("perfect") were never reached, so they are not +; CDL-confirmed; their inline-string structure is inferred from the confirmed +; $F77A/$F7E8 twins and is marked as inference in OVERVIEW.md. ; .setcpu "6502" @@ -27,34 +47,38 @@ .segment "PRG" ; ---- data $C000-$C002 (3 bytes) ---- +; Unreachable three-byte stub: `jmp Reset`. Nothing in the ROM jumps to $C000 - the reset vector at $FFFC already points straight at Reset and no call targets this address - so it survives only as a leftover of the original code layout. +ResetStub: .byte $4C, $0C, $E8 ; CPU:$C000 PRG:0000 4C 0C E8 ; ----------------------------------------------------------------------------- -; Routine: Label_C003 -; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. -; Local: Continues its parent routine along the condition or operation encoded in this label, -; then returns, branches again, or rejoins shared code as documented by the instructions. -; Parameters: Undetermined in Pass 1 unless implied by the caller. -; Returns: Undetermined in Pass 1; status flags and registers may carry results. -; Clobbers: Undetermined in Pass 1. +; Routine: RunObjectFrame +; Global: Whole per-object frame: drains the spawn queue, clears the object working +; RAM, runs the 5 object slots, then flushes the shadowed sound registers. +; Local: Called once per frame from NmiHandler ($FF87). Bails out immediately when +; game_flag bit 1 is set (the pause/freeze flag tested by the caller). +; Parameters: None. Every working value comes from RAM. +; Returns: Nothing. +; Clobbers: A, X, Y, Zp60-$6F, $0500-$0572, $05E0-$05F0, $4000-$4015. ; ----------------------------------------------------------------------------- -Label_C003: - lda Zp68 ; CPU:$C003 PRG:0003 A5 68 +RunObjectFrame: + lda game_flag ; CPU:$C003 PRG:0003 A5 68 and #$02 ; CPU:$C005 PRG:0005 29 02 - beq Label_C00A ; CPU:$C007 PRG:0007 F0 01 + beq DrainSpawnQueue ; CPU:$C007 PRG:0007 F0 01 rts ; CPU:$C009 PRG:0009 60 ; ----------------------------------------------------------------------------- -; Routine: Label_C00A -; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. -; Local: Continues its parent routine along the condition or operation encoded in this label, -; then returns, branches again, or rejoins shared code as documented by the instructions. -; Parameters: Undetermined in Pass 1 unless implied by the caller. -; Returns: Undetermined in Pass 1; status flags and registers may carry results. -; Clobbers: Undetermined in Pass 1. +; Routine: DrainSpawnQueue +; Global: Hands every pending entry of the 8-slot spawn queue to SpawnObject and +; clears the slot afterwards. +; Local: Reached only by fall-through from RunObjectFrame. This label is the loop's +; entry; DrainSpawnQueue_Loop is the head the backward branch returns to. +; Parameters: None. +; Returns: Nothing. +; Clobbers: A, X; spawn_queue ($60-$67). ; ----------------------------------------------------------------------------- -Label_C00A: +DrainSpawnQueue: ldx #$00 ; CPU:$C00A PRG:000A A2 00 ; ----------------------------------------------------------------------------- -; Routine: Label_C00C +; Routine: DrainSpawnQueue_Loop ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -62,16 +86,16 @@ Label_C00A: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_C00C: - stx Zp6D ; CPU:$C00C PRG:000C 86 6D - lda Zp60,x ; CPU:$C00E PRG:000E B5 60 - beq Label_C01B ; CPU:$C010 PRG:0010 F0 09 +DrainSpawnQueue_Loop: + stx obj_index ; CPU:$C00C PRG:000C 86 6D + lda spawn_queue,x ; CPU:$C00E PRG:000E B5 60 + beq DrainSpawnQueue_Next ; CPU:$C010 PRG:0010 F0 09 jsr $C404 ; CPU:$C012 PRG:0012 20 04 C4 - ldx Zp6D ; CPU:$C015 PRG:0015 A6 6D + ldx obj_index ; CPU:$C015 PRG:0015 A6 6D lda #$00 ; CPU:$C017 PRG:0017 A9 00 - sta Zp60,x ; CPU:$C019 PRG:0019 95 60 + sta spawn_queue,x ; CPU:$C019 PRG:0019 95 60 ; ----------------------------------------------------------------------------- -; Routine: Label_C01B +; Routine: DrainSpawnQueue_Next ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -79,14 +103,14 @@ Label_C00C: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_C01B: +DrainSpawnQueue_Next: inx ; CPU:$C01B PRG:001B E8 cpx #$08 ; CPU:$C01C PRG:001C E0 08 - bne Label_C00C ; CPU:$C01E PRG:001E D0 EC + bne DrainSpawnQueue_Loop ; CPU:$C01E PRG:001E D0 EC ldx #$10 ; CPU:$C020 PRG:0020 A2 10 lda #$00 ; CPU:$C022 PRG:0022 A9 00 ; ----------------------------------------------------------------------------- -; Routine: Label_C024 +; Routine: ClearObjectWork_Loop ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -94,53 +118,62 @@ Label_C01B: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_C024: +ClearObjectWork_Loop: sta Zp6F,x ; CPU:$C024 PRG:0024 95 6F dex ; CPU:$C026 PRG:0026 CA - bne Label_C024 ; CPU:$C027 PRG:0027 D0 FB + bne ClearObjectWork_Loop ; CPU:$C027 PRG:0027 D0 FB sta $05F0 ; CPU:$C029 PRG:0029 8D F0 05 - sta Zp6D ; CPU:$C02C PRG:002C 85 6D + sta obj_index ; CPU:$C02C PRG:002C 85 6D ; ----------------------------------------------------------------------------- -; Routine: Label_C02E -; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. -; Local: Continues its parent routine along the condition or operation encoded in this label, -; then returns, branches again, or rejoins shared code as documented by the instructions. -; Parameters: Undetermined in Pass 1 unless implied by the caller. -; Returns: Undetermined in Pass 1; status flags and registers may carry results. -; Clobbers: Undetermined in Pass 1. +; Routine: UpdateObjects +; Global: Advances one object slot: ticks the state timer, re-enters the state when the +; timer expires, then renders and updates the object's sound. +; Local: Also the backward jump target of its own slot loop. +; Parameters: None. +; Returns: Nothing. +; Clobbers: A, X, Y; the per-object arrays at $0500-$0572. ; ----------------------------------------------------------------------------- -Label_C02E: - ldx Zp6D ; CPU:$C02E PRG:002E A6 6D +UpdateObjects: + ldx obj_index ; CPU:$C02E PRG:002E A6 6D lda $0500,x ; CPU:$C030 PRG:0030 BD 00 05 - beq Label_C05F ; CPU:$C033 PRG:0033 F0 2A + beq UpdateObjects_Next ; CPU:$C033 PRG:0033 F0 2A tay ; CPU:$C035 PRG:0035 A8 inc $0541,x ; CPU:$C036 PRG:0036 FE 41 05 lda $0541,x ; CPU:$C039 PRG:0039 BD 41 05 cmp $051E,x ; CPU:$C03C PRG:003C DD 1E 05 - bne Label_C054 ; CPU:$C03F PRG:003F D0 13 + bne UpdateObjects_Render ; CPU:$C03F PRG:003F D0 13 lda #$00 ; CPU:$C041 PRG:0041 A9 00 sta $0541,x ; CPU:$C043 PRG:0043 9D 41 05 inc $0532,x ; CPU:$C046 PRG:0046 FE 32 05 lda $0532,x ; CPU:$C049 PRG:0049 BD 32 05 cmp $0537,x ; CPU:$C04C PRG:004C DD 37 05 - bne Label_C054 ; CPU:$C04F PRG:004F D0 03 + bne UpdateObjects_Render ; CPU:$C04F PRG:004F D0 03 jsr $C082 ; CPU:$C051 PRG:0051 20 82 C0 ; ----------------------------------------------------------------------------- -; Routine: Label_C054 -; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. -; Local: Continues its parent routine along the condition or operation encoded in this label, -; then returns, branches again, or rejoins shared code as documented by the instructions. -; Parameters: Undetermined in Pass 1 unless implied by the caller. -; Returns: Undetermined in Pass 1; status flags and registers may carry results. -; Clobbers: Undetermined in Pass 1. +; Routine: UpdateObjects_Render +; Global: Per-object work for an object whose $0500 flag is set. +; Local: Builds the sprite, advances the animation frame, and refreshes the sound. +; Parameters: obj_index = the slot being processed. +; Returns: Nothing. +; Clobbers: A, X, Y. ; ----------------------------------------------------------------------------- -Label_C054: +UpdateObjects_Render: jsr $C22F ; CPU:$C054 PRG:0054 20 2F C2 - ldx Zp6D ; CPU:$C057 PRG:0057 A6 6D + ldx obj_index ; CPU:$C057 PRG:0057 A6 6D jsr $C2BB ; CPU:$C059 PRG:0059 20 BB C2 +; ----------------------------------------------------------------------------- +; Routine: UpdateObjects_Render_Sound +; Global: The tail of the per-object render step - updates the object sound and moves on. +; Local: ObjOp82_StopScript pops the script interpreter frame and jumps here so that a +; stopped object still gets its sound registers refreshed but no new sprite. +; Parameters: X = obj_index. +; Returns: Falls through into UpdateObjects_Next. +; Clobbers: Per UpdateObjectSound. +; ----------------------------------------------------------------------------- +UpdateObjects_Render_Sound: jsr $C314 ; CPU:$C05C PRG:005C 20 14 C3 ; ----------------------------------------------------------------------------- -; Routine: Label_C05F +; Routine: UpdateObjects_Next ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -148,27 +181,28 @@ Label_C054: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_C05F: - inc Zp6D ; CPU:$C05F PRG:005F E6 6D - lda Zp6D ; CPU:$C061 PRG:0061 A5 6D +UpdateObjects_Next: + inc obj_index ; CPU:$C05F PRG:005F E6 6D + lda obj_index ; CPU:$C061 PRG:0061 A5 6D cmp #$05 ; CPU:$C063 PRG:0063 C9 05 - beq Label_C06A ; CPU:$C065 PRG:0065 F0 03 + beq FlushSoundRegisters ; CPU:$C065 PRG:0065 F0 03 jmp $C02E ; CPU:$C067 PRG:0067 4C 2E C0 ; ----------------------------------------------------------------------------- -; Routine: Label_C06A -; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. -; Local: Continues its parent routine along the condition or operation encoded in this label, -; then returns, branches again, or rejoins shared code as documented by the instructions. -; Parameters: Undetermined in Pass 1 unless implied by the caller. -; Returns: Undetermined in Pass 1; status flags and registers may carry results. -; Clobbers: Undetermined in Pass 1. +; Routine: FlushSoundRegisters +; Global: Copies the object sound shadows into the real APU registers - APUSTATUS +; from $05F0 and $4000-$400F from $05E0-$05EF. +; Local: Runs once per frame at the end of RunObjectFrame, for the whole 16-byte +; register window regardless of which slots are live. +; Parameters: None. +; Returns: Nothing. +; Clobbers: A, X; $4015, $4000-$400F. ; ----------------------------------------------------------------------------- -Label_C06A: +FlushSoundRegisters: lda $05F0 ; CPU:$C06A PRG:006A AD F0 05 - sta $4015 ; CPU:$C06D PRG:006D 8D 15 40 + sta APUSTATUS ; CPU:$C06D PRG:006D 8D 15 40 ldx #$00 ; CPU:$C070 PRG:0070 A2 00 ; ----------------------------------------------------------------------------- -; Routine: Label_C072 +; Routine: FlushSoundRegisters_Loop ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -176,13 +210,13 @@ Label_C06A: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_C072: +FlushSoundRegisters_Loop: lda Zp70,x ; CPU:$C072 PRG:0072 B5 70 - beq Label_C07C ; CPU:$C074 PRG:0074 F0 06 + beq FlushSoundRegisters_Next ; CPU:$C074 PRG:0074 F0 06 lda $05E0,x ; CPU:$C076 PRG:0076 BD E0 05 - sta $4000,x ; CPU:$C079 PRG:0079 9D 00 40 + sta APUPULSE1CTRL,x ; CPU:$C079 PRG:0079 9D 00 40 ; ----------------------------------------------------------------------------- -; Routine: Label_C07C +; Routine: FlushSoundRegisters_Next ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -190,48 +224,60 @@ Label_C072: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_C07C: +FlushSoundRegisters_Next: inx ; CPU:$C07C PRG:007C E8 cpx #$10 ; CPU:$C07D PRG:007D E0 10 - bne Label_C072 ; CPU:$C07F PRG:007F D0 F1 + bne FlushSoundRegisters_Loop ; CPU:$C07F PRG:007F D0 F1 rts ; CPU:$C081 PRG:0081 60 ; ----------------------------------------------------------------------------- -; Routine: Label_C082 -; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. -; Local: Continues its parent routine along the condition or operation encoded in this label, -; then returns, branches again, or rejoins shared code as documented by the instructions. -; Parameters: Undetermined in Pass 1 unless implied by the caller. -; Returns: Undetermined in Pass 1; status flags and registers may carry results. -; Clobbers: Undetermined in Pass 1. +; Routine: ResumeObjectScript +; Global: Restores an object's saved script pointer and re-enters the dispatcher. +; Local: Called when the per-object sub-timer expires ($C051); loads the pointer saved +; in $0528/$052D and jumps to DispatchObjectScript. +; Parameters: obj_index = the slot to reload. +; Returns: Never returns to the caller. +; Clobbers: A; obj_script_lo/hi. ; ----------------------------------------------------------------------------- -Label_C082: +ResumeObjectScript: lda $0528,x ; CPU:$C082 PRG:0082 BD 28 05 - sta Zp69 ; CPU:$C085 PRG:0085 85 69 + sta obj_script_lo ; CPU:$C085 PRG:0085 85 69 lda $052D,x ; CPU:$C087 PRG:0087 BD 2D 05 - sta Zp6A ; CPU:$C08A PRG:008A 85 6A + sta obj_script_hi ; CPU:$C08A PRG:008A 85 6A jmp $C092 ; CPU:$C08C PRG:008C 4C 92 C0 -; ---- data $C08F-$C091 (3 bytes) ---- - .byte $20, $FC, $C3 ; CPU:$C08F PRG:008F 20 FC C3 ; ----------------------------------------------------------------------------- -; Routine: Label_C092 -; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. -; Local: Continues its parent routine along the condition or operation encoded in this label, -; then returns, branches again, or rejoins shared code as documented by the instructions. -; Parameters: Undetermined in Pass 1 unless implied by the caller. -; Returns: Undetermined in Pass 1; status flags and registers may carry results. -; Clobbers: Undetermined in Pass 1. +; Routine: NextScriptOpcode +; Global: Advances the object script pointer by one and re-enters the dispatcher. +; Local: The shared tail of every opcode handler that consumes no operand byte - the +; handlers jump here (jmp $C08F) instead of duplicating the advance. +; Parameters: obj_script_lo/hi = the pointer to advance. +; Returns: Never returns to the caller; execution continues at DispatchObjectScript. +; Clobbers: obj_script_lo/hi, A. ; ----------------------------------------------------------------------------- -Label_C092: - ldx Zp6D ; CPU:$C092 PRG:0092 A6 6D +NextScriptOpcode: + jsr $C3FC ; CPU:$C08F PRG:008F 20 FC C3 +; ----------------------------------------------------------------------------- +; Routine: DispatchObjectScript +; Global: Fetches the next behaviour byte and dispatches on it - this is the object +; virtual machine's fetch/execute step. +; Local: Opcodes $00-$7F are a raw state number (ObjOp_LowOpcode), $80-$DE index the +; handler table at $C0C0 (SetStateFromOpcode), $DF-$FF enter SetStateFromOpcode. +; The handler table holds handler-1 pointers because the rts that enters them +; increments the popped address. +; Parameters: obj_index = the slot to execute. +; Returns: Never returns to the caller; handlers re-enter here or leave through $C05C. +; Clobbers: A, X, Y, obj_script_lo/hi. +; ----------------------------------------------------------------------------- +DispatchObjectScript: + ldx obj_index ; CPU:$C092 PRG:0092 A6 6D ldy #$00 ; CPU:$C094 PRG:0094 A0 00 - lda (Zp69),y ; CPU:$C096 PRG:0096 B1 69 + lda (obj_script_lo),y ; CPU:$C096 PRG:0096 B1 69 tay ; CPU:$C098 PRG:0098 A8 and #$80 ; CPU:$C099 PRG:0099 29 80 - bne Label_C0A1 ; CPU:$C09B PRG:009B D0 04 + bne DispatchObjectScript_High ; CPU:$C09B PRG:009B D0 04 tya ; CPU:$C09D PRG:009D 98 jmp $C1A2 ; CPU:$C09E PRG:009E 4C A2 C1 ; ----------------------------------------------------------------------------- -; Routine: Label_C0A1 +; Routine: DispatchObjectScript_High ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -239,13 +285,13 @@ Label_C092: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_C0A1: +DispatchObjectScript_High: tya ; CPU:$C0A1 PRG:00A1 98 cmp #$DF ; CPU:$C0A2 PRG:00A2 C9 DF - bcc Label_C0A9 ; CPU:$C0A4 PRG:00A4 90 03 + bcc DispatchObjectScript_Table ; CPU:$C0A4 PRG:00A4 90 03 jmp $C18D ; CPU:$C0A6 PRG:00A6 4C 8D C1 ; ----------------------------------------------------------------------------- -; Routine: Label_C0A9 +; Routine: DispatchObjectScript_Table ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -253,9 +299,9 @@ Label_C0A1: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_C0A9: +DispatchObjectScript_Table: jsr $C3FC ; CPU:$C0A9 PRG:00A9 20 FC C3 - ldx Zp6D ; CPU:$C0AC PRG:00AC A6 6D + ldx obj_index ; CPU:$C0AC PRG:00AC A6 6D tya ; CPU:$C0AE PRG:00AE 98 and #$7F ; CPU:$C0AF PRG:00AF 29 7F asl a ; CPU:$C0B1 PRG:00B1 0A @@ -265,10 +311,16 @@ Label_C0A9: lda $C0C0,y ; CPU:$C0B7 PRG:00B7 B9 C0 C0 pha ; CPU:$C0BA PRG:00BA 48 ldy #$00 ; CPU:$C0BB PRG:00BB A0 00 - lda (Zp69),y ; CPU:$C0BD PRG:00BD B1 69 + lda (obj_script_lo),y ; CPU:$C0BD PRG:00BD B1 69 rts ; CPU:$C0BF PRG:00BF 60 +; ---- data $C0C0-$C0E5 (38 bytes) ---- +; Nineteen sixteen-bit object-script handler addresses, stored as handler minus one because the dispatching rts adds the one back. Selected by (opcode & $7F) * 2 in DispatchObjectScript_Table, so the table covers opcodes $80-$92. +ObjectOpcodeHandlerTable: + .byte $E5, $C0, $F1, $C0, $08, $C1, $12, $C1, $1E, $C1, $1E, $C1, $6E, $C1, $18, $C1 ; CPU:$C0C0 PRG:00C0 E5 C0 F1 C0 08 C1 12 C1 1E C1 1E C1 6E C1 18 C1 + .byte $1E, $C1, $49, $C1, $84, $C1, $1E, $C1, $2A, $C1, $49, $C1, $74, $C1, $8A, $C1 ; CPU:$C0D0 PRG:00D0 1E C1 49 C1 84 C1 1E C1 2A C1 49 C1 74 C1 8A C1 + .byte $8A, $C1, $8A, $C1, $8A, $C1 ; CPU:$C0E0 PRG:00E0 8A C1 8A C1 8A C1 ; ----------------------------------------------------------------------------- -; Routine: Label_C0C0 +; Routine: ObjOp80_SetScriptPtr ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -276,45 +328,68 @@ Label_C0A9: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_C0C0: - sbc ZpC0 ; CPU:$C0C0 PRG:00C0 E5 C0 - sbc (ZpC0),y ; CPU:$C0C2 PRG:00C2 F1 C0 - php ; CPU:$C0C4 PRG:00C4 08 - cmp (Zp12,x) ; CPU:$C0C5 PRG:00C5 C1 12 - cmp (Zp1E,x) ; CPU:$C0C7 PRG:00C7 C1 1E - cmp (Zp1E,x) ; CPU:$C0C9 PRG:00C9 C1 1E - cmp (Zp6E,x) ; CPU:$C0CB PRG:00CB C1 6E - cmp (Zp18,x) ; CPU:$C0CD PRG:00CD C1 18 - cmp (Zp1E,x) ; CPU:$C0CF PRG:00CF C1 1E - cmp (Zp49,x) ; CPU:$C0D1 PRG:00D1 C1 49 - cmp (Zp84,x) ; CPU:$C0D3 PRG:00D3 C1 84 - cmp (Zp1E,x) ; CPU:$C0D5 PRG:00D5 C1 1E - cmp (Zp2A,x) ; CPU:$C0D7 PRG:00D7 C1 2A - cmp (Zp49,x) ; CPU:$C0D9 PRG:00D9 C1 49 - cmp (Zp74,x) ; CPU:$C0DB PRG:00DB C1 74 - cmp (Zp8A,x) ; CPU:$C0DD PRG:00DD C1 8A - cmp (Zp8A,x) ; CPU:$C0DF PRG:00DF C1 8A - cmp (Zp8A,x) ; CPU:$C0E1 PRG:00E1 C1 8A - cmp (Zp8A,x) ; CPU:$C0E3 PRG:00E3 C1 8A - cmp (ZpAA,x) ; CPU:$C0E5 PRG:00E5 C1 AA +ObjOp80_SetScriptPtr: + tax ; CPU:$C0E6 PRG:00E6 AA ldy #$01 ; CPU:$C0E7 PRG:00E7 A0 01 - lda (Zp69),y ; CPU:$C0E9 PRG:00E9 B1 69 - sta Zp6A ; CPU:$C0EB PRG:00EB 85 6A - stx Zp69 ; CPU:$C0ED PRG:00ED 86 69 + lda (obj_script_lo),y ; CPU:$C0E9 PRG:00E9 B1 69 + sta obj_script_hi ; CPU:$C0EB PRG:00EB 85 6A + stx obj_script_lo ; CPU:$C0ED PRG:00ED 86 69 jmp $C092 ; CPU:$C0EF PRG:00EF 4C 92 C0 -; ---- data $C0F2-$C18C (155 bytes) ---- - .byte $20, $3D, $C1, $20, $FC, $C3, $A6, $6B, $A0, $00, $B1, $69, $DE, $00, $05, $D0 ; CPU:$C0F2 PRG:00F2 20 3D C1 20 FC C3 A6 6B A0 00 B1 69 DE 00 05 D0 - .byte $E3, $20, $FC, $C3, $4C, $8F, $C0, $A9, $00, $9D, $00, $05, $68, $68, $4C, $5C ; CPU:$C102 PRG:0102 E3 20 FC C3 4C 8F C0 A9 00 9D 00 05 68 68 4C 5C - .byte $C0, $9D, $14, $05, $4C, $8F, $C0, $9D, $0F, $05, $4C, $8F, $C0, $F0, $04, $18 ; CPU:$C112 PRG:0112 C0 9D 14 05 4C 8F C0 9D 0F 05 4C 8F C0 F0 04 18 - .byte $7D, $19, $05, $9D, $19, $05, $4C, $8F, $C0, $20, $3D, $C1, $98, $AA, $A0, $01 ; CPU:$C122 PRG:0122 7D 19 05 9D 19 05 4C 8F C0 20 3D C1 98 AA A0 01 - .byte $B1, $69, $9D, $00, $05, $20, $FC, $C3, $4C, $8F, $C0, $85, $6B, $0A, $18, $65 ; CPU:$C132 PRG:0132 B1 69 9D 00 05 20 FC C3 4C 8F C0 85 6B 0A 18 65 - .byte $6B, $0A, $65, $6D, $85, $6B, $A8, $60, $A8, $BD, $0A, $05, $29, $0F, $85, $6F ; CPU:$C142 PRG:0142 6B 0A 65 6D 85 6B A8 60 A8 BD 0A 05 29 0F 85 6F - .byte $98, $18, $10, $08, $65, $6F, $B0, $0C, $A9, $00, $F0, $08, $65, $6F, $C9, $10 ; CPU:$C152 PRG:0152 98 18 10 08 65 6F B0 0C A9 00 F0 08 65 6F C9 10 - .byte $90, $02, $A9, $0F, $85, $6F, $BD, $0A, $05, $29, $F0, $05, $6F, $9D, $0A, $05 ; CPU:$C162 PRG:0162 90 02 A9 0F 85 6F BD 0A 05 29 F0 05 6F 9D 0A 05 - .byte $4C, $8F, $C0, $A5, $69, $18, $69, $02, $85, $69, $A9, $00, $65, $6A, $85, $6A ; CPU:$C172 PRG:0172 4C 8F C0 A5 69 18 69 02 85 69 A9 00 65 6A 85 6A - .byte $4C, $8F, $C0, $20, $DA, $C3, $4C, $8F, $C0, $A5, $69 ; CPU:$C182 PRG:0182 4C 8F C0 20 DA C3 4C 8F C0 A5 69 ; ----------------------------------------------------------------------------- -; Routine: Label_C18D +; Routine: ObjOp81_Loop +; Global: Opcode $81: repeats the preceding script-pointer jump while a counter lasts. +; Local: The record index comes from ComputeRecordIndex and the counter lives in its +; $0500 field; a nonzero counter re-enters ObjOp80_SetScriptPtr. +; Parameters: A = the operand byte, obj_index = the executing slot. +; Returns: Never returns to the caller. +; Clobbers: A, X, Y, obj_ptr_lo/hi, obj_script_lo/hi. +; ----------------------------------------------------------------------------- +ObjOp81_Loop: + jsr $C13D ; CPU:$C0F2 PRG:00F2 20 3D C1 + jsr $C3FC ; CPU:$C0F5 PRG:00F5 20 FC C3 + ldx obj_ptr_lo ; CPU:$C0F8 PRG:00F8 A6 6B + ldy #$00 ; CPU:$C0FA PRG:00FA A0 00 + lda (obj_script_lo),y ; CPU:$C0FC PRG:00FC B1 69 + dec $0500,x ; CPU:$C0FE PRG:00FE DE 00 05 + bne ObjOp80_SetScriptPtr ; CPU:$C101 PRG:0101 D0 E3 + jsr $C3FC ; CPU:$C103 PRG:0103 20 FC C3 + jmp $C08F ; CPU:$C106 PRG:0106 4C 8F C0 +; ----------------------------------------------------------------------------- +; Routine: ObjOp82_StopScript +; Global: Opcode $82: ends the object script. +; Local: Clears the loop counter, discards the two interpreter frame bytes and rejoins +; UpdateObjects_Render just after its jsr. +; Parameters: obj_index = the executing slot. +; Returns: Never returns to the caller; UpdateObjects_Render continues. +; Clobbers: A; the stack. +; ----------------------------------------------------------------------------- +ObjOp82_StopScript: + lda #$00 ; CPU:$C109 PRG:0109 A9 00 + sta $0500,x ; CPU:$C10B PRG:010B 9D 00 05 + pla ; CPU:$C10E PRG:010E 68 + pla ; CPU:$C10F PRG:010F 68 + jmp $C05C ; CPU:$C110 PRG:0110 4C 5C C0 +ObjOp83_SetSoundParam: + sta $0514,x ; CPU:$C113 PRG:0113 9D 14 05 + jmp $C08F ; CPU:$C116 PRG:0116 4C 8F C0 +ObjOp87_SetAnimSelector: + sta $050F,x ; CPU:$C119 PRG:0119 9D 0F 05 + jmp $C08F ; CPU:$C11C PRG:011C 4C 8F C0 +; ----------------------------------------------------------------------------- +; Routine: ObjOp_AddSpeed +; Global: Opcodes $84/$85/$88/$8B: add the operand to the object speed in $0519. +; Local: A zero operand takes the branch to ObjOp84_StoreSpeed and clears the speed +; instead of adding to it. +; Parameters: A = the operand byte, obj_index = the executing slot. +; Returns: Never returns to the caller. +; Clobbers: A, flags; $0519. +; ----------------------------------------------------------------------------- +ObjOp_AddSpeed: + beq ObjOp84_StoreSpeed ; CPU:$C11F PRG:011F F0 04 + clc ; CPU:$C121 PRG:0121 18 + adc $0519,x ; CPU:$C122 PRG:0122 7D 19 05 +; ----------------------------------------------------------------------------- +; Routine: ObjOp84_StoreSpeed ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -322,58 +397,182 @@ Label_C0C0: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_C18D: +ObjOp84_StoreSpeed: + sta $0519,x ; CPU:$C125 PRG:0125 9D 19 05 + jmp $C08F ; CPU:$C128 PRG:0128 4C 8F C0 +; ----------------------------------------------------------------------------- +; Routine: ObjOp8C_SetRecordByte +; Global: Opcode $8C: stores the object script operand into a per-object record field. +; Local: The record index is ComputeRecordIndex(operand) - a six-byte stride - and the +; stored value is the script byte after the opcode. +; Parameters: A = the operand byte, obj_index = the executing slot. +; Returns: Never returns to the caller. +; Clobbers: A, X, Y, obj_ptr_lo, obj_script_lo/hi. +; ----------------------------------------------------------------------------- +ObjOp8C_SetRecordByte: + jsr $C13D ; CPU:$C12B PRG:012B 20 3D C1 + tya ; CPU:$C12E PRG:012E 98 + tax ; CPU:$C12F PRG:012F AA + ldy #$01 ; CPU:$C130 PRG:0130 A0 01 + lda (obj_script_lo),y ; CPU:$C132 PRG:0132 B1 69 + sta $0500,x ; CPU:$C134 PRG:0134 9D 00 05 + jsr $C3FC ; CPU:$C137 PRG:0137 20 FC C3 + jmp $C08F ; CPU:$C13A PRG:013A 4C 8F C0 +; ----------------------------------------------------------------------------- +; Routine: ComputeRecordIndex +; Global: Converts an object record number into an index into the per-slot record arrays. +; Local: result = number * 6 + obj_index, i.e. a six-byte record stride per object slot; +; callers reach a field with (obj_ptr_lo),y on top of the returned Y. +; Parameters: A = record number. +; Returns: Y = record index; A = number * 6. +; Clobbers: A, Y. +; ----------------------------------------------------------------------------- +ComputeRecordIndex: + sta obj_ptr_lo ; CPU:$C13D PRG:013D 85 6B + asl a ; CPU:$C13F PRG:013F 0A + clc ; CPU:$C140 PRG:0140 18 + adc obj_ptr_lo ; CPU:$C141 PRG:0141 65 6B + asl a ; CPU:$C143 PRG:0143 0A + adc obj_index ; CPU:$C144 PRG:0144 65 6D + sta obj_ptr_lo ; CPU:$C146 PRG:0146 85 6B + tay ; CPU:$C148 PRG:0148 A8 + rts ; CPU:$C149 PRG:0149 60 +; ----------------------------------------------------------------------------- +; Routine: ObjOp89_SetFlagsNibble +; Global: Opcodes $89/$8D: set the low nibble of the object flag byte $050A. +; Local: The existing high nibble is preserved; the sum is clamped to $00-$0F. +; Parameters: A = the operand byte, obj_index = the executing slot. +; Returns: Never returns to the caller. +; Clobbers: A, X, Y, Zp6F; $050A. +; ----------------------------------------------------------------------------- +ObjOp89_SetFlagsNibble: + tay ; CPU:$C14A PRG:014A A8 + lda $050A,x ; CPU:$C14B PRG:014B BD 0A 05 + and #$0F ; CPU:$C14E PRG:014E 29 0F + sta Zp6F ; CPU:$C150 PRG:0150 85 6F + tya ; CPU:$C152 PRG:0152 98 + clc ; CPU:$C153 PRG:0153 18 + bpl ObjOp89_ClampNibble ; CPU:$C154 PRG:0154 10 08 + adc Zp6F ; CPU:$C156 PRG:0156 65 6F + bcs ObjOp89_StoreNibble ; CPU:$C158 PRG:0158 B0 0C + lda #$00 ; CPU:$C15A PRG:015A A9 00 + beq ObjOp89_StoreNibble ; CPU:$C15C PRG:015C F0 08 +; ----------------------------------------------------------------------------- +; Routine: ObjOp89_ClampNibble +; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. +; Local: Continues its parent routine along the condition or operation encoded in this label, +; then returns, branches again, or rejoins shared code as documented by the instructions. +; Parameters: Undetermined in Pass 1 unless implied by the caller. +; Returns: Undetermined in Pass 1; status flags and registers may carry results. +; Clobbers: Undetermined in Pass 1. +; ----------------------------------------------------------------------------- +ObjOp89_ClampNibble: + adc Zp6F ; CPU:$C15E PRG:015E 65 6F + cmp #$10 ; CPU:$C160 PRG:0160 C9 10 + bcc ObjOp89_StoreNibble ; CPU:$C162 PRG:0162 90 02 + lda #$0F ; CPU:$C164 PRG:0164 A9 0F +; ----------------------------------------------------------------------------- +; Routine: ObjOp89_StoreNibble +; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. +; Local: Continues its parent routine along the condition or operation encoded in this label, +; then returns, branches again, or rejoins shared code as documented by the instructions. +; Parameters: Undetermined in Pass 1 unless implied by the caller. +; Returns: Undetermined in Pass 1; status flags and registers may carry results. +; Clobbers: Undetermined in Pass 1. +; ----------------------------------------------------------------------------- +ObjOp89_StoreNibble: + sta Zp6F ; CPU:$C166 PRG:0166 85 6F + lda $050A,x ; CPU:$C168 PRG:0168 BD 0A 05 + and #$F0 ; CPU:$C16B PRG:016B 29 F0 + ora Zp6F ; CPU:$C16D PRG:016D 05 6F +; ----------------------------------------------------------------------------- +; Routine: ObjOp86_SetFlags +; Global: Opcode $86: store the object script operand whole into the flag byte $050A. +; Local: Enters in the middle of the ObjOp89_SetFlagsNibble tail, so only the final +; store is performed. +; Parameters: A = the operand byte, obj_index = the executing slot. +; Returns: Never returns to the caller. +; Clobbers: A; $050A. +; ----------------------------------------------------------------------------- +ObjOp86_SetFlags: + sta $050A,x ; CPU:$C16F PRG:016F 9D 0A 05 + jmp $C08F ; CPU:$C172 PRG:0172 4C 8F C0 +ObjOp8E_SkipTwoBytes: + lda obj_script_lo ; CPU:$C175 PRG:0175 A5 69 + clc ; CPU:$C177 PRG:0177 18 + adc #$02 ; CPU:$C178 PRG:0178 69 02 + sta obj_script_lo ; CPU:$C17A PRG:017A 85 69 + lda #$00 ; CPU:$C17C PRG:017C A9 00 + adc obj_script_hi ; CPU:$C17E PRG:017E 65 6A + sta obj_script_hi ; CPU:$C180 PRG:0180 85 6A + jmp $C08F ; CPU:$C182 PRG:0182 4C 8F C0 +ObjOp8A_SpawnFromScript: + jsr $C3DA ; CPU:$C185 PRG:0185 20 DA C3 + jmp $C08F ; CPU:$C188 PRG:0188 4C 8F C0 +ObjOp8F_StateFromScriptPtr: + lda obj_script_lo ; CPU:$C18B PRG:018B A5 69 +; ----------------------------------------------------------------------------- +; Routine: SetStateFromOpcode +; Global: Shared entry for opcodes $80 and up. +; Local: Saves the script pointer of the state being entered, then resolves the new +; state through SetObjectState_Resolve unless the opcode is the script-pointer +; form handled by ObjOp80_SetScriptPtr. +; Parameters: A = the opcode byte. +; Returns: Never returns to the caller. +; Clobbers: A, X; $0546/$054B. +; ----------------------------------------------------------------------------- +SetStateFromOpcode: pha ; CPU:$C18D PRG:018D 48 lda $053C,x ; CPU:$C18E PRG:018E BD 3C 05 jsr $C205 ; CPU:$C191 PRG:0191 20 05 C2 - lda Zp6B ; CPU:$C194 PRG:0194 A5 6B + lda obj_ptr_lo ; CPU:$C194 PRG:0194 A5 6B sta $0546,x ; CPU:$C196 PRG:0196 9D 46 05 - lda Zp6C ; CPU:$C199 PRG:0199 A5 6C + lda obj_ptr_hi ; CPU:$C199 PRG:0199 A5 6C sta $054B,x ; CPU:$C19B PRG:019B 9D 4B 05 pla ; CPU:$C19E PRG:019E 68 jmp $C1C0 ; CPU:$C19F PRG:019F 4C C0 C1 ; ----------------------------------------------------------------------------- -; Routine: Label_C1A2 -; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. -; Local: Continues its parent routine along the condition or operation encoded in this label, -; then returns, branches again, or rejoins shared code as documented by the instructions. -; Parameters: Undetermined in Pass 1 unless implied by the caller. -; Returns: Undetermined in Pass 1; status flags and registers may carry results. -; Clobbers: Undetermined in Pass 1. +; Routine: ObjOp_LowOpcode +; Global: Opcodes $00-$7F: the opcode byte itself is the object's new state number. +; Local: Stores it in $053C, saves the current script pointer, then commits the state +; through EnterObjectState. +; Parameters: A = the opcode byte, obj_index = the slot. +; Returns: Never returns to the caller. +; Clobbers: A, Y; $053C, $0546/$054B. ; ----------------------------------------------------------------------------- -Label_C1A2: +ObjOp_LowOpcode: sta $053C,x ; CPU:$C1A2 PRG:01A2 9D 3C 05 jsr $C200 ; CPU:$C1A5 PRG:01A5 20 00 C2 - lda Zp6B ; CPU:$C1A8 PRG:01A8 A5 6B + lda obj_ptr_lo ; CPU:$C1A8 PRG:01A8 A5 6B sta $0546,x ; CPU:$C1AA PRG:01AA 9D 46 05 - lda Zp6C ; CPU:$C1AD PRG:01AD A5 6C + lda obj_ptr_hi ; CPU:$C1AD PRG:01AD A5 6C sta $054B,x ; CPU:$C1AF PRG:01AF 9D 4B 05 ldy #$00 ; CPU:$C1B2 PRG:01B2 A0 00 - lda (Zp69),y ; CPU:$C1B4 PRG:01B4 B1 69 + lda (obj_script_lo),y ; CPU:$C1B4 PRG:01B4 B1 69 cmp #$DF ; CPU:$C1B6 PRG:01B6 C9 DF - bcs Label_C1C0 ; CPU:$C1B8 PRG:01B8 B0 06 + bcs SetObjectState_Resolve ; CPU:$C1B8 PRG:01B8 B0 06 lda $0569,x ; CPU:$C1BA PRG:01BA BD 69 05 jmp $C1DA ; CPU:$C1BD PRG:01BD 4C DA C1 ; ----------------------------------------------------------------------------- -; Routine: Label_C1C0 -; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. -; Local: Continues its parent routine along the condition or operation encoded in this label, -; then returns, branches again, or rejoins shared code as documented by the instructions. -; Parameters: Undetermined in Pass 1 unless implied by the caller. -; Returns: Undetermined in Pass 1; status flags and registers may carry results. -; Clobbers: Undetermined in Pass 1. +; Routine: SetObjectState_Resolve +; Global: Converts the opcode tail into a state number: $DF takes the next script byte +; literally, anything above indexes the state table at $C543. +; Local: Shared tail of both opcode halves. +; Parameters: A = the opcode byte. +; Returns: Falls into SetObjectState_Store. +; Clobbers: A, Y. ; ----------------------------------------------------------------------------- -Label_C1C0: +SetObjectState_Resolve: sec ; CPU:$C1C0 PRG:01C0 38 sbc #$DF ; CPU:$C1C1 PRG:01C1 E9 DF - bne Label_C1D1 ; CPU:$C1C3 PRG:01C3 D0 0C + bne SetObjectState_Table ; CPU:$C1C3 PRG:01C3 D0 0C jsr $C3FC ; CPU:$C1C5 PRG:01C5 20 FC C3 ldy #$00 ; CPU:$C1C8 PRG:01C8 A0 00 - lda (Zp69),y ; CPU:$C1CA PRG:01CA B1 69 - ldx Zp6D ; CPU:$C1CC PRG:01CC A6 6D + lda (obj_script_lo),y ; CPU:$C1CA PRG:01CA B1 69 + ldx obj_index ; CPU:$C1CC PRG:01CC A6 6D jmp $C1D5 ; CPU:$C1CE PRG:01CE 4C D5 C1 ; ----------------------------------------------------------------------------- -; Routine: Label_C1D1 +; Routine: SetObjectState_Table ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -381,11 +580,11 @@ Label_C1C0: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_C1D1: +SetObjectState_Table: tay ; CPU:$C1D1 PRG:01D1 A8 lda $C543,y ; CPU:$C1D2 PRG:01D2 B9 43 C5 ; ----------------------------------------------------------------------------- -; Routine: Label_C1D5 +; Routine: SetObjectState_Store ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -393,26 +592,26 @@ Label_C1D1: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_C1D5: +SetObjectState_Store: pha ; CPU:$C1D5 PRG:01D5 48 jsr $C3FC ; CPU:$C1D6 PRG:01D6 20 FC C3 pla ; CPU:$C1D9 PRG:01D9 68 ; ----------------------------------------------------------------------------- -; Routine: Label_C1DA -; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. -; Local: Continues its parent routine along the condition or operation encoded in this label, -; then returns, branches again, or rejoins shared code as documented by the instructions. -; Parameters: Undetermined in Pass 1 unless implied by the caller. -; Returns: Undetermined in Pass 1; status flags and registers may carry results. -; Clobbers: Undetermined in Pass 1. +; Routine: EnterObjectState +; Global: Commits a new object state: stores the state number, snapshots the script +; pointer into $0528/$052D and clears the state's timers and counters. +; Local: Reached from both the low-opcode path and the state-table path. +; Parameters: A = the new state, obj_index = the slot. +; Returns: rts - the caller resumes the dispatcher. +; Clobbers: A, X; $0537, $0569, $0528/$052D, $0532, $055A, $0564, $0541, $055F. ; ----------------------------------------------------------------------------- -Label_C1DA: - ldx Zp6D ; CPU:$C1DA PRG:01DA A6 6D +EnterObjectState: + ldx obj_index ; CPU:$C1DA PRG:01DA A6 6D sta $0537,x ; CPU:$C1DC PRG:01DC 9D 37 05 sta $0569,x ; CPU:$C1DF PRG:01DF 9D 69 05 - lda Zp69 ; CPU:$C1E2 PRG:01E2 A5 69 + lda obj_script_lo ; CPU:$C1E2 PRG:01E2 A5 69 sta $0528,x ; CPU:$C1E4 PRG:01E4 9D 28 05 - lda Zp6A ; CPU:$C1E7 PRG:01E7 A5 6A + lda obj_script_hi ; CPU:$C1E7 PRG:01E7 A5 6A sta $052D,x ; CPU:$C1E9 PRG:01E9 9D 2D 05 lda #$00 ; CPU:$C1EC PRG:01EC A9 00 sta $0532,x ; CPU:$C1EE PRG:01EE 9D 32 05 @@ -423,34 +622,33 @@ Label_C1DA: sta $055F,x ; CPU:$C1FC PRG:01FC 9D 5F 05 rts ; CPU:$C1FF PRG:01FF 60 ; ----------------------------------------------------------------------------- -; Routine: Label_C200 -; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. -; Local: Continues its parent routine along the condition or operation encoded in this label, -; then returns, branches again, or rejoins shared code as documented by the instructions. -; Parameters: Undetermined in Pass 1 unless implied by the caller. -; Returns: Undetermined in Pass 1; status flags and registers may carry results. -; Clobbers: Undetermined in Pass 1. +; Routine: AdvanceScriptPtrKeepA +; Global: Advances the object script pointer one byte while preserving A. +; Local: Pushes A around AdvanceScriptPtr and falls into SetObjPtr. +; Parameters: A = the value to preserve. +; Returns: Falls into SetObjPtr. +; Clobbers: A (restored), obj_script_lo/hi. ; ----------------------------------------------------------------------------- -Label_C200: +AdvanceScriptPtrKeepA: pha ; CPU:$C200 PRG:0200 48 jsr $C3FC ; CPU:$C201 PRG:0201 20 FC C3 pla ; CPU:$C204 PRG:0204 68 ; ----------------------------------------------------------------------------- -; Routine: Label_C205 -; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. -; Local: Continues its parent routine along the condition or operation encoded in this label, -; then returns, branches again, or rejoins shared code as documented by the instructions. -; Parameters: Undetermined in Pass 1 unless implied by the caller. -; Returns: Undetermined in Pass 1; status flags and registers may carry results. -; Clobbers: Undetermined in Pass 1. +; Routine: SetObjPtr +; Global: Loads the scratch pointer obj_ptr from A, treating 0 as the null pointer. +; Local: Object type 3 uses a special encoding, every other type picks its record +; out of the state table at $C478. +; Parameters: A = the record index or 0. +; Returns: rts. +; Clobbers: A, Y; obj_ptr_lo/hi. ; ----------------------------------------------------------------------------- -Label_C205: - sta Zp6B ; CPU:$C205 PRG:0205 85 6B - bne Label_C20C ; CPU:$C207 PRG:0207 D0 03 - sta Zp6C ; CPU:$C209 PRG:0209 85 6C +SetObjPtr: + sta obj_ptr_lo ; CPU:$C205 PRG:0205 85 6B + bne SetObjPtr_NonZero ; CPU:$C207 PRG:0207 D0 03 + sta obj_ptr_hi ; CPU:$C209 PRG:0209 85 6C rts ; CPU:$C20B PRG:020B 60 ; ----------------------------------------------------------------------------- -; Routine: Label_C20C +; Routine: SetObjPtr_NonZero ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -458,17 +656,17 @@ Label_C205: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_C20C: - ldx Zp6D ; CPU:$C20C PRG:020C A6 6D +SetObjPtr_NonZero: + ldx obj_index ; CPU:$C20C PRG:020C A6 6D lda $0523,x ; CPU:$C20E PRG:020E BD 23 05 cmp #$03 ; CPU:$C211 PRG:0211 C9 03 - bne Label_C21C ; CPU:$C213 PRG:0213 D0 07 + bne SetObjPtr_FromStateTable ; CPU:$C213 PRG:0213 D0 07 lda #$01 ; CPU:$C215 PRG:0215 A9 01 - sta Zp6C ; CPU:$C217 PRG:0217 85 6C - dec Zp6B ; CPU:$C219 PRG:0219 C6 6B + sta obj_ptr_hi ; CPU:$C217 PRG:0217 85 6C + dec obj_ptr_lo ; CPU:$C219 PRG:0219 C6 6B rts ; CPU:$C21B PRG:021B 60 ; ----------------------------------------------------------------------------- -; Routine: Label_C21C +; Routine: SetObjPtr_FromStateTable ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -476,63 +674,64 @@ Label_C20C: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_C21C: - lda Zp6B ; CPU:$C21C PRG:021C A5 6B +SetObjPtr_FromStateTable: + lda obj_ptr_lo ; CPU:$C21C PRG:021C A5 6B clc ; CPU:$C21E PRG:021E 18 adc $0519,x ; CPU:$C21F PRG:021F 7D 19 05 asl a ; CPU:$C222 PRG:0222 0A tay ; CPU:$C223 PRG:0223 A8 lda $C478,y ; CPU:$C224 PRG:0224 B9 78 C4 - sta Zp6B ; CPU:$C227 PRG:0227 85 6B + sta obj_ptr_lo ; CPU:$C227 PRG:0227 85 6B lda $C479,y ; CPU:$C229 PRG:0229 B9 79 C4 - sta Zp6C ; CPU:$C22C PRG:022C 85 6C + sta obj_ptr_hi ; CPU:$C22C PRG:022C 85 6C rts ; CPU:$C22E PRG:022E 60 ; ----------------------------------------------------------------------------- -; Routine: Label_C22F -; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. -; Local: Continues its parent routine along the condition or operation encoded in this label, -; then returns, branches again, or rejoins shared code as documented by the instructions. -; Parameters: Undetermined in Pass 1 unless implied by the caller. -; Returns: Undetermined in Pass 1; status flags and registers may carry results. -; Clobbers: Undetermined in Pass 1. +; Routine: BuildObjectSprite +; Global: Builds the OAM entry for the object in the current slot and stages its sound +; parameters. +; Local: Objects without an animation selector take the short BuildObjectSprite_NoAnim +; path; the rest decode the compressed offset stream. +; Parameters: obj_index = the slot to draw. +; Returns: rts. +; Clobbers: A, X, Y, Zp6E, Zp6F; $056E. ; ----------------------------------------------------------------------------- -Label_C22F: +BuildObjectSprite: lda #$00 ; CPU:$C22F PRG:022F A9 00 sta Zp6E ; CPU:$C231 PRG:0231 85 6E - ldx Zp6D ; CPU:$C233 PRG:0233 A6 6D + ldx obj_index ; CPU:$C233 PRG:0233 A6 6D lda $0523,x ; CPU:$C235 PRG:0235 BD 23 05 cmp #$02 ; CPU:$C238 PRG:0238 C9 02 - beq Label_C286 ; CPU:$C23A PRG:023A F0 4A + beq BuildObjectSprite_NoAnim ; CPU:$C23A PRG:023A F0 4A lda $050A,x ; CPU:$C23C PRG:023C BD 0A 05 sta Zp6F ; CPU:$C23F PRG:023F 85 6F and #$10 ; CPU:$C241 PRG:0241 29 10 - beq Label_C286 ; CPU:$C243 PRG:0243 F0 41 + beq BuildObjectSprite_NoAnim ; CPU:$C243 PRG:0243 F0 41 lda $050F,x ; CPU:$C245 PRG:0245 BD 0F 05 - beq Label_C286 ; CPU:$C248 PRG:0248 F0 3C + beq BuildObjectSprite_NoAnim ; CPU:$C248 PRG:0248 F0 3C asl a ; CPU:$C24A PRG:024A 0A tay ; CPU:$C24B PRG:024B A8 lda $C559,y ; CPU:$C24C PRG:024C B9 59 C5 - sta Zp6B ; CPU:$C24F PRG:024F 85 6B + sta obj_ptr_lo ; CPU:$C24F PRG:024F 85 6B lda $C55A,y ; CPU:$C251 PRG:0251 B9 5A C5 - sta Zp6C ; CPU:$C254 PRG:0254 85 6C + sta obj_ptr_hi ; CPU:$C254 PRG:0254 85 6C ldy $055A,x ; CPU:$C256 PRG:0256 BC 5A 05 jsr $C28D ; CPU:$C259 PRG:0259 20 8D C2 iny ; CPU:$C25C PRG:025C C8 tya ; CPU:$C25D PRG:025D 98 sta $055A,x ; CPU:$C25E PRG:025E 9D 5A 05 - lda Zp6B ; CPU:$C261 PRG:0261 A5 6B + lda obj_ptr_lo ; CPU:$C261 PRG:0261 A5 6B eor #$FF ; CPU:$C263 PRG:0263 49 FF clc ; CPU:$C265 PRG:0265 18 adc #$10 ; CPU:$C266 PRG:0266 69 10 - sta Zp6B ; CPU:$C268 PRG:0268 85 6B + sta obj_ptr_lo ; CPU:$C268 PRG:0268 85 6B lda Zp6F ; CPU:$C26A PRG:026A A5 6F and #$0F ; CPU:$C26C PRG:026C 29 0F sec ; CPU:$C26E PRG:026E 38 - sbc Zp6B ; CPU:$C26F PRG:026F E5 6B - bcs Label_C275 ; CPU:$C271 PRG:0271 B0 02 + sbc obj_ptr_lo ; CPU:$C26F PRG:026F E5 6B + bcs BuildObjectSprite_ClampY ; CPU:$C271 PRG:0271 B0 02 lda #$00 ; CPU:$C273 PRG:0273 A9 00 ; ----------------------------------------------------------------------------- -; Routine: Label_C275 +; Routine: BuildObjectSprite_ClampY ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -540,7 +739,7 @@ Label_C22F: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_C275: +BuildObjectSprite_ClampY: sta Zp6F ; CPU:$C275 PRG:0275 85 6F lda $050A,x ; CPU:$C277 PRG:0277 BD 0A 05 and #$F0 ; CPU:$C27A PRG:027A 29 F0 @@ -550,7 +749,7 @@ Label_C275: sta Zp6E ; CPU:$C283 PRG:0283 85 6E rts ; CPU:$C285 PRG:0285 60 ; ----------------------------------------------------------------------------- -; Routine: Label_C286 +; Routine: BuildObjectSprite_NoAnim ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -558,26 +757,26 @@ Label_C275: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_C286: +BuildObjectSprite_NoAnim: lda $050A,x ; CPU:$C286 PRG:0286 BD 0A 05 sta $056E,x ; CPU:$C289 PRG:0289 9D 6E 05 rts ; CPU:$C28C PRG:028C 60 ; ----------------------------------------------------------------------------- -; Routine: Label_C28D -; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. -; Local: Continues its parent routine along the condition or operation encoded in this label, -; then returns, branches again, or rejoins shared code as documented by the instructions. -; Parameters: Undetermined in Pass 1 unless implied by the caller. -; Returns: Undetermined in Pass 1; status flags and registers may carry results. -; Clobbers: Undetermined in Pass 1. +; Routine: DecodeAnimOffset +; Global: Decodes one element of the object's compressed animation offset stream. +; Local: $80 repeats the previous value, $81 is a signed back-reference, $82 restarts +; at the head of the stream, anything smaller is a literal. +; Parameters: obj_ptr = the stream, Y = the read offset. +; Returns: A = the decoded value; A>=0x80 on the literal/table paths is passed through. +; Clobbers: A, Y. ; ----------------------------------------------------------------------------- -Label_C28D: - lda (Zp6B),y ; CPU:$C28D PRG:028D B1 6B - bmi Label_C294 ; CPU:$C28F PRG:028F 30 03 - sta Zp6B ; CPU:$C291 PRG:0291 85 6B +DecodeAnimOffset: + lda (obj_ptr_lo),y ; CPU:$C28D PRG:028D B1 6B + bmi DecodeAnimOffset_Back ; CPU:$C28F PRG:028F 30 03 + sta obj_ptr_lo ; CPU:$C291 PRG:0291 85 6B rts ; CPU:$C293 PRG:0293 60 ; ----------------------------------------------------------------------------- -; Routine: Label_C294 +; Routine: DecodeAnimOffset_Back ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -585,15 +784,15 @@ Label_C28D: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_C294: +DecodeAnimOffset_Back: cmp #$80 ; CPU:$C294 PRG:0294 C9 80 - bne Label_C29E ; CPU:$C296 PRG:0296 D0 06 + bne DecodeAnimOffset_Relative ; CPU:$C296 PRG:0296 D0 06 dey ; CPU:$C298 PRG:0298 88 - lda (Zp6B),y ; CPU:$C299 PRG:0299 B1 6B - sta Zp6B ; CPU:$C29B PRG:029B 85 6B + lda (obj_ptr_lo),y ; CPU:$C299 PRG:0299 B1 6B + sta obj_ptr_lo ; CPU:$C29B PRG:029B 85 6B rts ; CPU:$C29D PRG:029D 60 ; ----------------------------------------------------------------------------- -; Routine: Label_C29E +; Routine: DecodeAnimOffset_Relative ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -601,19 +800,19 @@ Label_C294: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_C29E: +DecodeAnimOffset_Relative: cmp #$81 ; CPU:$C29E PRG:029E C9 81 - bne Label_C2AD ; CPU:$C2A0 PRG:02A0 D0 0B + bne DecodeAnimOffset_Restart ; CPU:$C2A0 PRG:02A0 D0 0B tya ; CPU:$C2A2 PRG:02A2 98 iny ; CPU:$C2A3 PRG:02A3 C8 sec ; CPU:$C2A4 PRG:02A4 38 - sbc (Zp6B),y ; CPU:$C2A5 PRG:02A5 F1 6B + sbc (obj_ptr_lo),y ; CPU:$C2A5 PRG:02A5 F1 6B tay ; CPU:$C2A7 PRG:02A7 A8 - lda (Zp6B),y ; CPU:$C2A8 PRG:02A8 B1 6B - sta Zp6B ; CPU:$C2AA PRG:02AA 85 6B + lda (obj_ptr_lo),y ; CPU:$C2A8 PRG:02A8 B1 6B + sta obj_ptr_lo ; CPU:$C2AA PRG:02AA 85 6B rts ; CPU:$C2AC PRG:02AC 60 ; ----------------------------------------------------------------------------- -; Routine: Label_C2AD +; Routine: DecodeAnimOffset_Restart ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -621,15 +820,15 @@ Label_C29E: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_C2AD: +DecodeAnimOffset_Restart: cmp #$82 ; CPU:$C2AD PRG:02AD C9 82 - bne Label_C2B8 ; CPU:$C2AF PRG:02AF D0 07 + bne DecodeAnimOffset_Literal ; CPU:$C2AF PRG:02AF D0 07 ldy #$00 ; CPU:$C2B1 PRG:02B1 A0 00 - lda (Zp6B),y ; CPU:$C2B3 PRG:02B3 B1 6B - sta Zp6B ; CPU:$C2B5 PRG:02B5 85 6B + lda (obj_ptr_lo),y ; CPU:$C2B3 PRG:02B3 B1 6B + sta obj_ptr_lo ; CPU:$C2B5 PRG:02B5 85 6B rts ; CPU:$C2B7 PRG:02B7 60 ; ----------------------------------------------------------------------------- -; Routine: Label_C2B8 +; Routine: DecodeAnimOffset_Literal ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -637,28 +836,28 @@ Label_C2AD: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_C2B8: - sta Zp6B ; CPU:$C2B8 PRG:02B8 85 6B +DecodeAnimOffset_Literal: + sta obj_ptr_lo ; CPU:$C2B8 PRG:02B8 85 6B rts ; CPU:$C2BA PRG:02BA 60 ; ----------------------------------------------------------------------------- -; Routine: Label_C2BB -; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. -; Local: Continues its parent routine along the condition or operation encoded in this label, -; then returns, branches again, or rejoins shared code as documented by the instructions. -; Parameters: Undetermined in Pass 1 unless implied by the caller. -; Returns: Undetermined in Pass 1; status flags and registers may carry results. -; Clobbers: Undetermined in Pass 1. +; Routine: AdvanceAnimFrame +; Global: Advances the object's animation frame and refreshes its sound parameters. +; Local: Uses the countdown in $055F and the stream position in $0564 with the +; pointer table at $C552. +; Parameters: obj_index = the slot to advance. +; Returns: rts. +; Clobbers: A, X, Y, Zp6F; $055F, $0564. ; ----------------------------------------------------------------------------- -Label_C2BB: +AdvanceAnimFrame: lda #$00 ; CPU:$C2BB PRG:02BB A9 00 sta Zp6F ; CPU:$C2BD PRG:02BD 85 6F - ldx Zp6D ; CPU:$C2BF PRG:02BF A6 6D + ldx obj_index ; CPU:$C2BF PRG:02BF A6 6D lda $0514,x ; CPU:$C2C1 PRG:02C1 BD 14 05 - bmi Label_C2CA ; CPU:$C2C4 PRG:02C4 30 04 + bmi AdvanceAnimFrame_Return ; CPU:$C2C4 PRG:02C4 30 04 and #$7F ; CPU:$C2C6 PRG:02C6 29 7F - bne Label_C2CB ; CPU:$C2C8 PRG:02C8 D0 01 + bne AdvanceAnimFrame_Next ; CPU:$C2C8 PRG:02C8 D0 01 ; ----------------------------------------------------------------------------- -; Routine: Label_C2CA +; Routine: AdvanceAnimFrame_Return ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -666,10 +865,10 @@ Label_C2BB: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_C2CA: +AdvanceAnimFrame_Return: rts ; CPU:$C2CA PRG:02CA 60 ; ----------------------------------------------------------------------------- -; Routine: Label_C2CB +; Routine: AdvanceAnimFrame_Next ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -677,25 +876,25 @@ Label_C2CA: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_C2CB: +AdvanceAnimFrame_Next: dec $055F,x ; CPU:$C2CB PRG:02CB DE 5F 05 - bne Label_C2CA ; CPU:$C2CE PRG:02CE D0 FA + bne AdvanceAnimFrame_Return ; CPU:$C2CE PRG:02CE D0 FA asl a ; CPU:$C2D0 PRG:02D0 0A tay ; CPU:$C2D1 PRG:02D1 A8 lda $C552,y ; CPU:$C2D2 PRG:02D2 B9 52 C5 - sta Zp6B ; CPU:$C2D5 PRG:02D5 85 6B + sta obj_ptr_lo ; CPU:$C2D5 PRG:02D5 85 6B lda $C553,y ; CPU:$C2D7 PRG:02D7 B9 53 C5 - sta Zp6C ; CPU:$C2DA PRG:02DA 85 6C + sta obj_ptr_hi ; CPU:$C2DA PRG:02DA 85 6C ldy $0564,x ; CPU:$C2DC PRG:02DC BC 64 05 - lda (Zp6B),y ; CPU:$C2DF PRG:02DF B1 6B - bpl Label_C306 ; CPU:$C2E1 PRG:02E1 10 23 + lda (obj_ptr_lo),y ; CPU:$C2DF PRG:02DF B1 6B + bpl AdvanceAnimFrame_Commit ; CPU:$C2E1 PRG:02E1 10 23 cmp #$80 ; CPU:$C2E3 PRG:02E3 C9 80 - bne Label_C2EC ; CPU:$C2E5 PRG:02E5 D0 05 + bne AdvanceAnimFrame_Relative ; CPU:$C2E5 PRG:02E5 D0 05 dey ; CPU:$C2E7 PRG:02E7 88 dey ; CPU:$C2E8 PRG:02E8 88 jmp $C304 ; CPU:$C2E9 PRG:02E9 4C 04 C3 ; ----------------------------------------------------------------------------- -; Routine: Label_C2EC +; Routine: AdvanceAnimFrame_Relative ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -703,11 +902,11 @@ Label_C2CB: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_C2EC: +AdvanceAnimFrame_Relative: cmp #$81 ; CPU:$C2EC PRG:02EC C9 81 - bne Label_C2FE ; CPU:$C2EE PRG:02EE D0 0E + bne AdvanceAnimFrame_Restart ; CPU:$C2EE PRG:02EE D0 0E iny ; CPU:$C2F0 PRG:02F0 C8 - lda (Zp6B),y ; CPU:$C2F1 PRG:02F1 B1 6B + lda (obj_ptr_lo),y ; CPU:$C2F1 PRG:02F1 B1 6B sta Zp6F ; CPU:$C2F3 PRG:02F3 85 6F dey ; CPU:$C2F5 PRG:02F5 88 tya ; CPU:$C2F6 PRG:02F6 98 @@ -716,7 +915,7 @@ Label_C2EC: tay ; CPU:$C2FA PRG:02FA A8 jmp $C304 ; CPU:$C2FB PRG:02FB 4C 04 C3 ; ----------------------------------------------------------------------------- -; Routine: Label_C2FE +; Routine: AdvanceAnimFrame_Restart ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -724,12 +923,12 @@ Label_C2EC: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_C2FE: +AdvanceAnimFrame_Restart: cmp #$82 ; CPU:$C2FE PRG:02FE C9 82 - bne Label_C306 ; CPU:$C300 PRG:0300 D0 04 + bne AdvanceAnimFrame_Commit ; CPU:$C300 PRG:0300 D0 04 ldy #$00 ; CPU:$C302 PRG:0302 A0 00 ; ----------------------------------------------------------------------------- -; Routine: Label_C304 +; Routine: AdvanceAnimFrame_ReadCount ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -737,10 +936,10 @@ Label_C2FE: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_C304: - lda (Zp6B),y ; CPU:$C304 PRG:0304 B1 6B +AdvanceAnimFrame_ReadCount: + lda (obj_ptr_lo),y ; CPU:$C304 PRG:0304 B1 6B ; ----------------------------------------------------------------------------- -; Routine: Label_C306 +; Routine: AdvanceAnimFrame_Commit ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -748,33 +947,33 @@ Label_C304: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_C306: +AdvanceAnimFrame_Commit: sta $055F,x ; CPU:$C306 PRG:0306 9D 5F 05 iny ; CPU:$C309 PRG:0309 C8 - lda (Zp6B),y ; CPU:$C30A PRG:030A B1 6B + lda (obj_ptr_lo),y ; CPU:$C30A PRG:030A B1 6B sta Zp6F ; CPU:$C30C PRG:030C 85 6F iny ; CPU:$C30E PRG:030E C8 tya ; CPU:$C30F PRG:030F 98 sta $0564,x ; CPU:$C310 PRG:0310 9D 64 05 rts ; CPU:$C313 PRG:0313 60 ; ----------------------------------------------------------------------------- -; Routine: Label_C314 -; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. -; Local: Continues its parent routine along the condition or operation encoded in this label, -; then returns, branches again, or rejoins shared code as documented by the instructions. -; Parameters: Undetermined in Pass 1 unless implied by the caller. -; Returns: Undetermined in Pass 1; status flags and registers may carry results. -; Clobbers: Undetermined in Pass 1. +; Routine: UpdateObjectSound +; Global: Refreshes the object's contribution to the shadowed sound registers. +; Local: Object flag bit 5 silences the channel first; bit 0 gates whether the object +; reports sound at all. +; Parameters: obj_index = the slot to refresh. +; Returns: rts. +; Clobbers: A, X, Y, Zp6F; $0070-$007F, $05E0-$05E3, $05F0. ; ----------------------------------------------------------------------------- -Label_C314: - ldx Zp6D ; CPU:$C314 PRG:0314 A6 6D +UpdateObjectSound: + ldx obj_index ; CPU:$C314 PRG:0314 A6 6D lda $0500,x ; CPU:$C316 PRG:0316 BD 00 05 and #$20 ; CPU:$C319 PRG:0319 29 20 - beq Label_C32A ; CPU:$C31B PRG:031B F0 0D + beq UpdateObjectSound_Check ; CPU:$C31B PRG:031B F0 0D ldy #$10 ; CPU:$C31D PRG:031D A0 10 lda #$00 ; CPU:$C31F PRG:031F A9 00 ; ----------------------------------------------------------------------------- -; Routine: Label_C321 +; Routine: UpdateObjectSound_Silence ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -782,13 +981,13 @@ Label_C314: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_C321: +UpdateObjectSound_Silence: sta a:$006F,y ; CPU:$C321 PRG:0321 99 6F 00 dey ; CPU:$C324 PRG:0324 88 - bne Label_C321 ; CPU:$C325 PRG:0325 D0 FA + bne UpdateObjectSound_Silence ; CPU:$C325 PRG:0325 D0 FA sta $05F0 ; CPU:$C327 PRG:0327 8D F0 05 ; ----------------------------------------------------------------------------- -; Routine: Label_C32A +; Routine: UpdateObjectSound_Check ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -796,12 +995,12 @@ Label_C321: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_C32A: +UpdateObjectSound_Check: lda $0500,x ; CPU:$C32A PRG:032A BD 00 05 and #$01 ; CPU:$C32D PRG:032D 29 01 - bne Label_C332 ; CPU:$C32F PRG:032F D0 01 + bne UpdateObjectSound_Emit ; CPU:$C32F PRG:032F D0 01 ; ----------------------------------------------------------------------------- -; Routine: Label_C331 +; Routine: UpdateObjectSound_Return ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -809,10 +1008,10 @@ Label_C32A: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_C331: +UpdateObjectSound_Return: rts ; CPU:$C331 PRG:0331 60 ; ----------------------------------------------------------------------------- -; Routine: Label_C332 +; Routine: UpdateObjectSound_Emit ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -820,7 +1019,7 @@ Label_C331: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_C332: +UpdateObjectSound_Emit: lda $0523,x ; CPU:$C332 PRG:0332 BD 23 05 tay ; CPU:$C335 PRG:0335 A8 lda $C3B8,y ; CPU:$C336 PRG:0336 B9 B8 C3 @@ -837,10 +1036,10 @@ Label_C332: sta a:$0073,y ; CPU:$C34E PRG:034E 99 73 00 lda $0546,x ; CPU:$C351 PRG:0351 BD 46 05 ora $054B,x ; CPU:$C354 PRG:0354 1D 4B 05 - beq Label_C331 ; CPU:$C357 PRG:0357 F0 D8 + beq UpdateObjectSound_Return ; CPU:$C357 PRG:0357 F0 D8 lda $0532,x ; CPU:$C359 PRG:0359 BD 32 05 ora $0541,x ; CPU:$C35C PRG:035C 1D 41 05 - bne Label_C39F ; CPU:$C35F PRG:035F D0 3E + bne UpdateObjectSound_Sustain ; CPU:$C35F PRG:035F D0 3E lda #$01 ; CPU:$C361 PRG:0361 A9 01 sta a:$0070,y ; CPU:$C363 PRG:0363 99 70 00 sta a:$0072,y ; CPU:$C366 PRG:0366 99 72 00 @@ -854,10 +1053,10 @@ Label_C332: lda $056E,x ; CPU:$C37D PRG:037D BD 6E 05 sta $05E0,y ; CPU:$C380 PRG:0380 99 E0 05 lda $0514,x ; CPU:$C383 PRG:0383 BD 14 05 - bmi Label_C38A ; CPU:$C386 PRG:0386 30 02 + bmi UpdateObjectSound_UseVolume ; CPU:$C386 PRG:0386 30 02 lda Zp6F ; CPU:$C388 PRG:0388 A5 6F ; ----------------------------------------------------------------------------- -; Routine: Label_C38A +; Routine: UpdateObjectSound_UseVolume ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -865,12 +1064,12 @@ Label_C332: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_C38A: +UpdateObjectSound_UseVolume: sta $05E1,y ; CPU:$C38A PRG:038A 99 E1 05 lda #$01 ; CPU:$C38D PRG:038D A9 01 sta a:$0071,y ; CPU:$C38F PRG:038F 99 71 00 ; ----------------------------------------------------------------------------- -; Routine: Label_C392 +; Routine: UpdateObjectSound_EnableChannel ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -878,14 +1077,14 @@ Label_C38A: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_C392: +UpdateObjectSound_EnableChannel: ldy $0523,x ; CPU:$C392 PRG:0392 BC 23 05 lda $C3B4,y ; CPU:$C395 PRG:0395 B9 B4 C3 ora $05F0 ; CPU:$C398 PRG:0398 0D F0 05 sta $05F0 ; CPU:$C39B PRG:039B 8D F0 05 rts ; CPU:$C39E PRG:039E 60 ; ----------------------------------------------------------------------------- -; Routine: Label_C39F +; Routine: UpdateObjectSound_Sustain ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -893,15 +1092,15 @@ Label_C392: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_C39F: +UpdateObjectSound_Sustain: lda Zp6E ; CPU:$C39F PRG:039F A5 6E - beq Label_C3AE ; CPU:$C3A1 PRG:03A1 F0 0B + beq UpdateObjectSound_CheckVolume ; CPU:$C3A1 PRG:03A1 F0 0B lda $056E,x ; CPU:$C3A3 PRG:03A3 BD 6E 05 sta $05E0,y ; CPU:$C3A6 PRG:03A6 99 E0 05 lda #$01 ; CPU:$C3A9 PRG:03A9 A9 01 sta a:$0070,y ; CPU:$C3AB PRG:03AB 99 70 00 ; ----------------------------------------------------------------------------- -; Routine: Label_C3AE +; Routine: UpdateObjectSound_CheckVolume ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -909,28 +1108,29 @@ Label_C39F: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_C3AE: +UpdateObjectSound_CheckVolume: lda Zp6F ; CPU:$C3AE PRG:03AE A5 6F - bne Label_C38A ; CPU:$C3B0 PRG:03B0 D0 D8 - beq Label_C392 ; CPU:$C3B2 PRG:03B2 F0 DE - ora (Zp02,x) ; CPU:$C3B4 PRG:03B4 01 02 - .byte $04, $08 ; CPU:$C3B6 PRG:03B6 04 08 -- nop Zp08 (undocumented; ca65 cannot encode) - inc $FBFD,x ; CPU:$C3B8 PRG:03B8 FE FD FB + bne UpdateObjectSound_UseVolume ; CPU:$C3B0 PRG:03B0 D0 D8 + beq UpdateObjectSound_EnableChannel ; CPU:$C3B2 PRG:03B2 F0 DE +; ---- data $C3B4-$C3BA (7 bytes) ---- +; Eight APU channel mask bytes ($01 $02 $04 $08 enable pulse1/pulse2/triangle/noise, $FE $FD $FB $F7 disable them). UpdateObjectSound_EnableChannel indexes the table with the per-object channel byte at $0523 and ORs the result into the $05F0 shadow. The eighth byte at $C3BB is the tail of the same table. +SoundChannelMask: + .byte $01, $02, $04, $08, $FE, $FD, $FB ; CPU:$C3B4 PRG:03B4 01 02 04 08 FE FD FB ; ---- data $C3BB-$C3BB (1 bytes) ---- .byte $F7 ; CPU:$C3BB PRG:03BB F7 ; ----------------------------------------------------------------------------- -; Routine: Label_C3BC -; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. -; Local: Continues its parent routine along the condition or operation encoded in this label, -; then returns, branches again, or rejoins shared code as documented by the instructions. -; Parameters: Undetermined in Pass 1 unless implied by the caller. -; Returns: Undetermined in Pass 1; status flags and registers may carry results. -; Clobbers: Undetermined in Pass 1. +; Routine: ClearGameState +; Global: Zeroes the game-working RAM - Zp5F-$66, the two per-object arrays at +; $0500-$0504 and $0523-$0527, and the APU status shadow. +; Local: Reached from ResetGameState and from the $C3BC entry itself. +; Parameters: None. +; Returns: rts. +; Clobbers: A, X; Zp5F-$66, $0500-$0504, $0523-$0527, $4015. ; ----------------------------------------------------------------------------- -Label_C3BC: +ClearGameState: ldx #$08 ; CPU:$C3BC PRG:03BC A2 08 ; ----------------------------------------------------------------------------- -; Routine: Label_C3BE +; Routine: ClearGameState_LoopByte ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -938,14 +1138,14 @@ Label_C3BC: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_C3BE: +ClearGameState_LoopByte: lda #$00 ; CPU:$C3BE PRG:03BE A9 00 sta Zp5F,x ; CPU:$C3C0 PRG:03C0 95 5F dex ; CPU:$C3C2 PRG:03C2 CA - bne Label_C3BE ; CPU:$C3C3 PRG:03C3 D0 F9 + bne ClearGameState_LoopByte ; CPU:$C3C3 PRG:03C3 D0 F9 ldx #$05 ; CPU:$C3C5 PRG:03C5 A2 05 ; ----------------------------------------------------------------------------- -; Routine: Label_C3C7 +; Routine: ClearGameState_LoopArrays ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -953,31 +1153,31 @@ Label_C3BE: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_C3C7: +ClearGameState_LoopArrays: lda #$00 ; CPU:$C3C7 PRG:03C7 A9 00 sta $04FF,x ; CPU:$C3C9 PRG:03C9 9D FF 04 lda #$00 ; CPU:$C3CC PRG:03CC A9 00 sta $0522,x ; CPU:$C3CE PRG:03CE 9D 22 05 dex ; CPU:$C3D1 PRG:03D1 CA - bne Label_C3C7 ; CPU:$C3D2 PRG:03D2 D0 F3 + bne ClearGameState_LoopArrays ; CPU:$C3D2 PRG:03D2 D0 F3 lda #$00 ; CPU:$C3D4 PRG:03D4 A9 00 - sta $4015 ; CPU:$C3D6 PRG:03D6 8D 15 40 + sta APUSTATUS ; CPU:$C3D6 PRG:03D6 8D 15 40 rts ; CPU:$C3D9 PRG:03D9 60 ; ----------------------------------------------------------------------------- -; Routine: Label_C3DA -; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. -; Local: Continues its parent routine along the condition or operation encoded in this label, -; then returns, branches again, or rejoins shared code as documented by the instructions. -; Parameters: Undetermined in Pass 1 unless implied by the caller. -; Returns: Undetermined in Pass 1; status flags and registers may carry results. -; Clobbers: Undetermined in Pass 1. +; Routine: QueueSpawnRequest +; Global: Posts a spawn request into the first free slot of the 8-byte spawn queue. +; Local: The request is (A = type); X is saved and restored so the caller's slot index +; survives. +; Parameters: A = the spawn type, X = the caller's index. +; Returns: A and X restored to their entry values; queue unchanged if full. +; Clobbers: obj_ptr_lo/hi, spawn_queue. ; ----------------------------------------------------------------------------- -Label_C3DA: - sta Zp6B ; CPU:$C3DA PRG:03DA 85 6B - stx Zp6C ; CPU:$C3DC PRG:03DC 86 6C +QueueSpawnRequest: + sta obj_ptr_lo ; CPU:$C3DA PRG:03DA 85 6B + stx obj_ptr_hi ; CPU:$C3DC PRG:03DC 86 6C ldx #$00 ; CPU:$C3DE PRG:03DE A2 00 ; ----------------------------------------------------------------------------- -; Routine: Label_C3E0 +; Routine: QueueSpawnRequest_FindSlot ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -985,14 +1185,14 @@ Label_C3DA: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_C3E0: - lda Zp60,x ; CPU:$C3E0 PRG:03E0 B5 60 - bne Label_C3EB ; CPU:$C3E2 PRG:03E2 D0 07 - lda Zp6B ; CPU:$C3E4 PRG:03E4 A5 6B - sta Zp60,x ; CPU:$C3E6 PRG:03E6 95 60 +QueueSpawnRequest_FindSlot: + lda spawn_queue,x ; CPU:$C3E0 PRG:03E0 B5 60 + bne QueueSpawnRequest_NextSlot ; CPU:$C3E2 PRG:03E2 D0 07 + lda obj_ptr_lo ; CPU:$C3E4 PRG:03E4 A5 6B + sta spawn_queue,x ; CPU:$C3E6 PRG:03E6 95 60 jmp $C3F0 ; CPU:$C3E8 PRG:03E8 4C F0 C3 ; ----------------------------------------------------------------------------- -; Routine: Label_C3EB +; Routine: QueueSpawnRequest_NextSlot ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -1000,12 +1200,12 @@ Label_C3E0: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_C3EB: +QueueSpawnRequest_NextSlot: inx ; CPU:$C3EB PRG:03EB E8 cpx #$08 ; CPU:$C3EC PRG:03EC E0 08 - bne Label_C3E0 ; CPU:$C3EE PRG:03EE D0 F0 + bne QueueSpawnRequest_FindSlot ; CPU:$C3EE PRG:03EE D0 F0 ; ----------------------------------------------------------------------------- -; Routine: Label_C3F0 +; Routine: QueueSpawnRequest_Done ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -1013,38 +1213,36 @@ Label_C3EB: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_C3F0: - lda Zp6B ; CPU:$C3F0 PRG:03F0 A5 6B - ldx Zp6C ; CPU:$C3F2 PRG:03F2 A6 6C +QueueSpawnRequest_Done: + lda obj_ptr_lo ; CPU:$C3F0 PRG:03F0 A5 6B + ldx obj_ptr_hi ; CPU:$C3F2 PRG:03F2 A6 6C rts ; CPU:$C3F4 PRG:03F4 60 ; ----------------------------------------------------------------------------- -; Routine: Label_C3F5 -; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. -; Local: Continues its parent routine along the condition or operation encoded in this label, -; then returns, branches again, or rejoins shared code as documented by the instructions. -; Parameters: Undetermined in Pass 1 unless implied by the caller. -; Returns: Undetermined in Pass 1; status flags and registers may carry results. -; Clobbers: Undetermined in Pass 1. +; Routine: ResetGameState +; Global: Clears game_flag and then the whole game working set. +; Local: The shared 'start a new game' entry. +; Parameters: None. +; Returns: Never returns - falls into ClearGameState. +; Clobbers: A; game_flag. ; ----------------------------------------------------------------------------- -Label_C3F5: +ResetGameState: lda #$00 ; CPU:$C3F5 PRG:03F5 A9 00 - sta Zp68 ; CPU:$C3F7 PRG:03F7 85 68 + sta game_flag ; CPU:$C3F7 PRG:03F7 85 68 jmp $C3BC ; CPU:$C3F9 PRG:03F9 4C BC C3 ; ----------------------------------------------------------------------------- -; Routine: Label_C3FC -; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. -; Local: Continues its parent routine along the condition or operation encoded in this label, -; then returns, branches again, or rejoins shared code as documented by the instructions. -; Parameters: Undetermined in Pass 1 unless implied by the caller. -; Returns: Undetermined in Pass 1; status flags and registers may carry results. -; Clobbers: Undetermined in Pass 1. +; Routine: AdvanceScriptPtr +; Global: 16-bit increment of the object script pointer. +; Local: The high byte is only bumped on low-byte wrap. +; Parameters: obj_script_lo/hi = the pointer to advance. +; Returns: rts; Z set when the pointer did not wrap. +; Clobbers: obj_script_lo/hi, flags. ; ----------------------------------------------------------------------------- -Label_C3FC: - inc Zp69 ; CPU:$C3FC PRG:03FC E6 69 - beq Label_C401 ; CPU:$C3FE PRG:03FE F0 01 +AdvanceScriptPtr: + inc obj_script_lo ; CPU:$C3FC PRG:03FC E6 69 + beq AdvanceScriptPtr_HiCarry ; CPU:$C3FE PRG:03FE F0 01 rts ; CPU:$C400 PRG:0400 60 ; ----------------------------------------------------------------------------- -; Routine: Label_C401 +; Routine: AdvanceScriptPtr_HiCarry ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -1052,24 +1250,25 @@ Label_C3FC: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_C401: - inc Zp6A ; CPU:$C401 PRG:0401 E6 6A +AdvanceScriptPtr_HiCarry: + inc obj_script_hi ; CPU:$C401 PRG:0401 E6 6A rts ; CPU:$C403 PRG:0403 60 ; ----------------------------------------------------------------------------- -; Routine: Label_C404 -; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. -; Local: Continues its parent routine along the condition or operation encoded in this label, -; then returns, branches again, or rejoins shared code as documented by the instructions. -; Parameters: Undetermined in Pass 1 unless implied by the caller. -; Returns: Undetermined in Pass 1; status flags and registers may carry results. -; Clobbers: Undetermined in Pass 1. +; Routine: SpawnObject +; Global: Spawns object type A from the descriptor table, or jumps through it when the +; type has bit 7 set. +; Local: A positive type reads a record that carries the spawn count, the target slot +; of each copy and the 10 field bytes copied per slot. +; Parameters: A = the spawn type. +; Returns: rts (all slots busy), or never - a bit-7 type jumps through the table. +; Clobbers: A, X, Y, Zp6E, Zp6F, obj_ptr_lo/hi, obj_script_lo/hi. ; ----------------------------------------------------------------------------- -Label_C404: +SpawnObject: sta Zp6E ; CPU:$C404 PRG:0404 85 6E - bne Label_C409 ; CPU:$C406 PRG:0406 D0 01 + bne SpawnObject_JumpTable ; CPU:$C406 PRG:0406 D0 01 rts ; CPU:$C408 PRG:0408 60 ; ----------------------------------------------------------------------------- -; Routine: Label_C409 +; Routine: SpawnObject_JumpTable ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -1077,8 +1276,8 @@ Label_C404: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_C409: - bpl Label_C416 ; CPU:$C409 PRG:0409 10 0B +SpawnObject_JumpTable: + bpl SpawnObject_Create ; CPU:$C409 PRG:0409 10 0B asl a ; CPU:$C40B PRG:040B 0A tax ; CPU:$C40C PRG:040C AA lda $C523,x ; CPU:$C40D PRG:040D BD 23 C5 @@ -1086,7 +1285,7 @@ Label_C409: lda $C522,x ; CPU:$C411 PRG:0411 BD 22 C5 pha ; CPU:$C414 PRG:0414 48 ; ----------------------------------------------------------------------------- -; Routine: Label_C415 +; Routine: SpawnObject_Return ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -1094,10 +1293,10 @@ Label_C409: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_C415: +SpawnObject_Return: rts ; CPU:$C415 PRG:0415 60 ; ----------------------------------------------------------------------------- -; Routine: Label_C416 +; Routine: SpawnObject_Create ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -1105,19 +1304,19 @@ Label_C415: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_C416: +SpawnObject_Create: asl a ; CPU:$C416 PRG:0416 0A tax ; CPU:$C417 PRG:0417 AA lda $C523,x ; CPU:$C418 PRG:0418 BD 23 C5 - sta Zp6A ; CPU:$C41B PRG:041B 85 6A + sta obj_script_hi ; CPU:$C41B PRG:041B 85 6A lda $C522,x ; CPU:$C41D PRG:041D BD 22 C5 - sta Zp69 ; CPU:$C420 PRG:0420 85 69 + sta obj_script_lo ; CPU:$C420 PRG:0420 85 69 ldy #$00 ; CPU:$C422 PRG:0422 A0 00 - lda (Zp69),y ; CPU:$C424 PRG:0424 B1 69 + lda (obj_script_lo),y ; CPU:$C424 PRG:0424 B1 69 iny ; CPU:$C426 PRG:0426 C8 sta Zp6F ; CPU:$C427 PRG:0427 85 6F ; ----------------------------------------------------------------------------- -; Routine: Label_C429 +; Routine: SpawnObject_SlotLoop ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -1125,23 +1324,23 @@ Label_C416: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_C429: - lda (Zp69),y ; CPU:$C429 PRG:0429 B1 69 +SpawnObject_SlotLoop: + lda (obj_script_lo),y ; CPU:$C429 PRG:0429 B1 69 iny ; CPU:$C42B PRG:042B C8 tax ; CPU:$C42C PRG:042C AA - lda (Zp69),y ; CPU:$C42D PRG:042D B1 69 + lda (obj_script_lo),y ; CPU:$C42D PRG:042D B1 69 cmp #$80 ; CPU:$C42F PRG:042F C9 80 - beq Label_C471 ; CPU:$C431 PRG:0431 F0 3E + beq SpawnObject_EndRecord ; CPU:$C431 PRG:0431 F0 3E lda $0500,x ; CPU:$C433 PRG:0433 BD 00 05 and #$40 ; CPU:$C436 PRG:0436 29 40 - bne Label_C415 ; CPU:$C438 PRG:0438 D0 DB + bne SpawnObject_Return ; CPU:$C438 PRG:0438 D0 DB lda Zp6E ; CPU:$C43A PRG:043A A5 6E sta $0582,x ; CPU:$C43C PRG:043C 9D 82 05 - stx Zp6B ; CPU:$C43F PRG:043F 86 6B + stx obj_ptr_lo ; CPU:$C43F PRG:043F 86 6B lda #$0A ; CPU:$C441 PRG:0441 A9 0A - sta Zp6C ; CPU:$C443 PRG:0443 85 6C + sta obj_ptr_hi ; CPU:$C443 PRG:0443 85 6C ; ----------------------------------------------------------------------------- -; Routine: Label_C445 +; Routine: SpawnObject_CopyField ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -1149,17 +1348,17 @@ Label_C429: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_C445: - lda (Zp69),y ; CPU:$C445 PRG:0445 B1 69 +SpawnObject_CopyField: + lda (obj_script_lo),y ; CPU:$C445 PRG:0445 B1 69 iny ; CPU:$C447 PRG:0447 C8 sta $0500,x ; CPU:$C448 PRG:0448 9D 00 05 txa ; CPU:$C44B PRG:044B 8A clc ; CPU:$C44C PRG:044C 18 adc #$05 ; CPU:$C44D PRG:044D 69 05 tax ; CPU:$C44F PRG:044F AA - dec Zp6C ; CPU:$C450 PRG:0450 C6 6C - bne Label_C445 ; CPU:$C452 PRG:0452 D0 F1 - ldx Zp6B ; CPU:$C454 PRG:0454 A6 6B + dec obj_ptr_hi ; CPU:$C450 PRG:0450 C6 6C + bne SpawnObject_CopyField ; CPU:$C452 PRG:0452 D0 F1 + ldx obj_ptr_lo ; CPU:$C454 PRG:0454 A6 6B lda #$00 ; CPU:$C456 PRG:0456 A9 00 sta $0532,x ; CPU:$C458 PRG:0458 9D 32 05 lda $051E,x ; CPU:$C45B PRG:045B BD 1E 05 @@ -1171,7 +1370,7 @@ Label_C445: sta $0569,x ; CPU:$C46B PRG:046B 9D 69 05 jmp $C475 ; CPU:$C46E PRG:046E 4C 75 C4 ; ----------------------------------------------------------------------------- -; Routine: Label_C471 +; Routine: SpawnObject_EndRecord ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -1179,11 +1378,11 @@ Label_C445: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_C471: +SpawnObject_EndRecord: sta $0500,x ; CPU:$C471 PRG:0471 9D 00 05 iny ; CPU:$C474 PRG:0474 C8 ; ----------------------------------------------------------------------------- -; Routine: Label_C475 +; Routine: SpawnObject_NextSlot ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -1191,9 +1390,9 @@ Label_C471: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_C475: +SpawnObject_NextSlot: dec Zp6F ; CPU:$C475 PRG:0475 C6 6F - bne Label_C429 ; CPU:$C477 PRG:0477 D0 B0 + bne SpawnObject_SlotLoop ; CPU:$C477 PRG:0477 D0 B0 rts ; CPU:$C479 PRG:0479 60 ; ---- data $C47A-$CA20 (1447 bytes) ---- ; referenced by `lda $C543,y` at $C1D2 (operand $C543 falls inside this region) @@ -1203,6 +1402,8 @@ Label_C475: ; referenced by `lda $C553,y` at $C2D7 (operand $C553 falls inside this region) ; referenced by `lda $C523,x` at $C40D (operand $C523 falls inside this region) ; ... and 3 further references from decoded code +; Eighty-four sixteen-bit per-object pointers selected by (obj_ptr_lo + $0519,x) * 2 in SetObjPtr_FromStateTable. The code bases the table at $C478, but entry 0 is the bne operand and the rts of the preceding routine, and the index is always at least 1, so the live entries run $C47A-$C521. +ObjectStatePointerTable: .byte $FF, $03, $C7, $03, $90, $03, $5D, $03, $2D, $03, $FF, $02, $D4, $02, $AB, $02 ; CPU:$C47A PRG:047A FF 03 C7 03 90 03 5D 03 2D 03 FF 02 D4 02 AB 02 .byte $85, $02, $61, $02, $3F, $02, $1E, $02, $FF, $01, $E3, $01, $C8, $01, $AE, $01 ; CPU:$C48A PRG:048A 85 02 61 02 3F 02 1E 02 FF 01 E3 01 C8 01 AE 01 .byte $96, $01, $7F, $01, $6A, $01, $55, $01, $42, $01, $30, $01, $1F, $01, $0F, $01 ; CPU:$C49A PRG:049A 96 01 7F 01 6A 01 55 01 42 01 30 01 1F 01 0F 01 @@ -1213,10 +1414,22 @@ Label_C475: .byte $28, $00, $26, $00, $23, $00, $21, $00, $1F, $00, $1E, $00, $1C, $00, $1A, $00 ; CPU:$C4EA PRG:04EA 28 00 26 00 23 00 21 00 1F 00 1E 00 1C 00 1A 00 .byte $19, $00, $17, $00, $16, $00, $15, $00, $14, $00, $13, $00, $11, $00, $10, $00 ; CPU:$C4FA PRG:04FA 19 00 17 00 16 00 15 00 14 00 13 00 11 00 10 00 .byte $0F, $00, $0F, $00, $0E, $00, $0D, $00, $0C, $00, $0B, $00, $0B, $00, $0A, $00 ; CPU:$C50A PRG:050A 0F 00 0F 00 0E 00 0D 00 0C 00 0B 00 0B 00 0A 00 - .byte $0A, $00, $09, $00, $08, $00, $08, $00, $BB, $C3, $C0, $C5, $E3, $C5, $F6, $C5 ; CPU:$C51A PRG:051A 0A 00 09 00 08 00 08 00 BB C3 C0 C5 E3 C5 F6 C5 + .byte $0A, $00, $09, $00, $08, $00, $08, $00 ; CPU:$C51A PRG:051A 0A 00 09 00 08 00 08 00 +; Fifteen sixteen-bit spawn-record pointers used by SpawnObject ($C404), which is called with a spawn id taken from the eight-slot queue at $0060-$0067. Id 0 means "empty queue slot", so the entry at $C522 (which points into the sound mask table) is dead; the live entries $C524-$C541 point at the record lists from $C5C0 onward. +SpawnObjectTable: + .byte $BB, $C3, $C0, $C5, $E3, $C5, $F6, $C5 ; CPU:$C522 PRG:0522 BB C3 C0 C5 E3 C5 F6 C5 .byte $06, $C6, $18, $C6, $27, $C6, $41, $C6, $88, $C9, $5B, $C6, $6B, $C6, $27, $C7 ; CPU:$C52A PRG:052A 06 C6 18 C6 27 C6 41 C6 88 C9 5B C6 6B C6 27 C7 - .byte $0C, $C8, $AB, $C8, $FC, $C8, $41, $C9, $BC, $C9, $01, $02, $03, $04, $06, $08 ; CPU:$C53A PRG:053A 0C C8 AB C8 FC C8 41 C9 BC C9 01 02 03 04 06 08 - .byte $0C, $10, $18, $20, $30, $40, $60, $80, $C0, $00, $56, $C5, $04, $BC, $04, $C4 ; CPU:$C54A PRG:054A 0C 10 18 20 30 40 60 80 C0 00 56 C5 04 BC 04 C4 + .byte $0C, $C8, $AB, $C8, $FC, $C8, $41, $C9, $BC ; CPU:$C53A PRG:053A 0C C8 AB C8 FC C8 41 C9 BC +; Sixteen one-byte per-state values (1, 2, 3, 4, 6, 8, 12, 16, 24, 32, 48, 64, 96, 128, 192, 0) read by SetObjectState_Table, which indexes it with y = opcode - $DF for script opcodes $E0 and above, and stored into both the state byte at $0537 and the counter at $0569. As with the pointer tables the byte the code bases on ($C543) is the dead entry 0, so the live values occupy $C544-$C553. +StateTimerTable: + .byte $C9, $01, $02, $03, $04, $06, $08 ; CPU:$C543 PRG:0543 C9 01 02 03 04 06 08 + .byte $0C, $10, $18, $20, $30, $40, $60, $80 ; CPU:$C54A PRG:054A 0C 10 18 20 30 40 60 80 +; Sixteen-bit animation-sequence pointers selected by (the animation group in $0514,x) * 2 in AdvanceAnimFrame. The live entry 1 is at $C554/$C555 and points at the frame sequences from $C556; as elsewhere in this block the base entry 0 is dead. +AnimationPointerTable: + .byte $C0, $00, $56, $C5, $04, $BC, $04 ; CPU:$C552 PRG:0552 C0 00 56 C5 04 BC 04 +; Sixteen-bit sprite-animation pointers selected by (the animation selector in $050F,x) * 2 in BuildObjectSprite. The live entries begin at $C55B ($C56F, $C56F, $C577, $C57F, $C587, $C587, $C595, $C595, $C595, $C5AF, ...) and address the $80-terminated tile sequences that follow; entry 0 at the code's base is dead. +SpriteAnimationTable: + .byte $C4 ; CPU:$C559 PRG:0559 C4 .byte $82, $6F, $C5, $6F, $C5, $77, $C5, $7F, $C5, $87, $C5, $87, $C5, $95, $C5, $95 ; CPU:$C55A PRG:055A 82 6F C5 6F C5 77 C5 7F C5 87 C5 87 C5 95 C5 95 .byte $C5, $95, $C5, $AF, $C5, $0F, $0D, $0A, $07, $04, $02, $00, $80, $0D, $0E, $0F ; CPU:$C56A PRG:056A C5 95 C5 AF C5 0F 0D 0A 07 04 02 00 80 0D 0E 0F .byte $0E, $0C, $0A, $08, $80, $0F, $0D, $0B, $0A, $0A, $0A, $08, $80, $06, $0C, $0E ; CPU:$C57A PRG:057A 0E 0C 0A 08 80 0F 0D 0B 0A 0A 0A 08 80 06 0C 0E @@ -1295,158 +1508,153 @@ Label_C475: .byte $06, $E6, $01, $82, $08, $E6, $05, $08, $05, $E4, $05, $08, $05, $05, $05, $E2 ; CPU:$CA0A PRG:0A0A 06 E6 01 82 08 E6 05 08 05 E4 05 08 05 05 05 E2 .byte $05, $05, $05, $05, $05, $05, $82 ; CPU:$CA1A PRG:0A1A 05 05 05 05 05 05 82 ; ----------------------------------------------------------------------------- -; Routine: Label_CA21 -; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. -; Local: Continues its parent routine along the condition or operation encoded in this label, -; then returns, branches again, or rejoins shared code as documented by the instructions. -; Parameters: Undetermined in Pass 1 unless implied by the caller. -; Returns: Undetermined in Pass 1; status flags and registers may carry results. -; Clobbers: Undetermined in Pass 1. +; Routine: DisableRendering +; Global: Turns the PPU off for safe VRAM access: clears NMI in the control shadow and +; the background/sprite enable bits in the mask shadow at the same time. +; Local: Pairs with EnableRendering. Used around the queued VRAM writes so a mid-frame +; PPUADDR change cannot corrupt rendering. +; Parameters: None. +; Returns: rts. +; Clobbers: A; ppu_ctrl_shadow, ppu_mask_shadow, PPUCTRL, PPUMASK. ; ----------------------------------------------------------------------------- -Label_CA21: +DisableRendering: jsr $CA38 ; CPU:$CA21 PRG:0A21 20 38 CA - lda ZpF1 ; CPU:$CA24 PRG:0A24 A5 F1 + lda ppu_mask_shadow ; CPU:$CA24 PRG:0A24 A5 F1 and #$E7 ; CPU:$CA26 PRG:0A26 29 E7 - sta $2001 ; CPU:$CA28 PRG:0A28 8D 01 20 - sta ZpF1 ; CPU:$CA2B PRG:0A2B 85 F1 + sta PPUMASK ; CPU:$CA28 PRG:0A28 8D 01 20 + sta ppu_mask_shadow ; CPU:$CA2B PRG:0A2B 85 F1 rts ; CPU:$CA2D PRG:0A2D 60 ; ----------------------------------------------------------------------------- -; Routine: Label_CA2E -; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. -; Local: Continues its parent routine along the condition or operation encoded in this label, -; then returns, branches again, or rejoins shared code as documented by the instructions. -; Parameters: Undetermined in Pass 1 unless implied by the caller. -; Returns: Undetermined in Pass 1; status flags and registers may carry results. -; Clobbers: Undetermined in Pass 1. +; Routine: EnableRendering +; Global: Sets PPUMASK bits 3 and 4 so the background and sprites are shown again. +; Local: The counterpart of DisableRendering. +; Parameters: None. +; Returns: rts. +; Clobbers: A; ppu_mask_shadow, PPUMASK. ; ----------------------------------------------------------------------------- -Label_CA2E: - lda ZpF1 ; CPU:$CA2E PRG:0A2E A5 F1 +EnableRendering: + lda ppu_mask_shadow ; CPU:$CA2E PRG:0A2E A5 F1 ora #$18 ; CPU:$CA30 PRG:0A30 09 18 - sta ZpF1 ; CPU:$CA32 PRG:0A32 85 F1 - sta $2001 ; CPU:$CA34 PRG:0A34 8D 01 20 + sta ppu_mask_shadow ; CPU:$CA32 PRG:0A32 85 F1 + sta PPUMASK ; CPU:$CA34 PRG:0A34 8D 01 20 rts ; CPU:$CA37 PRG:0A37 60 ; ----------------------------------------------------------------------------- -; Routine: Label_CA38 -; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. -; Local: Continues its parent routine along the condition or operation encoded in this label, -; then returns, branches again, or rejoins shared code as documented by the instructions. -; Parameters: Undetermined in Pass 1 unless implied by the caller. -; Returns: Undetermined in Pass 1; status flags and registers may carry results. -; Clobbers: Undetermined in Pass 1. +; Routine: DisableNmi +; Global: Clears NMI-enable in the PPUCTRL shadow and writes it out. +; Local: Falls into WritePpuCtrl. +; Parameters: None. +; Returns: rts. +; Clobbers: A; ppu_ctrl_shadow, PPUCTRL. ; ----------------------------------------------------------------------------- -Label_CA38: - lda ZpF0 ; CPU:$CA38 PRG:0A38 A5 F0 +DisableNmi: + lda ppu_ctrl_shadow ; CPU:$CA38 PRG:0A38 A5 F0 and #$7F ; CPU:$CA3A PRG:0A3A 29 7F ; ----------------------------------------------------------------------------- -; Routine: Label_CA3C -; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. -; Local: Continues its parent routine along the condition or operation encoded in this label, -; then returns, branches again, or rejoins shared code as documented by the instructions. -; Parameters: Undetermined in Pass 1 unless implied by the caller. -; Returns: Undetermined in Pass 1; status flags and registers may carry results. -; Clobbers: Undetermined in Pass 1. +; Routine: WritePpuCtrl +; Global: Writes A to both PPUCTRL and its shadow. +; Local: The shared tail of DisableNmi and SetPpuCtrlAndMask. +; Parameters: A = the value to latch. +; Returns: rts. +; Clobbers: ppu_ctrl_shadow, PPUCTRL. ; ----------------------------------------------------------------------------- -Label_CA3C: - sta $2000 ; CPU:$CA3C PRG:0A3C 8D 00 20 - sta ZpF0 ; CPU:$CA3F PRG:0A3F 85 F0 +WritePpuCtrl: + sta PPUCTRL ; CPU:$CA3C PRG:0A3C 8D 00 20 + sta ppu_ctrl_shadow ; CPU:$CA3F PRG:0A3F 85 F0 rts ; CPU:$CA41 PRG:0A41 60 ; ----------------------------------------------------------------------------- -; Routine: Label_CA42 -; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. -; Local: Continues its parent routine along the condition or operation encoded in this label, -; then returns, branches again, or rejoins shared code as documented by the instructions. -; Parameters: Undetermined in Pass 1 unless implied by the caller. -; Returns: Undetermined in Pass 1; status flags and registers may carry results. -; Clobbers: Undetermined in Pass 1. +; Routine: EnableNmiAndRendering +; Global: Re-arms the display: writes the control shadow and zeroes the scroll, enables +; rendering, then sets NMI-enable. +; Local: The mirror of DisableRendering. +; Parameters: None. +; Returns: rts. +; Clobbers: A; ppu_ctrl_shadow, ppu_mask_shadow, PPUCTRL, PPUMASK, PPUSCROLL. ; ----------------------------------------------------------------------------- -Label_CA42: +EnableNmiAndRendering: jsr $CA52 ; CPU:$CA42 PRG:0A42 20 52 CA jsr $CA2E ; CPU:$CA45 PRG:0A45 20 2E CA ; ----------------------------------------------------------------------------- -; Routine: Label_CA48 -; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. -; Local: Continues its parent routine along the condition or operation encoded in this label, -; then returns, branches again, or rejoins shared code as documented by the instructions. -; Parameters: Undetermined in Pass 1 unless implied by the caller. -; Returns: Undetermined in Pass 1; status flags and registers may carry results. -; Clobbers: Undetermined in Pass 1. +; Routine: EnableNmi +; Global: Sets NMI-enable in the PPUCTRL shadow and writes it out. +; Local: Used both as a critical-section exit and to turn the frame interrupt on. +; Parameters: None. +; Returns: rts. +; Clobbers: A; ppu_ctrl_shadow, PPUCTRL. ; ----------------------------------------------------------------------------- -Label_CA48: - lda ZpF0 ; CPU:$CA48 PRG:0A48 A5 F0 +EnableNmi: + lda ppu_ctrl_shadow ; CPU:$CA48 PRG:0A48 A5 F0 ora #$80 ; CPU:$CA4A PRG:0A4A 09 80 - sta ZpF0 ; CPU:$CA4C PRG:0A4C 85 F0 - sta $2000 ; CPU:$CA4E PRG:0A4E 8D 00 20 + sta ppu_ctrl_shadow ; CPU:$CA4C PRG:0A4C 85 F0 + sta PPUCTRL ; CPU:$CA4E PRG:0A4E 8D 00 20 rts ; CPU:$CA51 PRG:0A51 60 ; ----------------------------------------------------------------------------- -; Routine: Label_CA52 -; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. -; Local: Continues its parent routine along the condition or operation encoded in this label, -; then returns, branches again, or rejoins shared code as documented by the instructions. -; Parameters: Undetermined in Pass 1 unless implied by the caller. -; Returns: Undetermined in Pass 1; status flags and registers may carry results. -; Clobbers: Undetermined in Pass 1. +; Routine: WritePpuCtrlAndResetScroll +; Global: Latches the control shadow and resets the scroll to (0,0). +; Local: The usual prelude to any nametable work done outside vblank. +; Parameters: None. +; Returns: rts. +; Clobbers: A, ppu_ctrl_shadow, PPUCTRL, PPUSCROLL. ; ----------------------------------------------------------------------------- -Label_CA52: - lda ZpF0 ; CPU:$CA52 PRG:0A52 A5 F0 - sta $2000 ; CPU:$CA54 PRG:0A54 8D 00 20 +WritePpuCtrlAndResetScroll: + lda ppu_ctrl_shadow ; CPU:$CA52 PRG:0A52 A5 F0 + sta PPUCTRL ; CPU:$CA54 PRG:0A54 8D 00 20 lda #$00 ; CPU:$CA57 PRG:0A57 A9 00 - sta $2005 ; CPU:$CA59 PRG:0A59 8D 05 20 - sta $2005 ; CPU:$CA5C PRG:0A5C 8D 05 20 + sta PPUSCROLL ; CPU:$CA59 PRG:0A59 8D 05 20 + sta PPUSCROLL ; CPU:$CA5C PRG:0A5C 8D 05 20 rts ; CPU:$CA5F PRG:0A5F 60 ; ----------------------------------------------------------------------------- -; Routine: Label_CA60 -; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. -; Local: Continues its parent routine along the condition or operation encoded in this label, -; then returns, branches again, or rejoins shared code as documented by the instructions. -; Parameters: Undetermined in Pass 1 unless implied by the caller. -; Returns: Undetermined in Pass 1; status flags and registers may carry results. -; Clobbers: Undetermined in Pass 1. +; Routine: SetNtBase2000 +; Global: Forces the nametable base to $2000 and clears the PPUCTRL nametable bits. +; Local: nt_base_hi/lo are the software copy of the rendering base that +; ComputeTileAddress adds in. +; Parameters: None. +; Returns: rts. +; Clobbers: A; ppu_ctrl_shadow, nt_base_hi/lo. ; ----------------------------------------------------------------------------- -Label_CA60: - lda ZpF0 ; CPU:$CA60 PRG:0A60 A5 F0 +SetNtBase2000: + lda ppu_ctrl_shadow ; CPU:$CA60 PRG:0A60 A5 F0 and #$FC ; CPU:$CA62 PRG:0A62 29 FC - sta ZpF0 ; CPU:$CA64 PRG:0A64 85 F0 + sta ppu_ctrl_shadow ; CPU:$CA64 PRG:0A64 85 F0 lda #$20 ; CPU:$CA66 PRG:0A66 A9 20 - sta ZpF2 ; CPU:$CA68 PRG:0A68 85 F2 + sta nt_base_hi ; CPU:$CA68 PRG:0A68 85 F2 lda #$00 ; CPU:$CA6A PRG:0A6A A9 00 - sta ZpF3 ; CPU:$CA6C PRG:0A6C 85 F3 + sta nt_base_lo ; CPU:$CA6C PRG:0A6C 85 F3 rts ; CPU:$CA6E PRG:0A6E 60 ; ----------------------------------------------------------------------------- -; Routine: Label_CA6F -; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. -; Local: Continues its parent routine along the condition or operation encoded in this label, -; then returns, branches again, or rejoins shared code as documented by the instructions. -; Parameters: Undetermined in Pass 1 unless implied by the caller. -; Returns: Undetermined in Pass 1; status flags and registers may carry results. -; Clobbers: Undetermined in Pass 1. +; Routine: SetNtSelectBit +; Global: Sets PPUCTRL shadow bit 0 (the nametable-select bit) from A's bit 0. +; Local: Rotates A's low bit into the shadow through the carry. +; Parameters: A = the bit to install. +; Returns: rts; the shadow is updated in place. +; Clobbers: A, flags; ppu_ctrl_shadow. ; ----------------------------------------------------------------------------- -Label_CA6F: +SetNtSelectBit: lsr a ; CPU:$CA6F PRG:0A6F 4A php ; CPU:$CA70 PRG:0A70 08 - lsr ZpF0 ; CPU:$CA71 PRG:0A71 46 F0 + lsr ppu_ctrl_shadow ; CPU:$CA71 PRG:0A71 46 F0 plp ; CPU:$CA73 PRG:0A73 28 - asl ZpF0 ; CPU:$CA74 PRG:0A74 06 F0 + asl ppu_ctrl_shadow ; CPU:$CA74 PRG:0A74 06 F0 rts ; CPU:$CA76 PRG:0A76 60 ; ----------------------------------------------------------------------------- -; Routine: Label_CA77 -; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. -; Local: Continues its parent routine along the condition or operation encoded in this label, -; then returns, branches again, or rejoins shared code as documented by the instructions. -; Parameters: Undetermined in Pass 1 unless implied by the caller. -; Returns: Undetermined in Pass 1; status flags and registers may carry results. -; Clobbers: Undetermined in Pass 1. +; Routine: UpdateNtBaseFromPpuCtrl +; Global: Recomputes nt_base_hi/lo from the nametable-select bit of the control shadow: +; $2440 when it is set, $2000 when it is clear. +; Local: Called after any PPUCTRL change that could move the rendered nametable. +; Parameters: None. +; Returns: rts. +; Clobbers: A; nt_base_hi/lo. ; ----------------------------------------------------------------------------- -Label_CA77: - lda ZpF0 ; CPU:$CA77 PRG:0A77 A5 F0 - and Zp01 ; CPU:$CA79 PRG:0A79 25 01 - beq Label_CA86 ; CPU:$CA7B PRG:0A7B F0 09 +UpdateNtBaseFromPpuCtrl: + lda ppu_ctrl_shadow ; CPU:$CA77 PRG:0A77 A5 F0 + and timer_hi ; CPU:$CA79 PRG:0A79 25 01 + beq UpdateNtBaseFromPpuCtrl_Base0 ; CPU:$CA7B PRG:0A7B F0 09 lda #$24 ; CPU:$CA7D PRG:0A7D A9 24 - sta ZpF2 ; CPU:$CA7F PRG:0A7F 85 F2 + sta nt_base_hi ; CPU:$CA7F PRG:0A7F 85 F2 lda #$40 ; CPU:$CA81 PRG:0A81 A9 40 - sta ZpF3 ; CPU:$CA83 PRG:0A83 85 F3 + sta nt_base_lo ; CPU:$CA83 PRG:0A83 85 F3 rts ; CPU:$CA85 PRG:0A85 60 ; ----------------------------------------------------------------------------- -; Routine: Label_CA86 +; Routine: UpdateNtBaseFromPpuCtrl_Base0 ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -1454,22 +1662,21 @@ Label_CA77: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_CA86: +UpdateNtBaseFromPpuCtrl_Base0: lda #$20 ; CPU:$CA86 PRG:0A86 A9 20 - sta ZpF2 ; CPU:$CA88 PRG:0A88 85 F2 + sta nt_base_hi ; CPU:$CA88 PRG:0A88 85 F2 lda #$00 ; CPU:$CA8A PRG:0A8A A9 00 - sta ZpF3 ; CPU:$CA8C PRG:0A8C 85 F3 + sta nt_base_lo ; CPU:$CA8C PRG:0A8C 85 F3 rts ; CPU:$CA8E PRG:0A8E 60 ; ----------------------------------------------------------------------------- -; Routine: Label_CA8F -; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. -; Local: Continues its parent routine along the condition or operation encoded in this label, -; then returns, branches again, or rejoins shared code as documented by the instructions. -; Parameters: Undetermined in Pass 1 unless implied by the caller. -; Returns: Undetermined in Pass 1; status flags and registers may carry results. -; Clobbers: Undetermined in Pass 1. +; Routine: SetNtBaseFromA +; Global: Installs the nametable-select bit from A and recomputes nt_base_hi/lo. +; Local: SetNtSelectBit followed by UpdateNtBaseFromPpuCtrl. +; Parameters: A = the nametable-select bit value. +; Returns: rts. +; Clobbers: A; ppu_ctrl_shadow, nt_base_hi/lo. ; ----------------------------------------------------------------------------- -Label_CA8F: +SetNtBaseFromA: pha ; CPU:$CA8F PRG:0A8F 48 jsr $CA6F ; CPU:$CA90 PRG:0A90 20 6F CA pla ; CPU:$CA93 PRG:0A93 68 @@ -1477,58 +1684,55 @@ Label_CA8F: ; ---- data $CA97-$CAA2 (12 bytes) ---- .byte $A5, $F3, $F0, $02, $A9, $01, $60, $A5, $F0, $29, $01, $60 ; CPU:$CA97 PRG:0A97 A5 F3 F0 02 A9 01 60 A5 F0 29 01 60 ; ----------------------------------------------------------------------------- -; Routine: Label_CAA3 -; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. -; Local: Continues its parent routine along the condition or operation encoded in this label, -; then returns, branches again, or rejoins shared code as documented by the instructions. -; Parameters: Undetermined in Pass 1 unless implied by the caller. -; Returns: Undetermined in Pass 1; status flags and registers may carry results. -; Clobbers: Undetermined in Pass 1. +; Routine: WritePpuAddr +; Global: Sets the VRAM address latch from ppu_addr_hi then ppu_addr_lo. +; Local: The single choke point for PPUADDR in the whole ROM. +; Parameters: ppu_addr_hi/lo = the address to select. +; Returns: rts. +; Clobbers: PPUADDR (and therefore the internal VRAM latch). ; ----------------------------------------------------------------------------- -Label_CAA3: - lda ZpFD ; CPU:$CAA3 PRG:0AA3 A5 FD - sta $2006 ; CPU:$CAA5 PRG:0AA5 8D 06 20 - lda ZpFC ; CPU:$CAA8 PRG:0AA8 A5 FC - sta $2006 ; CPU:$CAAA PRG:0AAA 8D 06 20 +WritePpuAddr: + lda ppu_addr_hi ; CPU:$CAA3 PRG:0AA3 A5 FD + sta PPUADDR ; CPU:$CAA5 PRG:0AA5 8D 06 20 + lda ppu_addr_lo ; CPU:$CAA8 PRG:0AA8 A5 FC + sta PPUADDR ; CPU:$CAAA PRG:0AAA 8D 06 20 rts ; CPU:$CAAD PRG:0AAD 60 ; ----------------------------------------------------------------------------- -; Routine: Label_CAAE -; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. -; Local: Continues its parent routine along the condition or operation encoded in this label, -; then returns, branches again, or rejoins shared code as documented by the instructions. -; Parameters: Undetermined in Pass 1 unless implied by the caller. -; Returns: Undetermined in Pass 1; status flags and registers may carry results. -; Clobbers: Undetermined in Pass 1. +; Routine: ReadVramByte +; Global: Selects ppu_addr, reads the byte through PPUDATA and folds it into the +; running VRAM checksum in vram_update_checksum. +; Local: The read half of the verified VRAM write path. +; Parameters: ppu_addr_hi/lo = the address to read. +; Returns: A = the byte read, already added into vram_update_checksum. +; Clobbers: A; vram_update_checksum, PPUADDR, PPUDATA. ; ----------------------------------------------------------------------------- -Label_CAAE: +ReadVramByte: jsr $CAA3 ; CPU:$CAAE PRG:0AAE 20 A3 CA jsr $CAB9 ; CPU:$CAB1 PRG:0AB1 20 B9 CA - adc ZpEF ; CPU:$CAB4 PRG:0AB4 65 EF - sta ZpEF ; CPU:$CAB6 PRG:0AB6 85 EF + adc vram_update_checksum ; CPU:$CAB4 PRG:0AB4 65 EF + sta vram_update_checksum ; CPU:$CAB6 PRG:0AB6 85 EF rts ; CPU:$CAB8 PRG:0AB8 60 ; ----------------------------------------------------------------------------- -; Routine: Label_CAB9 -; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. -; Local: Continues its parent routine along the condition or operation encoded in this label, -; then returns, branches again, or rejoins shared code as documented by the instructions. -; Parameters: Undetermined in Pass 1 unless implied by the caller. -; Returns: Undetermined in Pass 1; status flags and registers may carry results. -; Clobbers: Undetermined in Pass 1. +; Routine: ReadPpuData +; Global: One-tick read of PPUDATA. +; Local: The caller is responsible for the dummy read after a PPUADDR write. +; Parameters: None. +; Returns: A = PPUDATA. +; Clobbers: A. ; ----------------------------------------------------------------------------- -Label_CAB9: - lda $2007 ; CPU:$CAB9 PRG:0AB9 AD 07 20 +ReadPpuData: + lda PPUDATA ; CPU:$CAB9 PRG:0AB9 AD 07 20 rts ; CPU:$CABC PRG:0ABC 60 ; ----------------------------------------------------------------------------- -; Routine: Label_CABD -; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. -; Local: Continues its parent routine along the condition or operation encoded in this label, -; then returns, branches again, or rejoins shared code as documented by the instructions. -; Parameters: Undetermined in Pass 1 unless implied by the caller. -; Returns: Undetermined in Pass 1; status flags and registers may carry results. -; Clobbers: Undetermined in Pass 1. +; Routine: WritePpuData +; Global: One-tick write of A to PPUDATA. +; Local: The inner loop body of every VRAM fill and copy in this ROM. +; Parameters: A = the byte to store. +; Returns: rts. +; Clobbers: PPUDATA. ; ----------------------------------------------------------------------------- -Label_CABD: - sta $2007 ; CPU:$CABD PRG:0ABD 8D 07 20 +WritePpuData: + sta PPUDATA ; CPU:$CABD PRG:0ABD 8D 07 20 rts ; CPU:$CAC0 PRG:0AC0 60 ; ---- data $CAC1-$CAF6 (54 bytes) ---- .byte $48, $20, $A3, $CA, $68, $4C, $BD, $CA, $20, $AE, $CA, $4C, $B9, $CA, $A4, $FD ; CPU:$CAC1 PRG:0AC1 48 20 A3 CA 68 4C BD CA 20 AE CA 4C B9 CA A4 FD @@ -1536,77 +1740,74 @@ Label_CABD: .byte $06, $FC, $26, $FD, $06, $FC, $26, $FD, $98, $65, $FC, $85, $FC, $A9, $00, $65 ; CPU:$CAE1 PRG:0AE1 06 FC 26 FD 06 FC 26 FD 98 65 FC 85 FC A9 00 65 .byte $FD, $65, $F2, $85, $FD, $60 ; CPU:$CAF1 PRG:0AF1 FD 65 F2 85 FD 60 ; ----------------------------------------------------------------------------- -; Routine: Label_CAF7 -; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. -; Local: Continues its parent routine along the condition or operation encoded in this label, -; then returns, branches again, or rejoins shared code as documented by the instructions. -; Parameters: Undetermined in Pass 1 unless implied by the caller. -; Returns: Undetermined in Pass 1; status flags and registers may carry results. -; Clobbers: Undetermined in Pass 1. +; Routine: ComputeTileAddress +; Global: Builds the VRAM address of a nametable cell: nt_base + Y*32 + X. +; Local: The row (Y) contributes five shifted adds; the result is returned in X/Y. +; Parameters: Y = the tile row, X = the tile column; nt_base_hi/lo = the base. +; Returns: X = address high, Y = address low. +; Clobbers: A, X, Y, ppu_addr_temp_lo/hi. ; ----------------------------------------------------------------------------- -Label_CAF7: +ComputeTileAddress: lda #$00 ; CPU:$CAF7 PRG:0AF7 A9 00 - sta ZpF7 ; CPU:$CAF9 PRG:0AF9 85 F7 - sty ZpF6 ; CPU:$CAFB PRG:0AFB 84 F6 - asl ZpF6 ; CPU:$CAFD PRG:0AFD 06 F6 - rol ZpF7 ; CPU:$CAFF PRG:0AFF 26 F7 - asl ZpF6 ; CPU:$CB01 PRG:0B01 06 F6 - rol ZpF7 ; CPU:$CB03 PRG:0B03 26 F7 - asl ZpF6 ; CPU:$CB05 PRG:0B05 06 F6 - rol ZpF7 ; CPU:$CB07 PRG:0B07 26 F7 - asl ZpF6 ; CPU:$CB09 PRG:0B09 06 F6 - rol ZpF7 ; CPU:$CB0B PRG:0B0B 26 F7 - asl ZpF6 ; CPU:$CB0D PRG:0B0D 06 F6 - rol ZpF7 ; CPU:$CB0F PRG:0B0F 26 F7 + sta ppu_addr_temp_hi ; CPU:$CAF9 PRG:0AF9 85 F7 + sty ppu_addr_temp_lo ; CPU:$CAFB PRG:0AFB 84 F6 + asl ppu_addr_temp_lo ; CPU:$CAFD PRG:0AFD 06 F6 + rol ppu_addr_temp_hi ; CPU:$CAFF PRG:0AFF 26 F7 + asl ppu_addr_temp_lo ; CPU:$CB01 PRG:0B01 06 F6 + rol ppu_addr_temp_hi ; CPU:$CB03 PRG:0B03 26 F7 + asl ppu_addr_temp_lo ; CPU:$CB05 PRG:0B05 06 F6 + rol ppu_addr_temp_hi ; CPU:$CB07 PRG:0B07 26 F7 + asl ppu_addr_temp_lo ; CPU:$CB09 PRG:0B09 06 F6 + rol ppu_addr_temp_hi ; CPU:$CB0B PRG:0B0B 26 F7 + asl ppu_addr_temp_lo ; CPU:$CB0D PRG:0B0D 06 F6 + rol ppu_addr_temp_hi ; CPU:$CB0F PRG:0B0F 26 F7 txa ; CPU:$CB11 PRG:0B11 8A - adc ZpF6 ; CPU:$CB12 PRG:0B12 65 F6 + adc ppu_addr_temp_lo ; CPU:$CB12 PRG:0B12 65 F6 tay ; CPU:$CB14 PRG:0B14 A8 lda #$00 ; CPU:$CB15 PRG:0B15 A9 00 - adc ZpF7 ; CPU:$CB17 PRG:0B17 65 F7 - adc ZpF2 ; CPU:$CB19 PRG:0B19 65 F2 + adc ppu_addr_temp_hi ; CPU:$CB17 PRG:0B17 65 F7 + adc nt_base_hi ; CPU:$CB19 PRG:0B19 65 F2 tax ; CPU:$CB1B PRG:0B1B AA rts ; CPU:$CB1C PRG:0B1C 60 ; ----------------------------------------------------------------------------- -; Routine: Label_CB1D -; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. -; Local: Continues its parent routine along the condition or operation encoded in this label, -; then returns, branches again, or rejoins shared code as documented by the instructions. -; Parameters: Undetermined in Pass 1 unless implied by the caller. -; Returns: Undetermined in Pass 1; status flags and registers may carry results. -; Clobbers: Undetermined in Pass 1. +; Routine: SetPpuCtrlAndMask +; Global: Latches PPUCTRL from A and PPUMASK from X in one call. +; Local: The reset path uses it to park the PPU in a known state ($10/$06). +; Parameters: A = PPUCTRL value, X = PPUMASK value. +; Returns: rts. +; Clobbers: ppu_ctrl_shadow, ppu_mask_shadow, PPUCTRL, PPUMASK. ; ----------------------------------------------------------------------------- -Label_CB1D: - stx $2001 ; CPU:$CB1D PRG:0B1D 8E 01 20 - stx ZpF1 ; CPU:$CB20 PRG:0B20 86 F1 +SetPpuCtrlAndMask: + stx PPUMASK ; CPU:$CB1D PRG:0B1D 8E 01 20 + stx ppu_mask_shadow ; CPU:$CB20 PRG:0B20 86 F1 jmp $CA3C ; CPU:$CB22 PRG:0B22 4C 3C CA ; ----------------------------------------------------------------------------- -; Routine: Label_CB25 -; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. -; Local: Continues its parent routine along the condition or operation encoded in this label, -; then returns, branches again, or rejoins shared code as documented by the instructions. -; Parameters: Undetermined in Pass 1 unless implied by the caller. -; Returns: Undetermined in Pass 1; status flags and registers may carry results. -; Clobbers: Undetermined in Pass 1. +; Routine: TriggerOamDma +; Global: Starts a $02 page DMA into OAM. +; Local: Called from the NMI once the sprite shadow at $0200-$02FF is complete. +; Parameters: None. +; Returns: rts. +; Clobbers: A; OAMDMA. ; ----------------------------------------------------------------------------- -Label_CB25: +TriggerOamDma: lda #$02 ; CPU:$CB25 PRG:0B25 A9 02 - sta $4014 ; CPU:$CB27 PRG:0B27 8D 14 40 + sta OAMDMA ; CPU:$CB27 PRG:0B27 8D 14 40 rts ; CPU:$CB2A PRG:0B2A 60 ; ----------------------------------------------------------------------------- -; Routine: Label_CB2B -; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. -; Local: Continues its parent routine along the condition or operation encoded in this label, -; then returns, branches again, or rejoins shared code as documented by the instructions. -; Parameters: Undetermined in Pass 1 unless implied by the caller. -; Returns: Undetermined in Pass 1; status flags and registers may carry results. -; Clobbers: Undetermined in Pass 1. +; Routine: FillVramByte +; Global: Writes A into ppu_addr, ppu_src_lo/hi times. +; Local: The byte count lives in the ppu_src pair, so the routine decrements that +; pair through DecPpuSrcCount. +; Parameters: A = the byte, ppu_addr_hi/lo = the destination, ppu_src = the count. +; Returns: rts. +; Clobbers: A, X, Y; ppu_src_lo/hi, PPUDATA. ; ----------------------------------------------------------------------------- -Label_CB2B: +FillVramByte: pha ; CPU:$CB2B PRG:0B2B 48 jsr $CAA3 ; CPU:$CB2C PRG:0B2C 20 A3 CA pla ; CPU:$CB2F PRG:0B2F 68 ; ----------------------------------------------------------------------------- -; Routine: Label_CB30 +; Routine: FillVramByte_Loop ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -1614,13 +1815,13 @@ Label_CB2B: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_CB30: +FillVramByte_Loop: jsr $CABD ; CPU:$CB30 PRG:0B30 20 BD CA jsr $CB39 ; CPU:$CB33 PRG:0B33 20 39 CB - bne Label_CB30 ; CPU:$CB36 PRG:0B36 D0 F8 + bne FillVramByte_Loop ; CPU:$CB36 PRG:0B36 D0 F8 rts ; CPU:$CB38 PRG:0B38 60 ; ----------------------------------------------------------------------------- -; Routine: Label_CB39 +; Routine: DecPpuSrcCount ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -1628,13 +1829,29 @@ Label_CB30: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_CB39: +DecPpuSrcCount: ldx #$F8 ; CPU:$CB39 PRG:0B39 A2 F8 jmp $CB45 ; CPU:$CB3B PRG:0B3B 4C 45 CB ; ---- data $CB3E-$CB44 (7 bytes) ---- .byte $A2, $FA, $4C, $45, $CB, $A2, $FC ; CPU:$CB3E PRG:0B3E A2 FA 4C 45 CB A2 FC ; ----------------------------------------------------------------------------- -; Routine: Label_CB45 +; Routine: DecCount16 +; Global: Generic 16-bit decrement of the counter whose high byte address is in X. +; Local: X selects one of the four zero-page pointer pairs: $F8 (ppu_src), $FA (ptr), +; $FC (ppu_addr) or $FE (ppu_addr_src). Z is clear while the counter is nonzero, +; which is what makes the callers' `bne` a loop test. +; Parameters: X = the high byte address of the counter pair. +; Returns: rts; Z clear if the counter is still nonzero. +; Clobbers: Y, flags; the selected pair. +; ----------------------------------------------------------------------------- +DecCount16: + ldy timer_lo,x ; CPU:$CB45 PRG:0B45 B4 00 + beq DecCount16_Borrow ; CPU:$CB47 PRG:0B47 F0 07 + dec timer_lo,x ; CPU:$CB49 PRG:0B49 D6 00 + bne DecCount16_Return ; CPU:$CB4B PRG:0B4B D0 02 + ldy timer_hi,x ; CPU:$CB4D PRG:0B4D B4 01 +; ----------------------------------------------------------------------------- +; Routine: DecCount16_Return ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -1642,25 +1859,10 @@ Label_CB39: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_CB45: - ldy Zp00,x ; CPU:$CB45 PRG:0B45 B4 00 - beq Label_CB50 ; CPU:$CB47 PRG:0B47 F0 07 - dec Zp00,x ; CPU:$CB49 PRG:0B49 D6 00 - bne Label_CB4F ; CPU:$CB4B PRG:0B4B D0 02 - ldy Zp01,x ; CPU:$CB4D PRG:0B4D B4 01 -; ----------------------------------------------------------------------------- -; Routine: Label_CB4F -; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. -; Local: Continues its parent routine along the condition or operation encoded in this label, -; then returns, branches again, or rejoins shared code as documented by the instructions. -; Parameters: Undetermined in Pass 1 unless implied by the caller. -; Returns: Undetermined in Pass 1; status flags and registers may carry results. -; Clobbers: Undetermined in Pass 1. -; ----------------------------------------------------------------------------- -Label_CB4F: +DecCount16_Return: rts ; CPU:$CB4F PRG:0B4F 60 ; ----------------------------------------------------------------------------- -; Routine: Label_CB50 +; Routine: DecCount16_Borrow ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -1668,41 +1870,48 @@ Label_CB4F: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_CB50: - dec Zp01,x ; CPU:$CB50 PRG:0B50 D6 01 - dec Zp00,x ; CPU:$CB52 PRG:0B52 D6 00 +DecCount16_Borrow: + dec timer_hi,x ; CPU:$CB50 PRG:0B50 D6 01 + dec timer_lo,x ; CPU:$CB52 PRG:0B52 D6 00 rts ; CPU:$CB54 PRG:0B54 60 ; ---- data $CB55-$CB59 (5 bytes) ---- .byte $A2, $F8, $4C, $61, $CB ; CPU:$CB55 PRG:0B55 A2 F8 4C 61 CB ; ----------------------------------------------------------------------------- -; Routine: Label_CB5A -; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. -; Local: Continues its parent routine along the condition or operation encoded in this label, -; then returns, branches again, or rejoins shared code as documented by the instructions. -; Parameters: Undetermined in Pass 1 unless implied by the caller. -; Returns: Undetermined in Pass 1; status flags and registers may carry results. -; Clobbers: Undetermined in Pass 1. +; Routine: IncPtr +; Global: 16-bit increment of the ptr_lo/hi pointer while a counted copy walks memory. +; Local: Enters IncCount16 with X = $FA, the high byte of ptr_lo. +; Parameters: None. +; Returns: rts. +; Clobbers: flags; ptr_lo/hi. ; ----------------------------------------------------------------------------- -Label_CB5A: +IncPtr: ldx #$FA ; CPU:$CB5A PRG:0B5A A2 FA jmp $CB61 ; CPU:$CB5C PRG:0B5C 4C 61 CB -; ---- data $CB5F-$CB60 (2 bytes) ---- - .byte $A2, $FC ; CPU:$CB5F PRG:0B5F A2 FC ; ----------------------------------------------------------------------------- -; Routine: Label_CB61 -; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. -; Local: Continues its parent routine along the condition or operation encoded in this label, -; then returns, branches again, or rejoins shared code as documented by the instructions. -; Parameters: Undetermined in Pass 1 unless implied by the caller. -; Returns: Undetermined in Pass 1; status flags and registers may carry results. -; Clobbers: Undetermined in Pass 1. +; Routine: IncPpuAddr +; Global: 16-bit increment of the ppu_addr pointer pair. +; Local: A counted-copy stub: selects the ppu_addr pair (X = $FC) and joins IncCount16, +; which is why the entry is two bytes into the pointer table and not a full routine. +; Parameters: none. +; Returns: none. +; Clobbers: A, ppu_addr_lo/hi. ; ----------------------------------------------------------------------------- -Label_CB61: - inc Zp00,x ; CPU:$CB61 PRG:0B61 F6 00 - beq Label_CB66 ; CPU:$CB63 PRG:0B63 F0 01 +IncPpuAddr: + ldx #$FC ; CPU:$CB5F PRG:0B5F A2 FC +; ----------------------------------------------------------------------------- +; Routine: IncCount16 +; Global: Generic 16-bit increment of the counter whose high byte address is in X. +; Local: The counterpart of DecCount16, with the same $F8/$FA/$FC/$FE selection. +; Parameters: X = the high byte address of the counter pair. +; Returns: rts. +; Clobbers: flags; the selected pair. +; ----------------------------------------------------------------------------- +IncCount16: + inc timer_lo,x ; CPU:$CB61 PRG:0B61 F6 00 + beq IncCount16_Hi ; CPU:$CB63 PRG:0B63 F0 01 rts ; CPU:$CB65 PRG:0B65 60 ; ----------------------------------------------------------------------------- -; Routine: Label_CB66 +; Routine: IncCount16_Hi ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -1710,23 +1919,24 @@ Label_CB61: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_CB66: - inc Zp01,x ; CPU:$CB66 PRG:0B66 F6 01 +IncCount16_Hi: + inc timer_hi,x ; CPU:$CB66 PRG:0B66 F6 01 rts ; CPU:$CB68 PRG:0B68 60 ; ----------------------------------------------------------------------------- -; Routine: Label_CB69 -; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. -; Local: Continues its parent routine along the condition or operation encoded in this label, -; then returns, branches again, or rejoins shared code as documented by the instructions. -; Parameters: Undetermined in Pass 1 unless implied by the caller. -; Returns: Undetermined in Pass 1; status flags and registers may carry results. -; Clobbers: Undetermined in Pass 1. +; Routine: CopyToVram +; Global: Copies ppu_src_lo/hi bytes from the CPU pointer to a VRAM destination. +; Local: The caller sets ppu_addr = the CPU source, ptr = the VRAM destination and +; ppu_src = the length; SwapPpuAddrAndPtr exchanges the two, WritePpuAddr +; latches the destination and the loop walks the source with (ptr_lo),y. +; Parameters: ppu_addr = source, ptr = destination, ppu_src = count. +; Returns: rts when the count reaches zero. +; Clobbers: A, X, Y; ptr_lo/hi, ppu_src_lo/hi, ppu_addr_lo/hi, PPUADDR, PPUDATA. ; ----------------------------------------------------------------------------- -Label_CB69: +CopyToVram: jsr $CB92 ; CPU:$CB69 PRG:0B69 20 92 CB jsr $CAA3 ; CPU:$CB6C PRG:0B6C 20 A3 CA ; ----------------------------------------------------------------------------- -; Routine: Label_CB6F +; Routine: CopyToVram_Loop ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -1734,27 +1944,27 @@ Label_CB69: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_CB6F: +CopyToVram_Loop: ldx #$00 ; CPU:$CB6F PRG:0B6F A2 00 - lda (ZpFA,x) ; CPU:$CB71 PRG:0B71 A1 FA + lda (ptr_lo,x) ; CPU:$CB71 PRG:0B71 A1 FA jsr $CABD ; CPU:$CB73 PRG:0B73 20 BD CA jsr $CB5A ; CPU:$CB76 PRG:0B76 20 5A CB jsr $CB39 ; CPU:$CB79 PRG:0B79 20 39 CB - bne Label_CB6F ; CPU:$CB7C PRG:0B7C D0 F1 + bne CopyToVram_Loop ; CPU:$CB7C PRG:0B7C D0 F1 rts ; CPU:$CB7E PRG:0B7E 60 ; ----------------------------------------------------------------------------- -; Routine: Label_CB7F -; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. -; Local: Continues its parent routine along the condition or operation encoded in this label, -; then returns, branches again, or rejoins shared code as documented by the instructions. -; Parameters: Undetermined in Pass 1 unless implied by the caller. -; Returns: Undetermined in Pass 1; status flags and registers may carry results. -; Clobbers: Undetermined in Pass 1. +; Routine: CopyFromVram +; Global: Copies ppu_src_lo/hi bytes out of VRAM into the CPU address held in ptr. +; Local: Selects the source through WritePpuAddr, then stores each PPUDATA byte +; through the (ptr_lo),y indirect. +; Parameters: ppu_addr = the VRAM source, ptr = the CPU destination, ppu_src = count. +; Returns: rts when the count reaches zero. +; Clobbers: A, X, Y; ptr_lo/hi, ppu_src_lo/hi, PPUADDR, PPUDATA. ; ----------------------------------------------------------------------------- -Label_CB7F: +CopyFromVram: jsr $CAAE ; CPU:$CB7F PRG:0B7F 20 AE CA ; ----------------------------------------------------------------------------- -; Routine: Label_CB82 +; Routine: CopyFromVram_Loop ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -1762,66 +1972,63 @@ Label_CB7F: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_CB82: +CopyFromVram_Loop: jsr $CAB9 ; CPU:$CB82 PRG:0B82 20 B9 CA ldx #$00 ; CPU:$CB85 PRG:0B85 A2 00 - sta (ZpFA,x) ; CPU:$CB87 PRG:0B87 81 FA + sta (ptr_lo,x) ; CPU:$CB87 PRG:0B87 81 FA jsr $CB5A ; CPU:$CB89 PRG:0B89 20 5A CB jsr $CB39 ; CPU:$CB8C PRG:0B8C 20 39 CB - bne Label_CB82 ; CPU:$CB8F PRG:0B8F D0 F1 + bne CopyFromVram_Loop ; CPU:$CB8F PRG:0B8F D0 F1 rts ; CPU:$CB91 PRG:0B91 60 ; ----------------------------------------------------------------------------- -; Routine: Label_CB92 -; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. -; Local: Continues its parent routine along the condition or operation encoded in this label, -; then returns, branches again, or rejoins shared code as documented by the instructions. -; Parameters: Undetermined in Pass 1 unless implied by the caller. -; Returns: Undetermined in Pass 1; status flags and registers may carry results. -; Clobbers: Undetermined in Pass 1. +; Routine: SwapPpuAddrAndPtr +; Global: Exchanges the ppu_addr and ptr pointer pairs, saving and restoring A and X. +; Local: Lets CopyToVram/CopyFromVram accept their inputs in one fixed order. +; Parameters: None. +; Returns: rts; A and X as on entry. +; Clobbers: ptr_lo/hi, ppu_addr_lo/hi. ; ----------------------------------------------------------------------------- -Label_CB92: +SwapPpuAddrAndPtr: pha ; CPU:$CB92 PRG:0B92 48 txa ; CPU:$CB93 PRG:0B93 8A pha ; CPU:$CB94 PRG:0B94 48 - lda ZpFA ; CPU:$CB95 PRG:0B95 A5 FA - ldx ZpFC ; CPU:$CB97 PRG:0B97 A6 FC - sta ZpFC ; CPU:$CB99 PRG:0B99 85 FC - stx ZpFA ; CPU:$CB9B PRG:0B9B 86 FA - lda ZpFB ; CPU:$CB9D PRG:0B9D A5 FB - ldx ZpFD ; CPU:$CB9F PRG:0B9F A6 FD - sta ZpFD ; CPU:$CBA1 PRG:0BA1 85 FD - stx ZpFB ; CPU:$CBA3 PRG:0BA3 86 FB + lda ptr_lo ; CPU:$CB95 PRG:0B95 A5 FA + ldx ppu_addr_lo ; CPU:$CB97 PRG:0B97 A6 FC + sta ppu_addr_lo ; CPU:$CB99 PRG:0B99 85 FC + stx ptr_lo ; CPU:$CB9B PRG:0B9B 86 FA + lda ptr_hi ; CPU:$CB9D PRG:0B9D A5 FB + ldx ppu_addr_hi ; CPU:$CB9F PRG:0B9F A6 FD + sta ppu_addr_hi ; CPU:$CBA1 PRG:0BA1 85 FD + stx ptr_hi ; CPU:$CBA3 PRG:0BA3 86 FB pla ; CPU:$CBA5 PRG:0BA5 68 tax ; CPU:$CBA6 PRG:0BA6 AA pla ; CPU:$CBA7 PRG:0BA7 68 rts ; CPU:$CBA8 PRG:0BA8 60 ; ----------------------------------------------------------------------------- -; Routine: Label_CBA9 -; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. -; Local: Continues its parent routine along the condition or operation encoded in this label, -; then returns, branches again, or rejoins shared code as documented by the instructions. -; Parameters: Undetermined in Pass 1 unless implied by the caller. -; Returns: Undetermined in Pass 1; status flags and registers may carry results. -; Clobbers: Undetermined in Pass 1. +; Routine: SetPpuAddrFromXY +; Global: Latches ppu_addr_hi from X and ppu_addr_lo from Y. +; Local: The usual way an address is handed to the copy and fill helpers. +; Parameters: X = address high, Y = address low. +; Returns: rts. +; Clobbers: ppu_addr_hi/lo. ; ----------------------------------------------------------------------------- -Label_CBA9: - stx ZpFD ; CPU:$CBA9 PRG:0BA9 86 FD - sty ZpFC ; CPU:$CBAB PRG:0BAB 84 FC +SetPpuAddrFromXY: + stx ppu_addr_hi ; CPU:$CBA9 PRG:0BA9 86 FD + sty ppu_addr_lo ; CPU:$CBAB PRG:0BAB 84 FC rts ; CPU:$CBAD PRG:0BAD 60 ; ----------------------------------------------------------------------------- -; Routine: Label_CBAE -; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. -; Local: Continues its parent routine along the condition or operation encoded in this label, -; then returns, branches again, or rejoins shared code as documented by the instructions. -; Parameters: Undetermined in Pass 1 unless implied by the caller. -; Returns: Undetermined in Pass 1; status flags and registers may carry results. -; Clobbers: Undetermined in Pass 1. +; Routine: FillOamOffscreen +; Global: Fills the whole $0200 sprite page with $F8, parking every sprite off-screen. +; Local: Runs before anything is drawn in a frame so unused OAM entries stay invisible. +; Parameters: None. +; Returns: rts. +; Clobbers: A, X; $0200-$02FF. ; ----------------------------------------------------------------------------- -Label_CBAE: +FillOamOffscreen: ldx #$00 ; CPU:$CBAE PRG:0BAE A2 00 lda #$F8 ; CPU:$CBB0 PRG:0BB0 A9 F8 ; ----------------------------------------------------------------------------- -; Routine: Label_CBB2 +; Routine: FillOamOffscreen_Loop ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -1829,29 +2036,29 @@ Label_CBAE: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_CBB2: +FillOamOffscreen_Loop: sta $0200,x ; CPU:$CBB2 PRG:0BB2 9D 00 02 dex ; CPU:$CBB5 PRG:0BB5 CA - bne Label_CBB2 ; CPU:$CBB6 PRG:0BB6 D0 FA + bne FillOamOffscreen_Loop ; CPU:$CBB6 PRG:0BB6 D0 FA rts ; CPU:$CBB8 PRG:0BB8 60 ; ----------------------------------------------------------------------------- -; Routine: Label_CBB9 -; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. -; Local: Continues its parent routine along the condition or operation encoded in this label, -; then returns, branches again, or rejoins shared code as documented by the instructions. -; Parameters: Undetermined in Pass 1 unless implied by the caller. -; Returns: Undetermined in Pass 1; status flags and registers may carry results. -; Clobbers: Undetermined in Pass 1. +; Routine: WriteStringToPpuData +; Global: Streams the $00-terminated string at ptr into PPUDATA. +; Local: Advances ptr through IncPtr, and calls QueueVramByte's tick so the queue +; accounting stays consistent. +; Parameters: ptr_lo/hi = the string address. +; Returns: rts at the terminator. +; Clobbers: A, X, Y; ptr_lo/hi, PPUDATA. ; ----------------------------------------------------------------------------- -Label_CBB9: +WriteStringToPpuData: ldy #$00 ; CPU:$CBB9 PRG:0BB9 A0 00 - lda (ZpFA),y ; CPU:$CBBB PRG:0BBB B1 FA - beq Label_CBC8 ; CPU:$CBBD PRG:0BBD F0 09 + lda (ptr_lo),y ; CPU:$CBBB PRG:0BBB B1 FA + beq WriteStringToPpuData_Done ; CPU:$CBBD PRG:0BBD F0 09 jsr $CB5A ; CPU:$CBBF PRG:0BBF 20 5A CB - sta $2007 ; CPU:$CBC2 PRG:0BC2 8D 07 20 + sta PPUDATA ; CPU:$CBC2 PRG:0BC2 8D 07 20 jmp $CBB9 ; CPU:$CBC5 PRG:0BC5 4C B9 CB ; ----------------------------------------------------------------------------- -; Routine: Label_CBC8 +; Routine: WriteStringToPpuData_Done ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -1859,46 +2066,47 @@ Label_CBB9: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_CBC8: +WriteStringToPpuData_Done: rts ; CPU:$CBC8 PRG:0BC8 60 ; ----------------------------------------------------------------------------- -; Routine: Label_CBC9 -; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. -; Local: Continues its parent routine along the condition or operation encoded in this label, -; then returns, branches again, or rejoins shared code as documented by the instructions. -; Parameters: Undetermined in Pass 1 unless implied by the caller. -; Returns: Undetermined in Pass 1; status flags and registers may carry results. -; Clobbers: Undetermined in Pass 1. +; Routine: PrintInlineStringToVram +; Global: Queues the $00-terminated string that follows the jsr at the call site. +; Local: The popped return address is the string itself, so the pushes at the end +; resume execution at the first byte after the terminator. +; Parameters: The string is inline in the code stream after the call. +; Returns: rts to the resumed address. +; Clobbers: A, X, Y; ptr_lo/hi, the stack. ; ----------------------------------------------------------------------------- -Label_CBC9: +PrintInlineStringToVram: pla ; CPU:$CBC9 PRG:0BC9 68 - sta ZpFA ; CPU:$CBCA PRG:0BCA 85 FA + sta ptr_lo ; CPU:$CBCA PRG:0BCA 85 FA pla ; CPU:$CBCC PRG:0BCC 68 - sta ZpFB ; CPU:$CBCD PRG:0BCD 85 FB + sta ptr_hi ; CPU:$CBCD PRG:0BCD 85 FB jsr $CB5A ; CPU:$CBCF PRG:0BCF 20 5A CB jsr $CBB9 ; CPU:$CBD2 PRG:0BD2 20 B9 CB - lda ZpFB ; CPU:$CBD5 PRG:0BD5 A5 FB + lda ptr_hi ; CPU:$CBD5 PRG:0BD5 A5 FB pha ; CPU:$CBD7 PRG:0BD7 48 - lda ZpFA ; CPU:$CBD8 PRG:0BD8 A5 FA + lda ptr_lo ; CPU:$CBD8 PRG:0BD8 A5 FA pha ; CPU:$CBDA PRG:0BDA 48 rts ; CPU:$CBDB PRG:0BDB 60 ; ----------------------------------------------------------------------------- -; Routine: Label_CBDC -; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. -; Local: Continues its parent routine along the condition or operation encoded in this label, -; then returns, branches again, or rejoins shared code as documented by the instructions. -; Parameters: Undetermined in Pass 1 unless implied by the caller. -; Returns: Undetermined in Pass 1; status flags and registers may carry results. -; Clobbers: Undetermined in Pass 1. +; Routine: PrintInlineString +; Global: Prints the $00-terminated string that follows the jsr at the call site. +; Local: Pops the return address into ptr, steps past the jsr's last byte and emits +; characters through QueueVramByte until the terminator, then pushes the +; address after the terminator so the rts resumes there. +; Parameters: The string is inline in the code stream after the call. +; Returns: rts to the resumed address. +; Clobbers: A, X, Y; ptr_lo/hi, the VRAM queue, the stack. ; ----------------------------------------------------------------------------- -Label_CBDC: +PrintInlineString: pla ; CPU:$CBDC PRG:0BDC 68 - sta ZpFA ; CPU:$CBDD PRG:0BDD 85 FA + sta ptr_lo ; CPU:$CBDD PRG:0BDD 85 FA pla ; CPU:$CBDF PRG:0BDF 68 - sta ZpFB ; CPU:$CBE0 PRG:0BE0 85 FB + sta ptr_hi ; CPU:$CBE0 PRG:0BE0 85 FB jsr $CB5A ; CPU:$CBE2 PRG:0BE2 20 5A CB ; ----------------------------------------------------------------------------- -; Routine: Label_CBE5 +; Routine: PrintInlineString_Loop ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -1906,15 +2114,15 @@ Label_CBDC: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_CBE5: +PrintInlineString_Loop: ldy #$00 ; CPU:$CBE5 PRG:0BE5 A0 00 - lda (ZpFA),y ; CPU:$CBE7 PRG:0BE7 B1 FA - beq Label_CBF4 ; CPU:$CBE9 PRG:0BE9 F0 09 + lda (ptr_lo),y ; CPU:$CBE7 PRG:0BE7 B1 FA + beq PrintInlineString_Done ; CPU:$CBE9 PRG:0BE9 F0 09 jsr $CC29 ; CPU:$CBEB PRG:0BEB 20 29 CC jsr $CB5A ; CPU:$CBEE PRG:0BEE 20 5A CB jmp $CBE5 ; CPU:$CBF1 PRG:0BF1 4C E5 CB ; ----------------------------------------------------------------------------- -; Routine: Label_CBF4 +; Routine: PrintInlineString_Done ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -1922,26 +2130,27 @@ Label_CBE5: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_CBF4: - lda ZpFB ; CPU:$CBF4 PRG:0BF4 A5 FB +PrintInlineString_Done: + lda ptr_hi ; CPU:$CBF4 PRG:0BF4 A5 FB pha ; CPU:$CBF6 PRG:0BF6 48 - lda ZpFA ; CPU:$CBF7 PRG:0BF7 A5 FA + lda ptr_lo ; CPU:$CBF7 PRG:0BF7 A5 FA pha ; CPU:$CBF9 PRG:0BF9 48 rts ; CPU:$CBFA PRG:0BFA 60 ; ----------------------------------------------------------------------------- -; Routine: Label_CBFB -; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. -; Local: Continues its parent routine along the condition or operation encoded in this label, -; then returns, branches again, or rejoins shared code as documented by the instructions. -; Parameters: Undetermined in Pass 1 unless implied by the caller. -; Returns: Undetermined in Pass 1; status flags and registers may carry results. -; Clobbers: Undetermined in Pass 1. +; Routine: BeginVramWrite +; Global: Opens a queued VRAM write: waits for queue space, claims a free descriptor +; slot and snapshots the current PPU address into ppu_addr_save. +; Local: The descriptor slot is closed by DrainVramQueue during the next NMI, so a +; begin/queue/copy sequence is atomic with respect to rendering. +; Parameters: X = the caller's index; it is saved and restored. +; Returns: rts with vram_slot_idx pointing at the new descriptor. +; Clobbers: A, X; vram_slot_idx, vram_queue_len, vram_slot_ofs, ppu_addr_save_lo/hi. ; ----------------------------------------------------------------------------- -Label_CBFB: +BeginVramWrite: txa ; CPU:$CBFB PRG:0BFB 8A pha ; CPU:$CBFC PRG:0BFC 48 ; ----------------------------------------------------------------------------- -; Routine: Label_CBFD +; Routine: BeginVramWrite_WaitSpace ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -1949,13 +2158,13 @@ Label_CBFB: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_CBFD: - lda ZpEE ; CPU:$CBFD PRG:0BFD A5 EE +BeginVramWrite_WaitSpace: + lda vram_queue_len ; CPU:$CBFD PRG:0BFD A5 EE cmp #$30 ; CPU:$CBFF PRG:0BFF C9 30 - beq Label_CBFD ; CPU:$CC01 PRG:0C01 F0 FA + beq BeginVramWrite_WaitSpace ; CPU:$CC01 PRG:0C01 F0 FA ldx #$14 ; CPU:$CC03 PRG:0C03 A2 14 ; ----------------------------------------------------------------------------- -; Routine: Label_CC05 +; Routine: BeginVramWrite_FindSlot ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -1963,17 +2172,17 @@ Label_CBFD: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_CC05: - lda ZpD0,x ; CPU:$CC05 PRG:0C05 B5 D0 - beq Label_CC12 ; CPU:$CC07 PRG:0C07 F0 09 +BeginVramWrite_FindSlot: + lda vram_slot_len,x ; CPU:$CC05 PRG:0C05 B5 D0 + beq BeginVramWrite_Alloc ; CPU:$CC07 PRG:0C07 F0 09 txa ; CPU:$CC09 PRG:0C09 8A sec ; CPU:$CC0A PRG:0C0A 38 sbc #$04 ; CPU:$CC0B PRG:0C0B E9 04 tax ; CPU:$CC0D PRG:0C0D AA - bcs Label_CC05 ; CPU:$CC0E PRG:0C0E B0 F5 - bcc Label_CBFD ; CPU:$CC10 PRG:0C10 90 EB + bcs BeginVramWrite_FindSlot ; CPU:$CC0E PRG:0C0E B0 F5 + bcc BeginVramWrite_WaitSpace ; CPU:$CC10 PRG:0C10 90 EB ; ----------------------------------------------------------------------------- -; Routine: Label_CC12 +; Routine: BeginVramWrite_Alloc ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -1981,35 +2190,36 @@ Label_CC05: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_CC12: - stx ZpED ; CPU:$CC12 PRG:0C12 86 ED +BeginVramWrite_Alloc: + stx vram_slot_idx ; CPU:$CC12 PRG:0C12 86 ED jsr $CA38 ; CPU:$CC14 PRG:0C14 20 38 CA - lda ZpEE ; CPU:$CC17 PRG:0C17 A5 EE - sta ZpD1,x ; CPU:$CC19 PRG:0C19 95 D1 + lda vram_queue_len ; CPU:$CC17 PRG:0C17 A5 EE + sta vram_slot_ofs,x ; CPU:$CC19 PRG:0C19 95 D1 jsr $CA48 ; CPU:$CC1B PRG:0C1B 20 48 CA - lda ZpFC ; CPU:$CC1E PRG:0C1E A5 FC - sta ZpF4 ; CPU:$CC20 PRG:0C20 85 F4 - lda ZpFD ; CPU:$CC22 PRG:0C22 A5 FD - sta ZpF5 ; CPU:$CC24 PRG:0C24 85 F5 + lda ppu_addr_lo ; CPU:$CC1E PRG:0C1E A5 FC + sta ppu_addr_save_lo ; CPU:$CC20 PRG:0C20 85 F4 + lda ppu_addr_hi ; CPU:$CC22 PRG:0C22 A5 FD + sta ppu_addr_save_hi ; CPU:$CC24 PRG:0C24 85 F5 pla ; CPU:$CC26 PRG:0C26 68 tax ; CPU:$CC27 PRG:0C27 AA rts ; CPU:$CC28 PRG:0C28 60 ; ----------------------------------------------------------------------------- -; Routine: Label_CC29 -; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. -; Local: Continues its parent routine along the condition or operation encoded in this label, -; then returns, branches again, or rejoins shared code as documented by the instructions. -; Parameters: Undetermined in Pass 1 unless implied by the caller. -; Returns: Undetermined in Pass 1; status flags and registers may carry results. -; Clobbers: Undetermined in Pass 1. +; Routine: QueueVramByte +; Global: Appends one byte to the staged VRAM write, opening a descriptor slot if the +; caller has not already done so. +; Local: The single funnel through which every nametable and attribute write in the +; game passes; vram_queue_len is the write position inside vram_buf. +; Parameters: A = the byte; vram_slot_idx = the current descriptor. +; Returns: A and X as on entry. +; Clobbers: vram_queue_len, vram_slot_len, vram_buf, ppu_addr_save_lo/hi. ; ----------------------------------------------------------------------------- -Label_CC29: +QueueVramByte: pha ; CPU:$CC29 PRG:0C29 48 - sta ZpF6 ; CPU:$CC2A PRG:0C2A 85 F6 + sta ppu_addr_temp_lo ; CPU:$CC2A PRG:0C2A 85 F6 txa ; CPU:$CC2C PRG:0C2C 8A pha ; CPU:$CC2D PRG:0C2D 48 ; ----------------------------------------------------------------------------- -; Routine: Label_CC2E +; Routine: QueueVramByte_WaitSpace ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -2017,22 +2227,22 @@ Label_CC29: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_CC2E: - lda ZpEE ; CPU:$CC2E PRG:0C2E A5 EE +QueueVramByte_WaitSpace: + lda vram_queue_len ; CPU:$CC2E PRG:0C2E A5 EE cmp #$30 ; CPU:$CC30 PRG:0C30 C9 30 - beq Label_CC2E ; CPU:$CC32 PRG:0C32 F0 FA - ldx ZpED ; CPU:$CC34 PRG:0C34 A6 ED - lda ZpD0,x ; CPU:$CC36 PRG:0C36 B5 D0 - bne Label_CC5E ; CPU:$CC38 PRG:0C38 D0 24 - lda ZpF4 ; CPU:$CC3A PRG:0C3A A5 F4 - sta ZpD2,x ; CPU:$CC3C PRG:0C3C 95 D2 - lda ZpF5 ; CPU:$CC3E PRG:0C3E A5 F5 - sta ZpD3,x ; CPU:$CC40 PRG:0C40 95 D3 + beq QueueVramByte_WaitSpace ; CPU:$CC32 PRG:0C32 F0 FA + ldx vram_slot_idx ; CPU:$CC34 PRG:0C34 A6 ED + lda vram_slot_len,x ; CPU:$CC36 PRG:0C36 B5 D0 + bne QueueVramByte_NewSlot ; CPU:$CC38 PRG:0C38 D0 24 + lda ppu_addr_save_lo ; CPU:$CC3A PRG:0C3A A5 F4 + sta vram_slot_addr_lo,x ; CPU:$CC3C PRG:0C3C 95 D2 + lda ppu_addr_save_hi ; CPU:$CC3E PRG:0C3E A5 F5 + sta vram_slot_addr_hi,x ; CPU:$CC40 PRG:0C40 95 D3 jsr $CA38 ; CPU:$CC42 PRG:0C42 20 38 CA - lda ZpEE ; CPU:$CC45 PRG:0C45 A5 EE - sta ZpD1,x ; CPU:$CC47 PRG:0C47 95 D1 + lda vram_queue_len ; CPU:$CC45 PRG:0C45 A5 EE + sta vram_slot_ofs,x ; CPU:$CC47 PRG:0C47 95 D1 ; ----------------------------------------------------------------------------- -; Routine: Label_CC49 +; Routine: QueueVramByte_Store ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -2040,12 +2250,12 @@ Label_CC2E: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_CC49: - inc ZpEE ; CPU:$CC49 PRG:0C49 E6 EE - inc ZpD0,x ; CPU:$CC4B PRG:0C4B F6 D0 +QueueVramByte_Store: + inc vram_queue_len ; CPU:$CC49 PRG:0C49 E6 EE + inc vram_slot_len,x ; CPU:$CC4B PRG:0C4B F6 D0 tax ; CPU:$CC4D PRG:0C4D AA - lda ZpF6 ; CPU:$CC4E PRG:0C4E A5 F6 - sta ZpA0,x ; CPU:$CC50 PRG:0C50 95 A0 + lda ppu_addr_temp_lo ; CPU:$CC4E PRG:0C4E A5 F6 + sta vram_buf,x ; CPU:$CC50 PRG:0C50 95 A0 jsr $CA48 ; CPU:$CC52 PRG:0C52 20 48 CA ldx #$F4 ; CPU:$CC55 PRG:0C55 A2 F4 jsr $CB61 ; CPU:$CC57 PRG:0C57 20 61 CB @@ -2054,7 +2264,7 @@ Label_CC49: pla ; CPU:$CC5C PRG:0C5C 68 rts ; CPU:$CC5D PRG:0C5D 60 ; ----------------------------------------------------------------------------- -; Routine: Label_CC5E +; Routine: QueueVramByte_NewSlot ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -2062,26 +2272,26 @@ Label_CC49: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_CC5E: +QueueVramByte_NewSlot: jsr $CA38 ; CPU:$CC5E PRG:0C5E 20 38 CA - lda ZpEE ; CPU:$CC61 PRG:0C61 A5 EE + lda vram_queue_len ; CPU:$CC61 PRG:0C61 A5 EE jmp $CC49 ; CPU:$CC63 PRG:0C63 4C 49 CC ; ---- data $CC66-$CC7A (21 bytes) ---- .byte $48, $A5, $FA, $85, $E9, $A5, $FB, $85, $EA, $A5, $FC, $85, $EB, $A5, $FD, $85 ; CPU:$CC66 PRG:0C66 48 A5 FA 85 E9 A5 FB 85 EA A5 FC 85 EB A5 FD 85 .byte $EC, $68, $85, $E8, $60 ; CPU:$CC76 PRG:0C76 EC 68 85 E8 60 ; ----------------------------------------------------------------------------- -; Routine: Label_CC7B -; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. -; Local: Continues its parent routine along the condition or operation encoded in this label, -; then returns, branches again, or rejoins shared code as documented by the instructions. -; Parameters: Undetermined in Pass 1 unless implied by the caller. -; Returns: Undetermined in Pass 1; status flags and registers may carry results. -; Clobbers: Undetermined in Pass 1. +; Routine: ResetVramQueue +; Global: Empties the VRAM write queue: clears every descriptor length, the slot +; index and the queue length. +; Local: Called from the reset path and at the start of every NMI. +; Parameters: None. +; Returns: rts. +; Clobbers: A, X; the $D0-$D3 descriptor array, vram_slot_idx, vram_queue_len. ; ----------------------------------------------------------------------------- -Label_CC7B: +ResetVramQueue: ldx #$18 ; CPU:$CC7B PRG:0C7B A2 18 ; ----------------------------------------------------------------------------- -; Routine: Label_CC7D +; Routine: ResetVramQueue_Loop ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -2089,31 +2299,32 @@ Label_CC7B: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_CC7D: +ResetVramQueue_Loop: lda #$00 ; CPU:$CC7D PRG:0C7D A9 00 - sta ZpD0,x ; CPU:$CC7F PRG:0C7F 95 D0 + sta vram_slot_len,x ; CPU:$CC7F PRG:0C7F 95 D0 txa ; CPU:$CC81 PRG:0C81 8A sec ; CPU:$CC82 PRG:0C82 38 sbc #$04 ; CPU:$CC83 PRG:0C83 E9 04 tax ; CPU:$CC85 PRG:0C85 AA - bcs Label_CC7D ; CPU:$CC86 PRG:0C86 B0 F5 + bcs ResetVramQueue_Loop ; CPU:$CC86 PRG:0C86 B0 F5 lda #$00 ; CPU:$CC88 PRG:0C88 A9 00 - sta ZpED ; CPU:$CC8A PRG:0C8A 85 ED - sta ZpEE ; CPU:$CC8C PRG:0C8C 85 EE + sta vram_slot_idx ; CPU:$CC8A PRG:0C8A 85 ED + sta vram_queue_len ; CPU:$CC8C PRG:0C8C 85 EE rts ; CPU:$CC8E PRG:0C8E 60 ; ----------------------------------------------------------------------------- -; Routine: Label_CC8F -; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. -; Local: Continues its parent routine along the condition or operation encoded in this label, -; then returns, branches again, or rejoins shared code as documented by the instructions. -; Parameters: Undetermined in Pass 1 unless implied by the caller. -; Returns: Undetermined in Pass 1; status flags and registers may carry results. -; Clobbers: Undetermined in Pass 1. +; Routine: DrainVramQueue +; Global: The NMI's VRAM pump: walks the six descriptor slots, points PPUADDR at each +; destination and streams its staged bytes out of vram_buf. +; Local: Afterwards it services a pending read-back (vram_read_*) and finally refreshes +; the palette from the shadow at $0080-$009F. +; Parameters: None. +; Returns: rts. +; Clobbers: A, X, Y; PPUADDR, PPUDATA, vram_queue_len, vram_read_len. ; ----------------------------------------------------------------------------- -Label_CC8F: +DrainVramQueue: ldy #$14 ; CPU:$CC8F PRG:0C8F A0 14 ; ----------------------------------------------------------------------------- -; Routine: Label_CC91 +; Routine: DrainVramQueue_Slot ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -2121,20 +2332,20 @@ Label_CC8F: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_CC91: +DrainVramQueue_Slot: lda a:$00D0,y ; CPU:$CC91 PRG:0C91 B9 D0 00 - beq Label_CCBA ; CPU:$CC94 PRG:0C94 F0 24 + beq DrainVramQueue_NextSlot ; CPU:$CC94 PRG:0C94 F0 24 tax ; CPU:$CC96 PRG:0C96 AA lda a:$00D3,y ; CPU:$CC97 PRG:0C97 B9 D3 00 - sta $2006 ; CPU:$CC9A PRG:0C9A 8D 06 20 + sta PPUADDR ; CPU:$CC9A PRG:0C9A 8D 06 20 lda a:$00D2,y ; CPU:$CC9D PRG:0C9D B9 D2 00 - sta $2006 ; CPU:$CCA0 PRG:0CA0 8D 06 20 + sta PPUADDR ; CPU:$CCA0 PRG:0CA0 8D 06 20 tya ; CPU:$CCA3 PRG:0CA3 98 pha ; CPU:$CCA4 PRG:0CA4 48 lda a:$00D1,y ; CPU:$CCA5 PRG:0CA5 B9 D1 00 tay ; CPU:$CCA8 PRG:0CA8 A8 ; ----------------------------------------------------------------------------- -; Routine: Label_CCA9 +; Routine: DrainVramQueue_CopyLoop ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -2142,18 +2353,18 @@ Label_CC91: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_CCA9: +DrainVramQueue_CopyLoop: lda a:$00A0,y ; CPU:$CCA9 PRG:0CA9 B9 A0 00 - sta $2007 ; CPU:$CCAC PRG:0CAC 8D 07 20 + sta PPUDATA ; CPU:$CCAC PRG:0CAC 8D 07 20 iny ; CPU:$CCAF PRG:0CAF C8 dex ; CPU:$CCB0 PRG:0CB0 CA - bne Label_CCA9 ; CPU:$CCB1 PRG:0CB1 D0 F6 + bne DrainVramQueue_CopyLoop ; CPU:$CCB1 PRG:0CB1 D0 F6 pla ; CPU:$CCB3 PRG:0CB3 68 tay ; CPU:$CCB4 PRG:0CB4 A8 lda #$00 ; CPU:$CCB5 PRG:0CB5 A9 00 sta a:$00D0,y ; CPU:$CCB7 PRG:0CB7 99 D0 00 ; ----------------------------------------------------------------------------- -; Routine: Label_CCBA +; Routine: DrainVramQueue_NextSlot ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -2161,25 +2372,25 @@ Label_CCA9: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_CCBA: +DrainVramQueue_NextSlot: tya ; CPU:$CCBA PRG:0CBA 98 sec ; CPU:$CCBB PRG:0CBB 38 sbc #$04 ; CPU:$CCBC PRG:0CBC E9 04 tay ; CPU:$CCBE PRG:0CBE A8 - bcs Label_CC91 ; CPU:$CCBF PRG:0CBF B0 D0 + bcs DrainVramQueue_Slot ; CPU:$CCBF PRG:0CBF B0 D0 lda #$00 ; CPU:$CCC1 PRG:0CC1 A9 00 - sta ZpEE ; CPU:$CCC3 PRG:0CC3 85 EE - lda ZpE8 ; CPU:$CCC5 PRG:0CC5 A5 E8 - beq Label_CCE5 ; CPU:$CCC7 PRG:0CC7 F0 1C + sta vram_queue_len ; CPU:$CCC3 PRG:0CC3 85 EE + lda vram_read_len ; CPU:$CCC5 PRG:0CC5 A5 E8 + beq FlushPaletteToPpu ; CPU:$CCC7 PRG:0CC7 F0 1C tax ; CPU:$CCC9 PRG:0CC9 AA - lda ZpEA ; CPU:$CCCA PRG:0CCA A5 EA - sta $2006 ; CPU:$CCCC PRG:0CCC 8D 06 20 - lda ZpE9 ; CPU:$CCCF PRG:0CCF A5 E9 - sta $2006 ; CPU:$CCD1 PRG:0CD1 8D 06 20 - lda $2007 ; CPU:$CCD4 PRG:0CD4 AD 07 20 + lda vram_read_addr_hi ; CPU:$CCCA PRG:0CCA A5 EA + sta PPUADDR ; CPU:$CCCC PRG:0CCC 8D 06 20 + lda vram_read_addr_lo ; CPU:$CCCF PRG:0CCF A5 E9 + sta PPUADDR ; CPU:$CCD1 PRG:0CD1 8D 06 20 + lda PPUDATA ; CPU:$CCD4 PRG:0CD4 AD 07 20 ldy #$00 ; CPU:$CCD7 PRG:0CD7 A0 00 ; ----------------------------------------------------------------------------- -; Routine: Label_CCD9 +; Routine: DrainVramQueue_ReadLoop ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -2187,32 +2398,32 @@ Label_CCBA: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_CCD9: - lda $2007 ; CPU:$CCD9 PRG:0CD9 AD 07 20 - sta (ZpEB),y ; CPU:$CCDC PRG:0CDC 91 EB +DrainVramQueue_ReadLoop: + lda PPUDATA ; CPU:$CCD9 PRG:0CD9 AD 07 20 + sta (vram_read_dst_lo),y ; CPU:$CCDC PRG:0CDC 91 EB iny ; CPU:$CCDE PRG:0CDE C8 dex ; CPU:$CCDF PRG:0CDF CA - bne Label_CCD9 ; CPU:$CCE0 PRG:0CE0 D0 F7 - stx ZpE8 ; CPU:$CCE2 PRG:0CE2 86 E8 + bne DrainVramQueue_ReadLoop ; CPU:$CCE0 PRG:0CE0 D0 F7 + stx vram_read_len ; CPU:$CCE2 PRG:0CE2 86 E8 rts ; CPU:$CCE4 PRG:0CE4 60 ; ----------------------------------------------------------------------------- -; Routine: Label_CCE5 -; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. -; Local: Continues its parent routine along the condition or operation encoded in this label, -; then returns, branches again, or rejoins shared code as documented by the instructions. -; Parameters: Undetermined in Pass 1 unless implied by the caller. -; Returns: Undetermined in Pass 1; status flags and registers may carry results. -; Clobbers: Undetermined in Pass 1. +; Routine: FlushPaletteToPpu +; Global: Writes the 32-byte palette shadow at $0080-$009F to $3F00-$3F1F. +; Local: Runs at the end of every NMI, and ends by reselecting $3F00 so the PPU +; leaves vblank with a known address. +; Parameters: None. +; Returns: rts. +; Clobbers: A, X, Y; PPUADDR, PPUDATA. ; ----------------------------------------------------------------------------- -Label_CCE5: +FlushPaletteToPpu: lda #$3F ; CPU:$CCE5 PRG:0CE5 A9 3F - sta $2006 ; CPU:$CCE7 PRG:0CE7 8D 06 20 + sta PPUADDR ; CPU:$CCE7 PRG:0CE7 8D 06 20 lda #$00 ; CPU:$CCEA PRG:0CEA A9 00 - sta $2006 ; CPU:$CCEC PRG:0CEC 8D 06 20 + sta PPUADDR ; CPU:$CCEC PRG:0CEC 8D 06 20 ldx #$20 ; CPU:$CCEF PRG:0CEF A2 20 ldy #$00 ; CPU:$CCF1 PRG:0CF1 A0 00 ; ----------------------------------------------------------------------------- -; Routine: Label_CCF3 +; Routine: FlushPaletteToPpu_Loop ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -2220,21 +2431,21 @@ Label_CCE5: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_CCF3: +FlushPaletteToPpu_Loop: lda a:$0080,y ; CPU:$CCF3 PRG:0CF3 B9 80 00 - sta $2007 ; CPU:$CCF6 PRG:0CF6 8D 07 20 + sta PPUDATA ; CPU:$CCF6 PRG:0CF6 8D 07 20 iny ; CPU:$CCF9 PRG:0CF9 C8 dex ; CPU:$CCFA PRG:0CFA CA - bne Label_CCF3 ; CPU:$CCFB PRG:0CFB D0 F6 + bne FlushPaletteToPpu_Loop ; CPU:$CCFB PRG:0CFB D0 F6 lda #$3F ; CPU:$CCFD PRG:0CFD A9 3F - sta $2006 ; CPU:$CCFF PRG:0CFF 8D 06 20 + sta PPUADDR ; CPU:$CCFF PRG:0CFF 8D 06 20 lda #$00 ; CPU:$CD02 PRG:0D02 A9 00 - sta $2006 ; CPU:$CD04 PRG:0D04 8D 06 20 - sta $2006 ; CPU:$CD07 PRG:0D07 8D 06 20 - sta $2006 ; CPU:$CD0A PRG:0D0A 8D 06 20 + sta PPUADDR ; CPU:$CD04 PRG:0D04 8D 06 20 + sta PPUADDR ; CPU:$CD07 PRG:0D07 8D 06 20 + sta PPUADDR ; CPU:$CD0A PRG:0D0A 8D 06 20 rts ; CPU:$CD0D PRG:0D0D 60 ; ----------------------------------------------------------------------------- -; Routine: Label_CD0E +; Routine: ReadControllers ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -2242,16 +2453,16 @@ Label_CCF3: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_CD0E: +ReadControllers: txa ; CPU:$CD0E PRG:0D0E 8A pha ; CPU:$CD0F PRG:0D0F 48 lda #$01 ; CPU:$CD10 PRG:0D10 A9 01 - sta $4016 ; CPU:$CD12 PRG:0D12 8D 16 40 + sta JOY1 ; CPU:$CD12 PRG:0D12 8D 16 40 lda #$00 ; CPU:$CD15 PRG:0D15 A9 00 - sta $4016 ; CPU:$CD17 PRG:0D17 8D 16 40 + sta JOY1 ; CPU:$CD17 PRG:0D17 8D 16 40 ldx #$08 ; CPU:$CD1A PRG:0D1A A2 08 ; ----------------------------------------------------------------------------- -; Routine: Label_CD1C +; Routine: ReadControllers_Loop ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -2259,26 +2470,26 @@ Label_CD0E: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_CD1C: - lda $4016 ; CPU:$CD1C PRG:0D1C AD 16 40 +ReadControllers_Loop: + lda JOY1 ; CPU:$CD1C PRG:0D1C AD 16 40 lsr a ; CPU:$CD1F PRG:0D1F 4A ror $0180 ; CPU:$CD20 PRG:0D20 6E 80 01 lsr a ; CPU:$CD23 PRG:0D23 4A ror $0182 ; CPU:$CD24 PRG:0D24 6E 82 01 - lda $4017 ; CPU:$CD27 PRG:0D27 AD 17 40 + lda JOY2 ; CPU:$CD27 PRG:0D27 AD 17 40 lsr a ; CPU:$CD2A PRG:0D2A 4A ror $0181 ; CPU:$CD2B PRG:0D2B 6E 81 01 lsr a ; CPU:$CD2E PRG:0D2E 4A ror $0183 ; CPU:$CD2F PRG:0D2F 6E 83 01 dex ; CPU:$CD32 PRG:0D32 CA - bne Label_CD1C ; CPU:$CD33 PRG:0D33 D0 E7 + bne ReadControllers_Loop ; CPU:$CD33 PRG:0D33 D0 E7 pla ; CPU:$CD35 PRG:0D35 68 tax ; CPU:$CD36 PRG:0D36 AA rts ; CPU:$CD37 PRG:0D37 60 ; ---- data $CD38-$CD3B (4 bytes) ---- .byte $BD, $80, $01, $60 ; CPU:$CD38 PRG:0D38 BD 80 01 60 ; ----------------------------------------------------------------------------- -; Routine: Label_CD3C +; Routine: GetAttributeCell ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -2286,26 +2497,26 @@ Label_CD1C: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_CD3C: - lda ZpFC ; CPU:$CD3C PRG:0D3C A5 FC +GetAttributeCell: + lda ppu_addr_lo ; CPU:$CD3C PRG:0D3C A5 FC tay ; CPU:$CD3E PRG:0D3E A8 and #$FC ; CPU:$CD3F PRG:0D3F 29 FC asl a ; CPU:$CD41 PRG:0D41 0A - sta ZpFC ; CPU:$CD42 PRG:0D42 85 FC - lda ZpFD ; CPU:$CD44 PRG:0D44 A5 FD + sta ppu_addr_lo ; CPU:$CD42 PRG:0D42 85 FC + lda ppu_addr_hi ; CPU:$CD44 PRG:0D44 A5 FD lsr a ; CPU:$CD46 PRG:0D46 4A lsr a ; CPU:$CD47 PRG:0D47 4A clc ; CPU:$CD48 PRG:0D48 18 - adc ZpFC ; CPU:$CD49 PRG:0D49 65 FC - adc ZpF3 ; CPU:$CD4B PRG:0D4B 65 F3 - sta ZpFC ; CPU:$CD4D PRG:0D4D 85 FC + adc ppu_addr_lo ; CPU:$CD49 PRG:0D49 65 FC + adc nt_base_lo ; CPU:$CD4B PRG:0D4B 65 F3 + sta ppu_addr_lo ; CPU:$CD4D PRG:0D4D 85 FC ldx #$00 ; CPU:$CD4F PRG:0D4F A2 00 - lda ZpFD ; CPU:$CD51 PRG:0D51 A5 FD + lda ppu_addr_hi ; CPU:$CD51 PRG:0D51 A5 FD and #$02 ; CPU:$CD53 PRG:0D53 29 02 - beq Label_CD58 ; CPU:$CD55 PRG:0D55 F0 01 + beq GetAttributeCell_Column ; CPU:$CD55 PRG:0D55 F0 01 inx ; CPU:$CD57 PRG:0D57 E8 ; ----------------------------------------------------------------------------- -; Routine: Label_CD58 +; Routine: GetAttributeCell_Column ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -2313,14 +2524,14 @@ Label_CD3C: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_CD58: +GetAttributeCell_Column: tya ; CPU:$CD58 PRG:0D58 98 and #$02 ; CPU:$CD59 PRG:0D59 29 02 - beq Label_CD5F ; CPU:$CD5B PRG:0D5B F0 02 + beq GetAttributeCell_Read ; CPU:$CD5B PRG:0D5B F0 02 inx ; CPU:$CD5D PRG:0D5D E8 inx ; CPU:$CD5E PRG:0D5E E8 ; ----------------------------------------------------------------------------- -; Routine: Label_CD5F +; Routine: GetAttributeCell_Read ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -2328,12 +2539,12 @@ Label_CD58: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_CD5F: - ldy ZpFC ; CPU:$CD5F PRG:0D5F A4 FC +GetAttributeCell_Read: + ldy ppu_addr_lo ; CPU:$CD5F PRG:0D5F A4 FC lda $0100,y ; CPU:$CD61 PRG:0D61 B9 00 01 rts ; CPU:$CD64 PRG:0D64 60 ; ----------------------------------------------------------------------------- -; Routine: Label_CD65 +; Routine: SetAttributeCell ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -2341,17 +2552,17 @@ Label_CD5F: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_CD65: +SetAttributeCell: pha ; CPU:$CD65 PRG:0D65 48 jsr $CD3C ; CPU:$CD66 PRG:0D66 20 3C CD - sta ZpFD ; CPU:$CD69 PRG:0D69 85 FD + sta ppu_addr_hi ; CPU:$CD69 PRG:0D69 85 FD lda #$FC ; CPU:$CD6B PRG:0D6B A9 FC - sta ZpF6 ; CPU:$CD6D PRG:0D6D 85 F6 + sta ppu_addr_temp_lo ; CPU:$CD6D PRG:0D6D 85 F6 txa ; CPU:$CD6F PRG:0D6F 8A - beq Label_CD7E ; CPU:$CD70 PRG:0D70 F0 0C + beq SetAttributeCell_Store ; CPU:$CD70 PRG:0D70 F0 0C pla ; CPU:$CD72 PRG:0D72 68 ; ----------------------------------------------------------------------------- -; Routine: Label_CD73 +; Routine: SetAttributeCell_Align ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -2359,17 +2570,17 @@ Label_CD65: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_CD73: +SetAttributeCell_Align: asl a ; CPU:$CD73 PRG:0D73 0A asl a ; CPU:$CD74 PRG:0D74 0A sec ; CPU:$CD75 PRG:0D75 38 - rol ZpF6 ; CPU:$CD76 PRG:0D76 26 F6 - rol ZpF6 ; CPU:$CD78 PRG:0D78 26 F6 + rol ppu_addr_temp_lo ; CPU:$CD76 PRG:0D76 26 F6 + rol ppu_addr_temp_lo ; CPU:$CD78 PRG:0D78 26 F6 dex ; CPU:$CD7A PRG:0D7A CA - bne Label_CD73 ; CPU:$CD7B PRG:0D7B D0 F6 + bne SetAttributeCell_Align ; CPU:$CD7B PRG:0D7B D0 F6 pha ; CPU:$CD7D PRG:0D7D 48 ; ----------------------------------------------------------------------------- -; Routine: Label_CD7E +; Routine: SetAttributeCell_Store ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -2377,26 +2588,26 @@ Label_CD73: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_CD7E: +SetAttributeCell_Store: pla ; CPU:$CD7E PRG:0D7E 68 - sta ZpF7 ; CPU:$CD7F PRG:0D7F 85 F7 - lda ZpFD ; CPU:$CD81 PRG:0D81 A5 FD - and ZpF6 ; CPU:$CD83 PRG:0D83 25 F6 - ora ZpF7 ; CPU:$CD85 PRG:0D85 05 F7 - sta ZpF6 ; CPU:$CD87 PRG:0D87 85 F6 + sta ppu_addr_temp_hi ; CPU:$CD7F PRG:0D7F 85 F7 + lda ppu_addr_hi ; CPU:$CD81 PRG:0D81 A5 FD + and ppu_addr_temp_lo ; CPU:$CD83 PRG:0D83 25 F6 + ora ppu_addr_temp_hi ; CPU:$CD85 PRG:0D85 05 F7 + sta ppu_addr_temp_lo ; CPU:$CD87 PRG:0D87 85 F6 sta $0100,y ; CPU:$CD89 PRG:0D89 99 00 01 tya ; CPU:$CD8C PRG:0D8C 98 and #$3F ; CPU:$CD8D PRG:0D8D 29 3F clc ; CPU:$CD8F PRG:0D8F 18 adc #$C0 ; CPU:$CD90 PRG:0D90 69 C0 - sta ZpFC ; CPU:$CD92 PRG:0D92 85 FC - lda ZpF2 ; CPU:$CD94 PRG:0D94 A5 F2 + sta ppu_addr_lo ; CPU:$CD92 PRG:0D92 85 FC + lda nt_base_hi ; CPU:$CD94 PRG:0D94 A5 F2 adc #$03 ; CPU:$CD96 PRG:0D96 69 03 - sta ZpFD ; CPU:$CD98 PRG:0D98 85 FD - lda ZpF6 ; CPU:$CD9A PRG:0D9A A5 F6 + sta ppu_addr_hi ; CPU:$CD98 PRG:0D98 85 FD + lda ppu_addr_temp_lo ; CPU:$CD9A PRG:0D9A A5 F6 rts ; CPU:$CD9C PRG:0D9C 60 ; ----------------------------------------------------------------------------- -; Routine: Label_CD9D +; Routine: UploadAttributeShadow ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -2404,17 +2615,17 @@ Label_CD7E: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_CD9D: - lda ZpF2 ; CPU:$CD9D PRG:0D9D A5 F2 +UploadAttributeShadow: + lda nt_base_hi ; CPU:$CD9D PRG:0D9D A5 F2 clc ; CPU:$CD9F PRG:0D9F 18 adc #$03 ; CPU:$CDA0 PRG:0DA0 69 03 - sta $2006 ; CPU:$CDA2 PRG:0DA2 8D 06 20 + sta PPUADDR ; CPU:$CDA2 PRG:0DA2 8D 06 20 lda #$C0 ; CPU:$CDA5 PRG:0DA5 A9 C0 - sta $2006 ; CPU:$CDA7 PRG:0DA7 8D 06 20 + sta PPUADDR ; CPU:$CDA7 PRG:0DA7 8D 06 20 ldx #$40 ; CPU:$CDAA PRG:0DAA A2 40 - ldy ZpF3 ; CPU:$CDAC PRG:0DAC A4 F3 + ldy nt_base_lo ; CPU:$CDAC PRG:0DAC A4 F3 ; ----------------------------------------------------------------------------- -; Routine: Label_CDAE +; Routine: UploadAttributeShadow_Loop ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -2422,15 +2633,15 @@ Label_CD9D: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_CDAE: +UploadAttributeShadow_Loop: lda $0100,y ; CPU:$CDAE PRG:0DAE B9 00 01 - sta $2007 ; CPU:$CDB1 PRG:0DB1 8D 07 20 + sta PPUDATA ; CPU:$CDB1 PRG:0DB1 8D 07 20 iny ; CPU:$CDB4 PRG:0DB4 C8 dex ; CPU:$CDB5 PRG:0DB5 CA - bne Label_CDAE ; CPU:$CDB6 PRG:0DB6 D0 F6 + bne UploadAttributeShadow_Loop ; CPU:$CDB6 PRG:0DB6 D0 F6 rts ; CPU:$CDB8 PRG:0DB8 60 ; ----------------------------------------------------------------------------- -; Routine: Label_CDB9 +; Routine: MixChecksum ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -2438,22 +2649,22 @@ Label_CDAE: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_CDB9: +MixChecksum: txa ; CPU:$CDB9 PRG:0DB9 8A pha ; CPU:$CDBA PRG:0DBA 48 - adc ZpEF ; CPU:$CDBB PRG:0DBB 65 EF + adc vram_update_checksum ; CPU:$CDBB PRG:0DBB 65 EF ldx $0184 ; CPU:$CDBD PRG:0DBD AE 84 01 adc $0200,x ; CPU:$CDC0 PRG:0DC0 7D 00 02 eor $0300,x ; CPU:$CDC3 PRG:0DC3 5D 00 03 sbc $0400,x ; CPU:$CDC6 PRG:0DC6 FD 00 04 - sta ZpEF ; CPU:$CDC9 PRG:0DC9 85 EF + sta vram_update_checksum ; CPU:$CDC9 PRG:0DC9 85 EF pla ; CPU:$CDCB PRG:0DCB 68 tax ; CPU:$CDCC PRG:0DCC AA inc $0184 ; CPU:$CDCD PRG:0DCD EE 84 01 - lda ZpEF ; CPU:$CDD0 PRG:0DD0 A5 EF + lda vram_update_checksum ; CPU:$CDD0 PRG:0DD0 A5 EF rts ; CPU:$CDD2 PRG:0DD2 60 ; ----------------------------------------------------------------------------- -; Routine: Label_CDD3 +; Routine: PrintTextToNametable ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -2461,12 +2672,12 @@ Label_CDB9: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_CDD3: +PrintTextToNametable: sta $0188 ; CPU:$CDD3 PRG:0DD3 8D 88 01 - stx ZpFF ; CPU:$CDD6 PRG:0DD6 86 FF - sty ZpFE ; CPU:$CDD8 PRG:0DD8 84 FE + stx ppu_addr_src_hi ; CPU:$CDD6 PRG:0DD6 86 FF + sty ppu_addr_src_lo ; CPU:$CDD8 PRG:0DD8 84 FE ; ----------------------------------------------------------------------------- -; Routine: Label_CDDA +; Routine: PrintTextToNametable_Row ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -2474,14 +2685,14 @@ Label_CDD3: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_CDDA: +PrintTextToNametable_Row: jsr $CE14 ; CPU:$CDDA PRG:0DDA 20 14 CE - beq Label_CE09 ; CPU:$CDDD PRG:0DDD F0 2A + beq PrintTextToNametable_NextRow ; CPU:$CDDD PRG:0DDD F0 2A cmp #$FF ; CPU:$CDDF PRG:0DDF C9 FF - bne Label_CDE4 ; CPU:$CDE1 PRG:0DE1 D0 01 + bne PrintTextToNametable_RowStart ; CPU:$CDE1 PRG:0DE1 D0 01 rts ; CPU:$CDE3 PRG:0DE3 60 ; ----------------------------------------------------------------------------- -; Routine: Label_CDE4 +; Routine: PrintTextToNametable_RowStart ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -2489,16 +2700,16 @@ Label_CDDA: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_CDE4: +PrintTextToNametable_RowStart: tax ; CPU:$CDE4 PRG:0DE4 AA ldy $0188 ; CPU:$CDE5 PRG:0DE5 AC 88 01 jsr $CAF7 ; CPU:$CDE8 PRG:0DE8 20 F7 CA - stx ZpF7 ; CPU:$CDEB PRG:0DEB 86 F7 - sty ZpF6 ; CPU:$CDED PRG:0DED 84 F6 + stx ppu_addr_temp_hi ; CPU:$CDEB PRG:0DEB 86 F7 + sty ppu_addr_temp_lo ; CPU:$CDED PRG:0DED 84 F6 ldx #$FE ; CPU:$CDEF PRG:0DEF A2 FE jsr $CB61 ; CPU:$CDF1 PRG:0DF1 20 61 CB ; ----------------------------------------------------------------------------- -; Routine: Label_CDF4 +; Routine: PrintTextToNametable_Char ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -2506,9 +2717,9 @@ Label_CDE4: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_CDF4: +PrintTextToNametable_Char: jsr $CE14 ; CPU:$CDF4 PRG:0DF4 20 14 CE - beq Label_CE09 ; CPU:$CDF7 PRG:0DF7 F0 10 + beq PrintTextToNametable_NextRow ; CPU:$CDF7 PRG:0DF7 F0 10 jsr $CE25 ; CPU:$CDF9 PRG:0DF9 20 25 CE ldx #$FE ; CPU:$CDFC PRG:0DFC A2 FE jsr $CB61 ; CPU:$CDFE PRG:0DFE 20 61 CB @@ -2516,7 +2727,7 @@ Label_CDF4: jsr $CB61 ; CPU:$CE03 PRG:0E03 20 61 CB jmp $CDF4 ; CPU:$CE06 PRG:0E06 4C F4 CD ; ----------------------------------------------------------------------------- -; Routine: Label_CE09 +; Routine: PrintTextToNametable_NextRow ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -2524,13 +2735,13 @@ Label_CDF4: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_CE09: +PrintTextToNametable_NextRow: inc $0188 ; CPU:$CE09 PRG:0E09 EE 88 01 ldx #$FE ; CPU:$CE0C PRG:0E0C A2 FE jsr $CB61 ; CPU:$CE0E PRG:0E0E 20 61 CB jmp $CDDA ; CPU:$CE11 PRG:0E11 4C DA CD ; ----------------------------------------------------------------------------- -; Routine: Label_CE14 +; Routine: ReadPpuDataAtSrc ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -2538,16 +2749,16 @@ Label_CE09: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_CE14: - lda ZpFF ; CPU:$CE14 PRG:0E14 A5 FF - sta $2006 ; CPU:$CE16 PRG:0E16 8D 06 20 - lda ZpFE ; CPU:$CE19 PRG:0E19 A5 FE - sta $2006 ; CPU:$CE1B PRG:0E1B 8D 06 20 - lda $2007 ; CPU:$CE1E PRG:0E1E AD 07 20 - lda $2007 ; CPU:$CE21 PRG:0E21 AD 07 20 +ReadPpuDataAtSrc: + lda ppu_addr_src_hi ; CPU:$CE14 PRG:0E14 A5 FF + sta PPUADDR ; CPU:$CE16 PRG:0E16 8D 06 20 + lda ppu_addr_src_lo ; CPU:$CE19 PRG:0E19 A5 FE + sta PPUADDR ; CPU:$CE1B PRG:0E1B 8D 06 20 + lda PPUDATA ; CPU:$CE1E PRG:0E1E AD 07 20 + lda PPUDATA ; CPU:$CE21 PRG:0E21 AD 07 20 rts ; CPU:$CE24 PRG:0E24 60 ; ----------------------------------------------------------------------------- -; Routine: Label_CE25 +; Routine: WritePpuDataAtTemp ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -2555,41 +2766,43 @@ Label_CE14: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_CE25: +WritePpuDataAtTemp: pha ; CPU:$CE25 PRG:0E25 48 - lda ZpF7 ; CPU:$CE26 PRG:0E26 A5 F7 - sta $2006 ; CPU:$CE28 PRG:0E28 8D 06 20 - lda ZpF6 ; CPU:$CE2B PRG:0E2B A5 F6 - sta $2006 ; CPU:$CE2D PRG:0E2D 8D 06 20 + lda ppu_addr_temp_hi ; CPU:$CE26 PRG:0E26 A5 F7 + sta PPUADDR ; CPU:$CE28 PRG:0E28 8D 06 20 + lda ppu_addr_temp_lo ; CPU:$CE2B PRG:0E2B A5 F6 + sta PPUADDR ; CPU:$CE2D PRG:0E2D 8D 06 20 pla ; CPU:$CE30 PRG:0E30 68 - sta $2007 ; CPU:$CE31 PRG:0E31 8D 07 20 + sta PPUDATA ; CPU:$CE31 PRG:0E31 8D 07 20 rts ; CPU:$CE34 PRG:0E34 60 -; ---- data $CE35-$CF9A (358 bytes) ---- - .byte $A9, $02, $85, $68, $A2, $0B, $A0, $A0, $20, $A9, $CB, $A2, $04, $A0, $80, $86 ; CPU:$CE35 PRG:0E35 A9 02 85 68 A2 0B A0 A0 20 A9 CB A2 04 A0 80 86 - .byte $FB, $84, $FA, $A2, $01, $A0, $92, $86, $F9, $84, $F8, $20, $7F, $CB, $A2, $00 ; CPU:$CE45 PRG:0E45 FB 84 FA A2 01 A0 92 86 F9 84 F8 20 7F CB A2 00 - .byte $A9, $F0, $9D, $00, $06, $9D, $00, $07, $CA, $D0, $F5, $20, $E4, $D4, $20, $E5 ; CPU:$CE55 PRG:0E55 A9 F0 9D 00 06 9D 00 07 CA D0 F5 20 E4 D4 20 E5 - .byte $CF, $20, $BB, $D1, $20, $0A, $D2, $A9, $06, $85, $FB, $A9, $24, $85, $FD, $A9 ; CPU:$CE65 PRG:0E65 CF 20 BB D1 20 0A D2 A9 06 85 FB A9 24 85 FD A9 - .byte $00, $85, $FA, $85, $FC, $85, $F8, $A9, $02, $85, $F9, $20, $7F, $CB, $A5, $FE ; CPU:$CE75 PRG:0E75 00 85 FA 85 FC 85 F8 A9 02 85 F9 20 7F CB A5 FE - .byte $48, $A5, $FF, $48, $A9, $00, $8D, $8B, $01, $20, $A0, $D2, $A9, $00, $8D, $C0 ; CPU:$CE85 PRG:0E85 48 A5 FF 48 A9 00 8D 8B 01 20 A0 D2 A9 00 8D C0 - .byte $01, $20, $25, $D3, $A0, $08, $8C, $88, $01, $AC, $88, $01, $A2, $03, $20, $F7 ; CPU:$CE95 PRG:0E95 01 20 25 D3 A0 08 8C 88 01 AC 88 01 A2 03 20 F7 - .byte $CA, $84, $FA, $86, $FB, $AC, $88, $01, $A2, $03, $20, $F9, $FA, $A9, $1A, $85 ; CPU:$CEA5 PRG:0EA5 CA 84 FA 86 FB AC 88 01 A2 03 20 F9 FA A9 1A 85 - .byte $F8, $A9, $00, $85, $F9, $20, $69, $CB, $EE, $88, $01, $AD, $88, $01, $C9, $1B ; CPU:$CEB5 PRG:0EB5 F8 A9 00 85 F9 20 69 CB EE 88 01 AD 88 01 C9 1B - .byte $D0, $D7, $68, $85, $FF, $68, $85, $FE, $A9, $01, $8D, $8B, $01, $20, $A0, $D2 ; CPU:$CEC5 PRG:0EC5 D0 D7 68 85 FF 68 85 FE A9 01 8D 8B 01 20 A0 D2 - .byte $A2, $24, $86, $FB, $A0, $00, $84, $FA, $A2, $06, $86, $FD, $84, $FC, $A2, $02 ; CPU:$CED5 PRG:0ED5 A2 24 86 FB A0 00 84 FA A2 06 86 FD 84 FC A2 02 - .byte $86, $F9, $84, $F8, $20, $69, $CB, $A2, $00, $A9, $00, $9D, $00, $06, $9D, $00 ; CPU:$CEE5 PRG:0EE5 86 F9 84 F8 20 69 CB A2 00 A9 00 9D 00 06 9D 00 - .byte $07, $CA, $D0, $F5, $A2, $24, $A0, $00, $20, $A9, $CB, $20, $AE, $CA, $A2, $05 ; CPU:$CEF5 PRG:0EF5 07 CA D0 F5 A2 24 A0 00 20 A9 CB 20 AE CA A2 05 - .byte $86, $FF, $A0, $E5, $84, $FE, $A0, $08, $8C, $88, $01, $A2, $03, $8E, $89, $01 ; CPU:$CF05 PRG:0F05 86 FF A0 E5 84 FE A0 08 8C 88 01 A2 03 8E 89 01 - .byte $20, $B9, $CA, $20, $D3, $D3, $A2, $FE, $20, $61, $CB, $EE, $89, $01, $AD, $89 ; CPU:$CF15 PRG:0F15 20 B9 CA 20 D3 D3 A2 FE 20 61 CB EE 89 01 AD 89 - .byte $01, $C9, $1D, $D0, $EB, $EE, $88, $01, $AD, $88, $01, $C9, $1B, $D0, $DC, $A9 ; CPU:$CF25 PRG:0F25 01 C9 1D D0 EB EE 88 01 AD 88 01 C9 1B D0 DC A9 - .byte $02, $A2, $0A, $A0, $4F, $20, $D3, $CD, $20, $9B, $CF, $03, $03, $03, $04, $02 ; CPU:$CF35 PRG:0F35 02 A2 0A A0 4F 20 D3 CD 20 9B CF 03 03 03 04 02 - .byte $18, $03, $1A, $03, $03, $FF, $20, $48, $CA, $20, $A4, $E1, $20, $25, $E2, $20 ; CPU:$CF45 PRG:0F45 18 03 1A 03 03 FF 20 48 CA 20 A4 E1 20 25 E2 20 - .byte $4F, $E2, $20, $5C, $E2, $20, $A2, $E2, $20, $C8, $E2, $20, $67, $F8, $20, $0D ; CPU:$CF55 PRG:0F55 4F E2 20 5C E2 20 A2 E2 20 C8 E2 20 67 F8 20 0D - .byte $E2, $AD, $C7, $01, $C9, $01, $90, $03, $20, $E5, $E1, $AD, $C7, $01, $C9, $02 ; CPU:$CF65 PRG:0F65 E2 AD C7 01 C9 01 90 03 20 E5 E1 AD C7 01 C9 02 - .byte $D0, $10, $A9, $20, $85, $FD, $A9, $82, $85, $FC, $20, $FB, $CB, $A9, $63, $20 ; CPU:$CF75 PRG:0F75 D0 10 A9 20 85 FD A9 82 85 FC 20 FB CB A9 63 20 - .byte $29, $CC, $20, $F5, $C3, $60, $86, $FD, $84, $FC, $20, $65, $CD, $48, $20, $A3 ; CPU:$CF85 PRG:0F85 29 CC 20 F5 C3 60 86 FD 84 FC 20 65 CD 48 20 A3 - .byte $CA, $68, $8D, $07, $20, $60 ; CPU:$CF95 PRG:0F95 CA 68 8D 07 20 60 ; ----------------------------------------------------------------------------- -; Routine: Label_CF9B +; Routine: LoadScene +; Global: Builds and uploads a complete stage screen (the field, banner and pockets). +; Local: Copies the 402-byte field tile set out of CHR into $0480, fills the field map, runs +; the layout script, uploads the map to the off-screen nametable, then the banner and +; pocket tables. +; Parameters: $0187 = stage number (1-$3C). +; Returns: Returns once the screen is fully drawn into VRAM and shadow RAM. +; Clobbers: A, X, Y, ptr, ppu_addr, ppu_addr_src, game_flag, $0600-$07FF. +; ----------------------------------------------------------------------------- +LoadScene: + lda #$02 ; CPU:$CE35 PRG:0E35 A9 02 + sta game_flag ; CPU:$CE37 PRG:0E37 85 68 + ldx #$0B ; CPU:$CE39 PRG:0E39 A2 0B + ldy #$A0 ; CPU:$CE3B PRG:0E3B A0 A0 + jsr $CBA9 ; CPU:$CE3D PRG:0E3D 20 A9 CB + ldx #$04 ; CPU:$CE40 PRG:0E40 A2 04 + ldy #$80 ; CPU:$CE42 PRG:0E42 A0 80 + stx ptr_hi ; CPU:$CE44 PRG:0E44 86 FB + sty ptr_lo ; CPU:$CE46 PRG:0E46 84 FA + ldx #$01 ; CPU:$CE48 PRG:0E48 A2 01 + ldy #$92 ; CPU:$CE4A PRG:0E4A A0 92 + stx ppu_src_hi ; CPU:$CE4C PRG:0E4C 86 F9 + sty ppu_src_lo ; CPU:$CE4E PRG:0E4E 84 F8 + jsr $CB7F ; CPU:$CE50 PRG:0E50 20 7F CB + ldx #$00 ; CPU:$CE53 PRG:0E53 A2 00 +; ----------------------------------------------------------------------------- +; Routine: FillFieldEmpty ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -2597,15 +2810,218 @@ Label_CE25: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_CF9B: +FillFieldEmpty: + lda #$F0 ; CPU:$CE55 PRG:0E55 A9 F0 + sta $0600,x ; CPU:$CE57 PRG:0E57 9D 00 06 + sta $0700,x ; CPU:$CE5A PRG:0E5A 9D 00 07 + dex ; CPU:$CE5D PRG:0E5D CA + bne FillFieldEmpty ; CPU:$CE5E PRG:0E5E D0 F5 + jsr $D4E4 ; CPU:$CE60 PRG:0E60 20 E4 D4 + jsr $CFE5 ; CPU:$CE63 PRG:0E63 20 E5 CF + jsr $D1BB ; CPU:$CE66 PRG:0E66 20 BB D1 + jsr $D20A ; CPU:$CE69 PRG:0E69 20 0A D2 + lda #$06 ; CPU:$CE6C PRG:0E6C A9 06 + sta ptr_hi ; CPU:$CE6E PRG:0E6E 85 FB + lda #$24 ; CPU:$CE70 PRG:0E70 A9 24 + sta ppu_addr_hi ; CPU:$CE72 PRG:0E72 85 FD + lda #$00 ; CPU:$CE74 PRG:0E74 A9 00 + sta ptr_lo ; CPU:$CE76 PRG:0E76 85 FA + sta ppu_addr_lo ; CPU:$CE78 PRG:0E78 85 FC + sta ppu_src_lo ; CPU:$CE7A PRG:0E7A 85 F8 + lda #$02 ; CPU:$CE7C PRG:0E7C A9 02 + sta ppu_src_hi ; CPU:$CE7E PRG:0E7E 85 F9 + jsr $CB7F ; CPU:$CE80 PRG:0E80 20 7F CB + lda ppu_addr_src_lo ; CPU:$CE83 PRG:0E83 A5 FE + pha ; CPU:$CE85 PRG:0E85 48 + lda ppu_addr_src_hi ; CPU:$CE86 PRG:0E86 A5 FF + pha ; CPU:$CE88 PRG:0E88 48 + lda #$00 ; CPU:$CE89 PRG:0E89 A9 00 + sta $018B ; CPU:$CE8B PRG:0E8B 8D 8B 01 + jsr $D2A0 ; CPU:$CE8E PRG:0E8E 20 A0 D2 + lda #$00 ; CPU:$CE91 PRG:0E91 A9 00 + sta $01C0 ; CPU:$CE93 PRG:0E93 8D C0 01 + jsr $D325 ; CPU:$CE96 PRG:0E96 20 25 D3 + ldy #$08 ; CPU:$CE99 PRG:0E99 A0 08 + sty $0188 ; CPU:$CE9B PRG:0E9B 8C 88 01 +; ----------------------------------------------------------------------------- +; Routine: UploadFieldRows +; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. +; Local: Continues its parent routine along the condition or operation encoded in this label, +; then returns, branches again, or rejoins shared code as documented by the instructions. +; Parameters: Undetermined in Pass 1 unless implied by the caller. +; Returns: Undetermined in Pass 1; status flags and registers may carry results. +; Clobbers: Undetermined in Pass 1. +; ----------------------------------------------------------------------------- +UploadFieldRows: + ldy $0188 ; CPU:$CE9E PRG:0E9E AC 88 01 + ldx #$03 ; CPU:$CEA1 PRG:0EA1 A2 03 + jsr $CAF7 ; CPU:$CEA3 PRG:0EA3 20 F7 CA + sty ptr_lo ; CPU:$CEA6 PRG:0EA6 84 FA + stx ptr_hi ; CPU:$CEA8 PRG:0EA8 86 FB + ldy $0188 ; CPU:$CEAA PRG:0EAA AC 88 01 + ldx #$03 ; CPU:$CEAD PRG:0EAD A2 03 + jsr $FAF9 ; CPU:$CEAF PRG:0EAF 20 F9 FA + lda #$1A ; CPU:$CEB2 PRG:0EB2 A9 1A + sta ppu_src_lo ; CPU:$CEB4 PRG:0EB4 85 F8 + lda #$00 ; CPU:$CEB6 PRG:0EB6 A9 00 + sta ppu_src_hi ; CPU:$CEB8 PRG:0EB8 85 F9 + jsr $CB69 ; CPU:$CEBA PRG:0EBA 20 69 CB + inc $0188 ; CPU:$CEBD PRG:0EBD EE 88 01 + lda $0188 ; CPU:$CEC0 PRG:0EC0 AD 88 01 + cmp #$1B ; CPU:$CEC3 PRG:0EC3 C9 1B + bne UploadFieldRows ; CPU:$CEC5 PRG:0EC5 D0 D7 + pla ; CPU:$CEC7 PRG:0EC7 68 + sta ppu_addr_src_hi ; CPU:$CEC8 PRG:0EC8 85 FF + pla ; CPU:$CECA PRG:0ECA 68 + sta ppu_addr_src_lo ; CPU:$CECB PRG:0ECB 85 FE + lda #$01 ; CPU:$CECD PRG:0ECD A9 01 + sta $018B ; CPU:$CECF PRG:0ECF 8D 8B 01 + jsr $D2A0 ; CPU:$CED2 PRG:0ED2 20 A0 D2 + ldx #$24 ; CPU:$CED5 PRG:0ED5 A2 24 + stx ptr_hi ; CPU:$CED7 PRG:0ED7 86 FB + ldy #$00 ; CPU:$CED9 PRG:0ED9 A0 00 + sty ptr_lo ; CPU:$CEDB PRG:0EDB 84 FA + ldx #$06 ; CPU:$CEDD PRG:0EDD A2 06 + stx ppu_addr_hi ; CPU:$CEDF PRG:0EDF 86 FD + sty ppu_addr_lo ; CPU:$CEE1 PRG:0EE1 84 FC + ldx #$02 ; CPU:$CEE3 PRG:0EE3 A2 02 + stx ppu_src_hi ; CPU:$CEE5 PRG:0EE5 86 F9 + sty ppu_src_lo ; CPU:$CEE7 PRG:0EE7 84 F8 + jsr $CB69 ; CPU:$CEE9 PRG:0EE9 20 69 CB + ldx #$00 ; CPU:$CEEC PRG:0EEC A2 00 +; ----------------------------------------------------------------------------- +; Routine: ClearFieldMap +; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. +; Local: Continues its parent routine along the condition or operation encoded in this label, +; then returns, branches again, or rejoins shared code as documented by the instructions. +; Parameters: Undetermined in Pass 1 unless implied by the caller. +; Returns: Undetermined in Pass 1; status flags and registers may carry results. +; Clobbers: Undetermined in Pass 1. +; ----------------------------------------------------------------------------- +ClearFieldMap: + lda #$00 ; CPU:$CEEE PRG:0EEE A9 00 + sta $0600,x ; CPU:$CEF0 PRG:0EF0 9D 00 06 + sta $0700,x ; CPU:$CEF3 PRG:0EF3 9D 00 07 + dex ; CPU:$CEF6 PRG:0EF6 CA + bne ClearFieldMap ; CPU:$CEF7 PRG:0EF7 D0 F5 + ldx #$24 ; CPU:$CEF9 PRG:0EF9 A2 24 + ldy #$00 ; CPU:$CEFB PRG:0EFB A0 00 + jsr $CBA9 ; CPU:$CEFD PRG:0EFD 20 A9 CB + jsr $CAAE ; CPU:$CF00 PRG:0F00 20 AE CA + ldx #$05 ; CPU:$CF03 PRG:0F03 A2 05 + stx ppu_addr_src_hi ; CPU:$CF05 PRG:0F05 86 FF + ldy #$E5 ; CPU:$CF07 PRG:0F07 A0 E5 + sty ppu_addr_src_lo ; CPU:$CF09 PRG:0F09 84 FE + ldy #$08 ; CPU:$CF0B PRG:0F0B A0 08 + sty $0188 ; CPU:$CF0D PRG:0F0D 8C 88 01 +; ----------------------------------------------------------------------------- +; Routine: DrawLayoutRows +; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. +; Local: Continues its parent routine along the condition or operation encoded in this label, +; then returns, branches again, or rejoins shared code as documented by the instructions. +; Parameters: Undetermined in Pass 1 unless implied by the caller. +; Returns: Undetermined in Pass 1; status flags and registers may carry results. +; Clobbers: Undetermined in Pass 1. +; ----------------------------------------------------------------------------- +DrawLayoutRows: + ldx #$03 ; CPU:$CF10 PRG:0F10 A2 03 + stx $0189 ; CPU:$CF12 PRG:0F12 8E 89 01 +; ----------------------------------------------------------------------------- +; Routine: DrawLayoutRows_Cell +; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. +; Local: Continues its parent routine along the condition or operation encoded in this label, +; then returns, branches again, or rejoins shared code as documented by the instructions. +; Parameters: Undetermined in Pass 1 unless implied by the caller. +; Returns: Undetermined in Pass 1; status flags and registers may carry results. +; Clobbers: Undetermined in Pass 1. +; ----------------------------------------------------------------------------- +DrawLayoutRows_Cell: + jsr $CAB9 ; CPU:$CF15 PRG:0F15 20 B9 CA + jsr $D3D3 ; CPU:$CF18 PRG:0F18 20 D3 D3 + ldx #$FE ; CPU:$CF1B PRG:0F1B A2 FE + jsr $CB61 ; CPU:$CF1D PRG:0F1D 20 61 CB + inc $0189 ; CPU:$CF20 PRG:0F20 EE 89 01 + lda $0189 ; CPU:$CF23 PRG:0F23 AD 89 01 + cmp #$1D ; CPU:$CF26 PRG:0F26 C9 1D + bne DrawLayoutRows_Cell ; CPU:$CF28 PRG:0F28 D0 EB + inc $0188 ; CPU:$CF2A PRG:0F2A EE 88 01 + lda $0188 ; CPU:$CF2D PRG:0F2D AD 88 01 + cmp #$1B ; CPU:$CF30 PRG:0F30 C9 1B + bne DrawLayoutRows ; CPU:$CF32 PRG:0F32 D0 DC + lda #$02 ; CPU:$CF34 PRG:0F34 A9 02 + ldx #$0A ; CPU:$CF36 PRG:0F36 A2 0A + ldy #$4F ; CPU:$CF38 PRG:0F38 A0 4F + jsr $CDD3 ; CPU:$CF3A PRG:0F3A 20 D3 CD + jsr $CF9B ; CPU:$CF3D PRG:0F3D 20 9B CF +; ---- data $CF40-$CF4A (11 bytes) ---- +; Inline command list issued while loading a scene in VS-COMP mode: the two records ($03 $03 $03 $04 $02) and ($18 $03 $1A $03 $03) ended by $FF. +VsCommandList: + .byte $03, $03, $03, $04, $02, $18, $03, $1A, $03, $03, $FF ; CPU:$CF40 PRG:0F40 03 03 03 04 02 18 03 1A 03 03 FF + jsr $CA48 ; CPU:$CF4B PRG:0F4B 20 48 CA + jsr $E1A4 ; CPU:$CF4E PRG:0F4E 20 A4 E1 + jsr $E225 ; CPU:$CF51 PRG:0F51 20 25 E2 + jsr $E24F ; CPU:$CF54 PRG:0F54 20 4F E2 + jsr $E25C ; CPU:$CF57 PRG:0F57 20 5C E2 + jsr $E2A2 ; CPU:$CF5A PRG:0F5A 20 A2 E2 + jsr $E2C8 ; CPU:$CF5D PRG:0F5D 20 C8 E2 + jsr $F867 ; CPU:$CF60 PRG:0F60 20 67 F8 + jsr $E20D ; CPU:$CF63 PRG:0F63 20 0D E2 + lda $01C7 ; CPU:$CF66 PRG:0F66 AD C7 01 + cmp #$01 ; CPU:$CF69 PRG:0F69 C9 01 + bcc LoadScene_CheckVsMode ; CPU:$CF6B PRG:0F6B 90 03 + jsr $E1E5 ; CPU:$CF6D PRG:0F6D 20 E5 E1 +; ----------------------------------------------------------------------------- +; Routine: LoadScene_CheckVsMode +; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. +; Local: Continues its parent routine along the condition or operation encoded in this label, +; then returns, branches again, or rejoins shared code as documented by the instructions. +; Parameters: Undetermined in Pass 1 unless implied by the caller. +; Returns: Undetermined in Pass 1; status flags and registers may carry results. +; Clobbers: Undetermined in Pass 1. +; ----------------------------------------------------------------------------- +LoadScene_CheckVsMode: + lda $01C7 ; CPU:$CF70 PRG:0F70 AD C7 01 + cmp #$02 ; CPU:$CF73 PRG:0F73 C9 02 + bne LoadScene_Done ; CPU:$CF75 PRG:0F75 D0 10 + lda #$20 ; CPU:$CF77 PRG:0F77 A9 20 + sta ppu_addr_hi ; CPU:$CF79 PRG:0F79 85 FD + lda #$82 ; CPU:$CF7B PRG:0F7B A9 82 + sta ppu_addr_lo ; CPU:$CF7D PRG:0F7D 85 FC + jsr $CBFB ; CPU:$CF7F PRG:0F7F 20 FB CB + lda #$63 ; CPU:$CF82 PRG:0F82 A9 63 + jsr $CC29 ; CPU:$CF84 PRG:0F84 20 29 CC +; ----------------------------------------------------------------------------- +; Routine: LoadScene_Done +; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. +; Local: Continues its parent routine along the condition or operation encoded in this label, +; then returns, branches again, or rejoins shared code as documented by the instructions. +; Parameters: Undetermined in Pass 1 unless implied by the caller. +; Returns: Undetermined in Pass 1; status flags and registers may carry results. +; Clobbers: Undetermined in Pass 1. +; ----------------------------------------------------------------------------- +LoadScene_Done: + jsr $C3F5 ; CPU:$CF87 PRG:0F87 20 F5 C3 + rts ; CPU:$CF8A PRG:0F8A 60 +; ---- data $CF8B-$CF9A (16 bytes) ---- + .byte $86, $FD, $84, $FC, $20, $65, $CD, $48, $20, $A3, $CA, $68, $8D, $07, $20, $60 ; CPU:$CF8B PRG:0F8B 86 FD 84 FC 20 65 CD 48 20 A3 CA 68 8D 07 20 60 +; ----------------------------------------------------------------------------- +; Routine: RunCommandList +; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. +; Local: Continues its parent routine along the condition or operation encoded in this label, +; then returns, branches again, or rejoins shared code as documented by the instructions. +; Parameters: Undetermined in Pass 1 unless implied by the caller. +; Returns: Undetermined in Pass 1; status flags and registers may carry results. +; Clobbers: Undetermined in Pass 1. +; ----------------------------------------------------------------------------- +RunCommandList: pla ; CPU:$CF9B PRG:0F9B 68 - sta ZpFE ; CPU:$CF9C PRG:0F9C 85 FE + sta ppu_addr_src_lo ; CPU:$CF9C PRG:0F9C 85 FE pla ; CPU:$CF9E PRG:0F9E 68 - sta ZpFF ; CPU:$CF9F PRG:0F9F 85 FF + sta ppu_addr_src_hi ; CPU:$CF9F PRG:0F9F 85 FF ldx #$FE ; CPU:$CFA1 PRG:0FA1 A2 FE jsr $CB61 ; CPU:$CFA3 PRG:0FA3 20 61 CB ; ----------------------------------------------------------------------------- -; Routine: Label_CFA6 +; Routine: RunCommandList_Loop ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -2613,37 +3029,37 @@ Label_CF9B: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_CFA6: +RunCommandList_Loop: ldy #$00 ; CPU:$CFA6 PRG:0FA6 A0 00 - lda (ZpFE),y ; CPU:$CFA8 PRG:0FA8 B1 FE + lda (ppu_addr_src_lo),y ; CPU:$CFA8 PRG:0FA8 B1 FE cmp #$FF ; CPU:$CFAA PRG:0FAA C9 FF - beq Label_CFDE ; CPU:$CFAC PRG:0FAC F0 30 - sta ZpF9 ; CPU:$CFAE PRG:0FAE 85 F9 + beq RunCommandList_Done ; CPU:$CFAC PRG:0FAC F0 30 + sta ppu_src_hi ; CPU:$CFAE PRG:0FAE 85 F9 iny ; CPU:$CFB0 PRG:0FB0 C8 - lda (ZpFE),y ; CPU:$CFB1 PRG:0FB1 B1 FE - sta ZpF8 ; CPU:$CFB3 PRG:0FB3 85 F8 + lda (ppu_addr_src_lo),y ; CPU:$CFB1 PRG:0FB1 B1 FE + sta ppu_src_lo ; CPU:$CFB3 PRG:0FB3 85 F8 iny ; CPU:$CFB5 PRG:0FB5 C8 - lda (ZpFE),y ; CPU:$CFB6 PRG:0FB6 B1 FE + lda (ppu_addr_src_lo),y ; CPU:$CFB6 PRG:0FB6 B1 FE sta $018C ; CPU:$CFB8 PRG:0FB8 8D 8C 01 iny ; CPU:$CFBB PRG:0FBB C8 - lda (ZpFE),y ; CPU:$CFBC PRG:0FBC B1 FE + lda (ppu_addr_src_lo),y ; CPU:$CFBC PRG:0FBC B1 FE sta $018A ; CPU:$CFBE PRG:0FBE 8D 8A 01 iny ; CPU:$CFC1 PRG:0FC1 C8 - lda (ZpFE),y ; CPU:$CFC2 PRG:0FC2 B1 FE + lda (ppu_addr_src_lo),y ; CPU:$CFC2 PRG:0FC2 B1 FE sta Zp09 ; CPU:$CFC4 PRG:0FC4 85 09 lda #$01 ; CPU:$CFC6 PRG:0FC6 A9 01 sta $018B ; CPU:$CFC8 PRG:0FC8 8D 8B 01 jsr $D2D4 ; CPU:$CFCB PRG:0FCB 20 D4 D2 - lda ZpFE ; CPU:$CFCE PRG:0FCE A5 FE + lda ppu_addr_src_lo ; CPU:$CFCE PRG:0FCE A5 FE clc ; CPU:$CFD0 PRG:0FD0 18 adc #$05 ; CPU:$CFD1 PRG:0FD1 69 05 - sta ZpFE ; CPU:$CFD3 PRG:0FD3 85 FE + sta ppu_addr_src_lo ; CPU:$CFD3 PRG:0FD3 85 FE lda #$00 ; CPU:$CFD5 PRG:0FD5 A9 00 - adc ZpFF ; CPU:$CFD7 PRG:0FD7 65 FF - sta ZpFF ; CPU:$CFD9 PRG:0FD9 85 FF + adc ppu_addr_src_hi ; CPU:$CFD7 PRG:0FD7 65 FF + sta ppu_addr_src_hi ; CPU:$CFD9 PRG:0FD9 85 FF jmp $CFA6 ; CPU:$CFDB PRG:0FDB 4C A6 CF ; ----------------------------------------------------------------------------- -; Routine: Label_CFDE +; Routine: RunCommandList_Done ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -2651,14 +3067,14 @@ Label_CFA6: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_CFDE: - lda ZpFF ; CPU:$CFDE PRG:0FDE A5 FF +RunCommandList_Done: + lda ppu_addr_src_hi ; CPU:$CFDE PRG:0FDE A5 FF pha ; CPU:$CFE0 PRG:0FE0 48 - lda ZpFE ; CPU:$CFE1 PRG:0FE1 A5 FE + lda ppu_addr_src_lo ; CPU:$CFE1 PRG:0FE1 A5 FE pha ; CPU:$CFE3 PRG:0FE3 48 rts ; CPU:$CFE4 PRG:0FE4 60 ; ----------------------------------------------------------------------------- -; Routine: Label_CFE5 +; Routine: RunSceneScript ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -2666,23 +3082,23 @@ Label_CFDE: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_CFE5: +RunSceneScript: ldy #$00 ; CPU:$CFE5 PRG:0FE5 A0 00 - lda (ZpFE),y ; CPU:$CFE7 PRG:0FE7 B1 FE + lda (ppu_addr_src_lo),y ; CPU:$CFE7 PRG:0FE7 B1 FE pha ; CPU:$CFE9 PRG:0FE9 48 sta $018B ; CPU:$CFEA PRG:0FEA 8D 8B 01 and #$1F ; CPU:$CFED PRG:0FED 29 1F - beq Label_D004 ; CPU:$CFEF PRG:0FEF F0 13 + beq RunSceneScript_Next ; CPU:$CFEF PRG:0FEF F0 13 sta $0189 ; CPU:$CFF1 PRG:0FF1 8D 89 01 ldy #$01 ; CPU:$CFF4 PRG:0FF4 A0 01 - lda (ZpFE),y ; CPU:$CFF6 PRG:0FF6 B1 FE + lda (ppu_addr_src_lo),y ; CPU:$CFF6 PRG:0FF6 B1 FE sta $0188 ; CPU:$CFF8 PRG:0FF8 8D 88 01 iny ; CPU:$CFFB PRG:0FFB C8 - lda (ZpFE),y ; CPU:$CFFC PRG:0FFC B1 FE + lda (ppu_addr_src_lo),y ; CPU:$CFFC PRG:0FFC B1 FE sta $018A ; CPU:$CFFE PRG:0FFE 8D 8A 01 jsr $D017 ; CPU:$D001 PRG:1001 20 17 D0 ; ----------------------------------------------------------------------------- -; Routine: Label_D004 +; Routine: RunSceneScript_Next ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -2690,14 +3106,14 @@ Label_CFE5: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_D004: - lda ZpFE ; CPU:$D004 PRG:1004 A5 FE +RunSceneScript_Next: + lda ppu_addr_src_lo ; CPU:$D004 PRG:1004 A5 FE clc ; CPU:$D006 PRG:1006 18 adc #$03 ; CPU:$D007 PRG:1007 69 03 - sta ZpFE ; CPU:$D009 PRG:1009 85 FE + sta ppu_addr_src_lo ; CPU:$D009 PRG:1009 85 FE lda #$00 ; CPU:$D00B PRG:100B A9 00 ; ----------------------------------------------------------------------------- -; Routine: Label_D00D +; Routine: RunSceneScript_Advance ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -2705,15 +3121,15 @@ Label_D004: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_D00D: - adc ZpFF ; CPU:$D00D PRG:100D 65 FF - sta ZpFF ; CPU:$D00F PRG:100F 85 FF +RunSceneScript_Advance: + adc ppu_addr_src_hi ; CPU:$D00D PRG:100D 65 FF + sta ppu_addr_src_hi ; CPU:$D00F PRG:100F 85 FF pla ; CPU:$D011 PRG:1011 68 and #$80 ; CPU:$D012 PRG:1012 29 80 - beq Label_CFE5 ; CPU:$D014 PRG:1014 F0 CF + beq RunSceneScript ; CPU:$D014 PRG:1014 F0 CF rts ; CPU:$D016 PRG:1016 60 ; ----------------------------------------------------------------------------- -; Routine: Label_D017 +; Routine: DrawCellRun ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -2721,15 +3137,15 @@ Label_D00D: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_D017: +DrawCellRun: lda #$0F ; CPU:$D017 PRG:1017 A9 0F sta $018C ; CPU:$D019 PRG:1019 8D 8C 01 lda $018B ; CPU:$D01C PRG:101C AD 8B 01 and #$60 ; CPU:$D01F PRG:101F 29 60 - bne Label_D026 ; CPU:$D021 PRG:1021 D0 03 + bne DrawCellRun_Kind20 ; CPU:$D021 PRG:1021 D0 03 jmp $D0D5 ; CPU:$D023 PRG:1023 4C D5 D0 ; ----------------------------------------------------------------------------- -; Routine: Label_D026 +; Routine: DrawCellRun_Kind20 ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -2737,12 +3153,12 @@ Label_D017: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_D026: +DrawCellRun_Kind20: cmp #$20 ; CPU:$D026 PRG:1026 C9 20 - bne Label_D02D ; CPU:$D028 PRG:1028 D0 03 + bne DrawCellRun_Kind40 ; CPU:$D028 PRG:1028 D0 03 jmp $D0E4 ; CPU:$D02A PRG:102A 4C E4 D0 ; ----------------------------------------------------------------------------- -; Routine: Label_D02D +; Routine: DrawCellRun_Kind40 ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -2750,17 +3166,17 @@ Label_D026: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_D02D: +DrawCellRun_Kind40: ldx $0188 ; CPU:$D02D PRG:102D AE 88 01 cmp #$40 ; CPU:$D030 PRG:1030 C9 40 - bne Label_D05B ; CPU:$D032 PRG:1032 D0 27 + bne DrawCellRun_TileFromBit ; CPU:$D032 PRG:1032 D0 27 txa ; CPU:$D034 PRG:1034 8A and #$20 ; CPU:$D035 PRG:1035 29 20 - beq Label_D03D ; CPU:$D037 PRG:1037 F0 04 + beq DrawCellRun_PickTile ; CPU:$D037 PRG:1037 F0 04 lda #$0F ; CPU:$D039 PRG:1039 A9 0F - bne Label_D047 ; CPU:$D03B PRG:103B D0 0A + bne DrawCellRun_SetTile ; CPU:$D03B PRG:103B D0 0A ; ----------------------------------------------------------------------------- -; Routine: Label_D03D +; Routine: DrawCellRun_PickTile ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -2768,7 +3184,7 @@ Label_D02D: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_D03D: +DrawCellRun_PickTile: txa ; CPU:$D03D PRG:103D 8A rol a ; CPU:$D03E PRG:103E 2A rol a ; CPU:$D03F PRG:103F 2A @@ -2777,7 +3193,7 @@ Label_D03D: tay ; CPU:$D043 PRG:1043 A8 lda $D057,y ; CPU:$D044 PRG:1044 B9 57 D0 ; ----------------------------------------------------------------------------- -; Routine: Label_D047 +; Routine: DrawCellRun_SetTile ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -2785,19 +3201,21 @@ Label_D03D: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_D047: +DrawCellRun_SetTile: sta $018C ; CPU:$D047 PRG:1047 8D 8C 01 txa ; CPU:$D04A PRG:104A 8A and #$1F ; CPU:$D04B PRG:104B 29 1F sta $0188 ; CPU:$D04D PRG:104D 8D 88 01 cmp $018A ; CPU:$D050 PRG:1050 CD 8A 01 - bcs Label_D0B1 ; CPU:$D053 PRG:1053 B0 5C - bcc Label_D0C3 ; CPU:$D055 PRG:1055 90 6C + bcs DrawCellRun_Diagonal ; CPU:$D053 PRG:1053 B0 5C + bcc DrawCellRun_DiagonalAlt ; CPU:$D055 PRG:1055 90 6C +; Four corner tile numbers ($3C $69 $C3 $96) picked by the row bits of the cells being drawn in DrawCellRun_PickTile. +DrawCellRun_TileTable: .byte $3C, $69, $C3 ; CPU:$D057 PRG:1057 3C 69 C3 -- nop $C369,x (undocumented; ca65 cannot encode) ; ---- data $D05A-$D05A (1 bytes) ---- .byte $96 ; CPU:$D05A PRG:105A 96 ; ----------------------------------------------------------------------------- -; Routine: Label_D05B +; Routine: DrawCellRun_TileFromBit ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -2805,7 +3223,7 @@ Label_D047: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_D05B: +DrawCellRun_TileFromBit: txa ; CPU:$D05B PRG:105B 8A pha ; CPU:$D05C PRG:105C 48 ldx #$FE ; CPU:$D05D PRG:105D A2 FE @@ -2815,12 +3233,12 @@ Label_D05B: and #$1F ; CPU:$D064 PRG:1064 29 1F sta $0188 ; CPU:$D066 PRG:1066 8D 88 01 txa ; CPU:$D069 PRG:1069 8A - bmi Label_D088 ; CPU:$D06A PRG:106A 30 1C + bmi DrawCellRun_Corner2x2 ; CPU:$D06A PRG:106A 30 1C and #$40 ; CPU:$D06C PRG:106C 29 40 - beq Label_D073 ; CPU:$D06E PRG:106E F0 03 + beq DrawCellRun_Block2x2 ; CPU:$D06E PRG:106E F0 03 jmp $D0F3 ; CPU:$D070 PRG:1070 4C F3 D0 ; ----------------------------------------------------------------------------- -; Routine: Label_D073 +; Routine: DrawCellRun_Block2x2 ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -2828,7 +3246,7 @@ Label_D05B: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_D073: +DrawCellRun_Block2x2: jsr $D0F3 ; CPU:$D073 PRG:1073 20 F3 D0 inc $0189 ; CPU:$D076 PRG:1076 EE 89 01 jsr $D0F3 ; CPU:$D079 PRG:1079 20 F3 D0 @@ -2837,7 +3255,7 @@ Label_D073: dec $0189 ; CPU:$D082 PRG:1082 CE 89 01 jmp $D0F3 ; CPU:$D085 PRG:1085 4C F3 D0 ; ----------------------------------------------------------------------------- -; Routine: Label_D088 +; Routine: DrawCellRun_Corner2x2 ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -2845,7 +3263,7 @@ Label_D073: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_D088: +DrawCellRun_Corner2x2: lda #$C3 ; CPU:$D088 PRG:1088 A9 C3 sta $018C ; CPU:$D08A PRG:108A 8D 8C 01 jsr $D0F3 ; CPU:$D08D PRG:108D 20 F3 D0 @@ -2862,7 +3280,7 @@ Label_D088: dec $0189 ; CPU:$D0AB PRG:10AB CE 89 01 jmp $D0F3 ; CPU:$D0AE PRG:10AE 4C F3 D0 ; ----------------------------------------------------------------------------- -; Routine: Label_D0B1 +; Routine: DrawCellRun_Diagonal ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -2870,16 +3288,16 @@ Label_D088: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_D0B1: +DrawCellRun_Diagonal: jsr $D0F3 ; CPU:$D0B1 PRG:10B1 20 F3 D0 lda $0188 ; CPU:$D0B4 PRG:10B4 AD 88 01 dec $0188 ; CPU:$D0B7 PRG:10B7 CE 88 01 inc $0189 ; CPU:$D0BA PRG:10BA EE 89 01 cmp $018A ; CPU:$D0BD PRG:10BD CD 8A 01 - bne Label_D0B1 ; CPU:$D0C0 PRG:10C0 D0 EF + bne DrawCellRun_Diagonal ; CPU:$D0C0 PRG:10C0 D0 EF rts ; CPU:$D0C2 PRG:10C2 60 ; ----------------------------------------------------------------------------- -; Routine: Label_D0C3 +; Routine: DrawCellRun_DiagonalAlt ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -2887,16 +3305,16 @@ Label_D0B1: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_D0C3: +DrawCellRun_DiagonalAlt: jsr $D0F3 ; CPU:$D0C3 PRG:10C3 20 F3 D0 lda $0188 ; CPU:$D0C6 PRG:10C6 AD 88 01 inc $0188 ; CPU:$D0C9 PRG:10C9 EE 88 01 inc $0189 ; CPU:$D0CC PRG:10CC EE 89 01 cmp $018A ; CPU:$D0CF PRG:10CF CD 8A 01 - bne Label_D0C3 ; CPU:$D0D2 PRG:10D2 D0 EF + bne DrawCellRun_DiagonalAlt ; CPU:$D0D2 PRG:10D2 D0 EF rts ; CPU:$D0D4 PRG:10D4 60 ; ----------------------------------------------------------------------------- -; Routine: Label_D0D5 +; Routine: DrawCellRun_Horizontal ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -2904,15 +3322,15 @@ Label_D0C3: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_D0D5: +DrawCellRun_Horizontal: jsr $D0F3 ; CPU:$D0D5 PRG:10D5 20 F3 D0 lda $0189 ; CPU:$D0D8 PRG:10D8 AD 89 01 inc $0189 ; CPU:$D0DB PRG:10DB EE 89 01 cmp $018A ; CPU:$D0DE PRG:10DE CD 8A 01 - bne Label_D0D5 ; CPU:$D0E1 PRG:10E1 D0 F2 + bne DrawCellRun_Horizontal ; CPU:$D0E1 PRG:10E1 D0 F2 rts ; CPU:$D0E3 PRG:10E3 60 ; ----------------------------------------------------------------------------- -; Routine: Label_D0E4 +; Routine: DrawCellRun_Vertical ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -2920,15 +3338,15 @@ Label_D0D5: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_D0E4: +DrawCellRun_Vertical: jsr $D0F3 ; CPU:$D0E4 PRG:10E4 20 F3 D0 lda $0188 ; CPU:$D0E7 PRG:10E7 AD 88 01 inc $0188 ; CPU:$D0EA PRG:10EA EE 88 01 cmp $018A ; CPU:$D0ED PRG:10ED CD 8A 01 - bne Label_D0E4 ; CPU:$D0F0 PRG:10F0 D0 F2 + bne DrawCellRun_Vertical ; CPU:$D0F0 PRG:10F0 D0 F2 rts ; CPU:$D0F2 PRG:10F2 60 ; ----------------------------------------------------------------------------- -; Routine: Label_D0F3 +; Routine: PlaceFieldTile ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -2936,35 +3354,35 @@ Label_D0E4: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_D0F3: +PlaceFieldTile: ldx $0189 ; CPU:$D0F3 PRG:10F3 AE 89 01 ldy $0188 ; CPU:$D0F6 PRG:10F6 AC 88 01 jsr $FAF9 ; CPU:$D0F9 PRG:10F9 20 F9 FA - lda ZpFC ; CPU:$D0FC PRG:10FC A5 FC + lda ppu_addr_lo ; CPU:$D0FC PRG:10FC A5 FC sec ; CPU:$D0FE PRG:10FE 38 sbc #$1B ; CPU:$D0FF PRG:10FF E9 1B - sta ZpFC ; CPU:$D101 PRG:1101 85 FC - lda ZpFD ; CPU:$D103 PRG:1103 A5 FD + sta ppu_addr_lo ; CPU:$D101 PRG:1101 85 FC + lda ppu_addr_hi ; CPU:$D103 PRG:1103 A5 FD sbc #$00 ; CPU:$D105 PRG:1105 E9 00 - sta ZpFD ; CPU:$D107 PRG:1107 85 FD + sta ppu_addr_hi ; CPU:$D107 PRG:1107 85 FD ldy #$1B ; CPU:$D109 PRG:1109 A0 1B lda $018C ; CPU:$D10B PRG:110B AD 8C 01 cmp #$0F ; CPU:$D10E PRG:110E C9 0F - beq Label_D12C ; CPU:$D110 PRG:1110 F0 1A + beq PlaceFieldTile_Store ; CPU:$D110 PRG:1110 F0 1A and #$F0 ; CPU:$D112 PRG:1112 29 F0 tax ; CPU:$D114 PRG:1114 AA - lda (ZpFC),y ; CPU:$D115 PRG:1115 B1 FC + lda (ppu_addr_lo),y ; CPU:$D115 PRG:1115 B1 FC and #$F0 ; CPU:$D117 PRG:1117 29 F0 cmp #$F0 ; CPU:$D119 PRG:1119 C9 F0 - beq Label_D129 ; CPU:$D11B PRG:111B F0 0C - sta ZpF9 ; CPU:$D11D PRG:111D 85 F9 + beq PlaceFieldTile_KeepTile ; CPU:$D11B PRG:111B F0 0C + sta ppu_src_hi ; CPU:$D11D PRG:111D 85 F9 txa ; CPU:$D11F PRG:111F 8A - cmp ZpF9 ; CPU:$D120 PRG:1120 C5 F9 - beq Label_D129 ; CPU:$D122 PRG:1122 F0 05 + cmp ppu_src_hi ; CPU:$D120 PRG:1120 C5 F9 + beq PlaceFieldTile_KeepTile ; CPU:$D122 PRG:1122 F0 05 lda #$0F ; CPU:$D124 PRG:1124 A9 0F jmp $D12C ; CPU:$D126 PRG:1126 4C 2C D1 ; ----------------------------------------------------------------------------- -; Routine: Label_D129 +; Routine: PlaceFieldTile_KeepTile ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -2972,10 +3390,10 @@ Label_D0F3: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_D129: +PlaceFieldTile_KeepTile: lda $018C ; CPU:$D129 PRG:1129 AD 8C 01 ; ----------------------------------------------------------------------------- -; Routine: Label_D12C +; Routine: PlaceFieldTile_Store ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -2983,29 +3401,29 @@ Label_D129: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_D12C: - sta ZpF6 ; CPU:$D12C PRG:112C 85 F6 - sta (ZpFC),y ; CPU:$D12E PRG:112E 91 FC +PlaceFieldTile_Store: + sta ppu_addr_temp_lo ; CPU:$D12C PRG:112C 85 F6 + sta (ppu_addr_lo),y ; CPU:$D12E PRG:112E 91 FC lda $0189 ; CPU:$D130 PRG:1130 AD 89 01 cmp #$1C ; CPU:$D133 PRG:1133 C9 1C - beq Label_D151 ; CPU:$D135 PRG:1135 F0 1A - lda ZpF6 ; CPU:$D137 PRG:1137 A5 F6 + beq PlaceFieldTile_SouthEdge ; CPU:$D135 PRG:1135 F0 1A + lda ppu_addr_temp_lo ; CPU:$D137 PRG:1137 A5 F6 and #$10 ; CPU:$D139 PRG:1139 29 10 - bne Label_D151 ; CPU:$D13B PRG:113B D0 14 + bne PlaceFieldTile_SouthEdge ; CPU:$D13B PRG:113B D0 14 iny ; CPU:$D13D PRG:113D C8 - lda (ZpFC),y ; CPU:$D13E PRG:113E B1 FC + lda (ppu_addr_lo),y ; CPU:$D13E PRG:113E B1 FC tax ; CPU:$D140 PRG:1140 AA and #$40 ; CPU:$D141 PRG:1141 29 40 - bne Label_D151 ; CPU:$D143 PRG:1143 D0 0C + bne PlaceFieldTile_SouthEdge ; CPU:$D143 PRG:1143 D0 0C txa ; CPU:$D145 PRG:1145 8A and #$FB ; CPU:$D146 PRG:1146 29 FB - sta (ZpFC),y ; CPU:$D148 PRG:1148 91 FC + sta (ppu_addr_lo),y ; CPU:$D148 PRG:1148 91 FC dey ; CPU:$D14A PRG:114A 88 - lda (ZpFC),y ; CPU:$D14B PRG:114B B1 FC + lda (ppu_addr_lo),y ; CPU:$D14B PRG:114B B1 FC and #$FE ; CPU:$D14D PRG:114D 29 FE - sta (ZpFC),y ; CPU:$D14F PRG:114F 91 FC + sta (ppu_addr_lo),y ; CPU:$D14F PRG:114F 91 FC ; ----------------------------------------------------------------------------- -; Routine: Label_D151 +; Routine: PlaceFieldTile_SouthEdge ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -3013,27 +3431,27 @@ Label_D12C: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_D151: +PlaceFieldTile_SouthEdge: lda $0188 ; CPU:$D151 PRG:1151 AD 88 01 cmp #$1A ; CPU:$D154 PRG:1154 C9 1A - beq Label_D174 ; CPU:$D156 PRG:1156 F0 1C - lda ZpF6 ; CPU:$D158 PRG:1158 A5 F6 + beq PlaceFieldTile_WestEdge ; CPU:$D156 PRG:1156 F0 1C + lda ppu_addr_temp_lo ; CPU:$D158 PRG:1158 A5 F6 and #$20 ; CPU:$D15A PRG:115A 29 20 - bne Label_D174 ; CPU:$D15C PRG:115C D0 16 + bne PlaceFieldTile_WestEdge ; CPU:$D15C PRG:115C D0 16 ldy #$35 ; CPU:$D15E PRG:115E A0 35 - lda (ZpFC),y ; CPU:$D160 PRG:1160 B1 FC + lda (ppu_addr_lo),y ; CPU:$D160 PRG:1160 B1 FC tax ; CPU:$D162 PRG:1162 AA and #$80 ; CPU:$D163 PRG:1163 29 80 - bne Label_D174 ; CPU:$D165 PRG:1165 D0 0D + bne PlaceFieldTile_WestEdge ; CPU:$D165 PRG:1165 D0 0D txa ; CPU:$D167 PRG:1167 8A and #$F7 ; CPU:$D168 PRG:1168 29 F7 - sta (ZpFC),y ; CPU:$D16A PRG:116A 91 FC + sta (ppu_addr_lo),y ; CPU:$D16A PRG:116A 91 FC ldy #$1B ; CPU:$D16C PRG:116C A0 1B - lda (ZpFC),y ; CPU:$D16E PRG:116E B1 FC + lda (ppu_addr_lo),y ; CPU:$D16E PRG:116E B1 FC and #$FD ; CPU:$D170 PRG:1170 29 FD - sta (ZpFC),y ; CPU:$D172 PRG:1172 91 FC + sta (ppu_addr_lo),y ; CPU:$D172 PRG:1172 91 FC ; ----------------------------------------------------------------------------- -; Routine: Label_D174 +; Routine: PlaceFieldTile_WestEdge ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -3041,27 +3459,27 @@ Label_D151: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_D174: +PlaceFieldTile_WestEdge: lda $0189 ; CPU:$D174 PRG:1174 AD 89 01 cmp #$03 ; CPU:$D177 PRG:1177 C9 03 - beq Label_D197 ; CPU:$D179 PRG:1179 F0 1C - lda ZpF6 ; CPU:$D17B PRG:117B A5 F6 + beq PlaceFieldTile_NorthEdge ; CPU:$D179 PRG:1179 F0 1C + lda ppu_addr_temp_lo ; CPU:$D17B PRG:117B A5 F6 and #$40 ; CPU:$D17D PRG:117D 29 40 - bne Label_D197 ; CPU:$D17F PRG:117F D0 16 + bne PlaceFieldTile_NorthEdge ; CPU:$D17F PRG:117F D0 16 ldy #$1A ; CPU:$D181 PRG:1181 A0 1A - lda (ZpFC),y ; CPU:$D183 PRG:1183 B1 FC + lda (ppu_addr_lo),y ; CPU:$D183 PRG:1183 B1 FC tax ; CPU:$D185 PRG:1185 AA and #$10 ; CPU:$D186 PRG:1186 29 10 - bne Label_D197 ; CPU:$D188 PRG:1188 D0 0D + bne PlaceFieldTile_NorthEdge ; CPU:$D188 PRG:1188 D0 0D txa ; CPU:$D18A PRG:118A 8A and #$FE ; CPU:$D18B PRG:118B 29 FE - sta (ZpFC),y ; CPU:$D18D PRG:118D 91 FC + sta (ppu_addr_lo),y ; CPU:$D18D PRG:118D 91 FC ldy #$1B ; CPU:$D18F PRG:118F A0 1B - lda (ZpFC),y ; CPU:$D191 PRG:1191 B1 FC + lda (ppu_addr_lo),y ; CPU:$D191 PRG:1191 B1 FC and #$FB ; CPU:$D193 PRG:1193 29 FB - sta (ZpFC),y ; CPU:$D195 PRG:1195 91 FC + sta (ppu_addr_lo),y ; CPU:$D195 PRG:1195 91 FC ; ----------------------------------------------------------------------------- -; Routine: Label_D197 +; Routine: PlaceFieldTile_NorthEdge ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -3069,27 +3487,27 @@ Label_D174: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_D197: +PlaceFieldTile_NorthEdge: lda $0188 ; CPU:$D197 PRG:1197 AD 88 01 cmp #$08 ; CPU:$D19A PRG:119A C9 08 - beq Label_D1BA ; CPU:$D19C PRG:119C F0 1C - lda ZpF6 ; CPU:$D19E PRG:119E A5 F6 + beq PlaceFieldTile_Done ; CPU:$D19C PRG:119C F0 1C + lda ppu_addr_temp_lo ; CPU:$D19E PRG:119E A5 F6 and #$80 ; CPU:$D1A0 PRG:11A0 29 80 - bne Label_D1BA ; CPU:$D1A2 PRG:11A2 D0 16 + bne PlaceFieldTile_Done ; CPU:$D1A2 PRG:11A2 D0 16 ldy #$01 ; CPU:$D1A4 PRG:11A4 A0 01 - lda (ZpFC),y ; CPU:$D1A6 PRG:11A6 B1 FC + lda (ppu_addr_lo),y ; CPU:$D1A6 PRG:11A6 B1 FC tax ; CPU:$D1A8 PRG:11A8 AA and #$20 ; CPU:$D1A9 PRG:11A9 29 20 - bne Label_D1BA ; CPU:$D1AB PRG:11AB D0 0D + bne PlaceFieldTile_Done ; CPU:$D1AB PRG:11AB D0 0D txa ; CPU:$D1AD PRG:11AD 8A and #$FD ; CPU:$D1AE PRG:11AE 29 FD - sta (ZpFC),y ; CPU:$D1B0 PRG:11B0 91 FC + sta (ppu_addr_lo),y ; CPU:$D1B0 PRG:11B0 91 FC ldy #$1B ; CPU:$D1B2 PRG:11B2 A0 1B - lda (ZpFC),y ; CPU:$D1B4 PRG:11B4 B1 FC + lda (ppu_addr_lo),y ; CPU:$D1B4 PRG:11B4 B1 FC and #$F7 ; CPU:$D1B6 PRG:11B6 29 F7 - sta (ZpFC),y ; CPU:$D1B8 PRG:11B8 91 FC + sta (ppu_addr_lo),y ; CPU:$D1B8 PRG:11B8 91 FC ; ----------------------------------------------------------------------------- -; Routine: Label_D1BA +; Routine: PlaceFieldTile_Done ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -3097,16 +3515,27 @@ Label_D197: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_D1BA: +PlaceFieldTile_Done: rts ; CPU:$D1BA PRG:11BA 60 -; ---- data $D1BB-$D209 (79 bytes) ---- - .byte $A9, $24, $8D, $06, $20, $A9, $00, $8D, $06, $20, $A2, $06, $A0, $00, $20, $A9 ; CPU:$D1BB PRG:11BB A9 24 8D 06 20 A9 00 8D 06 20 A2 06 A0 00 20 A9 - .byte $CB, $A0, $00, $B1, $FC, $AA, $C9, $F0, $90, $05, $A9, $DE, $4C, $FB, $D1, $29 ; CPU:$D1CB PRG:11CB CB A0 00 B1 FC AA C9 F0 90 05 A9 DE 4C FB D1 29 - .byte $F0, $D0, $0A, $8A, $29, $0F, $AA, $BD, $80, $04, $4C, $FB, $D1, $A0, $00, $8A ; CPU:$D1DB PRG:11DB F0 D0 0A 8A 29 0F AA BD 80 04 4C FB D1 A0 00 8A - .byte $D9, $90, $04, $F0, $05, $C8, $C8, $4C, $EB, $D1, $B9, $91, $04, $4C, $FB, $D1 ; CPU:$D1EB PRG:11EB D9 90 04 F0 05 C8 C8 4C EB D1 B9 91 04 4C FB D1 - .byte $A0, $00, $8D, $07, $20, $20, $5F, $CB, $A5, $FD, $C9, $08, $D0, $C3, $60 ; CPU:$D1FB PRG:11FB A0 00 8D 07 20 20 5F CB A5 FD C9 08 D0 C3 60 ; ----------------------------------------------------------------------------- -; Routine: Label_D20A +; Routine: UploadFieldMap +; Global: Uploads the 512-byte field map at $0600-$07FF to VRAM $2400. +; Local: Each cell is translated through the 16-byte tables at $0480/$0490 so that the +; stored cell code becomes the actual nametable tile number. +; Parameters: none. +; Returns: none. +; Clobbers: A, X, Y, ppu_addr, ptr, ppu_src. +; ----------------------------------------------------------------------------- +UploadFieldMap: + lda #$24 ; CPU:$D1BB PRG:11BB A9 24 + sta $2006 ; CPU:$D1BD PRG:11BD 8D 06 20 + lda #$00 ; CPU:$D1C0 PRG:11C0 A9 00 + sta $2006 ; CPU:$D1C2 PRG:11C2 8D 06 20 + ldx #$06 ; CPU:$D1C5 PRG:11C5 A2 06 + ldy #$00 ; CPU:$D1C7 PRG:11C7 A0 00 + jsr $CBA9 ; CPU:$D1C9 PRG:11C9 20 A9 CB +; ----------------------------------------------------------------------------- +; Routine: UploadFieldMap_Loop ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -3114,13 +3543,102 @@ Label_D1BA: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_D20A: +UploadFieldMap_Loop: + ldy #$00 ; CPU:$D1CC PRG:11CC A0 00 + lda (ppu_addr_lo),y ; CPU:$D1CE PRG:11CE B1 FC + tax ; CPU:$D1D0 PRG:11D0 AA + cmp #$F0 ; CPU:$D1D1 PRG:11D1 C9 F0 + bcc UploadFieldMap_LowNibble ; CPU:$D1D3 PRG:11D3 90 05 + lda #$DE ; CPU:$D1D5 PRG:11D5 A9 DE + jmp $D1FB ; CPU:$D1D7 PRG:11D7 4C FB D1 +; ----------------------------------------------------------------------------- +; Routine: UploadFieldMap_LowNibble +; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. +; Local: Continues its parent routine along the condition or operation encoded in this label, +; then returns, branches again, or rejoins shared code as documented by the instructions. +; Parameters: Undetermined in Pass 1 unless implied by the caller. +; Returns: Undetermined in Pass 1; status flags and registers may carry results. +; Clobbers: Undetermined in Pass 1. +; ----------------------------------------------------------------------------- +UploadFieldMap_LowNibble: + and #$F0 ; CPU:$D1DA PRG:11DA 29 F0 + bne UploadFieldMap_HighNibble ; CPU:$D1DC PRG:11DC D0 0A + txa ; CPU:$D1DE PRG:11DE 8A + and #$0F ; CPU:$D1DF PRG:11DF 29 0F + tax ; CPU:$D1E1 PRG:11E1 AA + lda $0480,x ; CPU:$D1E2 PRG:11E2 BD 80 04 + jmp $D1FB ; CPU:$D1E5 PRG:11E5 4C FB D1 +; ----------------------------------------------------------------------------- +; Routine: UploadFieldMap_HighNibble +; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. +; Local: Continues its parent routine along the condition or operation encoded in this label, +; then returns, branches again, or rejoins shared code as documented by the instructions. +; Parameters: Undetermined in Pass 1 unless implied by the caller. +; Returns: Undetermined in Pass 1; status flags and registers may carry results. +; Clobbers: Undetermined in Pass 1. +; ----------------------------------------------------------------------------- +UploadFieldMap_HighNibble: + ldy #$00 ; CPU:$D1E8 PRG:11E8 A0 00 + txa ; CPU:$D1EA PRG:11EA 8A +; ----------------------------------------------------------------------------- +; Routine: UploadFieldMap_HighNibbleSearch +; Global: Resolves a field cell whose high nibble is set by searching the $0490 pair table. +; Local: Walks the 2-byte entries (key, tile) until the key matches the cell code. +; Parameters: X = the cell code. +; Returns: Falls into UploadFieldMap_Found with Y = the matching entry offset. +; Clobbers: A, Y. +; ----------------------------------------------------------------------------- +UploadFieldMap_HighNibbleSearch: + cmp $0490,y ; CPU:$D1EB PRG:11EB D9 90 04 + beq UploadFieldMap_Found ; CPU:$D1EE PRG:11EE F0 05 + iny ; CPU:$D1F0 PRG:11F0 C8 + iny ; CPU:$D1F1 PRG:11F1 C8 + jmp $D1EB ; CPU:$D1F2 PRG:11F2 4C EB D1 +; ----------------------------------------------------------------------------- +; Routine: UploadFieldMap_Found +; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. +; Local: Continues its parent routine along the condition or operation encoded in this label, +; then returns, branches again, or rejoins shared code as documented by the instructions. +; Parameters: Undetermined in Pass 1 unless implied by the caller. +; Returns: Undetermined in Pass 1; status flags and registers may carry results. +; Clobbers: Undetermined in Pass 1. +; ----------------------------------------------------------------------------- +UploadFieldMap_Found: + lda $0491,y ; CPU:$D1F5 PRG:11F5 B9 91 04 + jmp $D1FB ; CPU:$D1F8 PRG:11F8 4C FB D1 +; ----------------------------------------------------------------------------- +; Routine: UploadFieldMap_Store +; Global: The shared store tail of the field-map upload - writes one translated tile. +; Local: Also advances the ppu_addr source pointer once per cell and repeats the loop until +; the whole $0600-$07FF page has been sent. +; Parameters: A = the nametable tile number. +; Returns: Returns when the source page is exhausted. +; Clobbers: A, Y, ppu_addr_lo/hi. +; ----------------------------------------------------------------------------- +UploadFieldMap_Store: + ldy #$00 ; CPU:$D1FB PRG:11FB A0 00 + sta $2007 ; CPU:$D1FD PRG:11FD 8D 07 20 + jsr $CB5F ; CPU:$D200 PRG:1200 20 5F CB + lda ppu_addr_hi ; CPU:$D203 PRG:1203 A5 FD + cmp #$08 ; CPU:$D205 PRG:1205 C9 08 + bne UploadFieldMap_Loop ; CPU:$D207 PRG:1207 D0 C3 + rts ; CPU:$D209 PRG:1209 60 +; ----------------------------------------------------------------------------- +; Routine: FixIsolatedCells +; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. +; Local: Continues its parent routine along the condition or operation encoded in this label, +; then returns, branches again, or rejoins shared code as documented by the instructions. +; Parameters: Undetermined in Pass 1 unless implied by the caller. +; Returns: Undetermined in Pass 1; status flags and registers may carry results. +; Clobbers: Undetermined in Pass 1. +; ----------------------------------------------------------------------------- +FixIsolatedCells: lda #$06 ; CPU:$D20A PRG:120A A9 06 - sta ZpFB ; CPU:$D20C PRG:120C 85 FB + sta ptr_hi ; CPU:$D20C PRG:120C 85 FB lda #$00 ; CPU:$D20E PRG:120E A9 00 - sta ZpFA ; CPU:$D210 PRG:1210 85 FA + sta ptr_lo ; CPU:$D210 PRG:1210 85 FA ; ----------------------------------------------------------------------------- -; Routine: Label_D212 +; Routine: FixIsolatedCells_Loop ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -3128,17 +3646,17 @@ Label_D20A: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_D212: +FixIsolatedCells_Loop: ldy #$00 ; CPU:$D212 PRG:1212 A0 00 - lda (ZpFA),y ; CPU:$D214 PRG:1214 B1 FA + lda (ptr_lo),y ; CPU:$D214 PRG:1214 B1 FA and #$33 ; CPU:$D216 PRG:1216 29 33 - bne Label_D222 ; CPU:$D218 PRG:1218 D0 08 + bne FixIsolatedCells_Next ; CPU:$D218 PRG:1218 D0 08 ldy #$1B ; CPU:$D21A PRG:121A A0 1B - lda (ZpFA),y ; CPU:$D21C PRG:121C B1 FA + lda (ptr_lo),y ; CPU:$D21C PRG:121C B1 FA and #$CC ; CPU:$D21E PRG:121E 29 CC - beq Label_D22C ; CPU:$D220 PRG:1220 F0 0A + beq FixIsolatedCells_Fix ; CPU:$D220 PRG:1220 F0 0A ; ----------------------------------------------------------------------------- -; Routine: Label_D222 +; Routine: FixIsolatedCells_Next ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -3146,14 +3664,14 @@ Label_D212: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_D222: +FixIsolatedCells_Next: jsr $CB5A ; CPU:$D222 PRG:1222 20 5A CB - lda ZpFB ; CPU:$D225 PRG:1225 A5 FB + lda ptr_hi ; CPU:$D225 PRG:1225 A5 FB cmp #$08 ; CPU:$D227 PRG:1227 C9 08 - bne Label_D212 ; CPU:$D229 PRG:1229 D0 E7 + bne FixIsolatedCells_Loop ; CPU:$D229 PRG:1229 D0 E7 rts ; CPU:$D22B PRG:122B 60 ; ----------------------------------------------------------------------------- -; Routine: Label_D22C +; Routine: FixIsolatedCells_Fix ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -3161,51 +3679,51 @@ Label_D222: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_D22C: - lda ZpFB ; CPU:$D22C PRG:122C A5 FB +FixIsolatedCells_Fix: + lda ptr_hi ; CPU:$D22C PRG:122C A5 FB clc ; CPU:$D22E PRG:122E 18 adc #$1E ; CPU:$D22F PRG:122F 69 1E - sta ZpFD ; CPU:$D231 PRG:1231 85 FD - lda ZpFA ; CPU:$D233 PRG:1233 A5 FA - sta ZpFC ; CPU:$D235 PRG:1235 85 FC + sta ppu_addr_hi ; CPU:$D231 PRG:1231 85 FD + lda ptr_lo ; CPU:$D233 PRG:1233 A5 FA + sta ppu_addr_lo ; CPU:$D235 PRG:1235 85 FC jsr $CAAE ; CPU:$D237 PRG:1237 20 AE CA - lda $2007 ; CPU:$D23A PRG:123A AD 07 20 + lda PPUDATA ; CPU:$D23A PRG:123A AD 07 20 ldx #$00 ; CPU:$D23D PRG:123D A2 00 jsr $D28F ; CPU:$D23F PRG:123F 20 8F D2 - sta ZpF8 ; CPU:$D242 PRG:1242 85 F8 - lda $2007 ; CPU:$D244 PRG:1244 AD 07 20 + sta ppu_src_lo ; CPU:$D242 PRG:1242 85 F8 + lda PPUDATA ; CPU:$D244 PRG:1244 AD 07 20 ldx #$1C ; CPU:$D247 PRG:1247 A2 1C jsr $D28F ; CPU:$D249 PRG:1249 20 8F D2 - sta ZpF9 ; CPU:$D24C PRG:124C 85 F9 + sta ppu_src_hi ; CPU:$D24C PRG:124C 85 F9 jsr $CAA3 ; CPU:$D24E PRG:124E 20 A3 CA - lda ZpF8 ; CPU:$D251 PRG:1251 A5 F8 - sta $2007 ; CPU:$D253 PRG:1253 8D 07 20 - lda ZpF9 ; CPU:$D256 PRG:1256 A5 F9 - sta $2007 ; CPU:$D258 PRG:1258 8D 07 20 - lda ZpFC ; CPU:$D25B PRG:125B A5 FC + lda ppu_src_lo ; CPU:$D251 PRG:1251 A5 F8 + sta PPUDATA ; CPU:$D253 PRG:1253 8D 07 20 + lda ppu_src_hi ; CPU:$D256 PRG:1256 A5 F9 + sta PPUDATA ; CPU:$D258 PRG:1258 8D 07 20 + lda ppu_addr_lo ; CPU:$D25B PRG:125B A5 FC clc ; CPU:$D25D PRG:125D 18 adc #$1A ; CPU:$D25E PRG:125E 69 1A - sta ZpFC ; CPU:$D260 PRG:1260 85 FC - lda ZpFD ; CPU:$D262 PRG:1262 A5 FD + sta ppu_addr_lo ; CPU:$D260 PRG:1260 85 FC + lda ppu_addr_hi ; CPU:$D262 PRG:1262 A5 FD adc #$00 ; CPU:$D264 PRG:1264 69 00 - sta ZpFD ; CPU:$D266 PRG:1266 85 FD + sta ppu_addr_hi ; CPU:$D266 PRG:1266 85 FD jsr $CAAE ; CPU:$D268 PRG:1268 20 AE CA - lda $2007 ; CPU:$D26B PRG:126B AD 07 20 + lda PPUDATA ; CPU:$D26B PRG:126B AD 07 20 ldx #$38 ; CPU:$D26E PRG:126E A2 38 jsr $D28F ; CPU:$D270 PRG:1270 20 8F D2 - sta ZpF8 ; CPU:$D273 PRG:1273 85 F8 - lda $2007 ; CPU:$D275 PRG:1275 AD 07 20 + sta ppu_src_lo ; CPU:$D273 PRG:1273 85 F8 + lda PPUDATA ; CPU:$D275 PRG:1275 AD 07 20 ldx #$54 ; CPU:$D278 PRG:1278 A2 54 jsr $D28F ; CPU:$D27A PRG:127A 20 8F D2 - sta ZpF9 ; CPU:$D27D PRG:127D 85 F9 + sta ppu_src_hi ; CPU:$D27D PRG:127D 85 F9 jsr $CAA3 ; CPU:$D27F PRG:127F 20 A3 CA - lda ZpF8 ; CPU:$D282 PRG:1282 A5 F8 - sta $2007 ; CPU:$D284 PRG:1284 8D 07 20 - lda ZpF9 ; CPU:$D287 PRG:1287 A5 F9 - sta $2007 ; CPU:$D289 PRG:1289 8D 07 20 + lda ppu_src_lo ; CPU:$D282 PRG:1282 A5 F8 + sta PPUDATA ; CPU:$D284 PRG:1284 8D 07 20 + lda ppu_src_hi ; CPU:$D287 PRG:1287 A5 F9 + sta PPUDATA ; CPU:$D289 PRG:1289 8D 07 20 jmp $D222 ; CPU:$D28C PRG:128C 4C 22 D2 ; ----------------------------------------------------------------------------- -; Routine: Label_D28F +; Routine: RemapTileIndex ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -3213,10 +3731,10 @@ Label_D22C: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_D28F: +RemapTileIndex: ldy #$0E ; CPU:$D28F PRG:128F A0 0E ; ----------------------------------------------------------------------------- -; Routine: Label_D291 +; Routine: RemapTileIndex_Loop ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -3224,16 +3742,16 @@ Label_D28F: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_D291: +RemapTileIndex_Loop: cmp $04B0,x ; CPU:$D291 PRG:1291 DD B0 04 - beq Label_D29C ; CPU:$D294 PRG:1294 F0 06 + beq RemapTileIndex_Found ; CPU:$D294 PRG:1294 F0 06 inx ; CPU:$D296 PRG:1296 E8 inx ; CPU:$D297 PRG:1297 E8 dey ; CPU:$D298 PRG:1298 88 - bne Label_D291 ; CPU:$D299 PRG:1299 D0 F6 + bne RemapTileIndex_Loop ; CPU:$D299 PRG:1299 D0 F6 rts ; CPU:$D29B PRG:129B 60 ; ----------------------------------------------------------------------------- -; Routine: Label_D29C +; Routine: RemapTileIndex_Found ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -3241,16 +3759,11 @@ Label_D291: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_D29C: +RemapTileIndex_Found: lda $04B1,x ; CPU:$D29C PRG:129C BD B1 04 rts ; CPU:$D29F PRG:129F 60 -; ---- data $D2A0-$D2D3 (52 bytes) ---- - .byte $A0, $00, $B1, $FE, $48, $29, $1F, $85, $F9, $C8, $B1, $FE, $85, $F8, $C8, $B1 ; CPU:$D2A0 PRG:12A0 A0 00 B1 FE 48 29 1F 85 F9 C8 B1 FE 85 F8 C8 B1 - .byte $FE, $8D, $8C, $01, $C8, $B1, $FE, $8D, $8A, $01, $A9, $00, $85, $09, $20, $D4 ; CPU:$D2B0 PRG:12B0 FE 8D 8C 01 C8 B1 FE 8D 8A 01 A9 00 85 09 20 D4 - .byte $D2, $A5, $FE, $18, $69, $04, $85, $FE, $A5, $FF, $69, $00, $85, $FF, $68, $29 ; CPU:$D2C0 PRG:12C0 D2 A5 FE 18 69 04 85 FE A5 FF 69 00 85 FF 68 29 - .byte $80, $F0, $CD, $60 ; CPU:$D2D0 PRG:12D0 80 F0 CD 60 ; ----------------------------------------------------------------------------- -; Routine: Label_D2D4 +; Routine: RunCellCommandList ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -3258,14 +3771,52 @@ Label_D29C: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_D2D4: - ldx ZpF9 ; CPU:$D2D4 PRG:12D4 A6 F9 - ldy ZpF8 ; CPU:$D2D6 PRG:12D6 A4 F8 +RunCellCommandList: + ldy #$00 ; CPU:$D2A0 PRG:12A0 A0 00 + lda (ppu_addr_src_lo),y ; CPU:$D2A2 PRG:12A2 B1 FE + pha ; CPU:$D2A4 PRG:12A4 48 + and #$1F ; CPU:$D2A5 PRG:12A5 29 1F + sta ppu_src_hi ; CPU:$D2A7 PRG:12A7 85 F9 + iny ; CPU:$D2A9 PRG:12A9 C8 + lda (ppu_addr_src_lo),y ; CPU:$D2AA PRG:12AA B1 FE + sta ppu_src_lo ; CPU:$D2AC PRG:12AC 85 F8 + iny ; CPU:$D2AE PRG:12AE C8 + lda (ppu_addr_src_lo),y ; CPU:$D2AF PRG:12AF B1 FE + sta $018C ; CPU:$D2B1 PRG:12B1 8D 8C 01 + iny ; CPU:$D2B4 PRG:12B4 C8 + lda (ppu_addr_src_lo),y ; CPU:$D2B5 PRG:12B5 B1 FE + sta $018A ; CPU:$D2B7 PRG:12B7 8D 8A 01 + lda #$00 ; CPU:$D2BA PRG:12BA A9 00 + sta Zp09 ; CPU:$D2BC PRG:12BC 85 09 + jsr $D2D4 ; CPU:$D2BE PRG:12BE 20 D4 D2 + lda ppu_addr_src_lo ; CPU:$D2C1 PRG:12C1 A5 FE + clc ; CPU:$D2C3 PRG:12C3 18 + adc #$04 ; CPU:$D2C4 PRG:12C4 69 04 + sta ppu_addr_src_lo ; CPU:$D2C6 PRG:12C6 85 FE + lda ppu_addr_src_hi ; CPU:$D2C8 PRG:12C8 A5 FF + adc #$00 ; CPU:$D2CA PRG:12CA 69 00 + sta ppu_addr_src_hi ; CPU:$D2CC PRG:12CC 85 FF + pla ; CPU:$D2CE PRG:12CE 68 + and #$80 ; CPU:$D2CF PRG:12CF 29 80 + beq RunCellCommandList ; CPU:$D2D1 PRG:12D1 F0 CD + rts ; CPU:$D2D3 PRG:12D3 60 +; ----------------------------------------------------------------------------- +; Routine: DrawCellGrid +; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. +; Local: Continues its parent routine along the condition or operation encoded in this label, +; then returns, branches again, or rejoins shared code as documented by the instructions. +; Parameters: Undetermined in Pass 1 unless implied by the caller. +; Returns: Undetermined in Pass 1; status flags and registers may carry results. +; Clobbers: Undetermined in Pass 1. +; ----------------------------------------------------------------------------- +DrawCellGrid: + ldx ppu_src_hi ; CPU:$D2D4 PRG:12D4 A6 F9 + ldy ppu_src_lo ; CPU:$D2D6 PRG:12D6 A4 F8 lda $018B ; CPU:$D2D8 PRG:12D8 AD 8B 01 - beq Label_D300 ; CPU:$D2DB PRG:12DB F0 23 - stx ZpFB ; CPU:$D2DD PRG:12DD 86 FB + beq DrawCellGrid_TileRow ; CPU:$D2DB PRG:12DB F0 23 + stx ptr_hi ; CPU:$D2DD PRG:12DD 86 FB ; ----------------------------------------------------------------------------- -; Routine: Label_D2DF +; Routine: DrawCellGrid_AttrLoop ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -3273,24 +3824,24 @@ Label_D2D4: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_D2DF: - ldx ZpFB ; CPU:$D2DF PRG:12DF A6 FB - ldy ZpF8 ; CPU:$D2E1 PRG:12E1 A4 F8 - stx ZpFD ; CPU:$D2E3 PRG:12E3 86 FD - sty ZpFC ; CPU:$D2E5 PRG:12E5 84 FC +DrawCellGrid_AttrLoop: + ldx ptr_hi ; CPU:$D2DF PRG:12DF A6 FB + ldy ppu_src_lo ; CPU:$D2E1 PRG:12E1 A4 F8 + stx ppu_addr_hi ; CPU:$D2E3 PRG:12E3 86 FD + sty ppu_addr_lo ; CPU:$D2E5 PRG:12E5 84 FC lda Zp09 ; CPU:$D2E7 PRG:12E7 A5 09 jsr $CD65 ; CPU:$D2E9 PRG:12E9 20 65 CD pha ; CPU:$D2EC PRG:12EC 48 jsr $CAA3 ; CPU:$D2ED PRG:12ED 20 A3 CA pla ; CPU:$D2F0 PRG:12F0 68 - sta $2007 ; CPU:$D2F1 PRG:12F1 8D 07 20 - lda ZpFB ; CPU:$D2F4 PRG:12F4 A5 FB - inc ZpFB ; CPU:$D2F6 PRG:12F6 E6 FB + sta PPUDATA ; CPU:$D2F1 PRG:12F1 8D 07 20 + lda ptr_hi ; CPU:$D2F4 PRG:12F4 A5 FB + inc ptr_hi ; CPU:$D2F6 PRG:12F6 E6 FB cmp $018C ; CPU:$D2F8 PRG:12F8 CD 8C 01 - bne Label_D2DF ; CPU:$D2FB PRG:12FB D0 E2 + bne DrawCellGrid_AttrLoop ; CPU:$D2FB PRG:12FB D0 E2 jmp $D31B ; CPU:$D2FD PRG:12FD 4C 1B D3 ; ----------------------------------------------------------------------------- -; Routine: Label_D300 +; Routine: DrawCellGrid_TileRow ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -3298,16 +3849,16 @@ Label_D2DF: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_D300: +DrawCellGrid_TileRow: jsr $FAF9 ; CPU:$D300 PRG:1300 20 F9 FA lda $018C ; CPU:$D303 PRG:1303 AD 8C 01 sec ; CPU:$D306 PRG:1306 38 - sbc ZpF9 ; CPU:$D307 PRG:1307 E5 F9 + sbc ppu_src_hi ; CPU:$D307 PRG:1307 E5 F9 tax ; CPU:$D309 PRG:1309 AA inx ; CPU:$D30A PRG:130A E8 ldy #$00 ; CPU:$D30B PRG:130B A0 00 ; ----------------------------------------------------------------------------- -; Routine: Label_D30D +; Routine: DrawCellGrid_TileCell ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -3315,14 +3866,14 @@ Label_D300: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_D30D: - lda (ZpFC),y ; CPU:$D30D PRG:130D B1 FC +DrawCellGrid_TileCell: + lda (ppu_addr_lo),y ; CPU:$D30D PRG:130D B1 FC cmp #$DE ; CPU:$D30F PRG:130F C9 DE - bne Label_D317 ; CPU:$D311 PRG:1311 D0 04 + bne DrawCellGrid_TileNext ; CPU:$D311 PRG:1311 D0 04 lda #$80 ; CPU:$D313 PRG:1313 A9 80 - sta (ZpFC),y ; CPU:$D315 PRG:1315 91 FC + sta (ppu_addr_lo),y ; CPU:$D315 PRG:1315 91 FC ; ----------------------------------------------------------------------------- -; Routine: Label_D317 +; Routine: DrawCellGrid_TileNext ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -3330,12 +3881,12 @@ Label_D30D: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_D317: +DrawCellGrid_TileNext: iny ; CPU:$D317 PRG:1317 C8 dex ; CPU:$D318 PRG:1318 CA - bne Label_D30D ; CPU:$D319 PRG:1319 D0 F2 + bne DrawCellGrid_TileCell ; CPU:$D319 PRG:1319 D0 F2 ; ----------------------------------------------------------------------------- -; Routine: Label_D31B +; Routine: DrawCellGrid_NextColumn ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -3343,22 +3894,14 @@ Label_D317: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_D31B: - lda ZpF8 ; CPU:$D31B PRG:131B A5 F8 - inc ZpF8 ; CPU:$D31D PRG:131D E6 F8 +DrawCellGrid_NextColumn: + lda ppu_src_lo ; CPU:$D31B PRG:131B A5 F8 + inc ppu_src_lo ; CPU:$D31D PRG:131D E6 F8 cmp $018A ; CPU:$D31F PRG:131F CD 8A 01 - bne Label_D2D4 ; CPU:$D322 PRG:1322 D0 B0 + bne DrawCellGrid ; CPU:$D322 PRG:1322 D0 B0 rts ; CPU:$D324 PRG:1324 60 -; ---- data $D325-$D391 (109 bytes) ---- - .byte $A0, $00, $B1, $FE, $48, $29, $1F, $F0, $56, $8D, $89, $01, $AA, $C8, $B1, $FE ; CPU:$D325 PRG:1325 A0 00 B1 FE 48 29 1F F0 56 8D 89 01 AA C8 B1 FE - .byte $8D, $88, $01, $A8, $20, $F9, $FA, $AD, $C0, $01, $0A, $AA, $AD, $88, $01, $9D ; CPU:$D335 PRG:1335 8D 88 01 A8 20 F9 FA AD C0 01 0A AA AD 88 01 9D - .byte $A0, $01, $FE, $A0, $01, $1E, $A0, $01, $1E, $A0, $01, $1E, $A0, $01, $AD, $89 ; CPU:$D345 PRG:1345 A0 01 FE A0 01 1E A0 01 1E A0 01 1E A0 01 AD 89 - .byte $01, $9D, $A1, $01, $FE, $A1, $01, $1E, $A1, $01, $1E, $A1, $01, $1E, $A1, $01 ; CPU:$D355 PRG:1355 01 9D A1 01 FE A1 01 1E A1 01 1E A1 01 1E A1 01 - .byte $EE, $C0, $01, $A0, $00, $A2, $C6, $20, $92, $D3, $A0, $01, $A2, $C7, $20, $92 ; CPU:$D365 PRG:1365 EE C0 01 A0 00 A2 C6 20 92 D3 A0 01 A2 C7 20 92 - .byte $D3, $A0, $1A, $A2, $C5, $20, $92, $D3, $A0, $1B, $A2, $C4, $20, $92, $D3, $A2 ; CPU:$D375 PRG:1375 D3 A0 1A A2 C5 20 92 D3 A0 1B A2 C4 20 92 D3 A2 - .byte $FE, $20, $61, $CB, $20, $61, $CB, $68, $29, $80, $F0, $94, $60 ; CPU:$D385 PRG:1385 FE 20 61 CB 20 61 CB 68 29 80 F0 94 60 ; ----------------------------------------------------------------------------- -; Routine: Label_D392 +; Routine: DefinePockets ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -3366,16 +3909,83 @@ Label_D31B: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_D392: - lda (ZpFC),y ; CPU:$D392 PRG:1392 B1 FC +DefinePockets: + ldy #$00 ; CPU:$D325 PRG:1325 A0 00 + lda (ppu_addr_src_lo),y ; CPU:$D327 PRG:1327 B1 FE + pha ; CPU:$D329 PRG:1329 48 + and #$1F ; CPU:$D32A PRG:132A 29 1F + beq DefinePockets_Next ; CPU:$D32C PRG:132C F0 56 + sta $0189 ; CPU:$D32E PRG:132E 8D 89 01 + tax ; CPU:$D331 PRG:1331 AA + iny ; CPU:$D332 PRG:1332 C8 + lda (ppu_addr_src_lo),y ; CPU:$D333 PRG:1333 B1 FE + sta $0188 ; CPU:$D335 PRG:1335 8D 88 01 + tay ; CPU:$D338 PRG:1338 A8 + jsr $FAF9 ; CPU:$D339 PRG:1339 20 F9 FA + lda $01C0 ; CPU:$D33C PRG:133C AD C0 01 + asl a ; CPU:$D33F PRG:133F 0A + tax ; CPU:$D340 PRG:1340 AA + lda $0188 ; CPU:$D341 PRG:1341 AD 88 01 + sta $01A0,x ; CPU:$D344 PRG:1344 9D A0 01 + inc $01A0,x ; CPU:$D347 PRG:1347 FE A0 01 + asl $01A0,x ; CPU:$D34A PRG:134A 1E A0 01 + asl $01A0,x ; CPU:$D34D PRG:134D 1E A0 01 + asl $01A0,x ; CPU:$D350 PRG:1350 1E A0 01 + lda $0189 ; CPU:$D353 PRG:1353 AD 89 01 + sta $01A1,x ; CPU:$D356 PRG:1356 9D A1 01 + inc $01A1,x ; CPU:$D359 PRG:1359 FE A1 01 + asl $01A1,x ; CPU:$D35C PRG:135C 1E A1 01 + asl $01A1,x ; CPU:$D35F PRG:135F 1E A1 01 + asl $01A1,x ; CPU:$D362 PRG:1362 1E A1 01 + inc $01C0 ; CPU:$D365 PRG:1365 EE C0 01 + ldy #$00 ; CPU:$D368 PRG:1368 A0 00 + ldx #$C6 ; CPU:$D36A PRG:136A A2 C6 + jsr $D392 ; CPU:$D36C PRG:136C 20 92 D3 + ldy #$01 ; CPU:$D36F PRG:136F A0 01 + ldx #$C7 ; CPU:$D371 PRG:1371 A2 C7 + jsr $D392 ; CPU:$D373 PRG:1373 20 92 D3 + ldy #$1A ; CPU:$D376 PRG:1376 A0 1A + ldx #$C5 ; CPU:$D378 PRG:1378 A2 C5 + jsr $D392 ; CPU:$D37A PRG:137A 20 92 D3 + ldy #$1B ; CPU:$D37D PRG:137D A0 1B + ldx #$C4 ; CPU:$D37F PRG:137F A2 C4 + jsr $D392 ; CPU:$D381 PRG:1381 20 92 D3 +; ----------------------------------------------------------------------------- +; Routine: DefinePockets_Next +; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. +; Local: Continues its parent routine along the condition or operation encoded in this label, +; then returns, branches again, or rejoins shared code as documented by the instructions. +; Parameters: Undetermined in Pass 1 unless implied by the caller. +; Returns: Undetermined in Pass 1; status flags and registers may carry results. +; Clobbers: Undetermined in Pass 1. +; ----------------------------------------------------------------------------- +DefinePockets_Next: + ldx #$FE ; CPU:$D384 PRG:1384 A2 FE + jsr $CB61 ; CPU:$D386 PRG:1386 20 61 CB + jsr $CB61 ; CPU:$D389 PRG:1389 20 61 CB + pla ; CPU:$D38C PRG:138C 68 + and #$80 ; CPU:$D38D PRG:138D 29 80 + beq DefinePockets ; CPU:$D38F PRG:138F F0 94 + rts ; CPU:$D391 PRG:1391 60 +; ----------------------------------------------------------------------------- +; Routine: DrawPocketCorner +; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. +; Local: Continues its parent routine along the condition or operation encoded in this label, +; then returns, branches again, or rejoins shared code as documented by the instructions. +; Parameters: Undetermined in Pass 1 unless implied by the caller. +; Returns: Undetermined in Pass 1; status flags and registers may carry results. +; Clobbers: Undetermined in Pass 1. +; ----------------------------------------------------------------------------- +DrawPocketCorner: + lda (ppu_addr_lo),y ; CPU:$D392 PRG:1392 B1 FC cmp #$D4 ; CPU:$D394 PRG:1394 C9 D4 - bcs Label_D39F ; CPU:$D396 PRG:1396 B0 07 + bcs DrawPocketCorner_Return ; CPU:$D396 PRG:1396 B0 07 cmp #$80 ; CPU:$D398 PRG:1398 C9 80 - bne Label_D3A0 ; CPU:$D39A PRG:139A D0 04 + bne DrawPocketCorner_Remap ; CPU:$D39A PRG:139A D0 04 txa ; CPU:$D39C PRG:139C 8A - sta (ZpFC),y ; CPU:$D39D PRG:139D 91 FC + sta (ppu_addr_lo),y ; CPU:$D39D PRG:139D 91 FC ; ----------------------------------------------------------------------------- -; Routine: Label_D39F +; Routine: DrawPocketCorner_Return ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -3383,10 +3993,10 @@ Label_D392: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_D39F: +DrawPocketCorner_Return: rts ; CPU:$D39F PRG:139F 60 ; ----------------------------------------------------------------------------- -; Routine: Label_D3A0 +; Routine: DrawPocketCorner_Remap ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -3394,21 +4004,21 @@ Label_D39F: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_D3A0: +DrawPocketCorner_Remap: sec ; CPU:$D3A0 PRG:13A0 38 sbc #$C4 ; CPU:$D3A1 PRG:13A1 E9 C4 - bcc Label_D39F ; CPU:$D3A3 PRG:13A3 90 FA + bcc DrawPocketCorner_Return ; CPU:$D3A3 PRG:13A3 90 FA pha ; CPU:$D3A5 PRG:13A5 48 txa ; CPU:$D3A6 PRG:13A6 8A cmp #$C4 ; CPU:$D3A7 PRG:13A7 C9 C4 - bne Label_D3B3 ; CPU:$D3A9 PRG:13A9 D0 08 + bne DrawPocketCorner_RemapC5 ; CPU:$D3A9 PRG:13A9 D0 08 pla ; CPU:$D3AB PRG:13AB 68 tax ; CPU:$D3AC PRG:13AC AA lda $0520,x ; CPU:$D3AD PRG:13AD BD 20 05 - sta (ZpFC),y ; CPU:$D3B0 PRG:13B0 91 FC + sta (ppu_addr_lo),y ; CPU:$D3B0 PRG:13B0 91 FC rts ; CPU:$D3B2 PRG:13B2 60 ; ----------------------------------------------------------------------------- -; Routine: Label_D3B3 +; Routine: DrawPocketCorner_RemapC5 ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -3416,16 +4026,16 @@ Label_D3A0: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_D3B3: +DrawPocketCorner_RemapC5: cmp #$C5 ; CPU:$D3B3 PRG:13B3 C9 C5 - bne Label_D3BF ; CPU:$D3B5 PRG:13B5 D0 08 + bne DrawPocketCorner_RemapC6 ; CPU:$D3B5 PRG:13B5 D0 08 pla ; CPU:$D3B7 PRG:13B7 68 tax ; CPU:$D3B8 PRG:13B8 AA lda $0530,x ; CPU:$D3B9 PRG:13B9 BD 30 05 - sta (ZpFC),y ; CPU:$D3BC PRG:13BC 91 FC + sta (ppu_addr_lo),y ; CPU:$D3BC PRG:13BC 91 FC rts ; CPU:$D3BE PRG:13BE 60 ; ----------------------------------------------------------------------------- -; Routine: Label_D3BF +; Routine: DrawPocketCorner_RemapC6 ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -3433,16 +4043,16 @@ Label_D3B3: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_D3BF: +DrawPocketCorner_RemapC6: cmp #$C6 ; CPU:$D3BF PRG:13BF C9 C6 - bne Label_D3CB ; CPU:$D3C1 PRG:13C1 D0 08 + bne DrawPocketCorner_RemapC7 ; CPU:$D3C1 PRG:13C1 D0 08 pla ; CPU:$D3C3 PRG:13C3 68 tax ; CPU:$D3C4 PRG:13C4 AA lda $0540,x ; CPU:$D3C5 PRG:13C5 BD 40 05 - sta (ZpFC),y ; CPU:$D3C8 PRG:13C8 91 FC + sta (ppu_addr_lo),y ; CPU:$D3C8 PRG:13C8 91 FC rts ; CPU:$D3CA PRG:13CA 60 ; ----------------------------------------------------------------------------- -; Routine: Label_D3CB +; Routine: DrawPocketCorner_RemapC7 ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -3450,14 +4060,14 @@ Label_D3BF: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_D3CB: +DrawPocketCorner_RemapC7: pla ; CPU:$D3CB PRG:13CB 68 tax ; CPU:$D3CC PRG:13CC AA lda $0550,x ; CPU:$D3CD PRG:13CD BD 50 05 - sta (ZpFC),y ; CPU:$D3D0 PRG:13D0 91 FC + sta (ppu_addr_lo),y ; CPU:$D3D0 PRG:13D0 91 FC rts ; CPU:$D3D2 PRG:13D2 60 ; ----------------------------------------------------------------------------- -; Routine: Label_D3D3 +; Routine: PlaceLayoutTile ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -3465,18 +4075,18 @@ Label_D3CB: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_D3D3: +PlaceLayoutTile: jsr $D4AF ; CPU:$D3D3 PRG:13D3 20 AF D4 - sta ZpFA ; CPU:$D3D6 PRG:13D6 85 FA - beq Label_D41E ; CPU:$D3D8 PRG:13D8 F0 44 + sta ptr_lo ; CPU:$D3D6 PRG:13D6 85 FA + beq PlaceLayoutTile_Done ; CPU:$D3D8 PRG:13D8 F0 44 ldy #$1B ; CPU:$D3DA PRG:13DA A0 1B cmp #$10 ; CPU:$D3DC PRG:13DC C9 10 - bne Label_D3E5 ; CPU:$D3DE PRG:13DE D0 05 - ora (ZpFE),y ; CPU:$D3E0 PRG:13E0 11 FE - sta (ZpFE),y ; CPU:$D3E2 PRG:13E2 91 FE + bne PlaceLayoutTile_Simple ; CPU:$D3DE PRG:13DE D0 05 + ora (ppu_addr_src_lo),y ; CPU:$D3E0 PRG:13E0 11 FE + sta (ppu_addr_src_lo),y ; CPU:$D3E2 PRG:13E2 91 FE rts ; CPU:$D3E4 PRG:13E4 60 ; ----------------------------------------------------------------------------- -; Routine: Label_D3E5 +; Routine: PlaceLayoutTile_Simple ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -3484,21 +4094,21 @@ Label_D3D3: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_D3E5: - sta (ZpFE),y ; CPU:$D3E5 PRG:13E5 91 FE +PlaceLayoutTile_Simple: + sta (ppu_addr_src_lo),y ; CPU:$D3E5 PRG:13E5 91 FE and #$0F ; CPU:$D3E7 PRG:13E7 29 0F lda $0188 ; CPU:$D3E9 PRG:13E9 AD 88 01 - sta ZpFC ; CPU:$D3EC PRG:13EC 85 FC - dec ZpFC ; CPU:$D3EE PRG:13EE C6 FC + sta ppu_addr_lo ; CPU:$D3EC PRG:13EC 85 FC + dec ppu_addr_lo ; CPU:$D3EE PRG:13EE C6 FC lda $0189 ; CPU:$D3F0 PRG:13F0 AD 89 01 - sta ZpFD ; CPU:$D3F3 PRG:13F3 85 FD - dec ZpFD ; CPU:$D3F5 PRG:13F5 C6 FD + sta ppu_addr_hi ; CPU:$D3F3 PRG:13F3 85 FD + dec ppu_addr_hi ; CPU:$D3F5 PRG:13F5 C6 FD lda #$00 ; CPU:$D3F7 PRG:13F7 A9 00 - sta ZpFB ; CPU:$D3F9 PRG:13F9 85 FB + sta ptr_hi ; CPU:$D3F9 PRG:13F9 85 FB lda #$03 ; CPU:$D3FB PRG:13FB A9 03 sta $018A ; CPU:$D3FD PRG:13FD 8D 8A 01 ; ----------------------------------------------------------------------------- -; Routine: Label_D400 +; Routine: PlaceLayoutTile_Row ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -3506,11 +4116,11 @@ Label_D3E5: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_D400: +PlaceLayoutTile_Row: lda #$03 ; CPU:$D400 PRG:1400 A9 03 sta $018B ; CPU:$D402 PRG:1402 8D 8B 01 ; ----------------------------------------------------------------------------- -; Routine: Label_D405 +; Routine: PlaceLayoutTile_Cell ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -3518,20 +4128,20 @@ Label_D400: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_D405: +PlaceLayoutTile_Cell: jsr $D41F ; CPU:$D405 PRG:1405 20 1F D4 - inc ZpFB ; CPU:$D408 PRG:1408 E6 FB - inc ZpFD ; CPU:$D40A PRG:140A E6 FD + inc ptr_hi ; CPU:$D408 PRG:1408 E6 FB + inc ppu_addr_hi ; CPU:$D40A PRG:140A E6 FD dec $018B ; CPU:$D40C PRG:140C CE 8B 01 - bne Label_D405 ; CPU:$D40F PRG:140F D0 F4 - dec ZpFD ; CPU:$D411 PRG:1411 C6 FD - dec ZpFD ; CPU:$D413 PRG:1413 C6 FD - dec ZpFD ; CPU:$D415 PRG:1415 C6 FD - inc ZpFC ; CPU:$D417 PRG:1417 E6 FC + bne PlaceLayoutTile_Cell ; CPU:$D40F PRG:140F D0 F4 + dec ppu_addr_hi ; CPU:$D411 PRG:1411 C6 FD + dec ppu_addr_hi ; CPU:$D413 PRG:1413 C6 FD + dec ppu_addr_hi ; CPU:$D415 PRG:1415 C6 FD + inc ppu_addr_lo ; CPU:$D417 PRG:1417 E6 FC dec $018A ; CPU:$D419 PRG:1419 CE 8A 01 - bne Label_D400 ; CPU:$D41C PRG:141C D0 E2 + bne PlaceLayoutTile_Row ; CPU:$D41C PRG:141C D0 E2 ; ----------------------------------------------------------------------------- -; Routine: Label_D41E +; Routine: PlaceLayoutTile_Done ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -3539,10 +4149,10 @@ Label_D405: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_D41E: +PlaceLayoutTile_Done: rts ; CPU:$D41E PRG:141E 60 ; ----------------------------------------------------------------------------- -; Routine: Label_D41F +; Routine: PlaceLayoutTile_Neighbour ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -3550,27 +4160,27 @@ Label_D41E: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_D41F: - lda ZpFC ; CPU:$D41F PRG:141F A5 FC +PlaceLayoutTile_Neighbour: + lda ppu_addr_lo ; CPU:$D41F PRG:141F A5 FC cmp #$FF ; CPU:$D421 PRG:1421 C9 FF - beq Label_D45D ; CPU:$D423 PRG:1423 F0 38 + beq PlaceLayoutTile_Neighbour_Return ; CPU:$D423 PRG:1423 F0 38 cmp #$1B ; CPU:$D425 PRG:1425 C9 1B - beq Label_D45D ; CPU:$D427 PRG:1427 F0 34 - lda ZpFD ; CPU:$D429 PRG:1429 A5 FD + beq PlaceLayoutTile_Neighbour_Return ; CPU:$D427 PRG:1427 F0 34 + lda ppu_addr_hi ; CPU:$D429 PRG:1429 A5 FD cmp #$FF ; CPU:$D42B PRG:142B C9 FF - beq Label_D45D ; CPU:$D42D PRG:142D F0 2E + beq PlaceLayoutTile_Neighbour_Return ; CPU:$D42D PRG:142D F0 2E cmp #$1D ; CPU:$D42F PRG:142F C9 1D - beq Label_D45D ; CPU:$D431 PRG:1431 F0 2A - ldy ZpFB ; CPU:$D433 PRG:1433 A4 FB + beq PlaceLayoutTile_Neighbour_Return ; CPU:$D431 PRG:1431 F0 2A + ldy ptr_hi ; CPU:$D433 PRG:1433 A4 FB lda $0560,y ; CPU:$D435 PRG:1435 B9 60 05 tay ; CPU:$D438 PRG:1438 A8 - lda ZpFA ; CPU:$D439 PRG:1439 A5 FA + lda ptr_lo ; CPU:$D439 PRG:1439 A5 FA cmp #$07 ; CPU:$D43B PRG:143B C9 07 - bne Label_D449 ; CPU:$D43D PRG:143D D0 0A - ldx ZpFB ; CPU:$D43F PRG:143F A6 FB + bne PlaceLayoutTile_Neighbour_Blend ; CPU:$D43D PRG:143D D0 0A + ldx ptr_hi ; CPU:$D43F PRG:143F A6 FB lda $0569,x ; CPU:$D441 PRG:1441 BD 69 05 ; ----------------------------------------------------------------------------- -; Routine: Label_D444 +; Routine: PlaceLayoutTile_Neighbour_Pick ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -3578,11 +4188,11 @@ Label_D41F: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_D444: - sta ZpF8 ; CPU:$D444 PRG:1444 85 F8 +PlaceLayoutTile_Neighbour_Pick: + sta ppu_src_lo ; CPU:$D444 PRG:1444 85 F8 jmp $D45E ; CPU:$D446 PRG:1446 4C 5E D4 ; ----------------------------------------------------------------------------- -; Routine: Label_D449 +; Routine: PlaceLayoutTile_Neighbour_Blend ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -3590,22 +4200,22 @@ Label_D444: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_D449: +PlaceLayoutTile_Neighbour_Blend: rol a ; CPU:$D449 PRG:1449 2A rol a ; CPU:$D44A PRG:144A 2A rol a ; CPU:$D44B PRG:144B 2A and #$03 ; CPU:$D44C PRG:144C 29 03 - sta ZpF8 ; CPU:$D44E PRG:144E 85 F8 + sta ppu_src_lo ; CPU:$D44E PRG:144E 85 F8 asl a ; CPU:$D450 PRG:1450 0A asl a ; CPU:$D451 PRG:1451 0A asl a ; CPU:$D452 PRG:1452 0A - adc ZpF8 ; CPU:$D453 PRG:1453 65 F8 - adc ZpFB ; CPU:$D455 PRG:1455 65 FB + adc ppu_src_lo ; CPU:$D453 PRG:1453 65 F8 + adc ptr_hi ; CPU:$D455 PRG:1455 65 FB tax ; CPU:$D457 PRG:1457 AA lda $0572,x ; CPU:$D458 PRG:1458 BD 72 05 - bcc Label_D444 ; CPU:$D45B PRG:145B 90 E7 + bcc PlaceLayoutTile_Neighbour_Pick ; CPU:$D45B PRG:145B 90 E7 ; ----------------------------------------------------------------------------- -; Routine: Label_D45D +; Routine: PlaceLayoutTile_Neighbour_Return ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -3613,10 +4223,10 @@ Label_D449: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_D45D: +PlaceLayoutTile_Neighbour_Return: rts ; CPU:$D45D PRG:145D 60 ; ----------------------------------------------------------------------------- -; Routine: Label_D45E +; Routine: PlaceLayoutTile_Neighbour_Compose ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -3624,19 +4234,19 @@ Label_D45D: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_D45E: - lda ZpF8 ; CPU:$D45E PRG:145E A5 F8 - beq Label_D487 ; CPU:$D460 PRG:1460 F0 25 - lda (ZpFE),y ; CPU:$D462 PRG:1462 B1 FE +PlaceLayoutTile_Neighbour_Compose: + lda ppu_src_lo ; CPU:$D45E PRG:145E A5 F8 + beq PlaceLayoutTile_Neighbour_Skip ; CPU:$D460 PRG:1460 F0 25 + lda (ppu_addr_src_lo),y ; CPU:$D462 PRG:1462 B1 FE tax ; CPU:$D464 PRG:1464 AA and #$F0 ; CPU:$D465 PRG:1465 29 F0 - sta ZpF9 ; CPU:$D467 PRG:1467 85 F9 + sta ppu_src_hi ; CPU:$D467 PRG:1467 85 F9 txa ; CPU:$D469 PRG:1469 8A and #$0F ; CPU:$D46A PRG:146A 29 0F sta $018C ; CPU:$D46C PRG:146C 8D 8C 01 - beq Label_D488 ; CPU:$D46F PRG:146F F0 17 + beq PlaceLayoutTile_Neighbour_Clear ; CPU:$D46F PRG:146F F0 17 cmp #$08 ; CPU:$D471 PRG:1471 C9 08 - bcc Label_D487 ; CPU:$D473 PRG:1473 90 12 + bcc PlaceLayoutTile_Neighbour_Skip ; CPU:$D473 PRG:1473 90 12 jsr $D48F ; CPU:$D475 PRG:1475 20 8F D4 asl a ; CPU:$D478 PRG:1478 0A asl a ; CPU:$D479 PRG:1479 0A @@ -3645,10 +4255,10 @@ Label_D45E: tax ; CPU:$D47E PRG:147E AA lda $058E,x ; CPU:$D47F PRG:147F BD 8E 05 clc ; CPU:$D482 PRG:1482 18 - adc ZpF9 ; CPU:$D483 PRG:1483 65 F9 - sta (ZpFE),y ; CPU:$D485 PRG:1485 91 FE + adc ppu_src_hi ; CPU:$D483 PRG:1483 65 F9 + sta (ppu_addr_src_lo),y ; CPU:$D485 PRG:1485 91 FE ; ----------------------------------------------------------------------------- -; Routine: Label_D487 +; Routine: PlaceLayoutTile_Neighbour_Skip ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -3656,10 +4266,10 @@ Label_D45E: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_D487: +PlaceLayoutTile_Neighbour_Skip: rts ; CPU:$D487 PRG:1487 60 ; ----------------------------------------------------------------------------- -; Routine: Label_D488 +; Routine: PlaceLayoutTile_Neighbour_Clear ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -3667,13 +4277,13 @@ Label_D487: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_D488: - lda ZpF9 ; CPU:$D488 PRG:1488 A5 F9 - ora ZpF8 ; CPU:$D48A PRG:148A 05 F8 - sta (ZpFE),y ; CPU:$D48C PRG:148C 91 FE +PlaceLayoutTile_Neighbour_Clear: + lda ppu_src_hi ; CPU:$D488 PRG:1488 A5 F9 + ora ppu_src_lo ; CPU:$D48A PRG:148A 05 F8 + sta (ppu_addr_src_lo),y ; CPU:$D48C PRG:148C 91 FE rts ; CPU:$D48E PRG:148E 60 ; ----------------------------------------------------------------------------- -; Routine: Label_D48F +; Routine: GetConnectionIndex ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -3681,29 +4291,29 @@ Label_D488: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_D48F: - lda ZpF9 ; CPU:$D48F PRG:148F A5 F9 +GetConnectionIndex: + lda ppu_src_hi ; CPU:$D48F PRG:148F A5 F9 and #$C0 ; CPU:$D491 PRG:1491 29 C0 eor #$FF ; CPU:$D493 PRG:1493 49 FF clc ; CPU:$D495 PRG:1495 18 adc #$40 ; CPU:$D496 PRG:1496 69 40 and #$C0 ; CPU:$D498 PRG:1498 29 C0 clc ; CPU:$D49A PRG:149A 18 - adc ZpF8 ; CPU:$D49B PRG:149B 65 F8 + adc ppu_src_lo ; CPU:$D49B PRG:149B 65 F8 rol a ; CPU:$D49D PRG:149D 2A rol a ; CPU:$D49E PRG:149E 2A rol a ; CPU:$D49F PRG:149F 2A and #$03 ; CPU:$D4A0 PRG:14A0 29 03 tax ; CPU:$D4A2 PRG:14A2 AA - lda ZpF8 ; CPU:$D4A3 PRG:14A3 A5 F8 + lda ppu_src_lo ; CPU:$D4A3 PRG:14A3 A5 F8 and #$04 ; CPU:$D4A5 PRG:14A5 29 04 - beq Label_D4AD ; CPU:$D4A7 PRG:14A7 F0 04 + beq GetConnectionIndex_Result ; CPU:$D4A7 PRG:14A7 F0 04 inx ; CPU:$D4A9 PRG:14A9 E8 inx ; CPU:$D4AA PRG:14AA E8 inx ; CPU:$D4AB PRG:14AB E8 inx ; CPU:$D4AC PRG:14AC E8 ; ----------------------------------------------------------------------------- -; Routine: Label_D4AD +; Routine: GetConnectionIndex_Result ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -3711,11 +4321,11 @@ Label_D48F: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_D4AD: +GetConnectionIndex_Result: txa ; CPU:$D4AD PRG:14AD 8A rts ; CPU:$D4AE PRG:14AE 60 ; ----------------------------------------------------------------------------- -; Routine: Label_D4AF +; Routine: ClassifyLayoutTile ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -3723,13 +4333,13 @@ Label_D4AD: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_D4AF: +ClassifyLayoutTile: cmp #$81 ; CPU:$D4AF PRG:14AF C9 81 - bcs Label_D4B6 ; CPU:$D4B1 PRG:14B1 B0 03 + bcs ClassifyLayoutTile_High ; CPU:$D4B1 PRG:14B1 B0 03 lda #$00 ; CPU:$D4B3 PRG:14B3 A9 00 rts ; CPU:$D4B5 PRG:14B5 60 ; ----------------------------------------------------------------------------- -; Routine: Label_D4B6 +; Routine: ClassifyLayoutTile_High ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -3737,13 +4347,13 @@ Label_D4AF: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_D4B6: +ClassifyLayoutTile_High: cmp #$C4 ; CPU:$D4B6 PRG:14B6 C9 C4 - bcc Label_D4BD ; CPU:$D4B8 PRG:14B8 90 03 + bcc ClassifyLayoutTile_Mid ; CPU:$D4B8 PRG:14B8 90 03 lda #$10 ; CPU:$D4BA PRG:14BA A9 10 rts ; CPU:$D4BC PRG:14BC 60 ; ----------------------------------------------------------------------------- -; Routine: Label_D4BD +; Routine: ClassifyLayoutTile_Mid ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -3751,13 +4361,13 @@ Label_D4B6: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_D4BD: +ClassifyLayoutTile_Mid: cmp #$B0 ; CPU:$D4BD PRG:14BD C9 B0 - bcs Label_D4C4 ; CPU:$D4BF PRG:14BF B0 03 + bcs ClassifyLayoutTile_Bits ; CPU:$D4BF PRG:14BF B0 03 lda #$07 ; CPU:$D4C1 PRG:14C1 A9 07 rts ; CPU:$D4C3 PRG:14C3 60 ; ----------------------------------------------------------------------------- -; Routine: Label_D4C4 +; Routine: ClassifyLayoutTile_Bits ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -3765,7 +4375,7 @@ Label_D4BD: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_D4C4: +ClassifyLayoutTile_Bits: ror a ; CPU:$D4C4 PRG:14C4 6A ror a ; CPU:$D4C5 PRG:14C5 6A ror a ; CPU:$D4C6 PRG:14C6 6A @@ -3773,7 +4383,7 @@ Label_D4C4: ora #$05 ; CPU:$D4C9 PRG:14C9 09 05 rts ; CPU:$D4CB PRG:14CB 60 ; ----------------------------------------------------------------------------- -; Routine: Label_D4CC +; Routine: ReadStageLayoutId ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -3781,20 +4391,20 @@ Label_D4C4: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_D4CC: +ReadStageLayoutId: lda $0187 ; CPU:$D4CC PRG:14CC AD 87 01 clc ; CPU:$D4CF PRG:14CF 18 adc #$F5 ; CPU:$D4D0 PRG:14D0 69 F5 tay ; CPU:$D4D2 PRG:14D2 A8 lda #$0C ; CPU:$D4D3 PRG:14D3 A9 0C adc #$00 ; CPU:$D4D5 PRG:14D5 69 00 - sta $2006 ; CPU:$D4D7 PRG:14D7 8D 06 20 - sty $2006 ; CPU:$D4DA PRG:14DA 8C 06 20 - lda $2007 ; CPU:$D4DD PRG:14DD AD 07 20 - lda $2007 ; CPU:$D4E0 PRG:14E0 AD 07 20 + sta PPUADDR ; CPU:$D4D7 PRG:14D7 8D 06 20 + sty PPUADDR ; CPU:$D4DA PRG:14DA 8C 06 20 + lda PPUDATA ; CPU:$D4DD PRG:14DD AD 07 20 + lda PPUDATA ; CPU:$D4E0 PRG:14E0 AD 07 20 rts ; CPU:$D4E3 PRG:14E3 60 ; ----------------------------------------------------------------------------- -; Routine: Label_D4E4 +; Routine: SelectLayoutScript ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -3802,13 +4412,13 @@ Label_D4CC: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_D4E4: +SelectLayoutScript: jsr $D4CC ; CPU:$D4E4 PRG:14E4 20 CC D4 cmp #$1F ; CPU:$D4E7 PRG:14E7 C9 1F - bcc Label_D4ED ; CPU:$D4E9 PRG:14E9 90 02 + bcc SelectLayoutScript_Index ; CPU:$D4E9 PRG:14E9 90 02 sbc #$1E ; CPU:$D4EB PRG:14EB E9 1E ; ----------------------------------------------------------------------------- -; Routine: Label_D4ED +; Routine: SelectLayoutScript_Index ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -3816,196 +4426,229 @@ Label_D4E4: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_D4ED: +SelectLayoutScript_Index: asl a ; CPU:$D4ED PRG:14ED 0A tay ; CPU:$D4EE PRG:14EE A8 lda $D4F8,y ; CPU:$D4EF PRG:14EF B9 F8 D4 ldx $D4F9,y ; CPU:$D4F2 PRG:14F2 BE F9 D4 - sta ZpFE ; CPU:$D4F5 PRG:14F5 85 FE - stx ZpFF ; CPU:$D4F7 PRG:14F7 86 FF + sta ppu_addr_src_lo ; CPU:$D4F5 PRG:14F5 85 FE + stx ppu_addr_src_hi ; CPU:$D4F7 PRG:14F7 86 FF rts ; CPU:$D4F9 PRG:14F9 60 -; ---- data $D4FA-$E01D (2852 bytes) ---- +; ---- data $D4FA-$D535 (60 bytes) ---- +; Thirty sixteen-bit pointers to the per-layout cell scripts. SelectLayoutScript reads $D4F8,y and $D4F9,y with y = 2 * layout id and remaps ids $1F and above to id - $1E, so entry 0 is the dead word at $D4F8 and the live table is $D4FA-$D535: 1=$D559 2=$D597 3=$D617 4=$D691 5=$D6F5 6=$D759 7=$D7B5 8=$D815 9=$D87B 10=$D8E9 11=$D94D 12=$D9BA 13=$DA1C 14=$DAC0 15=$DB18 16=$DB88 17=$DBE2 18=$DC28 19=$DC4C 20=$DC76 21=$DCC2 22=$DCFA 23=$DD1C 24=$DD75 25=$DDDA 26=$DE0E 27=$DE42 28=$DEC9 29=$DF01 30=$DF72 +LayoutScriptTable: .byte $59, $D5, $97, $D5, $17, $D6, $91, $D6, $F5, $D6, $59, $D7, $B5, $D7, $15, $D8 ; CPU:$D4FA PRG:14FA 59 D5 97 D5 17 D6 91 D6 F5 D6 59 D7 B5 D7 15 D8 .byte $7B, $D8, $E9, $D8, $4D, $D9, $BA, $D9, $1C, $DA, $C0, $DA, $18, $DB, $88, $DB ; CPU:$D50A PRG:150A 7B D8 E9 D8 4D D9 BA D9 1C DA C0 DA 18 DB 88 DB .byte $E2, $DB, $28, $DC, $4C, $DC, $76, $DC, $C2, $DC, $FA, $DC, $1C, $DD, $75, $DD ; CPU:$D51A PRG:151A E2 DB 28 DC 4C DC 76 DC C2 DC FA DC 1C DD 75 DD - .byte $DA, $DD, $0E, $DE, $42, $DE, $C9, $DE, $01, $DF, $72, $DF, $20, $CC, $D4, $85 ; CPU:$D52A PRG:152A DA DD 0E DE 42 DE C9 DE 01 DF 72 DF 20 CC D4 85 - .byte $FC, $A9, $00, $06, $FC, $2A, $06, $FC, $2A, $06, $FC, $2A, $06, $FC, $2A, $85 ; CPU:$D53A PRG:153A FC A9 00 06 FC 2A 06 FC 2A 06 FC 2A 06 FC 2A 85 - .byte $FD, $A5, $FC, $18, $69, $22, $85, $FE, $A5, $FD, $69, $0D, $85, $FF, $60, $03 ; CPU:$D54A PRG:154A FD A5 FC 18 69 22 85 FE A5 FD 69 0D 85 FF 60 03 - .byte $08, $1C, $03, $1A, $1C, $23, $08, $1A, $3C, $08, $1A, $07, $09, $0E, $11, $09 ; CPU:$D55A PRG:155A 08 1C 03 1A 1C 23 08 1A 3C 08 1A 07 09 0E 11 09 - .byte $18, $07, $19, $0E, $11, $19, $18, $24, $0C, $16, $3B, $0C, $16, $66, $88, $78 ; CPU:$D56A PRG:156A 18 07 19 0E 11 19 18 24 0C 16 3B 0C 16 66 88 78 - .byte $88, $63, $8B, $7B, $8B, $63, $96, $7B, $96, $66, $99, $F8, $99, $84, $08, $1B ; CPU:$D57A PRG:157A 88 63 8B 7B 8B 63 96 7B 96 66 99 F8 99 84 08 1B - .byte $19, $04, $09, $0F, $08, $1A, $09, $04, $18, $0F, $19, $9A, $18, $03, $08, $0B ; CPU:$D58A PRG:158A 19 04 09 0F 08 1A 09 04 18 0F 19 9A 18 03 08 0B - .byte $14, $08, $1C, $07, $09, $0B, $15, $09, $18, $07, $19, $0B, $14, $19, $18, $03 ; CPU:$D59A PRG:159A 14 08 1C 07 09 0B 15 09 18 07 19 0B 14 19 18 03 - .byte $1A, $0B, $14, $1A, $1C, $23, $08, $1A, $24, $0C, $16, $3B, $0C, $16, $3C, $08 ; CPU:$D5AA PRG:15AA 1A 0B 14 1A 1C 23 08 1A 24 0C 16 3B 0C 16 3C 08 - .byte $1A, $4C, $29, $0C, $4C, $2A, $0D, $4C, $C8, $0B, $4B, $4A, $0E, $50, $2C, $09 ; CPU:$D5BA PRG:15BA 1A 4C 29 0C 4C 2A 0D 4C C8 0B 4B 4A 0E 50 2C 09 - .byte $50, $2D, $09, $50, $8B, $08, $50, $0E, $0A, $4C, $38, $15, $4C, $39, $16, $4B ; CPU:$D5CA PRG:15CA 50 2D 09 50 8B 08 50 0E 0A 4C 38 15 4C 39 16 4B - .byte $98, $14, $4C, $1A, $17, $50, $35, $18, $50, $36, $19, $50, $D4, $18, $50, $57 ; CPU:$D5DA PRG:15DA 98 14 4C 1A 17 50 35 18 50 36 19 50 D4 18 50 57 - .byte $1A, $66, $88, $78, $88, $63, $8B, $7B, $8B, $63, $96, $7B, $96, $66, $99, $F8 ; CPU:$D5EA PRG:15EA 1A 66 88 78 88 63 8B 7B 8B 63 96 7B 96 66 99 F8 - .byte $99, $04, $08, $0B, $19, $14, $08, $1B, $19, $0C, $0B, $0D, $17, $12, $0B, $13 ; CPU:$D5FA PRG:15FA 99 04 08 0B 19 14 08 1B 19 0C 0B 0D 17 12 0B 13 - .byte $17, $8E, $0D, $11, $15, $04, $09, $1A, $09, $04, $18, $9A, $18, $08, $08, $17 ; CPU:$D60A PRG:160A 17 8E 0D 11 15 04 09 1A 09 04 18 9A 18 08 08 17 - .byte $0C, $09, $13, $28, $08, $0B, $03, $0D, $06, $68, $0C, $68, $0D, $67, $0D, $37 ; CPU:$D61A PRG:161A 0C 09 13 28 08 0B 03 0D 06 68 0C 68 0D 67 0D 37 - .byte $08, $0B, $19, $0D, $1C, $76, $0C, $76, $0D, $77, $0D, $23, $0D, $15, $3C, $0D ; CPU:$D62A PRG:162A 08 0B 19 0D 1C 76 0C 76 0D 77 0D 23 0D 15 3C 0D - .byte $15, $03, $15, $06, $19, $15, $1C, $28, $17, $1A, $37, $17, $1A, $67, $14, $68 ; CPU:$D63A PRG:163A 15 03 15 06 19 15 1C 28 17 1A 37 17 1A 67 14 68 - .byte $14, $68, $15, $77, $14, $76, $14, $76, $15, $0C, $19, $13, $08, $1A, $17, $6B ; CPU:$D64A PRG:164A 14 68 15 77 14 76 14 76 15 0C 19 13 08 1A 17 6B - .byte $88, $73, $88, $68, $8B, $76, $8B, $66, $8D, $78, $8D, $63, $90, $63, $91, $7B ; CPU:$D65A PRG:165A 88 73 88 68 8B 76 8B 66 8D 78 8D 63 90 63 91 7B - .byte $90, $7B, $91, $66, $94, $78, $94, $68, $96, $76, $96, $6B, $99, $F3, $99, $08 ; CPU:$D66A PRG:166A 90 7B 91 66 94 78 94 68 96 76 96 6B 99 F3 99 08 - .byte $08, $16, $19, $84, $0E, $1B, $15, $09, $09, $15, $09, $04, $0E, $1A, $0E, $04 ; CPU:$D67A PRG:167A 08 16 19 84 0E 1B 15 09 09 15 09 04 0E 1A 0E 04 - .byte $13, $1A, $13, $09, $18, $95, $18, $07, $08, $18, $07, $09, $0C, $13, $09, $18 ; CPU:$D68A PRG:168A 13 1A 13 09 18 95 18 07 08 18 07 09 0C 13 09 18 - .byte $07, $19, $0B, $14, $19, $18, $07, $1A, $18, $44, $2B, $09, $45, $2B, $0A, $59 ; CPU:$D69A PRG:169A 07 19 0B 14 19 18 07 1A 18 44 2B 09 45 2B 0A 59 - .byte $29, $0B, $59, $2A, $0B, $44, $37, $19, $45, $37, $18, $59, $39, $17, $59, $38 ; CPU:$D6AA PRG:16AA 29 0B 59 2A 0B 44 37 19 45 37 18 59 39 17 59 38 - .byte $17, $43, $8B, $08, $45, $0C, $0A, $59, $C8, $0B, $58, $4A, $0C, $43, $57, $1A ; CPU:$D6BA PRG:16BA 17 43 8B 08 45 0C 0A 59 C8 0B 58 4A 0C 43 57 1A - .byte $45, $D6, $18, $58, $98, $16, $59, $1A, $17, $23, $0C, $16, $24, $0C, $16, $3B ; CPU:$D6CA PRG:16CA 45 D6 18 58 98 16 59 1A 17 23 0C 16 24 0C 16 3B - .byte $0C, $16, $BC, $0C, $16, $0C, $08, $13, $09, $06, $0A, $19, $19, $85, $0C, $1A ; CPU:$D6DA PRG:16DA 0C 16 BC 0C 16 0C 08 13 09 06 0A 19 19 85 0C 1A - .byte $17, $0D, $08, $11, $08, $0C, $19, $0F, $19, $92, $19, $03, $08, $0B, $03, $09 ; CPU:$D6EA PRG:16EA 17 0D 08 11 08 0C 19 0F 19 92 19 03 08 0B 03 09 - .byte $0B, $14, $08, $1C, $14, $09, $1C, $0A, $19, $15, $0A, $1A, $15, $23, $0A, $13 ; CPU:$D6FA PRG:16FA 0B 14 08 1C 14 09 1C 0A 19 15 0A 1A 15 23 0A 13 - .byte $24, $0A, $13, $3B, $0A, $13, $3C, $0A, $13, $4C, $29, $0C, $50, $2C, $09, $44 ; CPU:$D70A PRG:170A 24 0A 13 3B 0A 13 3C 0A 13 4C 29 0C 50 2C 09 44 - .byte $34, $19, $45, $34, $18, $56, $38, $14, $56, $39, $14, $4C, $C8, $0B, $4C, $4A ; CPU:$D71A PRG:171A 34 19 45 34 18 56 38 14 56 39 14 4C C8 0B 4C 4A - .byte $0D, $50, $8B, $08, $50, $0D, $0A, $45, $D3, $18, $43, $54, $1A, $55, $98, $13 ; CPU:$D72A PRG:172A 0D 50 8B 08 50 0D 0A 45 D3 18 43 54 1A 55 98 13 - .byte $D6, $1A, $14, $05, $0A, $0D, $13, $06, $14, $19, $15, $08, $16, $17, $17, $0A ; CPU:$D73A PRG:173A D6 1A 14 05 0A 0D 13 06 14 19 15 08 16 17 17 0A - .byte $18, $15, $18, $12, $0A, $1A, $13, $8E, $0C, $11, $13, $08, $0D, $96, $0D, $09 ; CPU:$D74A PRG:174A 18 15 18 12 0A 1A 13 8E 0C 11 13 08 0D 96 0D 09 - .byte $08, $1C, $0D, $09, $18, $29, $09, $0B, $03, $0D, $06, $23, $0E, $1A, $24, $11 ; CPU:$D75A PRG:175A 08 1C 0D 09 18 29 09 0B 03 0D 06 23 0E 1A 24 11 - .byte $16, $04, $1A, $16, $07, $19, $12, $36, $17, $19, $19, $15, $1C, $3C, $09, $14 ; CPU:$D76A PRG:176A 16 04 1A 16 07 19 12 36 17 19 19 15 1C 3C 09 14 - .byte $3B, $0C, $11, $6C, $88, $78, $88, $69, $8B, $7B, $8B, $66, $8D, $63, $90, $7B ; CPU:$D77A PRG:177A 3B 0C 11 6C 88 78 88 69 8B 7B 8B 66 8D 63 90 7B - .byte $91, $78, $94, $63, $96, $75, $96, $66, $99, $72, $99, $69, $0C, $67, $0D, $69 ; CPU:$D78A PRG:178A 91 78 94 63 96 75 96 66 99 72 99 69 0C 67 0D 69 - .byte $0D, $75, $14, $77, $14, $F5, $15, $0A, $09, $1B, $14, $84, $0E, $15, $19, $0A ; CPU:$D79A PRG:179A 0D 75 14 77 14 F5 15 0A 09 1B 14 84 0E 15 19 0A - .byte $09, $1A, $09, $04, $0E, $1A, $13, $04, $18, $94, $18, $04, $08, $1B, $04, $1A ; CPU:$D7AA PRG:17AA 09 1A 09 04 0E 1A 13 04 18 94 18 04 08 1B 04 1A - .byte $1B, $23, $09, $19, $3C, $09, $19, $43, $88, $08, $5C, $C8, $08, $43, $5A, $1A ; CPU:$D7BA PRG:17BA 1B 23 09 19 3C 09 19 43 88 08 5C C8 08 43 5A 1A - .byte $5C, $1A, $1A, $66, $88, $68, $88, $6A, $88, $6C, $88, $72, $88, $74, $88, $76 ; CPU:$D7CA PRG:17CA 5C 1A 1A 66 88 68 88 6A 88 6C 88 72 88 74 88 76 - .byte $88, $78, $88, $63, $8B, $63, $8D, $63, $8F, $63, $92, $63, $94, $63, $96, $7B ; CPU:$D7DA PRG:17DA 88 78 88 63 8B 63 8D 63 8F 63 92 63 94 63 96 7B - .byte $8B, $7B, $8D, $7B, $8F, $7B, $92, $7B, $94, $7B, $96, $66, $99, $68, $99, $6A ; CPU:$D7EA PRG:17EA 8B 7B 8D 7B 8F 7B 92 7B 94 7B 96 66 99 68 99 6A - .byte $99, $6C, $99, $72, $99, $74, $99, $76, $99, $F8, $99, $84, $09, $1B, $19, $04 ; CPU:$D7FA PRG:17FA 99 6C 99 72 99 74 99 76 99 F8 99 84 09 1B 19 04 - .byte $09, $0F, $08, $1A, $09, $04, $18, $0F, $19, $9A, $18, $10, $08, $1C, $12, $09 ; CPU:$D80A PRG:180A 09 0F 08 1A 09 04 18 0F 19 9A 18 10 08 1C 12 09 - .byte $18, $3C, $09, $0B, $23, $17, $19, $03, $1A, $0F, $07, $19, $0D, $43, $34, $08 ; CPU:$D81A PRG:181A 18 3C 09 0B 23 17 19 03 1A 0F 07 19 0D 43 34 08 - .byte $44, $34, $09, $50, $39, $0E, $50, $3A, $0E, $43, $93, $08, $45, $14, $0A, $50 ; CPU:$D82A PRG:182A 44 34 09 50 39 0E 50 3A 0E 43 93 08 45 14 0A 50 - .byte $98, $0E, $51, $1A, $0F, $63, $15, $63, $96, $66, $99, $78, $88, $7B, $8B, $FB ; CPU:$D83A PRG:183A 98 0E 51 1A 0F 63 15 63 96 66 99 78 88 7B 8B FB - .byte $0C, $10, $08, $1B, $0F, $04, $14, $0F, $19, $06, $12, $17, $13, $10, $14, $15 ; CPU:$D84A PRG:184A 0C 10 08 1B 0F 04 14 0F 19 06 12 17 13 10 14 15 - .byte $15, $10, $16, $13, $17, $10, $18, $11, $19, $08, $10, $19, $11, $0A, $0E, $0F ; CPU:$D85A PRG:185A 15 10 16 13 17 10 18 11 19 08 10 19 11 0A 0E 0F - .byte $0F, $0C, $0C, $0F, $0D, $8E, $0A, $0F, $0B, $10, $08, $1A, $09, $04, $18, $8E ; CPU:$D86A PRG:186A 0F 0C 0C 0F 0D 8E 0A 0F 0B 10 08 1A 09 04 18 8E - .byte $19, $03, $08, $1C, $07, $0D, $10, $08, $0E, $0F, $10, $14, $17, $0F, $15, $18 ; CPU:$D87A PRG:187A 19 03 08 1C 07 0D 10 08 0E 0F 10 14 17 0F 15 18 - .byte $03, $1A, $1C, $43, $29, $0C, $44, $29, $0C, $43, $39, $0F, $44, $39, $0F, $51 ; CPU:$D88A PRG:188A 03 1A 1C 43 29 0C 44 29 0C 43 39 0F 44 39 0F 51 - .byte $33, $09, $52, $33, $09, $58, $36, $19, $59, $36, $19, $43, $4A, $0E, $45, $C9 ; CPU:$D89A PRG:189A 33 09 52 33 09 58 36 19 59 36 19 43 4A 0E 45 C9 - .byte $0C, $43, $98, $0F, $45, $19, $0D, $4E, $95, $09, $53, $13, $0A, $57, $56, $19 ; CPU:$D8AA PRG:18AA 0C 43 98 0F 45 19 0D 4E 95 09 53 13 0A 57 56 19 - .byte $D8, $D4, $18, $04, $08, $1B, $09, $06, $0A, $19, $0B, $08, $0C, $17, $0D, $0E ; CPU:$D8BA PRG:18BA D8 D4 18 04 08 1B 09 06 0A 19 0B 08 0C 17 0D 0E - .byte $0E, $15, $0F, $0C, $10, $13, $11, $0A, $12, $11, $13, $08, $14, $0F, $15, $06 ; CPU:$D8CA PRG:18CA 0E 15 0F 0C 10 13 11 0A 12 11 13 08 14 0F 15 06 - .byte $16, $19, $17, $84, $18, $1B, $19, $07, $09, $17, $09, $07, $18, $97, $18, $0B ; CPU:$D8DA PRG:18DA 16 19 17 84 18 1B 19 07 09 17 09 07 18 97 18 0B - .byte $08, $14, $0B, $09, $14, $0B, $19, $14, $0B, $1A, $14, $27, $0C, $16, $28, $0C ; CPU:$D8EA PRG:18EA 08 14 0B 09 14 0B 19 14 0B 1A 14 27 0C 16 28 0C - .byte $16, $37, $0C, $16, $38, $0C, $16, $48, $2B, $09, $49, $2B, $0A, $55, $29, $0B ; CPU:$D8FA PRG:18FA 16 37 0C 16 38 0C 16 48 2B 09 49 2B 0A 55 29 0B - .byte $55, $2A, $0B, $48, $37, $19, $49, $37, $18, $55, $38, $17, $55, $39, $17, $47 ; CPU:$D90A PRG:190A 55 2A 0B 48 37 19 49 37 18 55 38 17 55 39 17 47 - .byte $8B, $08, $49, $0C, $0A, $55, $C8, $0B, $54, $4A, $0C, $47, $57, $1A, $49, $D6 ; CPU:$D91A PRG:191A 8B 08 49 0C 0A 55 C8 0B 54 4A 0C 47 57 1A 49 D6 - .byte $18, $54, $98, $16, $D5, $1A, $17, $0A, $0A, $15, $19, $09, $0C, $09, $16, $96 ; CPU:$D92A PRG:192A 18 54 98 16 D5 1A 17 0A 0A 15 19 09 0C 09 16 96 - .byte $0C, $16, $16, $0F, $0E, $0E, $0F, $10, $0F, $0D, $10, $11, $10, $0E, $11, $10 ; CPU:$D93A PRG:193A 0C 16 16 0F 0E 0E 0F 10 0F 0D 10 11 10 0E 11 10 - .byte $11, $8F, $12, $03, $08, $1C, $03, $1A, $1C, $23, $09, $19, $3C, $09, $19, $04 ; CPU:$D94A PRG:194A 11 8F 12 03 08 1C 03 1A 1C 23 09 19 3C 09 19 04 - .byte $09, $1B, $05, $0B, $0C, $13, $0B, $1A, $07, $0D, $0A, $15, $0D, $18, $2C, $0F ; CPU:$D95A PRG:195A 09 1B 05 0B 0C 13 0B 1A 07 0D 0A 15 0D 18 2C 0F - .byte $12, $2E, $0D, $14, $31, $0D, $14, $33, $0F, $12, $44, $CA, $0E, $44, $4B, $0F ; CPU:$D96A PRG:196A 12 2E 0D 14 31 0D 14 33 0F 12 44 CA 0E 44 4B 0F - .byte $49, $8E, $0A, $49, $0F, $0A, $51, $4A, $0F, $52, $CA, $0E, $57, $8E, $0A, $57 ; CPU:$D97A PRG:197A 49 8E 0A 49 0F 0A 51 4A 0F 52 CA 0E 57 8E 0A 57 - .byte $0F, $0B, $4C, $8E, $0C, $4D, $0E, $0E, $4C, $53, $14, $4D, $D3, $13, $51, $CC ; CPU:$D98A PRG:198A 0F 0B 4C 8E 0C 4D 0E 0E 4C 53 14 4D D3 13 51 CC - .byte $0E, $52, $4E, $0E, $52, $14, $13, $52, $93, $13, $63, $98, $64, $99, $66, $90 ; CPU:$D99A PRG:199A 0E 52 4E 0E 52 14 13 52 93 13 63 98 64 99 66 90 - .byte $78, $90, $7A, $99, $FB, $98, $84, $0A, $1B, $19, $05, $0E, $19, $0E, $8F, $18 ; CPU:$D9AA PRG:19AA 78 90 7A 99 FB 98 84 0A 1B 19 05 0E 19 0E 8F 18 - .byte $03, $08, $1C, $08, $09, $17, $09, $0A, $09, $16, $0A, $16, $09, $18, $09, $16 ; CPU:$D9BA PRG:19BA 03 08 1C 08 09 17 09 0A 09 16 0A 16 09 18 09 16 - .byte $18, $16, $08, $19, $17, $03, $1A, $1C, $23, $09, $19, $3C, $09, $19, $47, $49 ; CPU:$D9CA PRG:19CA 18 16 08 19 17 03 1A 1C 23 09 19 3C 09 19 47 49 - .byte $0B, $56, $0B, $09, $47, $99, $17, $56, $D7, $19, $44, $CC, $0E, $44, $4D, $0E ; CPU:$D9DA PRG:19DA 0B 56 0B 09 47 99 17 56 D7 19 44 CC 0E 44 4D 0E - .byte $59, $8E, $0C, $5A, $0E, $0D, $44, $95, $14, $44, $16, $14, $59, $54, $16, $5A ; CPU:$D9EA PRG:19EA 59 8E 0C 5A 0E 0D 44 95 14 44 16 14 59 54 16 5A - .byte $D4, $15, $6F, $8C, $6F, $95, $69, $90, $69, $91, $75, $90, $F5, $91, $84, $08 ; CPU:$D9FA PRG:19FA D4 15 6F 8C 6F 95 69 90 69 91 75 90 F5 91 84 08 - .byte $1B, $19, $05, $09, $04, $0A, $19, $09, $1A, $0A, $04, $17, $05, $18, $1A, $17 ; CPU:$DA0A PRG:1A0A 1B 19 05 09 04 0A 19 09 1A 0A 04 17 05 18 1A 17 - .byte $99, $18, $05, $08, $0B, $14, $08, $1A, $04, $09, $1B, $0D, $0A, $12, $0D, $18 ; CPU:$DA1A PRG:1A1A 99 18 05 08 0B 14 08 1A 04 09 1B 0D 0A 12 0D 18 - .byte $12, $04, $19, $1B, $05, $1A, $0B, $14, $1A, $1A, $23, $0A, $0E, $23, $14, $18 ; CPU:$DA2A PRG:1A2A 12 04 19 1B 05 1A 0B 14 1A 1A 23 0A 0E 23 14 18 - .byte $24, $0A, $18, $25, $10, $12, $3A, $10, $12, $3B, $0A, $18, $3C, $0A, $0E, $3C ; CPU:$DA3A PRG:1A3A 24 0A 18 25 10 12 3A 10 12 3B 0A 18 3C 0A 0E 3C - .byte $14, $18, $43, $89, $08, $5B, $C8, $09, $43, $59, $1A, $5B, $1A, $19, $64, $89 ; CPU:$DA4A PRG:1A4A 14 18 43 89 08 5B C8 09 43 59 1A 5B 1A 19 64 89 - .byte $6B, $88, $6C, $89, $73, $88, $72, $89, $7A, $89, $63, $8E, $64, $8F, $7A, $8F ; CPU:$DA5A PRG:1A5A 6B 88 6C 89 73 88 72 89 7A 89 63 8E 64 8F 7A 8F - .byte $7B, $8E, $63, $93, $64, $92, $7A, $92, $7B, $93, $64, $98, $6C, $98, $6B, $99 ; CPU:$DA6A PRG:1A6A 7B 8E 63 93 64 92 7A 92 7B 93 64 98 6C 98 6B 99 - .byte $72, $98, $73, $99, $7A, $98, $0D, $0E, $12, $0C, $0F, $13, $0C, $13, $13, $0D ; CPU:$DA7A PRG:1A7A 72 98 73 99 7A 98 0D 0E 12 0C 0F 13 0C 13 13 0D - .byte $14, $12, $2B, $10, $12, $2C, $10, $12, $33, $10, $12, $34, $10, $12, $4B, $8F ; CPU:$DA8A PRG:1A8A 14 12 2B 10 12 2C 10 12 33 10 12 34 10 12 4B 8F - .byte $0E, $4B, $53, $14, $53, $CE, $0F, $53, $14, $13, $6C, $8F, $72, $8F, $6C, $92 ; CPU:$DA9A PRG:1A9A 0E 4B 53 14 53 CE 0F 53 14 13 6C 8F 72 8F 6C 92 - .byte $F2, $92, $05, $0A, $1A, $0F, $05, $14, $1A, $18, $05, $10, $0B, $13, $94, $10 ; CPU:$DAAA PRG:1AAA F2 92 05 0A 1A 0F 05 14 1A 18 05 10 0B 13 94 10 - .byte $1A, $13, $16, $0C, $88, $15, $03, $08, $0B, $14, $08, $1C, $0B, $0C, $14, $03 ; CPU:$DABA PRG:1ABA 1A 13 16 0C 88 15 03 08 0B 14 08 1C 0B 0C 14 03 - .byte $0F, $08, $17, $0F, $1C, $03, $13, $08, $17, $13, $1C, $0B, $16, $14, $03, $1A ; CPU:$DACA PRG:1ACA 0F 08 17 0F 1C 03 13 08 17 13 1C 0B 16 14 03 1A - .byte $0B, $14, $1A, $1C, $23, $09, $0E, $2B, $09, $0B, $34, $09, $0B, $3C, $09, $0E ; CPU:$DADA PRG:1ADA 0B 14 1A 1C 23 09 0E 2B 09 0B 34 09 0B 3C 09 0E - .byte $28, $10, $12, $37, $10, $12, $23, $14, $19, $2B, $17, $19, $34, $17, $19, $BC ; CPU:$DAEA PRG:1AEA 28 10 12 37 10 12 23 14 19 2B 17 19 34 17 19 BC - .byte $14, $19, $04, $09, $0A, $0E, $15, $09, $1B, $0E, $04, $14, $0A, $19, $15, $14 ; CPU:$DAFA PRG:1AFA 14 19 04 09 0A 0E 15 09 1B 0E 04 14 0A 19 15 14 - .byte $1B, $19, $89, $0D, $16, $15, $09, $09, $1A, $0D, $04, $14, $95, $18, $05, $08 ; CPU:$DB0A PRG:1B0A 1B 19 89 0D 16 15 09 09 1A 0D 04 14 95 18 05 08 - .byte $0B, $14, $08, $1A, $04, $09, $1B, $0D, $0A, $12, $0D, $18, $12, $04, $19, $1B ; CPU:$DB1A PRG:1B1A 0B 14 08 1A 04 09 1B 0D 0A 12 0D 18 12 04 19 1B - .byte $05, $1A, $0B, $14, $1A, $1A, $23, $0A, $0E, $23, $14, $18, $24, $0A, $18, $25 ; CPU:$DB2A PRG:1B2A 05 1A 0B 14 1A 1A 23 0A 0E 23 14 18 24 0A 18 25 - .byte $10, $12, $3A, $10, $12, $3B, $0A, $18, $3C, $0A, $0E, $3C, $14, $18, $43, $89 ; CPU:$DB3A PRG:1B3A 10 12 3A 10 12 3B 0A 18 3C 0A 0E 3C 14 18 43 89 - .byte $08, $5B, $C8, $09, $43, $59, $1A, $5B, $1A, $19, $64, $89, $6B, $88, $6C, $89 ; CPU:$DB4A PRG:1B4A 08 5B C8 09 43 59 1A 5B 1A 19 64 89 6B 88 6C 89 - .byte $73, $88, $72, $89, $7A, $89, $63, $8E, $64, $8F, $7A, $8F, $7B, $8E, $63, $93 ; CPU:$DB5A PRG:1B5A 73 88 72 89 7A 89 63 8E 64 8F 7A 8F 7B 8E 63 93 - .byte $64, $92, $7A, $92, $7B, $93, $64, $98, $6C, $98, $6B, $99, $72, $98, $73, $99 ; CPU:$DB6A PRG:1B6A 64 92 7A 92 7B 93 64 98 6C 98 6B 99 72 98 73 99 - .byte $7A, $98, $6F, $10, $F0, $11, $85, $0A, $1A, $18, $16, $15, $88, $0C, $04, $08 ; CPU:$DB7A PRG:1B7A 7A 98 6F 10 F0 11 85 0A 1A 18 16 15 88 0C 04 08 - .byte $13, $04, $19, $13, $45, $29, $10, $46, $29, $10, $45, $38, $11, $46, $38, $11 ; CPU:$DB8A PRG:1B8A 13 04 19 13 45 29 10 46 29 10 45 38 11 46 38 11 - .byte $54, $29, $10, $54, $38, $11, $43, $48, $10, $47, $C9, $10, $43, $99, $11, $47 ; CPU:$DB9A PRG:1B9A 54 29 10 54 38 11 43 48 10 47 C9 10 43 99 11 47 - .byte $18, $11, $53, $49, $10, $54, $C8, $10, $53, $98, $11, $D4, $19, $11, $07, $09 ; CPU:$DBAA PRG:1BAA 18 11 53 49 10 54 C8 10 53 98 11 D4 19 11 07 09 - .byte $13, $09, $06, $18, $13, $18, $08, $16, $15, $17, $08, $0A, $15, $0B, $0C, $12 ; CPU:$DBBA PRG:1BBA 13 09 06 18 13 18 08 16 15 17 08 0A 15 0B 0C 12 - .byte $17, $15, $0A, $14, $0B, $15, $18, $0E, $19, $13, $0C, $0C, $17, $0F, $0A, $0C ; CPU:$DBCA PRG:1BCA 17 15 0A 14 0B 15 18 0E 19 13 0C 0C 17 0F 0A 0C - .byte $15, $0D, $8E, $10, $1A, $11, $98, $10, $03, $19, $1C, $03, $1A, $1C, $23, $15 ; CPU:$DBDA PRG:1BDA 15 0D 8E 10 1A 11 98 10 03 19 1C 03 1A 1C 23 15 - .byte $18, $3C, $15, $18, $63, $15, $7B, $15, $43, $34, $08, $44, $34, $09, $50, $28 ; CPU:$DBEA PRG:1BEA 18 3C 15 18 63 15 7B 15 43 34 08 44 34 09 50 28 - .byte $14, $50, $29, $14, $43, $93, $08, $45, $14, $0B, $51, $C8, $13, $D1, $4B, $14 ; CPU:$DBFA PRG:1BFA 14 50 29 14 43 93 08 45 14 0B 51 C8 13 D1 4B 14 - .byte $0E, $0A, $11, $0B, $0C, $0C, $13, $0D, $0A, $0E, $15, $0F, $08, $10, $17, $11 ; CPU:$DC0A PRG:1C0A 0E 0A 11 0B 0C 0C 13 0D 0A 0E 15 0F 08 10 17 11 - .byte $06, $12, $19, $13, $84, $14, $1B, $18, $0F, $09, $03, $17, $9B, $17, $03, $08 ; CPU:$DC1A PRG:1C1A 06 12 19 13 84 14 1B 18 0F 09 03 17 9B 17 03 08 - .byte $1C, $03, $1A, $1C, $23, $09, $19, $3C, $09, $19, $69, $88, $75, $88, $7B, $8F ; CPU:$DC2A PRG:1C2A 1C 03 1A 1C 23 09 19 3C 09 19 69 88 75 88 7B 8F - .byte $63, $92, $69, $99, $75, $99, $78, $4C, $E7, $56, $84, $09, $1B, $19, $1A, $09 ; CPU:$DC3A PRG:1C3A 63 92 69 99 75 99 78 4C E7 56 84 09 1B 19 1A 09 - .byte $84, $18, $03, $0B, $1C, $03, $14, $1C, $23, $0C, $13, $3C, $0C, $13, $63, $8B ; CPU:$DC4A PRG:1C4A 84 18 03 0B 1C 03 14 1C 23 0C 13 3C 0C 13 63 8B - .byte $63, $93, $7B, $8B, $7B, $93, $66, $8D, $70, $8D, $6E, $91, $F8, $91, $84, $0C ; CPU:$DC5A PRG:1C5A 63 93 7B 8B 7B 93 66 8D 70 8D 6E 91 F8 91 84 0C - .byte $1B, $13, $0A, $0C, $12, $0E, $0C, $11, $04, $10, $84, $11, $03, $08, $1C, $03 ; CPU:$DC6A PRG:1C6A 1B 13 0A 0C 12 0E 0C 11 04 10 84 11 03 08 1C 03 - .byte $09, $0D, $03, $0A, $09, $03, $0B, $07, $03, $0C, $06, $23, $0D, $19, $24, $0D ; CPU:$DC7A PRG:1C7A 09 0D 03 0A 09 03 0B 07 03 0C 06 23 0D 19 24 0D - .byte $11, $25, $0D, $0E, $03, $1A, $1C, $12, $19, $1C, $16, $18, $1C, $18, $17, $1C ; CPU:$DC8A PRG:1C8A 11 25 0D 0E 03 1A 1C 12 19 1C 16 18 1C 18 17 1C - .byte $19, $16, $1C, $3A, $14, $15, $3B, $11, $15, $3C, $09, $15, $63, $91, $64, $8E ; CPU:$DC9A PRG:1C9A 19 16 1C 3A 14 15 3B 11 15 3C 09 15 63 91 64 8E - .byte $69, $89, $6D, $88, $7B, $90, $7A, $93, $75, $98, $71, $99, $46, $0D, $0B, $D7 ; CPU:$DCAA PRG:1CAA 69 89 6D 88 7B 90 7A 93 75 98 71 99 46 0D 0B D7 - .byte $97, $15, $84, $09, $1B, $19, $8F, $10, $03, $08, $1C, $03, $1A, $1C, $23, $09 ; CPU:$DCBA PRG:1CBA 97 15 84 09 1B 19 8F 10 03 08 1C 03 1A 1C 23 09 - .byte $19, $3C, $09, $19, $6A, $4C, $6C, $4C, $6E, $4C, $70, $4C, $72, $4C, $74, $4C ; CPU:$DCCA PRG:1CCA 19 3C 09 19 6A 4C 6C 4C 6E 4C 70 4C 72 4C 74 4C - .byte $76, $4C, $6A, $56, $6C, $56, $6E, $56, $70, $56, $72, $56, $74, $56, $76, $56 ; CPU:$DCDA PRG:1CDA 76 4C 6A 56 6C 56 6E 56 70 56 72 56 74 56 76 56 - .byte $68, $4E, $E8, $54, $84, $09, $1B, $19, $07, $10, $07, $11, $1A, $09, $9A, $18 ; CPU:$DCEA PRG:1CEA 68 4E E8 54 84 09 1B 19 07 10 07 11 1A 09 9A 18 - .byte $03, $08, $1C, $03, $1A, $1C, $23, $08, $19, $3C, $08, $19, $6F, $8C, $47, $CF ; CPU:$DCFA PRG:1CFA 03 08 1C 03 1A 1C 23 08 19 3C 08 19 6F 8C 47 CF - .byte $15, $47, $50, $16, $52, $95, $0F, $D2, $16, $10, $84, $08, $1B, $19, $0F, $14 ; CPU:$DD0A PRG:1D0A 15 47 50 16 52 95 0F D2 16 10 84 08 1B 19 0F 14 - .byte $8F, $18, $0C, $09, $16, $11, $0D, $1C, $11, $16, $1C, $0C, $1A, $16, $3C, $0E ; CPU:$DD1A PRG:1D1A 8F 18 0C 09 16 11 0D 1C 11 16 1C 0C 1A 16 3C 0E - .byte $15, $43, $91, $09, $46, $11, $0A, $44, $31, $0A, $45, $31, $0A, $43, $52, $1A ; CPU:$DD2A PRG:1D2A 15 43 91 09 46 11 0A 44 31 0A 45 31 0A 43 52 1A - .byte $46, $D2, $19, $44, $32, $19, $45, $32, $19, $50, $8D, $0A, $54, $0C, $09, $52 ; CPU:$DD3A PRG:1D3A 46 D2 19 44 32 19 45 32 19 50 8D 0A 54 0C 09 52 - .byte $2C, $0A, $53, $2C, $0A, $50, $56, $19, $54, $D7, $1A, $52, $37, $19, $53, $37 ; CPU:$DD4A PRG:1D4A 2C 0A 53 2C 0A 50 56 19 54 D7 1A 52 37 19 53 37 - .byte $19, $EB, $91, $0C, $0A, $13, $19, $0A, $0C, $0B, $17, $08, $0E, $09, $15, $06 ; CPU:$DD5A PRG:1D5A 19 EB 91 0C 0A 13 19 0A 0C 0B 17 08 0E 09 15 06 - .byte $10, $07, $13, $94, $0E, $1B, $15, $10, $0A, $90, $18, $03, $08, $08, $10, $08 ; CPU:$DD6A PRG:1D6A 10 07 13 94 0E 1B 15 10 0A 90 18 03 08 08 10 08 - .byte $1A, $08, $15, $10, $03, $1A, $1A, $23, $09, $19, $28, $09, $14, $30, $09, $14 ; CPU:$DD7A PRG:1D7A 1A 08 15 10 03 1A 1A 23 09 19 28 09 14 30 09 14 - .byte $3C, $0A, $0E, $3C, $13, $18, $59, $49, $0B, $5B, $C8, $09, $5A, $29, $0A, $7B ; CPU:$DD8A PRG:1D8A 3C 0A 0E 3C 13 18 59 49 0B 5B C8 09 5A 29 0A 7B - .byte $49, $59, $90, $0E, $5B, $10, $0F, $5A, $30, $0F, $59, $51, $13, $5B, $D1, $12 ; CPU:$DD9A PRG:1D9A 49 59 90 0E 5B 10 0F 5A 30 0F 59 51 13 5B D1 12 - .byte $5A, $31, $12, $59, $99, $17, $5B, $1A, $19, $5A, $39, $18, $7B, $59, $44, $D7 ; CPU:$DDAA PRG:1DAA 5A 31 12 59 99 17 5B 1A 19 5A 39 18 7B 59 44 D7 - .byte $19, $44, $58, $19, $75, $14, $F6, $14, $04, $09, $07, $19, $08, $16, $10, $19 ; CPU:$DDBA PRG:1DBA 19 44 58 19 75 14 F6 14 04 09 07 19 08 16 10 19 - .byte $11, $09, $19, $19, $1A, $0A, $1B, $0F, $9A, $12, $1B, $19, $15, $0C, $96, $0C ; CPU:$DDCA PRG:1DCA 11 09 19 19 1A 0A 1B 0F 9A 12 1B 19 15 0C 96 0C - .byte $03, $08, $1C, $03, $1A, $1C, $23, $09, $19, $3C, $09, $19, $10, $0C, $15, $15 ; CPU:$DDDA PRG:1DDA 03 08 1C 03 1A 1C 23 09 19 3C 09 19 10 0C 15 15 - .byte $11, $18, $10, $16, $15, $0B, $11, $0E, $66, $49, $64, $4B, $64, $57, $66, $59 ; CPU:$DDEA PRG:1DEA 11 18 10 16 15 0B 11 0E 66 49 64 4B 64 57 66 59 - .byte $78, $88, $7B, $8B, $7B, $96, $F8, $99, $84, $09, $1B, $19, $04, $09, $04, $18 ; CPU:$DDFA PRG:1DFA 78 88 7B 8B 7B 96 F8 99 84 09 1B 19 04 09 04 18 - .byte $1A, $09, $9A, $18, $03, $08, $1C, $06, $09, $18, $07, $19, $19, $03, $1A, $1C ; CPU:$DE0A PRG:1E0A 1A 09 9A 18 03 08 1C 06 09 18 07 19 19 03 1A 1C - .byte $23, $09, $19, $24, $0C, $17, $3B, $0B, $16, $3C, $09, $19, $63, $8B, $78, $88 ; CPU:$DE1A PRG:1E1A 23 09 19 24 0C 17 3B 0B 16 3C 09 19 63 8B 78 88 - .byte $66, $99, $7B, $96, $66, $89, $7A, $8B, $64, $96, $F8, $98, $84, $09, $1B, $19 ; CPU:$DE2A PRG:1E2A 66 99 7B 96 66 89 7A 8B 64 96 F8 98 84 09 1B 19 - .byte $04, $09, $1A, $09, $04, $18, $9A, $18, $03, $08, $1C, $07, $09, $18, $03, $1A ; CPU:$DE3A PRG:1E3A 04 09 1A 09 04 18 9A 18 03 08 1C 07 09 18 03 1A - .byte $1C, $07, $19, $18, $23, $09, $19, $3C, $09, $19, $24, $0C, $16, $25, $0C, $16 ; CPU:$DE4A PRG:1E4A 1C 07 19 18 23 09 19 3C 09 19 24 0C 16 25 0C 16 - .byte $26, $0C, $16, $27, $0D, $15, $28, $0D, $15, $29, $0D, $15, $2A, $0E, $14, $2B ; CPU:$DE5A PRG:1E5A 26 0C 16 27 0D 15 28 0D 15 29 0D 15 2A 0E 14 2B - .byte $0E, $14, $2C, $0E, $14, $2D, $0F, $13, $2E, $10, $12, $19, $0C, $1B, $16, $0D ; CPU:$DE6A PRG:1E6A 0E 14 2C 0E 14 2D 0F 13 2E 10 12 19 0C 1B 16 0D - .byte $1B, $13, $0E, $16, $72, $4F, $72, $53, $13, $14, $16, $16, $15, $1B, $19, $16 ; CPU:$DE7A PRG:1E7A 1B 13 0E 16 72 4F 72 53 13 14 16 16 15 1B 19 16 - .byte $1B, $4D, $CE, $0F, $4D, $14, $13, $66, $88, $63, $8B, $78, $88, $7B, $8B, $66 ; CPU:$DE8A PRG:1E8A 1B 4D CE 0F 4D 14 13 66 88 63 8B 78 88 7B 8B 66 - .byte $8C, $69, $8D, $72, $8E, $73, $8E, $75, $8D, $76, $8D, $78, $8C, $63, $96, $66 ; CPU:$DE9A PRG:1E9A 8C 69 8D 72 8E 73 8E 75 8D 76 8D 78 8C 63 96 66 - .byte $99, $78, $99, $7B, $96, $66, $95, $69, $94, $72, $93, $73, $93, $75, $94, $76 ; CPU:$DEAA PRG:1EAA 99 78 99 7B 96 66 95 69 94 72 93 73 93 75 94 76 - .byte $94, $F8, $95, $84, $09, $1B, $19, $04, $09, $1A, $09, $04, $18, $9A, $18, $03 ; CPU:$DEBA PRG:1EBA 94 F8 95 84 09 1B 19 04 09 1A 09 04 18 9A 18 03 - .byte $08, $1C, $03, $1A, $1C, $23, $09, $19, $3C, $09, $19, $44, $0A, $09, $44, $13 ; CPU:$DECA PRG:1ECA 08 1C 03 1A 1C 23 09 19 3C 09 19 44 0A 09 44 13 - .byte $13, $44, $D8, $19, $5A, $49, $0A, $5B, $8F, $0F, $5A, $99, $18, $64, $49, $64 ; CPU:$DEDA PRG:1EDA 13 44 D8 19 5A 49 0A 5B 8F 0F 5A 99 18 64 49 64 - .byte $52, $64, $59, $7B, $49, $7B, $50, $7B, $59, $0A, $11, $0D, $92, $11, $15, $84 ; CPU:$DEEA PRG:1EEA 52 64 59 7B 49 7B 50 7B 59 0A 11 0D 92 11 15 84 - .byte $09, $1B, $19, $04, $10, $9A, $11, $03, $0C, $0B, $14, $0C, $1C, $03, $16, $0B ; CPU:$DEFA PRG:1EFA 09 1B 19 04 10 9A 11 03 0C 0B 14 0C 1C 03 16 0B - .byte $14, $16, $1C, $23, $0D, $15, $3C, $0D, $15, $4B, $2B, $08, $4C, $2B, $08, $50 ; CPU:$DF0A PRG:1F0A 14 16 1C 23 0D 15 3C 0D 15 4B 2B 08 4C 2B 08 50 - .byte $28, $0B, $51, $28, $0B, $4A, $8B, $08, $4C, $0C, $09, $50, $49, $0C, $52, $C8 ; CPU:$DF1A PRG:1F1A 28 0B 51 28 0B 4A 8B 08 4C 0C 09 50 49 0C 52 C8 - .byte $0B, $4B, $37, $1A, $4C, $37, $1A, $50, $3A, $17, $51, $3A, $17, $4A, $57, $1A ; CPU:$DF2A PRG:1F2A 0B 4B 37 1A 4C 37 1A 50 3A 17 51 3A 17 4A 57 1A - .byte $4C, $D6, $19, $50, $99, $16, $52, $1A, $17, $08, $11, $0A, $29, $10, $12, $0E ; CPU:$DF3A PRG:1F3A 4C D6 19 50 99 16 52 1A 17 08 11 0A 29 10 12 0E - .byte $11, $11, $16, $11, $18, $B7, $10, $12, $04, $0D, $1B, $15, $0C, $0A, $13, $17 ; CPU:$DF4A PRG:1F4A 11 11 16 11 18 B7 10 12 04 0D 1B 15 0C 0A 13 17 - .byte $8E, $08, $11, $19, $08, $10, $09, $10, $08, $11, $09, $11, $0F, $10, $0F, $11 ; CPU:$DF5A PRG:1F5A 8E 08 11 19 08 10 09 10 08 11 09 11 0F 10 0F 11 - .byte $16, $10, $17, $10, $16, $11, $97, $11, $03, $08, $0D, $12, $08, $1C, $03, $19 ; CPU:$DF6A PRG:1F6A 16 10 17 10 16 11 97 11 03 08 0D 12 08 1C 03 19 - .byte $0D, $12, $19, $1C, $23, $09, $0D, $23, $14, $18, $3C, $09, $0D, $3C, $14, $18 ; CPU:$DF7A PRG:1F7A 0D 12 19 1C 23 09 0D 23 14 18 3C 09 0D 3C 14 18 - .byte $4D, $29, $0C, $4E, $29, $0B, $4F, $2B, $09, $4F, $2C, $09, $4C, $49, $0B, $4E ; CPU:$DF8A PRG:1F8A 4D 29 0C 4E 29 0B 4F 2B 09 4F 2C 09 4C 49 0B 4E - .byte $C8, $09, $50, $89, $08, $51, $0B, $09, $44, $2D, $11, $44, $2E, $11, $44, $33 ; CPU:$DF9A PRG:1F9A C8 09 50 89 08 51 0B 09 44 2D 11 44 2E 11 44 33 - .byte $10, $44, $34, $10, $43, $4E, $10, $43, $93, $11, $44, $CC, $0F, $44, $15, $12 ; CPU:$DFAA PRG:1FAA 10 44 34 10 43 4E 10 43 93 11 44 CC 0F 44 15 12 - .byte $57, $31, $0D, $59, $30, $0E, $57, $30, $14, $59, $31, $13, $58, $8F, $0C, $5A ; CPU:$DFBA PRG:1FBA 57 31 0D 59 30 0E 57 30 14 59 31 13 58 8F 0C 5A - .byte $10, $0E, $58, $52, $15, $5A, $D1, $13, $4D, $38, $15, $4E, $38, $17, $4F, $35 ; CPU:$DFCA PRG:1FCA 10 0E 58 52 15 5A D1 13 4D 38 15 4E 38 17 4F 35 - .byte $18, $50, $37, $18, $4C, $98, $16, $4E, $19, $18, $50, $58, $19, $D1, $D6, $18 ; CPU:$DFDA PRG:1FDA 18 50 37 18 4C 98 16 4E 19 18 50 58 19 D1 D6 18 - .byte $04, $09, $0D, $0D, $12, $09, $1B, $0D, $04, $14, $0D, $18, $12, $14, $1B, $18 ; CPU:$DFEA PRG:1FEA 04 09 0D 0D 12 09 1B 0D 04 14 0D 18 12 14 1B 18 - .byte $86, $0A, $19, $17, $03, $08, $0A, $08, $14, $08, $1B, $08, $0E, $0C, $10, $0C ; CPU:$DFFA PRG:1FFA 86 0A 19 17 03 08 0A 08 14 08 1B 08 0E 0C 10 0C - .byte $08, $0F, $08, $11, $16, $0F, $16, $11, $0E, $14, $10, $14, $03, $18, $0A, $18 ; CPU:$E00A PRG:200A 08 0F 08 11 16 0F 16 11 0E 14 10 14 03 18 0A 18 - .byte $14, $18, $9B, $18 ; CPU:$E01A PRG:201A 14 18 9B 18 + .byte $DA, $DD, $0E, $DE, $42, $DE, $C9, $DE, $01, $DF, $72, $DF ; CPU:$D52A PRG:152A DA DD 0E DE 42 DE C9 DE 01 DF 72 DF ; ----------------------------------------------------------------------------- -; Routine: Label_E01E +; Routine: ComputeStageLayoutAddress +; Global: Computes the VRAM address of the layout block for the current stage. +; Local: Reads the stage layout id (ReadStageLayoutId), shifts it left four times and adds +; the base $0D22, yielding ppu_addr_src. +; Parameters: $0187 = stage number. +; Returns: ppu_addr_src = layout block address. +; Clobbers: A, ppu_addr_lo/hi, ppu_addr_src_lo/hi. +; ----------------------------------------------------------------------------- +ComputeStageLayoutAddress: + jsr $D4CC ; CPU:$D536 PRG:1536 20 CC D4 + sta ppu_addr_lo ; CPU:$D539 PRG:1539 85 FC + lda #$00 ; CPU:$D53B PRG:153B A9 00 + asl ppu_addr_lo ; CPU:$D53D PRG:153D 06 FC + rol a ; CPU:$D53F PRG:153F 2A + asl ppu_addr_lo ; CPU:$D540 PRG:1540 06 FC + rol a ; CPU:$D542 PRG:1542 2A + asl ppu_addr_lo ; CPU:$D543 PRG:1543 06 FC + rol a ; CPU:$D545 PRG:1545 2A + asl ppu_addr_lo ; CPU:$D546 PRG:1546 06 FC + rol a ; CPU:$D548 PRG:1548 2A + sta ppu_addr_hi ; CPU:$D549 PRG:1549 85 FD + lda ppu_addr_lo ; CPU:$D54B PRG:154B A5 FC + clc ; CPU:$D54D PRG:154D 18 + adc #$22 ; CPU:$D54E PRG:154E 69 22 + sta ppu_addr_src_lo ; CPU:$D550 PRG:1550 85 FE + lda ppu_addr_hi ; CPU:$D552 PRG:1552 A5 FD + adc #$0D ; CPU:$D554 PRG:1554 69 0D + sta ppu_addr_src_hi ; CPU:$D556 PRG:1556 85 FF + rts ; CPU:$D558 PRG:1558 60 +; ---- data $D559-$E01D (2757 bytes) ---- +; The 2757-byte layout blob addressed by LayoutScriptTable. Each layout is a stream of three-byte records consumed by RunSceneScript (byte 0 = the shape/flags code whose low five bits give the cell count, byte 1 = the row, byte 2 = the count), ended by a record with bit 7 set. Script starts: $D559 $D597 $D617 $D691 $D6F5 $D759 $D7B5 $D815 $D87B $D8E9 $D94D $D9BA $DA1C $DAC0 $DB18 $DB88 $DBE2 $DC28 $DC4C $DC76 $DCC2 $DCFA $DD1C $DD75 $DDDA $DE0E $DE42 $DEC9 $DF01 $DF72 +LayoutData: + .byte $03, $08, $1C, $03, $1A, $1C, $23, $08, $1A, $3C, $08, $1A, $07, $09, $0E, $11 ; CPU:$D559 PRG:1559 03 08 1C 03 1A 1C 23 08 1A 3C 08 1A 07 09 0E 11 + .byte $09, $18, $07, $19, $0E, $11, $19, $18, $24, $0C, $16, $3B, $0C, $16, $66, $88 ; CPU:$D569 PRG:1569 09 18 07 19 0E 11 19 18 24 0C 16 3B 0C 16 66 88 + .byte $78, $88, $63, $8B, $7B, $8B, $63, $96, $7B, $96, $66, $99, $F8, $99, $84, $08 ; CPU:$D579 PRG:1579 78 88 63 8B 7B 8B 63 96 7B 96 66 99 F8 99 84 08 + .byte $1B, $19, $04, $09, $0F, $08, $1A, $09, $04, $18, $0F, $19, $9A, $18, $03, $08 ; CPU:$D589 PRG:1589 1B 19 04 09 0F 08 1A 09 04 18 0F 19 9A 18 03 08 + .byte $0B, $14, $08, $1C, $07, $09, $0B, $15, $09, $18, $07, $19, $0B, $14, $19, $18 ; CPU:$D599 PRG:1599 0B 14 08 1C 07 09 0B 15 09 18 07 19 0B 14 19 18 + .byte $03, $1A, $0B, $14, $1A, $1C, $23, $08, $1A, $24, $0C, $16, $3B, $0C, $16, $3C ; CPU:$D5A9 PRG:15A9 03 1A 0B 14 1A 1C 23 08 1A 24 0C 16 3B 0C 16 3C + .byte $08, $1A, $4C, $29, $0C, $4C, $2A, $0D, $4C, $C8, $0B, $4B, $4A, $0E, $50, $2C ; CPU:$D5B9 PRG:15B9 08 1A 4C 29 0C 4C 2A 0D 4C C8 0B 4B 4A 0E 50 2C + .byte $09, $50, $2D, $09, $50, $8B, $08, $50, $0E, $0A, $4C, $38, $15, $4C, $39, $16 ; CPU:$D5C9 PRG:15C9 09 50 2D 09 50 8B 08 50 0E 0A 4C 38 15 4C 39 16 + .byte $4B, $98, $14, $4C, $1A, $17, $50, $35, $18, $50, $36, $19, $50, $D4, $18, $50 ; CPU:$D5D9 PRG:15D9 4B 98 14 4C 1A 17 50 35 18 50 36 19 50 D4 18 50 + .byte $57, $1A, $66, $88, $78, $88, $63, $8B, $7B, $8B, $63, $96, $7B, $96, $66, $99 ; CPU:$D5E9 PRG:15E9 57 1A 66 88 78 88 63 8B 7B 8B 63 96 7B 96 66 99 + .byte $F8, $99, $04, $08, $0B, $19, $14, $08, $1B, $19, $0C, $0B, $0D, $17, $12, $0B ; CPU:$D5F9 PRG:15F9 F8 99 04 08 0B 19 14 08 1B 19 0C 0B 0D 17 12 0B + .byte $13, $17, $8E, $0D, $11, $15, $04, $09, $1A, $09, $04, $18, $9A, $18, $08, $08 ; CPU:$D609 PRG:1609 13 17 8E 0D 11 15 04 09 1A 09 04 18 9A 18 08 08 + .byte $17, $0C, $09, $13, $28, $08, $0B, $03, $0D, $06, $68, $0C, $68, $0D, $67, $0D ; CPU:$D619 PRG:1619 17 0C 09 13 28 08 0B 03 0D 06 68 0C 68 0D 67 0D + .byte $37, $08, $0B, $19, $0D, $1C, $76, $0C, $76, $0D, $77, $0D, $23, $0D, $15, $3C ; CPU:$D629 PRG:1629 37 08 0B 19 0D 1C 76 0C 76 0D 77 0D 23 0D 15 3C + .byte $0D, $15, $03, $15, $06, $19, $15, $1C, $28, $17, $1A, $37, $17, $1A, $67, $14 ; CPU:$D639 PRG:1639 0D 15 03 15 06 19 15 1C 28 17 1A 37 17 1A 67 14 + .byte $68, $14, $68, $15, $77, $14, $76, $14, $76, $15, $0C, $19, $13, $08, $1A, $17 ; CPU:$D649 PRG:1649 68 14 68 15 77 14 76 14 76 15 0C 19 13 08 1A 17 + .byte $6B, $88, $73, $88, $68, $8B, $76, $8B, $66, $8D, $78, $8D, $63, $90, $63, $91 ; CPU:$D659 PRG:1659 6B 88 73 88 68 8B 76 8B 66 8D 78 8D 63 90 63 91 + .byte $7B, $90, $7B, $91, $66, $94, $78, $94, $68, $96, $76, $96, $6B, $99, $F3, $99 ; CPU:$D669 PRG:1669 7B 90 7B 91 66 94 78 94 68 96 76 96 6B 99 F3 99 + .byte $08, $08, $16, $19, $84, $0E, $1B, $15, $09, $09, $15, $09, $04, $0E, $1A, $0E ; CPU:$D679 PRG:1679 08 08 16 19 84 0E 1B 15 09 09 15 09 04 0E 1A 0E + .byte $04, $13, $1A, $13, $09, $18, $95, $18, $07, $08, $18, $07, $09, $0C, $13, $09 ; CPU:$D689 PRG:1689 04 13 1A 13 09 18 95 18 07 08 18 07 09 0C 13 09 + .byte $18, $07, $19, $0B, $14, $19, $18, $07, $1A, $18, $44, $2B, $09, $45, $2B, $0A ; CPU:$D699 PRG:1699 18 07 19 0B 14 19 18 07 1A 18 44 2B 09 45 2B 0A + .byte $59, $29, $0B, $59, $2A, $0B, $44, $37, $19, $45, $37, $18, $59, $39, $17, $59 ; CPU:$D6A9 PRG:16A9 59 29 0B 59 2A 0B 44 37 19 45 37 18 59 39 17 59 + .byte $38, $17, $43, $8B, $08, $45, $0C, $0A, $59, $C8, $0B, $58, $4A, $0C, $43, $57 ; CPU:$D6B9 PRG:16B9 38 17 43 8B 08 45 0C 0A 59 C8 0B 58 4A 0C 43 57 + .byte $1A, $45, $D6, $18, $58, $98, $16, $59, $1A, $17, $23, $0C, $16, $24, $0C, $16 ; CPU:$D6C9 PRG:16C9 1A 45 D6 18 58 98 16 59 1A 17 23 0C 16 24 0C 16 + .byte $3B, $0C, $16, $BC, $0C, $16, $0C, $08, $13, $09, $06, $0A, $19, $19, $85, $0C ; CPU:$D6D9 PRG:16D9 3B 0C 16 BC 0C 16 0C 08 13 09 06 0A 19 19 85 0C + .byte $1A, $17, $0D, $08, $11, $08, $0C, $19, $0F, $19, $92, $19, $03, $08, $0B, $03 ; CPU:$D6E9 PRG:16E9 1A 17 0D 08 11 08 0C 19 0F 19 92 19 03 08 0B 03 + .byte $09, $0B, $14, $08, $1C, $14, $09, $1C, $0A, $19, $15, $0A, $1A, $15, $23, $0A ; CPU:$D6F9 PRG:16F9 09 0B 14 08 1C 14 09 1C 0A 19 15 0A 1A 15 23 0A + .byte $13, $24, $0A, $13, $3B, $0A, $13, $3C, $0A, $13, $4C, $29, $0C, $50, $2C, $09 ; CPU:$D709 PRG:1709 13 24 0A 13 3B 0A 13 3C 0A 13 4C 29 0C 50 2C 09 + .byte $44, $34, $19, $45, $34, $18, $56, $38, $14, $56, $39, $14, $4C, $C8, $0B, $4C ; CPU:$D719 PRG:1719 44 34 19 45 34 18 56 38 14 56 39 14 4C C8 0B 4C + .byte $4A, $0D, $50, $8B, $08, $50, $0D, $0A, $45, $D3, $18, $43, $54, $1A, $55, $98 ; CPU:$D729 PRG:1729 4A 0D 50 8B 08 50 0D 0A 45 D3 18 43 54 1A 55 98 + .byte $13, $D6, $1A, $14, $05, $0A, $0D, $13, $06, $14, $19, $15, $08, $16, $17, $17 ; CPU:$D739 PRG:1739 13 D6 1A 14 05 0A 0D 13 06 14 19 15 08 16 17 17 + .byte $0A, $18, $15, $18, $12, $0A, $1A, $13, $8E, $0C, $11, $13, $08, $0D, $96, $0D ; CPU:$D749 PRG:1749 0A 18 15 18 12 0A 1A 13 8E 0C 11 13 08 0D 96 0D + .byte $09, $08, $1C, $0D, $09, $18, $29, $09, $0B, $03, $0D, $06, $23, $0E, $1A, $24 ; CPU:$D759 PRG:1759 09 08 1C 0D 09 18 29 09 0B 03 0D 06 23 0E 1A 24 + .byte $11, $16, $04, $1A, $16, $07, $19, $12, $36, $17, $19, $19, $15, $1C, $3C, $09 ; CPU:$D769 PRG:1769 11 16 04 1A 16 07 19 12 36 17 19 19 15 1C 3C 09 + .byte $14, $3B, $0C, $11, $6C, $88, $78, $88, $69, $8B, $7B, $8B, $66, $8D, $63, $90 ; CPU:$D779 PRG:1779 14 3B 0C 11 6C 88 78 88 69 8B 7B 8B 66 8D 63 90 + .byte $7B, $91, $78, $94, $63, $96, $75, $96, $66, $99, $72, $99, $69, $0C, $67, $0D ; CPU:$D789 PRG:1789 7B 91 78 94 63 96 75 96 66 99 72 99 69 0C 67 0D + .byte $69, $0D, $75, $14, $77, $14, $F5, $15, $0A, $09, $1B, $14, $84, $0E, $15, $19 ; CPU:$D799 PRG:1799 69 0D 75 14 77 14 F5 15 0A 09 1B 14 84 0E 15 19 + .byte $0A, $09, $1A, $09, $04, $0E, $1A, $13, $04, $18, $94, $18, $04, $08, $1B, $04 ; CPU:$D7A9 PRG:17A9 0A 09 1A 09 04 0E 1A 13 04 18 94 18 04 08 1B 04 + .byte $1A, $1B, $23, $09, $19, $3C, $09, $19, $43, $88, $08, $5C, $C8, $08, $43, $5A ; CPU:$D7B9 PRG:17B9 1A 1B 23 09 19 3C 09 19 43 88 08 5C C8 08 43 5A + .byte $1A, $5C, $1A, $1A, $66, $88, $68, $88, $6A, $88, $6C, $88, $72, $88, $74, $88 ; CPU:$D7C9 PRG:17C9 1A 5C 1A 1A 66 88 68 88 6A 88 6C 88 72 88 74 88 + .byte $76, $88, $78, $88, $63, $8B, $63, $8D, $63, $8F, $63, $92, $63, $94, $63, $96 ; CPU:$D7D9 PRG:17D9 76 88 78 88 63 8B 63 8D 63 8F 63 92 63 94 63 96 + .byte $7B, $8B, $7B, $8D, $7B, $8F, $7B, $92, $7B, $94, $7B, $96, $66, $99, $68, $99 ; CPU:$D7E9 PRG:17E9 7B 8B 7B 8D 7B 8F 7B 92 7B 94 7B 96 66 99 68 99 + .byte $6A, $99, $6C, $99, $72, $99, $74, $99, $76, $99, $F8, $99, $84, $09, $1B, $19 ; CPU:$D7F9 PRG:17F9 6A 99 6C 99 72 99 74 99 76 99 F8 99 84 09 1B 19 + .byte $04, $09, $0F, $08, $1A, $09, $04, $18, $0F, $19, $9A, $18, $10, $08, $1C, $12 ; CPU:$D809 PRG:1809 04 09 0F 08 1A 09 04 18 0F 19 9A 18 10 08 1C 12 + .byte $09, $18, $3C, $09, $0B, $23, $17, $19, $03, $1A, $0F, $07, $19, $0D, $43, $34 ; CPU:$D819 PRG:1819 09 18 3C 09 0B 23 17 19 03 1A 0F 07 19 0D 43 34 + .byte $08, $44, $34, $09, $50, $39, $0E, $50, $3A, $0E, $43, $93, $08, $45, $14, $0A ; CPU:$D829 PRG:1829 08 44 34 09 50 39 0E 50 3A 0E 43 93 08 45 14 0A + .byte $50, $98, $0E, $51, $1A, $0F, $63, $15, $63, $96, $66, $99, $78, $88, $7B, $8B ; CPU:$D839 PRG:1839 50 98 0E 51 1A 0F 63 15 63 96 66 99 78 88 7B 8B + .byte $FB, $0C, $10, $08, $1B, $0F, $04, $14, $0F, $19, $06, $12, $17, $13, $10, $14 ; CPU:$D849 PRG:1849 FB 0C 10 08 1B 0F 04 14 0F 19 06 12 17 13 10 14 + .byte $15, $15, $10, $16, $13, $17, $10, $18, $11, $19, $08, $10, $19, $11, $0A, $0E ; CPU:$D859 PRG:1859 15 15 10 16 13 17 10 18 11 19 08 10 19 11 0A 0E + .byte $0F, $0F, $0C, $0C, $0F, $0D, $8E, $0A, $0F, $0B, $10, $08, $1A, $09, $04, $18 ; CPU:$D869 PRG:1869 0F 0F 0C 0C 0F 0D 8E 0A 0F 0B 10 08 1A 09 04 18 + .byte $8E, $19, $03, $08, $1C, $07, $0D, $10, $08, $0E, $0F, $10, $14, $17, $0F, $15 ; CPU:$D879 PRG:1879 8E 19 03 08 1C 07 0D 10 08 0E 0F 10 14 17 0F 15 + .byte $18, $03, $1A, $1C, $43, $29, $0C, $44, $29, $0C, $43, $39, $0F, $44, $39, $0F ; CPU:$D889 PRG:1889 18 03 1A 1C 43 29 0C 44 29 0C 43 39 0F 44 39 0F + .byte $51, $33, $09, $52, $33, $09, $58, $36, $19, $59, $36, $19, $43, $4A, $0E, $45 ; CPU:$D899 PRG:1899 51 33 09 52 33 09 58 36 19 59 36 19 43 4A 0E 45 + .byte $C9, $0C, $43, $98, $0F, $45, $19, $0D, $4E, $95, $09, $53, $13, $0A, $57, $56 ; CPU:$D8A9 PRG:18A9 C9 0C 43 98 0F 45 19 0D 4E 95 09 53 13 0A 57 56 + .byte $19, $D8, $D4, $18, $04, $08, $1B, $09, $06, $0A, $19, $0B, $08, $0C, $17, $0D ; CPU:$D8B9 PRG:18B9 19 D8 D4 18 04 08 1B 09 06 0A 19 0B 08 0C 17 0D + .byte $0E, $0E, $15, $0F, $0C, $10, $13, $11, $0A, $12, $11, $13, $08, $14, $0F, $15 ; CPU:$D8C9 PRG:18C9 0E 0E 15 0F 0C 10 13 11 0A 12 11 13 08 14 0F 15 + .byte $06, $16, $19, $17, $84, $18, $1B, $19, $07, $09, $17, $09, $07, $18, $97, $18 ; CPU:$D8D9 PRG:18D9 06 16 19 17 84 18 1B 19 07 09 17 09 07 18 97 18 + .byte $0B, $08, $14, $0B, $09, $14, $0B, $19, $14, $0B, $1A, $14, $27, $0C, $16, $28 ; CPU:$D8E9 PRG:18E9 0B 08 14 0B 09 14 0B 19 14 0B 1A 14 27 0C 16 28 + .byte $0C, $16, $37, $0C, $16, $38, $0C, $16, $48, $2B, $09, $49, $2B, $0A, $55, $29 ; CPU:$D8F9 PRG:18F9 0C 16 37 0C 16 38 0C 16 48 2B 09 49 2B 0A 55 29 + .byte $0B, $55, $2A, $0B, $48, $37, $19, $49, $37, $18, $55, $38, $17, $55, $39, $17 ; CPU:$D909 PRG:1909 0B 55 2A 0B 48 37 19 49 37 18 55 38 17 55 39 17 + .byte $47, $8B, $08, $49, $0C, $0A, $55, $C8, $0B, $54, $4A, $0C, $47, $57, $1A, $49 ; CPU:$D919 PRG:1919 47 8B 08 49 0C 0A 55 C8 0B 54 4A 0C 47 57 1A 49 + .byte $D6, $18, $54, $98, $16, $D5, $1A, $17, $0A, $0A, $15, $19, $09, $0C, $09, $16 ; CPU:$D929 PRG:1929 D6 18 54 98 16 D5 1A 17 0A 0A 15 19 09 0C 09 16 + .byte $96, $0C, $16, $16, $0F, $0E, $0E, $0F, $10, $0F, $0D, $10, $11, $10, $0E, $11 ; CPU:$D939 PRG:1939 96 0C 16 16 0F 0E 0E 0F 10 0F 0D 10 11 10 0E 11 + .byte $10, $11, $8F, $12, $03, $08, $1C, $03, $1A, $1C, $23, $09, $19, $3C, $09, $19 ; CPU:$D949 PRG:1949 10 11 8F 12 03 08 1C 03 1A 1C 23 09 19 3C 09 19 + .byte $04, $09, $1B, $05, $0B, $0C, $13, $0B, $1A, $07, $0D, $0A, $15, $0D, $18, $2C ; CPU:$D959 PRG:1959 04 09 1B 05 0B 0C 13 0B 1A 07 0D 0A 15 0D 18 2C + .byte $0F, $12, $2E, $0D, $14, $31, $0D, $14, $33, $0F, $12, $44, $CA, $0E, $44, $4B ; CPU:$D969 PRG:1969 0F 12 2E 0D 14 31 0D 14 33 0F 12 44 CA 0E 44 4B + .byte $0F, $49, $8E, $0A, $49, $0F, $0A, $51, $4A, $0F, $52, $CA, $0E, $57, $8E, $0A ; CPU:$D979 PRG:1979 0F 49 8E 0A 49 0F 0A 51 4A 0F 52 CA 0E 57 8E 0A + .byte $57, $0F, $0B, $4C, $8E, $0C, $4D, $0E, $0E, $4C, $53, $14, $4D, $D3, $13, $51 ; CPU:$D989 PRG:1989 57 0F 0B 4C 8E 0C 4D 0E 0E 4C 53 14 4D D3 13 51 + .byte $CC, $0E, $52, $4E, $0E, $52, $14, $13, $52, $93, $13, $63, $98, $64, $99, $66 ; CPU:$D999 PRG:1999 CC 0E 52 4E 0E 52 14 13 52 93 13 63 98 64 99 66 + .byte $90, $78, $90, $7A, $99, $FB, $98, $84, $0A, $1B, $19, $05, $0E, $19, $0E, $8F ; CPU:$D9A9 PRG:19A9 90 78 90 7A 99 FB 98 84 0A 1B 19 05 0E 19 0E 8F + .byte $18, $03, $08, $1C, $08, $09, $17, $09, $0A, $09, $16, $0A, $16, $09, $18, $09 ; CPU:$D9B9 PRG:19B9 18 03 08 1C 08 09 17 09 0A 09 16 0A 16 09 18 09 + .byte $16, $18, $16, $08, $19, $17, $03, $1A, $1C, $23, $09, $19, $3C, $09, $19, $47 ; CPU:$D9C9 PRG:19C9 16 18 16 08 19 17 03 1A 1C 23 09 19 3C 09 19 47 + .byte $49, $0B, $56, $0B, $09, $47, $99, $17, $56, $D7, $19, $44, $CC, $0E, $44, $4D ; CPU:$D9D9 PRG:19D9 49 0B 56 0B 09 47 99 17 56 D7 19 44 CC 0E 44 4D + .byte $0E, $59, $8E, $0C, $5A, $0E, $0D, $44, $95, $14, $44, $16, $14, $59, $54, $16 ; CPU:$D9E9 PRG:19E9 0E 59 8E 0C 5A 0E 0D 44 95 14 44 16 14 59 54 16 + .byte $5A, $D4, $15, $6F, $8C, $6F, $95, $69, $90, $69, $91, $75, $90, $F5, $91, $84 ; CPU:$D9F9 PRG:19F9 5A D4 15 6F 8C 6F 95 69 90 69 91 75 90 F5 91 84 + .byte $08, $1B, $19, $05, $09, $04, $0A, $19, $09, $1A, $0A, $04, $17, $05, $18, $1A ; CPU:$DA09 PRG:1A09 08 1B 19 05 09 04 0A 19 09 1A 0A 04 17 05 18 1A + .byte $17, $99, $18, $05, $08, $0B, $14, $08, $1A, $04, $09, $1B, $0D, $0A, $12, $0D ; CPU:$DA19 PRG:1A19 17 99 18 05 08 0B 14 08 1A 04 09 1B 0D 0A 12 0D + .byte $18, $12, $04, $19, $1B, $05, $1A, $0B, $14, $1A, $1A, $23, $0A, $0E, $23, $14 ; CPU:$DA29 PRG:1A29 18 12 04 19 1B 05 1A 0B 14 1A 1A 23 0A 0E 23 14 + .byte $18, $24, $0A, $18, $25, $10, $12, $3A, $10, $12, $3B, $0A, $18, $3C, $0A, $0E ; CPU:$DA39 PRG:1A39 18 24 0A 18 25 10 12 3A 10 12 3B 0A 18 3C 0A 0E + .byte $3C, $14, $18, $43, $89, $08, $5B, $C8, $09, $43, $59, $1A, $5B, $1A, $19, $64 ; CPU:$DA49 PRG:1A49 3C 14 18 43 89 08 5B C8 09 43 59 1A 5B 1A 19 64 + .byte $89, $6B, $88, $6C, $89, $73, $88, $72, $89, $7A, $89, $63, $8E, $64, $8F, $7A ; CPU:$DA59 PRG:1A59 89 6B 88 6C 89 73 88 72 89 7A 89 63 8E 64 8F 7A + .byte $8F, $7B, $8E, $63, $93, $64, $92, $7A, $92, $7B, $93, $64, $98, $6C, $98, $6B ; CPU:$DA69 PRG:1A69 8F 7B 8E 63 93 64 92 7A 92 7B 93 64 98 6C 98 6B + .byte $99, $72, $98, $73, $99, $7A, $98, $0D, $0E, $12, $0C, $0F, $13, $0C, $13, $13 ; CPU:$DA79 PRG:1A79 99 72 98 73 99 7A 98 0D 0E 12 0C 0F 13 0C 13 13 + .byte $0D, $14, $12, $2B, $10, $12, $2C, $10, $12, $33, $10, $12, $34, $10, $12, $4B ; CPU:$DA89 PRG:1A89 0D 14 12 2B 10 12 2C 10 12 33 10 12 34 10 12 4B + .byte $8F, $0E, $4B, $53, $14, $53, $CE, $0F, $53, $14, $13, $6C, $8F, $72, $8F, $6C ; CPU:$DA99 PRG:1A99 8F 0E 4B 53 14 53 CE 0F 53 14 13 6C 8F 72 8F 6C + .byte $92, $F2, $92, $05, $0A, $1A, $0F, $05, $14, $1A, $18, $05, $10, $0B, $13, $94 ; CPU:$DAA9 PRG:1AA9 92 F2 92 05 0A 1A 0F 05 14 1A 18 05 10 0B 13 94 + .byte $10, $1A, $13, $16, $0C, $88, $15, $03, $08, $0B, $14, $08, $1C, $0B, $0C, $14 ; CPU:$DAB9 PRG:1AB9 10 1A 13 16 0C 88 15 03 08 0B 14 08 1C 0B 0C 14 + .byte $03, $0F, $08, $17, $0F, $1C, $03, $13, $08, $17, $13, $1C, $0B, $16, $14, $03 ; CPU:$DAC9 PRG:1AC9 03 0F 08 17 0F 1C 03 13 08 17 13 1C 0B 16 14 03 + .byte $1A, $0B, $14, $1A, $1C, $23, $09, $0E, $2B, $09, $0B, $34, $09, $0B, $3C, $09 ; CPU:$DAD9 PRG:1AD9 1A 0B 14 1A 1C 23 09 0E 2B 09 0B 34 09 0B 3C 09 + .byte $0E, $28, $10, $12, $37, $10, $12, $23, $14, $19, $2B, $17, $19, $34, $17, $19 ; CPU:$DAE9 PRG:1AE9 0E 28 10 12 37 10 12 23 14 19 2B 17 19 34 17 19 + .byte $BC, $14, $19, $04, $09, $0A, $0E, $15, $09, $1B, $0E, $04, $14, $0A, $19, $15 ; CPU:$DAF9 PRG:1AF9 BC 14 19 04 09 0A 0E 15 09 1B 0E 04 14 0A 19 15 + .byte $14, $1B, $19, $89, $0D, $16, $15, $09, $09, $1A, $0D, $04, $14, $95, $18, $05 ; CPU:$DB09 PRG:1B09 14 1B 19 89 0D 16 15 09 09 1A 0D 04 14 95 18 05 + .byte $08, $0B, $14, $08, $1A, $04, $09, $1B, $0D, $0A, $12, $0D, $18, $12, $04, $19 ; CPU:$DB19 PRG:1B19 08 0B 14 08 1A 04 09 1B 0D 0A 12 0D 18 12 04 19 + .byte $1B, $05, $1A, $0B, $14, $1A, $1A, $23, $0A, $0E, $23, $14, $18, $24, $0A, $18 ; CPU:$DB29 PRG:1B29 1B 05 1A 0B 14 1A 1A 23 0A 0E 23 14 18 24 0A 18 + .byte $25, $10, $12, $3A, $10, $12, $3B, $0A, $18, $3C, $0A, $0E, $3C, $14, $18, $43 ; CPU:$DB39 PRG:1B39 25 10 12 3A 10 12 3B 0A 18 3C 0A 0E 3C 14 18 43 + .byte $89, $08, $5B, $C8, $09, $43, $59, $1A, $5B, $1A, $19, $64, $89, $6B, $88, $6C ; CPU:$DB49 PRG:1B49 89 08 5B C8 09 43 59 1A 5B 1A 19 64 89 6B 88 6C + .byte $89, $73, $88, $72, $89, $7A, $89, $63, $8E, $64, $8F, $7A, $8F, $7B, $8E, $63 ; CPU:$DB59 PRG:1B59 89 73 88 72 89 7A 89 63 8E 64 8F 7A 8F 7B 8E 63 + .byte $93, $64, $92, $7A, $92, $7B, $93, $64, $98, $6C, $98, $6B, $99, $72, $98, $73 ; CPU:$DB69 PRG:1B69 93 64 92 7A 92 7B 93 64 98 6C 98 6B 99 72 98 73 + .byte $99, $7A, $98, $6F, $10, $F0, $11, $85, $0A, $1A, $18, $16, $15, $88, $0C, $04 ; CPU:$DB79 PRG:1B79 99 7A 98 6F 10 F0 11 85 0A 1A 18 16 15 88 0C 04 + .byte $08, $13, $04, $19, $13, $45, $29, $10, $46, $29, $10, $45, $38, $11, $46, $38 ; CPU:$DB89 PRG:1B89 08 13 04 19 13 45 29 10 46 29 10 45 38 11 46 38 + .byte $11, $54, $29, $10, $54, $38, $11, $43, $48, $10, $47, $C9, $10, $43, $99, $11 ; CPU:$DB99 PRG:1B99 11 54 29 10 54 38 11 43 48 10 47 C9 10 43 99 11 + .byte $47, $18, $11, $53, $49, $10, $54, $C8, $10, $53, $98, $11, $D4, $19, $11, $07 ; CPU:$DBA9 PRG:1BA9 47 18 11 53 49 10 54 C8 10 53 98 11 D4 19 11 07 + .byte $09, $13, $09, $06, $18, $13, $18, $08, $16, $15, $17, $08, $0A, $15, $0B, $0C ; CPU:$DBB9 PRG:1BB9 09 13 09 06 18 13 18 08 16 15 17 08 0A 15 0B 0C + .byte $12, $17, $15, $0A, $14, $0B, $15, $18, $0E, $19, $13, $0C, $0C, $17, $0F, $0A ; CPU:$DBC9 PRG:1BC9 12 17 15 0A 14 0B 15 18 0E 19 13 0C 0C 17 0F 0A + .byte $0C, $15, $0D, $8E, $10, $1A, $11, $98, $10, $03, $19, $1C, $03, $1A, $1C, $23 ; CPU:$DBD9 PRG:1BD9 0C 15 0D 8E 10 1A 11 98 10 03 19 1C 03 1A 1C 23 + .byte $15, $18, $3C, $15, $18, $63, $15, $7B, $15, $43, $34, $08, $44, $34, $09, $50 ; CPU:$DBE9 PRG:1BE9 15 18 3C 15 18 63 15 7B 15 43 34 08 44 34 09 50 + .byte $28, $14, $50, $29, $14, $43, $93, $08, $45, $14, $0B, $51, $C8, $13, $D1, $4B ; CPU:$DBF9 PRG:1BF9 28 14 50 29 14 43 93 08 45 14 0B 51 C8 13 D1 4B + .byte $14, $0E, $0A, $11, $0B, $0C, $0C, $13, $0D, $0A, $0E, $15, $0F, $08, $10, $17 ; CPU:$DC09 PRG:1C09 14 0E 0A 11 0B 0C 0C 13 0D 0A 0E 15 0F 08 10 17 + .byte $11, $06, $12, $19, $13, $84, $14, $1B, $18, $0F, $09, $03, $17, $9B, $17, $03 ; CPU:$DC19 PRG:1C19 11 06 12 19 13 84 14 1B 18 0F 09 03 17 9B 17 03 + .byte $08, $1C, $03, $1A, $1C, $23, $09, $19, $3C, $09, $19, $69, $88, $75, $88, $7B ; CPU:$DC29 PRG:1C29 08 1C 03 1A 1C 23 09 19 3C 09 19 69 88 75 88 7B + .byte $8F, $63, $92, $69, $99, $75, $99, $78, $4C, $E7, $56, $84, $09, $1B, $19, $1A ; CPU:$DC39 PRG:1C39 8F 63 92 69 99 75 99 78 4C E7 56 84 09 1B 19 1A + .byte $09, $84, $18, $03, $0B, $1C, $03, $14, $1C, $23, $0C, $13, $3C, $0C, $13, $63 ; CPU:$DC49 PRG:1C49 09 84 18 03 0B 1C 03 14 1C 23 0C 13 3C 0C 13 63 + .byte $8B, $63, $93, $7B, $8B, $7B, $93, $66, $8D, $70, $8D, $6E, $91, $F8, $91, $84 ; CPU:$DC59 PRG:1C59 8B 63 93 7B 8B 7B 93 66 8D 70 8D 6E 91 F8 91 84 + .byte $0C, $1B, $13, $0A, $0C, $12, $0E, $0C, $11, $04, $10, $84, $11, $03, $08, $1C ; CPU:$DC69 PRG:1C69 0C 1B 13 0A 0C 12 0E 0C 11 04 10 84 11 03 08 1C + .byte $03, $09, $0D, $03, $0A, $09, $03, $0B, $07, $03, $0C, $06, $23, $0D, $19, $24 ; CPU:$DC79 PRG:1C79 03 09 0D 03 0A 09 03 0B 07 03 0C 06 23 0D 19 24 + .byte $0D, $11, $25, $0D, $0E, $03, $1A, $1C, $12, $19, $1C, $16, $18, $1C, $18, $17 ; CPU:$DC89 PRG:1C89 0D 11 25 0D 0E 03 1A 1C 12 19 1C 16 18 1C 18 17 + .byte $1C, $19, $16, $1C, $3A, $14, $15, $3B, $11, $15, $3C, $09, $15, $63, $91, $64 ; CPU:$DC99 PRG:1C99 1C 19 16 1C 3A 14 15 3B 11 15 3C 09 15 63 91 64 + .byte $8E, $69, $89, $6D, $88, $7B, $90, $7A, $93, $75, $98, $71, $99, $46, $0D, $0B ; CPU:$DCA9 PRG:1CA9 8E 69 89 6D 88 7B 90 7A 93 75 98 71 99 46 0D 0B + .byte $D7, $97, $15, $84, $09, $1B, $19, $8F, $10, $03, $08, $1C, $03, $1A, $1C, $23 ; CPU:$DCB9 PRG:1CB9 D7 97 15 84 09 1B 19 8F 10 03 08 1C 03 1A 1C 23 + .byte $09, $19, $3C, $09, $19, $6A, $4C, $6C, $4C, $6E, $4C, $70, $4C, $72, $4C, $74 ; CPU:$DCC9 PRG:1CC9 09 19 3C 09 19 6A 4C 6C 4C 6E 4C 70 4C 72 4C 74 + .byte $4C, $76, $4C, $6A, $56, $6C, $56, $6E, $56, $70, $56, $72, $56, $74, $56, $76 ; CPU:$DCD9 PRG:1CD9 4C 76 4C 6A 56 6C 56 6E 56 70 56 72 56 74 56 76 + .byte $56, $68, $4E, $E8, $54, $84, $09, $1B, $19, $07, $10, $07, $11, $1A, $09, $9A ; CPU:$DCE9 PRG:1CE9 56 68 4E E8 54 84 09 1B 19 07 10 07 11 1A 09 9A + .byte $18, $03, $08, $1C, $03, $1A, $1C, $23, $08, $19, $3C, $08, $19, $6F, $8C, $47 ; CPU:$DCF9 PRG:1CF9 18 03 08 1C 03 1A 1C 23 08 19 3C 08 19 6F 8C 47 + .byte $CF, $15, $47, $50, $16, $52, $95, $0F, $D2, $16, $10, $84, $08, $1B, $19, $0F ; CPU:$DD09 PRG:1D09 CF 15 47 50 16 52 95 0F D2 16 10 84 08 1B 19 0F + .byte $14, $8F, $18, $0C, $09, $16, $11, $0D, $1C, $11, $16, $1C, $0C, $1A, $16, $3C ; CPU:$DD19 PRG:1D19 14 8F 18 0C 09 16 11 0D 1C 11 16 1C 0C 1A 16 3C + .byte $0E, $15, $43, $91, $09, $46, $11, $0A, $44, $31, $0A, $45, $31, $0A, $43, $52 ; CPU:$DD29 PRG:1D29 0E 15 43 91 09 46 11 0A 44 31 0A 45 31 0A 43 52 + .byte $1A, $46, $D2, $19, $44, $32, $19, $45, $32, $19, $50, $8D, $0A, $54, $0C, $09 ; CPU:$DD39 PRG:1D39 1A 46 D2 19 44 32 19 45 32 19 50 8D 0A 54 0C 09 + .byte $52, $2C, $0A, $53, $2C, $0A, $50, $56, $19, $54, $D7, $1A, $52, $37, $19, $53 ; CPU:$DD49 PRG:1D49 52 2C 0A 53 2C 0A 50 56 19 54 D7 1A 52 37 19 53 + .byte $37, $19, $EB, $91, $0C, $0A, $13, $19, $0A, $0C, $0B, $17, $08, $0E, $09, $15 ; CPU:$DD59 PRG:1D59 37 19 EB 91 0C 0A 13 19 0A 0C 0B 17 08 0E 09 15 + .byte $06, $10, $07, $13, $94, $0E, $1B, $15, $10, $0A, $90, $18, $03, $08, $08, $10 ; CPU:$DD69 PRG:1D69 06 10 07 13 94 0E 1B 15 10 0A 90 18 03 08 08 10 + .byte $08, $1A, $08, $15, $10, $03, $1A, $1A, $23, $09, $19, $28, $09, $14, $30, $09 ; CPU:$DD79 PRG:1D79 08 1A 08 15 10 03 1A 1A 23 09 19 28 09 14 30 09 + .byte $14, $3C, $0A, $0E, $3C, $13, $18, $59, $49, $0B, $5B, $C8, $09, $5A, $29, $0A ; CPU:$DD89 PRG:1D89 14 3C 0A 0E 3C 13 18 59 49 0B 5B C8 09 5A 29 0A + .byte $7B, $49, $59, $90, $0E, $5B, $10, $0F, $5A, $30, $0F, $59, $51, $13, $5B, $D1 ; CPU:$DD99 PRG:1D99 7B 49 59 90 0E 5B 10 0F 5A 30 0F 59 51 13 5B D1 + .byte $12, $5A, $31, $12, $59, $99, $17, $5B, $1A, $19, $5A, $39, $18, $7B, $59, $44 ; CPU:$DDA9 PRG:1DA9 12 5A 31 12 59 99 17 5B 1A 19 5A 39 18 7B 59 44 + .byte $D7, $19, $44, $58, $19, $75, $14, $F6, $14, $04, $09, $07, $19, $08, $16, $10 ; CPU:$DDB9 PRG:1DB9 D7 19 44 58 19 75 14 F6 14 04 09 07 19 08 16 10 + .byte $19, $11, $09, $19, $19, $1A, $0A, $1B, $0F, $9A, $12, $1B, $19, $15, $0C, $96 ; CPU:$DDC9 PRG:1DC9 19 11 09 19 19 1A 0A 1B 0F 9A 12 1B 19 15 0C 96 + .byte $0C, $03, $08, $1C, $03, $1A, $1C, $23, $09, $19, $3C, $09, $19, $10, $0C, $15 ; CPU:$DDD9 PRG:1DD9 0C 03 08 1C 03 1A 1C 23 09 19 3C 09 19 10 0C 15 + .byte $15, $11, $18, $10, $16, $15, $0B, $11, $0E, $66, $49, $64, $4B, $64, $57, $66 ; CPU:$DDE9 PRG:1DE9 15 11 18 10 16 15 0B 11 0E 66 49 64 4B 64 57 66 + .byte $59, $78, $88, $7B, $8B, $7B, $96, $F8, $99, $84, $09, $1B, $19, $04, $09, $04 ; CPU:$DDF9 PRG:1DF9 59 78 88 7B 8B 7B 96 F8 99 84 09 1B 19 04 09 04 + .byte $18, $1A, $09, $9A, $18, $03, $08, $1C, $06, $09, $18, $07, $19, $19, $03, $1A ; CPU:$DE09 PRG:1E09 18 1A 09 9A 18 03 08 1C 06 09 18 07 19 19 03 1A + .byte $1C, $23, $09, $19, $24, $0C, $17, $3B, $0B, $16, $3C, $09, $19, $63, $8B, $78 ; CPU:$DE19 PRG:1E19 1C 23 09 19 24 0C 17 3B 0B 16 3C 09 19 63 8B 78 + .byte $88, $66, $99, $7B, $96, $66, $89, $7A, $8B, $64, $96, $F8, $98, $84, $09, $1B ; CPU:$DE29 PRG:1E29 88 66 99 7B 96 66 89 7A 8B 64 96 F8 98 84 09 1B + .byte $19, $04, $09, $1A, $09, $04, $18, $9A, $18, $03, $08, $1C, $07, $09, $18, $03 ; CPU:$DE39 PRG:1E39 19 04 09 1A 09 04 18 9A 18 03 08 1C 07 09 18 03 + .byte $1A, $1C, $07, $19, $18, $23, $09, $19, $3C, $09, $19, $24, $0C, $16, $25, $0C ; CPU:$DE49 PRG:1E49 1A 1C 07 19 18 23 09 19 3C 09 19 24 0C 16 25 0C + .byte $16, $26, $0C, $16, $27, $0D, $15, $28, $0D, $15, $29, $0D, $15, $2A, $0E, $14 ; CPU:$DE59 PRG:1E59 16 26 0C 16 27 0D 15 28 0D 15 29 0D 15 2A 0E 14 + .byte $2B, $0E, $14, $2C, $0E, $14, $2D, $0F, $13, $2E, $10, $12, $19, $0C, $1B, $16 ; CPU:$DE69 PRG:1E69 2B 0E 14 2C 0E 14 2D 0F 13 2E 10 12 19 0C 1B 16 + .byte $0D, $1B, $13, $0E, $16, $72, $4F, $72, $53, $13, $14, $16, $16, $15, $1B, $19 ; CPU:$DE79 PRG:1E79 0D 1B 13 0E 16 72 4F 72 53 13 14 16 16 15 1B 19 + .byte $16, $1B, $4D, $CE, $0F, $4D, $14, $13, $66, $88, $63, $8B, $78, $88, $7B, $8B ; CPU:$DE89 PRG:1E89 16 1B 4D CE 0F 4D 14 13 66 88 63 8B 78 88 7B 8B + .byte $66, $8C, $69, $8D, $72, $8E, $73, $8E, $75, $8D, $76, $8D, $78, $8C, $63, $96 ; CPU:$DE99 PRG:1E99 66 8C 69 8D 72 8E 73 8E 75 8D 76 8D 78 8C 63 96 + .byte $66, $99, $78, $99, $7B, $96, $66, $95, $69, $94, $72, $93, $73, $93, $75, $94 ; CPU:$DEA9 PRG:1EA9 66 99 78 99 7B 96 66 95 69 94 72 93 73 93 75 94 + .byte $76, $94, $F8, $95, $84, $09, $1B, $19, $04, $09, $1A, $09, $04, $18, $9A, $18 ; CPU:$DEB9 PRG:1EB9 76 94 F8 95 84 09 1B 19 04 09 1A 09 04 18 9A 18 + .byte $03, $08, $1C, $03, $1A, $1C, $23, $09, $19, $3C, $09, $19, $44, $0A, $09, $44 ; CPU:$DEC9 PRG:1EC9 03 08 1C 03 1A 1C 23 09 19 3C 09 19 44 0A 09 44 + .byte $13, $13, $44, $D8, $19, $5A, $49, $0A, $5B, $8F, $0F, $5A, $99, $18, $64, $49 ; CPU:$DED9 PRG:1ED9 13 13 44 D8 19 5A 49 0A 5B 8F 0F 5A 99 18 64 49 + .byte $64, $52, $64, $59, $7B, $49, $7B, $50, $7B, $59, $0A, $11, $0D, $92, $11, $15 ; CPU:$DEE9 PRG:1EE9 64 52 64 59 7B 49 7B 50 7B 59 0A 11 0D 92 11 15 + .byte $84, $09, $1B, $19, $04, $10, $9A, $11, $03, $0C, $0B, $14, $0C, $1C, $03, $16 ; CPU:$DEF9 PRG:1EF9 84 09 1B 19 04 10 9A 11 03 0C 0B 14 0C 1C 03 16 + .byte $0B, $14, $16, $1C, $23, $0D, $15, $3C, $0D, $15, $4B, $2B, $08, $4C, $2B, $08 ; CPU:$DF09 PRG:1F09 0B 14 16 1C 23 0D 15 3C 0D 15 4B 2B 08 4C 2B 08 + .byte $50, $28, $0B, $51, $28, $0B, $4A, $8B, $08, $4C, $0C, $09, $50, $49, $0C, $52 ; CPU:$DF19 PRG:1F19 50 28 0B 51 28 0B 4A 8B 08 4C 0C 09 50 49 0C 52 + .byte $C8, $0B, $4B, $37, $1A, $4C, $37, $1A, $50, $3A, $17, $51, $3A, $17, $4A, $57 ; CPU:$DF29 PRG:1F29 C8 0B 4B 37 1A 4C 37 1A 50 3A 17 51 3A 17 4A 57 + .byte $1A, $4C, $D6, $19, $50, $99, $16, $52, $1A, $17, $08, $11, $0A, $29, $10, $12 ; CPU:$DF39 PRG:1F39 1A 4C D6 19 50 99 16 52 1A 17 08 11 0A 29 10 12 + .byte $0E, $11, $11, $16, $11, $18, $B7, $10, $12, $04, $0D, $1B, $15, $0C, $0A, $13 ; CPU:$DF49 PRG:1F49 0E 11 11 16 11 18 B7 10 12 04 0D 1B 15 0C 0A 13 + .byte $17, $8E, $08, $11, $19, $08, $10, $09, $10, $08, $11, $09, $11, $0F, $10, $0F ; CPU:$DF59 PRG:1F59 17 8E 08 11 19 08 10 09 10 08 11 09 11 0F 10 0F + .byte $11, $16, $10, $17, $10, $16, $11, $97, $11, $03, $08, $0D, $12, $08, $1C, $03 ; CPU:$DF69 PRG:1F69 11 16 10 17 10 16 11 97 11 03 08 0D 12 08 1C 03 + .byte $19, $0D, $12, $19, $1C, $23, $09, $0D, $23, $14, $18, $3C, $09, $0D, $3C, $14 ; CPU:$DF79 PRG:1F79 19 0D 12 19 1C 23 09 0D 23 14 18 3C 09 0D 3C 14 + .byte $18, $4D, $29, $0C, $4E, $29, $0B, $4F, $2B, $09, $4F, $2C, $09, $4C, $49, $0B ; CPU:$DF89 PRG:1F89 18 4D 29 0C 4E 29 0B 4F 2B 09 4F 2C 09 4C 49 0B + .byte $4E, $C8, $09, $50, $89, $08, $51, $0B, $09, $44, $2D, $11, $44, $2E, $11, $44 ; CPU:$DF99 PRG:1F99 4E C8 09 50 89 08 51 0B 09 44 2D 11 44 2E 11 44 + .byte $33, $10, $44, $34, $10, $43, $4E, $10, $43, $93, $11, $44, $CC, $0F, $44, $15 ; CPU:$DFA9 PRG:1FA9 33 10 44 34 10 43 4E 10 43 93 11 44 CC 0F 44 15 + .byte $12, $57, $31, $0D, $59, $30, $0E, $57, $30, $14, $59, $31, $13, $58, $8F, $0C ; CPU:$DFB9 PRG:1FB9 12 57 31 0D 59 30 0E 57 30 14 59 31 13 58 8F 0C + .byte $5A, $10, $0E, $58, $52, $15, $5A, $D1, $13, $4D, $38, $15, $4E, $38, $17, $4F ; CPU:$DFC9 PRG:1FC9 5A 10 0E 58 52 15 5A D1 13 4D 38 15 4E 38 17 4F + .byte $35, $18, $50, $37, $18, $4C, $98, $16, $4E, $19, $18, $50, $58, $19, $D1, $D6 ; CPU:$DFD9 PRG:1FD9 35 18 50 37 18 4C 98 16 4E 19 18 50 58 19 D1 D6 + .byte $18, $04, $09, $0D, $0D, $12, $09, $1B, $0D, $04, $14, $0D, $18, $12, $14, $1B ; CPU:$DFE9 PRG:1FE9 18 04 09 0D 0D 12 09 1B 0D 04 14 0D 18 12 14 1B + .byte $18, $86, $0A, $19, $17, $03, $08, $0A, $08, $14, $08, $1B, $08, $0E, $0C, $10 ; CPU:$DFF9 PRG:1FF9 18 86 0A 19 17 03 08 0A 08 14 08 1B 08 0E 0C 10 + .byte $0C, $08, $0F, $08, $11, $16, $0F, $16, $11, $0E, $14, $10, $14, $03, $18, $0A ; CPU:$E009 PRG:2009 0C 08 0F 08 11 16 0F 16 11 0E 14 10 14 03 18 0A + .byte $18, $14, $18, $9B, $18 ; CPU:$E019 PRG:2019 18 14 18 9B 18 +; ----------------------------------------------------------------------------- +; Routine: UpdateAimInput ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -4013,17 +4656,17 @@ Label_D4ED: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_E01E: +UpdateAimInput: jsr $E370 ; CPU:$E01E PRG:201E 20 70 E3 tax ; CPU:$E021 PRG:2021 AA and #$C0 ; CPU:$E022 PRG:2022 29 C0 - bne Label_E02F ; CPU:$E024 PRG:2024 D0 09 - lda Zp01 ; CPU:$E026 PRG:2026 A5 01 + bne UpdateAimInput_RepeatStart ; CPU:$E024 PRG:2024 D0 09 + lda timer_hi ; CPU:$E026 PRG:2026 A5 01 and #$7F ; CPU:$E028 PRG:2028 29 7F - sta Zp01 ; CPU:$E02A PRG:202A 85 01 + sta timer_hi ; CPU:$E02A PRG:202A 85 01 jmp $E062 ; CPU:$E02C PRG:202C 4C 62 E0 ; ----------------------------------------------------------------------------- -; Routine: Label_E02F +; Routine: UpdateAimInput_RepeatStart ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -4031,17 +4674,17 @@ Label_E01E: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_E02F: - lda Zp01 ; CPU:$E02F PRG:202F A5 01 +UpdateAimInput_RepeatStart: + lda timer_hi ; CPU:$E02F PRG:202F A5 01 and #$80 ; CPU:$E031 PRG:2031 29 80 - bne Label_E040 ; CPU:$E033 PRG:2033 D0 0B + bne UpdateAimInput_RepeatDelay ; CPU:$E033 PRG:2033 D0 0B ora #$80 ; CPU:$E035 PRG:2035 09 80 - sta Zp01 ; CPU:$E037 PRG:2037 85 01 + sta timer_hi ; CPU:$E037 PRG:2037 85 01 lda #$10 ; CPU:$E039 PRG:2039 A9 10 sta $0348 ; CPU:$E03B PRG:203B 8D 48 03 - bne Label_E048 ; CPU:$E03E PRG:203E D0 08 + bne UpdateAimInput_AimLeft ; CPU:$E03E PRG:203E D0 08 ; ----------------------------------------------------------------------------- -; Routine: Label_E040 +; Routine: UpdateAimInput_RepeatDelay ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -4049,12 +4692,12 @@ Label_E02F: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_E040: +UpdateAimInput_RepeatDelay: dec $0348 ; CPU:$E040 PRG:2040 CE 48 03 - bne Label_E062 ; CPU:$E043 PRG:2043 D0 1D + bne UpdateAimInput_PowerMeter ; CPU:$E043 PRG:2043 D0 1D inc $0348 ; CPU:$E045 PRG:2045 EE 48 03 ; ----------------------------------------------------------------------------- -; Routine: Label_E048 +; Routine: UpdateAimInput_AimLeft ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -4062,15 +4705,15 @@ Label_E040: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_E048: +UpdateAimInput_AimLeft: txa ; CPU:$E048 PRG:2048 8A and #$40 ; CPU:$E049 PRG:2049 29 40 - beq Label_E055 ; CPU:$E04B PRG:204B F0 08 + beq UpdateAimInput_AimRight ; CPU:$E04B PRG:204B F0 08 dec $03C0 ; CPU:$E04D PRG:204D CE C0 03 lda #$03 ; CPU:$E050 PRG:2050 A9 03 jsr $C3DA ; CPU:$E052 PRG:2052 20 DA C3 ; ----------------------------------------------------------------------------- -; Routine: Label_E055 +; Routine: UpdateAimInput_AimRight ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -4078,15 +4721,15 @@ Label_E048: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_E055: +UpdateAimInput_AimRight: txa ; CPU:$E055 PRG:2055 8A and #$80 ; CPU:$E056 PRG:2056 29 80 - beq Label_E062 ; CPU:$E058 PRG:2058 F0 08 + beq UpdateAimInput_PowerMeter ; CPU:$E058 PRG:2058 F0 08 inc $03C0 ; CPU:$E05A PRG:205A EE C0 03 lda #$03 ; CPU:$E05D PRG:205D A9 03 jsr $C3DA ; CPU:$E05F PRG:205F 20 DA C3 ; ----------------------------------------------------------------------------- -; Routine: Label_E062 +; Routine: UpdateAimInput_PowerMeter ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -4094,18 +4737,18 @@ Label_E055: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_E062: +UpdateAimInput_PowerMeter: lda $03B0 ; CPU:$E062 PRG:2062 AD B0 03 - bmi Label_E079 ; CPU:$E065 PRG:2065 30 12 + bmi UpdateAimInput_PowerMeterDown ; CPU:$E065 PRG:2065 30 12 clc ; CPU:$E067 PRG:2067 18 adc $03A0 ; CPU:$E068 PRG:2068 6D A0 03 sta $03A0 ; CPU:$E06B PRG:206B 8D A0 03 - bcc Label_E094 ; CPU:$E06E PRG:206E 90 24 + bcc UpdateAimInput_LengthUp ; CPU:$E06E PRG:206E 90 24 sbc $03B0 ; CPU:$E070 PRG:2070 ED B0 03 sta $03A0 ; CPU:$E073 PRG:2073 8D A0 03 jmp $E089 ; CPU:$E076 PRG:2076 4C 89 E0 ; ----------------------------------------------------------------------------- -; Routine: Label_E079 +; Routine: UpdateAimInput_PowerMeterDown ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -4113,16 +4756,16 @@ Label_E062: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_E079: +UpdateAimInput_PowerMeterDown: clc ; CPU:$E079 PRG:2079 18 adc $03A0 ; CPU:$E07A PRG:207A 6D A0 03 sta $03A0 ; CPU:$E07D PRG:207D 8D A0 03 - bcs Label_E094 ; CPU:$E080 PRG:2080 B0 12 + bcs UpdateAimInput_LengthUp ; CPU:$E080 PRG:2080 B0 12 sec ; CPU:$E082 PRG:2082 38 sbc $03B0 ; CPU:$E083 PRG:2083 ED B0 03 sta $03A0 ; CPU:$E086 PRG:2086 8D A0 03 ; ----------------------------------------------------------------------------- -; Routine: Label_E089 +; Routine: UpdateAimInput_PowerMeterBounce ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -4130,14 +4773,14 @@ Label_E079: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_E089: +UpdateAimInput_PowerMeterBounce: lda $03B0 ; CPU:$E089 PRG:2089 AD B0 03 eor #$FF ; CPU:$E08C PRG:208C 49 FF clc ; CPU:$E08E PRG:208E 18 adc #$01 ; CPU:$E08F PRG:208F 69 01 sta $03B0 ; CPU:$E091 PRG:2091 8D B0 03 ; ----------------------------------------------------------------------------- -; Routine: Label_E094 +; Routine: UpdateAimInput_LengthUp ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -4145,18 +4788,18 @@ Label_E089: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_E094: +UpdateAimInput_LengthUp: ldy $0358 ; CPU:$E094 PRG:2094 AC 58 03 txa ; CPU:$E097 PRG:2097 8A and #$10 ; CPU:$E098 PRG:2098 29 10 - beq Label_E0A4 ; CPU:$E09A PRG:209A F0 08 + beq UpdateAimInput_LengthDown ; CPU:$E09A PRG:209A F0 08 tya ; CPU:$E09C PRG:209C 98 cmp #$7E ; CPU:$E09D PRG:209D C9 7E - bcs Label_E0A4 ; CPU:$E09F PRG:209F B0 03 + bcs UpdateAimInput_LengthDown ; CPU:$E09F PRG:209F B0 03 adc #$01 ; CPU:$E0A1 PRG:20A1 69 01 tay ; CPU:$E0A3 PRG:20A3 A8 ; ----------------------------------------------------------------------------- -; Routine: Label_E0A4 +; Routine: UpdateAimInput_LengthDown ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -4164,17 +4807,17 @@ Label_E094: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_E0A4: +UpdateAimInput_LengthDown: txa ; CPU:$E0A4 PRG:20A4 8A and #$20 ; CPU:$E0A5 PRG:20A5 29 20 - beq Label_E0B1 ; CPU:$E0A7 PRG:20A7 F0 08 + beq UpdateAimInput_StoreLength ; CPU:$E0A7 PRG:20A7 F0 08 tya ; CPU:$E0A9 PRG:20A9 98 cmp #$0A ; CPU:$E0AA PRG:20AA C9 0A - bcc Label_E0B1 ; CPU:$E0AC PRG:20AC 90 03 + bcc UpdateAimInput_StoreLength ; CPU:$E0AC PRG:20AC 90 03 sbc #$01 ; CPU:$E0AE PRG:20AE E9 01 tay ; CPU:$E0B0 PRG:20B0 A8 ; ----------------------------------------------------------------------------- -; Routine: Label_E0B1 +; Routine: UpdateAimInput_StoreLength ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -4182,12 +4825,12 @@ Label_E0A4: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_E0B1: +UpdateAimInput_StoreLength: sty $0358 ; CPU:$E0B1 PRG:20B1 8C 58 03 lda $0358 ; CPU:$E0B4 PRG:20B4 AD 58 03 sta $0318 ; CPU:$E0B7 PRG:20B7 8D 18 03 ; ----------------------------------------------------------------------------- -; Routine: Label_E0BA +; Routine: UpdateAimInput_Trace ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -4195,27 +4838,27 @@ Label_E0B1: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_E0BA: +UpdateAimInput_Trace: lda $0318 ; CPU:$E0BA PRG:20BA AD 18 03 - sta ZpFA ; CPU:$E0BD PRG:20BD 85 FA + sta ptr_lo ; CPU:$E0BD PRG:20BD 85 FA lda #$00 ; CPU:$E0BF PRG:20BF A9 00 - sta ZpFB ; CPU:$E0C1 PRG:20C1 85 FB + sta ptr_hi ; CPU:$E0C1 PRG:20C1 85 FB lda $03C0 ; CPU:$E0C3 PRG:20C3 AD C0 03 jsr $FEA8 ; CPU:$E0C6 PRG:20C6 20 A8 FE - lda ZpFC ; CPU:$E0C9 PRG:20C9 A5 FC - sta ZpF8 ; CPU:$E0CB PRG:20CB 85 F8 - lda ZpFD ; CPU:$E0CD PRG:20CD A5 FD - sta ZpF9 ; CPU:$E0CF PRG:20CF 85 F9 + lda ppu_addr_lo ; CPU:$E0C9 PRG:20C9 A5 FC + sta ppu_src_lo ; CPU:$E0CB PRG:20CB 85 F8 + lda ppu_addr_hi ; CPU:$E0CD PRG:20CD A5 FD + sta ppu_src_hi ; CPU:$E0CF PRG:20CF 85 F9 jsr $FD8B ; CPU:$E0D1 PRG:20D1 20 8B FD txa ; CPU:$E0D4 PRG:20D4 8A clc ; CPU:$E0D5 PRG:20D5 18 - bmi Label_E104 ; CPU:$E0D6 PRG:20D6 30 2C + bmi UpdateAimInput_NegX ; CPU:$E0D6 PRG:20D6 30 2C adc $0330 ; CPU:$E0D8 PRG:20D8 6D 30 03 - bcs Label_E0E1 ; CPU:$E0DB PRG:20DB B0 04 + bcs UpdateAimInput_ClampRight ; CPU:$E0DB PRG:20DB B0 04 cmp #$E0 ; CPU:$E0DD PRG:20DD C9 E0 - bcc Label_E0FE ; CPU:$E0DF PRG:20DF 90 1D + bcc UpdateAimInput_StoreEndX ; CPU:$E0DF PRG:20DF 90 1D ; ----------------------------------------------------------------------------- -; Routine: Label_E0E1 +; Routine: UpdateAimInput_ClampRight ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -4223,10 +4866,10 @@ Label_E0BA: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_E0E1: +UpdateAimInput_ClampRight: lda #$DF ; CPU:$E0E1 PRG:20E1 A9 DF ; ----------------------------------------------------------------------------- -; Routine: Label_E0E3 +; Routine: UpdateAimInput_RescaleX ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -4234,11 +4877,11 @@ Label_E0E1: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_E0E3: +UpdateAimInput_RescaleX: sec ; CPU:$E0E3 PRG:20E3 38 sbc $0330 ; CPU:$E0E4 PRG:20E4 ED 30 03 ; ----------------------------------------------------------------------------- -; Routine: Label_E0E7 +; Routine: UpdateAimInput_Rescale ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -4246,19 +4889,19 @@ Label_E0E3: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_E0E7: - sta ZpFD ; CPU:$E0E7 PRG:20E7 85 FD +UpdateAimInput_Rescale: + sta ppu_addr_hi ; CPU:$E0E7 PRG:20E7 85 FD lda #$00 ; CPU:$E0E9 PRG:20E9 A9 00 - sta ZpFC ; CPU:$E0EB PRG:20EB 85 FC - lda ZpF8 ; CPU:$E0ED PRG:20ED A5 F8 - sta ZpFA ; CPU:$E0EF PRG:20EF 85 FA - lda ZpF9 ; CPU:$E0F1 PRG:20F1 A5 F9 - sta ZpFB ; CPU:$E0F3 PRG:20F3 85 FB + sta ppu_addr_lo ; CPU:$E0EB PRG:20EB 85 FC + lda ppu_src_lo ; CPU:$E0ED PRG:20ED A5 F8 + sta ptr_lo ; CPU:$E0EF PRG:20EF 85 FA + lda ppu_src_hi ; CPU:$E0F1 PRG:20F1 A5 F9 + sta ptr_hi ; CPU:$E0F3 PRG:20F3 85 FB jsr $FDFE ; CPU:$E0F5 PRG:20F5 20 FE FD sty $0318 ; CPU:$E0F8 PRG:20F8 8C 18 03 jmp $E0BA ; CPU:$E0FB PRG:20FB 4C BA E0 ; ----------------------------------------------------------------------------- -; Routine: Label_E0FE +; Routine: UpdateAimInput_StoreEndX ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -4266,11 +4909,11 @@ Label_E0E7: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_E0FE: +UpdateAimInput_StoreEndX: sta $0328 ; CPU:$E0FE PRG:20FE 8D 28 03 jmp $E118 ; CPU:$E101 PRG:2101 4C 18 E1 ; ----------------------------------------------------------------------------- -; Routine: Label_E104 +; Routine: UpdateAimInput_NegX ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -4278,15 +4921,15 @@ Label_E0FE: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_E104: +UpdateAimInput_NegX: adc $0330 ; CPU:$E104 PRG:2104 6D 30 03 - bcc Label_E113 ; CPU:$E107 PRG:2107 90 0A + bcc UpdateAimInput_ClampLeft ; CPU:$E107 PRG:2107 90 0A cmp #$38 ; CPU:$E109 PRG:2109 C9 38 - bcc Label_E113 ; CPU:$E10B PRG:210B 90 06 + bcc UpdateAimInput_ClampLeft ; CPU:$E10B PRG:210B 90 06 sta $0328 ; CPU:$E10D PRG:210D 8D 28 03 jmp $E118 ; CPU:$E110 PRG:2110 4C 18 E1 ; ----------------------------------------------------------------------------- -; Routine: Label_E113 +; Routine: UpdateAimInput_ClampLeft ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -4294,11 +4937,11 @@ Label_E104: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_E113: +UpdateAimInput_ClampLeft: lda #$38 ; CPU:$E113 PRG:2113 A9 38 jmp $E0E3 ; CPU:$E115 PRG:2115 4C E3 E0 ; ----------------------------------------------------------------------------- -; Routine: Label_E118 +; Routine: UpdateAimInput_TraceY ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -4306,29 +4949,29 @@ Label_E113: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_E118: +UpdateAimInput_TraceY: lda #$00 ; CPU:$E118 PRG:2118 A9 00 - sta ZpFB ; CPU:$E11A PRG:211A 85 FB + sta ptr_hi ; CPU:$E11A PRG:211A 85 FB lda $0318 ; CPU:$E11C PRG:211C AD 18 03 - sta ZpFA ; CPU:$E11F PRG:211F 85 FA + sta ptr_lo ; CPU:$E11F PRG:211F 85 FA lda $03C0 ; CPU:$E121 PRG:2121 AD C0 03 jsr $FF0E ; CPU:$E124 PRG:2124 20 0E FF - lda ZpFC ; CPU:$E127 PRG:2127 A5 FC - sta ZpF8 ; CPU:$E129 PRG:2129 85 F8 - lda ZpFD ; CPU:$E12B PRG:212B A5 FD - sta ZpF9 ; CPU:$E12D PRG:212D 85 F9 + lda ppu_addr_lo ; CPU:$E127 PRG:2127 A5 FC + sta ppu_src_lo ; CPU:$E129 PRG:2129 85 F8 + lda ppu_addr_hi ; CPU:$E12B PRG:212B A5 FD + sta ppu_src_hi ; CPU:$E12D PRG:212D 85 F9 jsr $FD8B ; CPU:$E12F PRG:212F 20 8B FD txa ; CPU:$E132 PRG:2132 8A clc ; CPU:$E133 PRG:2133 18 - bmi Label_E14E ; CPU:$E134 PRG:2134 30 18 + bmi UpdateAimInput_NegY ; CPU:$E134 PRG:2134 30 18 adc $0370 ; CPU:$E136 PRG:2136 6D 70 03 - bcs Label_E145 ; CPU:$E139 PRG:2139 B0 0A + bcs UpdateAimInput_ClampBottom ; CPU:$E139 PRG:2139 B0 0A cmp #$F0 ; CPU:$E13B PRG:213B C9 F0 - bcs Label_E145 ; CPU:$E13D PRG:213D B0 06 + bcs UpdateAimInput_ClampBottom ; CPU:$E13D PRG:213D B0 06 sta $0338 ; CPU:$E13F PRG:213F 8D 38 03 jmp $E162 ; CPU:$E142 PRG:2142 4C 62 E1 ; ----------------------------------------------------------------------------- -; Routine: Label_E145 +; Routine: UpdateAimInput_ClampBottom ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -4336,10 +4979,10 @@ Label_E118: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_E145: +UpdateAimInput_ClampBottom: lda #$EF ; CPU:$E145 PRG:2145 A9 EF ; ----------------------------------------------------------------------------- -; Routine: Label_E147 +; Routine: UpdateAimInput_RescaleY ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -4347,12 +4990,12 @@ Label_E145: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_E147: +UpdateAimInput_RescaleY: sec ; CPU:$E147 PRG:2147 38 sbc $0370 ; CPU:$E148 PRG:2148 ED 70 03 jmp $E0E7 ; CPU:$E14B PRG:214B 4C E7 E0 ; ----------------------------------------------------------------------------- -; Routine: Label_E14E +; Routine: UpdateAimInput_NegY ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -4360,15 +5003,15 @@ Label_E147: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_E14E: +UpdateAimInput_NegY: adc $0370 ; CPU:$E14E PRG:214E 6D 70 03 - bcc Label_E15D ; CPU:$E151 PRG:2151 90 0A + bcc UpdateAimInput_ClampTop ; CPU:$E151 PRG:2151 90 0A cmp #$10 ; CPU:$E153 PRG:2153 C9 10 - bcc Label_E15D ; CPU:$E155 PRG:2155 90 06 + bcc UpdateAimInput_ClampTop ; CPU:$E155 PRG:2155 90 06 sta $0338 ; CPU:$E157 PRG:2157 8D 38 03 jmp $E162 ; CPU:$E15A PRG:215A 4C 62 E1 ; ----------------------------------------------------------------------------- -; Routine: Label_E15D +; Routine: UpdateAimInput_ClampTop ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -4376,11 +5019,11 @@ Label_E14E: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_E15D: +UpdateAimInput_ClampTop: lda #$10 ; CPU:$E15D PRG:215D A9 10 jmp $E147 ; CPU:$E15F PRG:215F 4C 47 E1 ; ----------------------------------------------------------------------------- -; Routine: Label_E162 +; Routine: UpdateAimInput_PowerBar ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -4388,7 +5031,7 @@ Label_E15D: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_E162: +UpdateAimInput_PowerBar: lda $03A0 ; CPU:$E162 PRG:2162 AD A0 03 lsr a ; CPU:$E165 PRG:2165 4A lsr a ; CPU:$E166 PRG:2166 4A @@ -4397,10 +5040,10 @@ Label_E162: clc ; CPU:$E169 PRG:2169 18 adc #$01 ; CPU:$E16A PRG:216A 69 01 lsr a ; CPU:$E16C PRG:216C 4A - sta ZpF6 ; CPU:$E16D PRG:216D 85 F6 + sta ppu_addr_temp_lo ; CPU:$E16D PRG:216D 85 F6 ldx #$00 ; CPU:$E16F PRG:216F A2 00 ; ----------------------------------------------------------------------------- -; Routine: Label_E171 +; Routine: UpdateAimInput_PowerBar_Loop ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -4408,14 +5051,14 @@ Label_E162: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_E171: - lda ZpF6 ; CPU:$E171 PRG:2171 A5 F6 - bne Label_E17C ; CPU:$E173 PRG:2173 D0 07 +UpdateAimInput_PowerBar_Loop: + lda ppu_addr_temp_lo ; CPU:$E171 PRG:2171 A5 F6 + bne UpdateAimInput_PowerBar_Fill ; CPU:$E173 PRG:2173 D0 07 lda #$F8 ; CPU:$E175 PRG:2175 A9 F8 sta $02E0,x ; CPU:$E177 PRG:2177 9D E0 02 - bne Label_E194 ; CPU:$E17A PRG:217A D0 18 + bne UpdateAimInput_PowerBar_Next ; CPU:$E17A PRG:217A D0 18 ; ----------------------------------------------------------------------------- -; Routine: Label_E17C +; Routine: UpdateAimInput_PowerBar_Fill ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -4423,8 +5066,8 @@ Label_E171: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_E17C: - dec ZpF6 ; CPU:$E17C PRG:217C C6 F6 +UpdateAimInput_PowerBar_Fill: + dec ppu_addr_temp_lo ; CPU:$E17C PRG:217C C6 F6 lda #$27 ; CPU:$E17E PRG:217E A9 27 sta $02E0,x ; CPU:$E180 PRG:2180 9D E0 02 lda #$25 ; CPU:$E183 PRG:2183 A9 25 @@ -4436,7 +5079,7 @@ Label_E17C: adc #$A0 ; CPU:$E18F PRG:218F 69 A0 sta $02E3,x ; CPU:$E191 PRG:2191 9D E3 02 ; ----------------------------------------------------------------------------- -; Routine: Label_E194 +; Routine: UpdateAimInput_PowerBar_Next ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -4444,16 +5087,16 @@ Label_E17C: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_E194: +UpdateAimInput_PowerBar_Next: inx ; CPU:$E194 PRG:2194 E8 inx ; CPU:$E195 PRG:2195 E8 inx ; CPU:$E196 PRG:2196 E8 inx ; CPU:$E197 PRG:2197 E8 cpx #$20 ; CPU:$E198 PRG:2198 E0 20 - bne Label_E171 ; CPU:$E19A PRG:219A D0 D5 + bne UpdateAimInput_PowerBar_Loop ; CPU:$E19A PRG:219A D0 D5 rts ; CPU:$E19C PRG:219C 60 ; ----------------------------------------------------------------------------- -; Routine: Label_E19D +; Routine: PrintCurrentPlayerScore ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -4461,12 +5104,12 @@ Label_E194: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_E19D: +PrintCurrentPlayerScore: lda $01C6 ; CPU:$E19D PRG:219D AD C6 01 - beq Label_E1A4 ; CPU:$E1A0 PRG:21A0 F0 02 - bne Label_E1E5 ; CPU:$E1A2 PRG:21A2 D0 41 + beq PrintPlayer1Score ; CPU:$E1A0 PRG:21A0 F0 02 + bne PrintPlayer2Score ; CPU:$E1A2 PRG:21A2 D0 41 ; ----------------------------------------------------------------------------- -; Routine: Label_E1A4 +; Routine: PrintPlayer1Score ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -4474,7 +5117,7 @@ Label_E19D: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_E1A4: +PrintPlayer1Score: txa ; CPU:$E1A4 PRG:21A4 8A pha ; CPU:$E1A5 PRG:21A5 48 tya ; CPU:$E1A6 PRG:21A6 98 @@ -4482,7 +5125,7 @@ Label_E1A4: ldx #$20 ; CPU:$E1A8 PRG:21A8 A2 20 ldy #$64 ; CPU:$E1AA PRG:21AA A0 64 ; ----------------------------------------------------------------------------- -; Routine: Label_E1AC +; Routine: PrintPlayer1Score_Source ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -4490,10 +5133,10 @@ Label_E1A4: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_E1AC: +PrintPlayer1Score_Source: lda #$68 ; CPU:$E1AC PRG:21AC A9 68 ; ----------------------------------------------------------------------------- -; Routine: Label_E1AE +; Routine: PrintScoreDigits ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -4501,15 +5144,15 @@ Label_E1AC: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_E1AE: - stx ZpFD ; CPU:$E1AE PRG:21AE 86 FD - sty ZpFC ; CPU:$E1B0 PRG:21B0 84 FC - sta ZpFA ; CPU:$E1B2 PRG:21B2 85 FA +PrintScoreDigits: + stx ppu_addr_hi ; CPU:$E1AE PRG:21AE 86 FD + sty ppu_addr_lo ; CPU:$E1B0 PRG:21B0 84 FC + sta ptr_lo ; CPU:$E1B2 PRG:21B2 85 FA jsr $CBFB ; CPU:$E1B4 PRG:21B4 20 FB CB - ldx ZpFA ; CPU:$E1B7 PRG:21B7 A6 FA + ldx ptr_lo ; CPU:$E1B7 PRG:21B7 A6 FA ldy #$06 ; CPU:$E1B9 PRG:21B9 A0 06 ; ----------------------------------------------------------------------------- -; Routine: Label_E1BB +; Routine: PrintScoreDigits_Loop ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -4517,14 +5160,14 @@ Label_E1AE: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_E1BB: +PrintScoreDigits_Loop: lda $0400,x ; CPU:$E1BB PRG:21BB BD 00 04 clc ; CPU:$E1BE PRG:21BE 18 adc #$30 ; CPU:$E1BF PRG:21BF 69 30 jsr $CC29 ; CPU:$E1C1 PRG:21C1 20 29 CC inx ; CPU:$E1C4 PRG:21C4 E8 dey ; CPU:$E1C5 PRG:21C5 88 - bne Label_E1BB ; CPU:$E1C6 PRG:21C6 D0 F3 + bne PrintScoreDigits_Loop ; CPU:$E1C6 PRG:21C6 D0 F3 lda #$30 ; CPU:$E1C8 PRG:21C8 A9 30 jsr $CC29 ; CPU:$E1CA PRG:21CA 20 29 CC pla ; CPU:$E1CD PRG:21CD 68 @@ -4536,7 +5179,7 @@ Label_E1BB: .byte $48, $4A, $4A, $4A, $4A, $18, $69, $30, $20, $29, $CC, $68, $29, $0F, $69, $30 ; CPU:$E1D2 PRG:21D2 48 4A 4A 4A 4A 18 69 30 20 29 CC 68 29 0F 69 30 .byte $4C, $29, $CC ; CPU:$E1E2 PRG:21E2 4C 29 CC ; ----------------------------------------------------------------------------- -; Routine: Label_E1E5 +; Routine: PrintPlayer2Score ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -4544,7 +5187,7 @@ Label_E1BB: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_E1E5: +PrintPlayer2Score: txa ; CPU:$E1E5 PRG:21E5 8A pha ; CPU:$E1E6 PRG:21E6 48 tya ; CPU:$E1E7 PRG:21E7 98 @@ -4552,7 +5195,7 @@ Label_E1E5: ldx #$20 ; CPU:$E1E9 PRG:21E9 A2 20 ldy #$84 ; CPU:$E1EB PRG:21EB A0 84 ; ----------------------------------------------------------------------------- -; Routine: Label_E1ED +; Routine: PrintPlayer2Score_Source ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -4560,11 +5203,11 @@ Label_E1E5: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_E1ED: +PrintPlayer2Score_Source: lda #$6E ; CPU:$E1ED PRG:21ED A9 6E jmp $E1AE ; CPU:$E1EF PRG:21EF 4C AE E1 ; ----------------------------------------------------------------------------- -; Routine: Label_E1F2 +; Routine: PrintMenuPlayerScore ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -4572,7 +5215,7 @@ Label_E1ED: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_E1F2: +PrintMenuPlayerScore: txa ; CPU:$E1F2 PRG:21F2 8A pha ; CPU:$E1F3 PRG:21F3 48 tya ; CPU:$E1F4 PRG:21F4 98 @@ -4580,10 +5223,10 @@ Label_E1F2: ldx #$20 ; CPU:$E1F6 PRG:21F6 A2 20 ldy #$69 ; CPU:$E1F8 PRG:21F8 A0 69 lda $01C6 ; CPU:$E1FA PRG:21FA AD C6 01 - bne Label_E1ED ; CPU:$E1FD PRG:21FD D0 EE + bne PrintPlayer2Score_Source ; CPU:$E1FD PRG:21FD D0 EE jmp $E1AC ; CPU:$E1FF PRG:21FF 4C AC E1 ; ----------------------------------------------------------------------------- -; Routine: Label_E202 +; Routine: PrintHiScoreMenu ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -4591,7 +5234,7 @@ Label_E1F2: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_E202: +PrintHiScoreMenu: txa ; CPU:$E202 PRG:2202 8A pha ; CPU:$E203 PRG:2203 48 tya ; CPU:$E204 PRG:2204 98 @@ -4600,7 +5243,7 @@ Label_E202: ldy #$75 ; CPU:$E208 PRG:2208 A0 75 jmp $E215 ; CPU:$E20A PRG:220A 4C 15 E2 ; ----------------------------------------------------------------------------- -; Routine: Label_E20D +; Routine: PrintHiScoreHud ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -4608,7 +5251,7 @@ Label_E202: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_E20D: +PrintHiScoreHud: txa ; CPU:$E20D PRG:220D 8A pha ; CPU:$E20E PRG:220E 48 tya ; CPU:$E20F PRG:220F 98 @@ -4616,7 +5259,7 @@ Label_E20D: ldx #$20 ; CPU:$E211 PRG:2211 A2 20 ldy #$A4 ; CPU:$E213 PRG:2213 A0 A4 ; ----------------------------------------------------------------------------- -; Routine: Label_E215 +; Routine: PrintHiScore_Source ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -4624,14 +5267,54 @@ Label_E20D: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_E215: +PrintHiScore_Source: lda #$62 ; CPU:$E215 PRG:2215 A9 62 jmp $E1AE ; CPU:$E217 PRG:2217 4C AE E1 -; ---- data $E21A-$E22E (21 bytes) ---- - .byte $8A, $48, $98, $48, $A2, $22, $A0, $B2, $4C, $2D, $E2, $8A, $48, $98, $48, $A2 ; CPU:$E21A PRG:221A 8A 48 98 48 A2 22 A0 B2 4C 2D E2 8A 48 98 48 A2 - .byte $20, $A0, $71, $A9, $87 ; CPU:$E22A PRG:222A 20 A0 71 A9 87 ; ----------------------------------------------------------------------------- -; Routine: Label_E22F +; Routine: PrintStageNumber +; Global: Draws the current stage number as two digits into the banner. +; Local: Sets the destination to $22B2 and jumps to the shared two-digit printer with the +; $0187 source index. +; Parameters: none. +; Returns: none. +; Clobbers: A, X, Y, the VRAM write queue. +; ----------------------------------------------------------------------------- +PrintStageNumber: + txa ; CPU:$E21A PRG:221A 8A + pha ; CPU:$E21B PRG:221B 48 + tya ; CPU:$E21C PRG:221C 98 + pha ; CPU:$E21D PRG:221D 48 + ldx #$22 ; CPU:$E21E PRG:221E A2 22 + ldy #$B2 ; CPU:$E220 PRG:2220 A0 B2 + jmp $E22D ; CPU:$E222 PRG:2222 4C 2D E2 +; ----------------------------------------------------------------------------- +; Routine: PrintStageNumberTop +; Global: Draws the current stage number as two digits into the top-of-screen readout. +; Local: Sets the destination to $2071 and joins PrintTwoDigitValue_Stage. +; Parameters: none. +; Returns: none. +; Clobbers: A, X, Y, the VRAM write queue. +; ----------------------------------------------------------------------------- +PrintStageNumberTop: + txa ; CPU:$E225 PRG:2225 8A + pha ; CPU:$E226 PRG:2226 48 + tya ; CPU:$E227 PRG:2227 98 + pha ; CPU:$E228 PRG:2228 48 + ldx #$20 ; CPU:$E229 PRG:2229 A2 20 + ldy #$71 ; CPU:$E22B PRG:222B A0 71 +; ----------------------------------------------------------------------------- +; Routine: PrintTwoDigitValue_Stage +; Global: The stage-number entry of the two-digit value printer. +; Local: Loads the $0187 source index into A and falls into PrintTwoDigitValue, which +; converts the byte at $0100+A into a tens and a units tile. +; Parameters: X = destination high byte, Y = destination low byte. +; Returns: none. +; Clobbers: A, X, Y, Zp0D/Zp0E, the VRAM write queue. +; ----------------------------------------------------------------------------- +PrintTwoDigitValue_Stage: + lda #$87 ; CPU:$E22D PRG:222D A9 87 +; ----------------------------------------------------------------------------- +; Routine: PrintTwoDigitValue ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -4639,16 +5322,16 @@ Label_E215: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_E22F: - stx ZpFD ; CPU:$E22F PRG:222F 86 FD - sty ZpFC ; CPU:$E231 PRG:2231 84 FC - sta ZpFA ; CPU:$E233 PRG:2233 85 FA +PrintTwoDigitValue: + stx ppu_addr_hi ; CPU:$E22F PRG:222F 86 FD + sty ppu_addr_lo ; CPU:$E231 PRG:2231 84 FC + sta ptr_lo ; CPU:$E233 PRG:2233 85 FA jsr $CBFB ; CPU:$E235 PRG:2235 20 FB CB - ldx ZpFA ; CPU:$E238 PRG:2238 A6 FA + ldx ptr_lo ; CPU:$E238 PRG:2238 A6 FA lda $0100,x ; CPU:$E23A PRG:223A BD 00 01 jsr $E2FE ; CPU:$E23D PRG:223D 20 FE E2 ; ----------------------------------------------------------------------------- -; Routine: Label_E240 +; Routine: PrintTwoDigitValue_Units ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -4656,7 +5339,7 @@ Label_E22F: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_E240: +PrintTwoDigitValue_Units: lda Zp0D ; CPU:$E240 PRG:2240 A5 0D jsr $CC29 ; CPU:$E242 PRG:2242 20 29 CC lda Zp0E ; CPU:$E245 PRG:2245 A5 0E @@ -4667,7 +5350,7 @@ Label_E240: tax ; CPU:$E24D PRG:224D AA rts ; CPU:$E24E PRG:224E 60 ; ----------------------------------------------------------------------------- -; Routine: Label_E24F +; Routine: PrintRate ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -4675,7 +5358,7 @@ Label_E240: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_E24F: +PrintRate: txa ; CPU:$E24F PRG:224F 8A pha ; CPU:$E250 PRG:2250 48 tya ; CPU:$E251 PRG:2251 98 @@ -4685,7 +5368,7 @@ Label_E24F: lda #$C4 ; CPU:$E257 PRG:2257 A9 C4 jmp $E22F ; CPU:$E259 PRG:2259 4C 2F E2 ; ----------------------------------------------------------------------------- -; Routine: Label_E25C +; Routine: PrintBallCount ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -4693,7 +5376,7 @@ Label_E24F: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_E25C: +PrintBallCount: txa ; CPU:$E25C PRG:225C 8A pha ; CPU:$E25D PRG:225D 48 tya ; CPU:$E25E PRG:225E 98 @@ -4702,11 +5385,11 @@ Label_E25C: ldy #$B1 ; CPU:$E262 PRG:2262 A0 B1 lda $01C7 ; CPU:$E264 PRG:2264 AD C7 01 cmp #$02 ; CPU:$E267 PRG:2267 C9 02 - bne Label_E270 ; CPU:$E269 PRG:2269 D0 05 + bne PrintBallCount_Value ; CPU:$E269 PRG:2269 D0 05 lda $01C6 ; CPU:$E26B PRG:226B AD C6 01 - bne Label_E275 ; CPU:$E26E PRG:226E D0 05 + bne PrintBallCount_Blank ; CPU:$E26E PRG:226E D0 05 ; ----------------------------------------------------------------------------- -; Routine: Label_E270 +; Routine: PrintBallCount_Value ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -4714,11 +5397,11 @@ Label_E25C: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_E270: +PrintBallCount_Value: lda #$C3 ; CPU:$E270 PRG:2270 A9 C3 jmp $E22F ; CPU:$E272 PRG:2272 4C 2F E2 ; ----------------------------------------------------------------------------- -; Routine: Label_E275 +; Routine: PrintBallCount_Blank ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -4726,16 +5409,19 @@ Label_E270: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_E275: +PrintBallCount_Blank: jsr $CBA9 ; CPU:$E275 PRG:2275 20 A9 CB jsr $CBFB ; CPU:$E278 PRG:2278 20 FB CB jsr $CBDC ; CPU:$E27B PRG:227B 20 DC CB - sta (Zp81,x) ; CPU:$E27E PRG:227E 81 81 - brk ; CPU:$E280 PRG:2280 00 -; ---- data $E281-$E285 (5 bytes) ---- - .byte $68, $A8, $68, $AA, $60 ; CPU:$E281 PRG:2281 68 A8 68 AA 60 +; ---- data $E27E-$E280 (3 bytes) ---- + .byte $81, $81, $00 ; CPU:$E27E PRG:227E 81 81 00 + pla ; CPU:$E281 PRG:2281 68 + tay ; CPU:$E282 PRG:2282 A8 + pla ; CPU:$E283 PRG:2283 68 + tax ; CPU:$E284 PRG:2284 AA + rts ; CPU:$E285 PRG:2285 60 ; ----------------------------------------------------------------------------- -; Routine: Label_E286 +; Routine: PrintMenuPower ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -4743,15 +5429,15 @@ Label_E275: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_E286: +PrintMenuPower: txa ; CPU:$E286 PRG:2286 8A pha ; CPU:$E287 PRG:2287 48 tya ; CPU:$E288 PRG:2288 98 pha ; CPU:$E289 PRG:2289 48 ldx #$22 ; CPU:$E28A PRG:228A A2 22 ldy #$F2 ; CPU:$E28C PRG:228C A0 F2 - stx ZpFD ; CPU:$E28E PRG:228E 86 FD - sty ZpFC ; CPU:$E290 PRG:2290 84 FC + stx ppu_addr_hi ; CPU:$E28E PRG:228E 86 FD + sty ppu_addr_lo ; CPU:$E290 PRG:2290 84 FC jsr $CBFB ; CPU:$E292 PRG:2292 20 FB CB lda Zp02 ; CPU:$E295 PRG:2295 A5 02 jsr $E2FE ; CPU:$E297 PRG:2297 20 FE E2 @@ -4759,7 +5445,7 @@ Label_E286: jsr $CC29 ; CPU:$E29C PRG:229C 20 29 CC jmp $E240 ; CPU:$E29F PRG:229F 4C 40 E2 ; ----------------------------------------------------------------------------- -; Routine: Label_E2A2 +; Routine: DrawShotIcons ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -4767,7 +5453,7 @@ Label_E286: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_E2A2: +DrawShotIcons: txa ; CPU:$E2A2 PRG:22A2 8A pha ; CPU:$E2A3 PRG:22A3 48 tya ; CPU:$E2A4 PRG:22A4 98 @@ -4778,7 +5464,7 @@ Label_E2A2: jsr $CBFB ; CPU:$E2AD PRG:22AD 20 FB CB ldx #$00 ; CPU:$E2B0 PRG:22B0 A2 00 ; ----------------------------------------------------------------------------- -; Routine: Label_E2B2 +; Routine: DrawShotIcons_Loop ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -4786,13 +5472,13 @@ Label_E2A2: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_E2B2: +DrawShotIcons_Loop: lda #$7D ; CPU:$E2B2 PRG:22B2 A9 7D cpx $01C5 ; CPU:$E2B4 PRG:22B4 EC C5 01 - bcc Label_E2BB ; CPU:$E2B7 PRG:22B7 90 02 + bcc DrawShotIcons_Store ; CPU:$E2B7 PRG:22B7 90 02 lda #$7E ; CPU:$E2B9 PRG:22B9 A9 7E ; ----------------------------------------------------------------------------- -; Routine: Label_E2BB +; Routine: DrawShotIcons_Store ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -4800,18 +5486,18 @@ Label_E2B2: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_E2BB: +DrawShotIcons_Store: jsr $CC29 ; CPU:$E2BB PRG:22BB 20 29 CC inx ; CPU:$E2BE PRG:22BE E8 cpx #$03 ; CPU:$E2BF PRG:22BF E0 03 - bne Label_E2B2 ; CPU:$E2C1 PRG:22C1 D0 EF + bne DrawShotIcons_Loop ; CPU:$E2C1 PRG:22C1 D0 EF pla ; CPU:$E2C3 PRG:22C3 68 tay ; CPU:$E2C4 PRG:22C4 A8 pla ; CPU:$E2C5 PRG:22C5 68 tax ; CPU:$E2C6 PRG:22C6 AA rts ; CPU:$E2C7 PRG:22C7 60 ; ----------------------------------------------------------------------------- -; Routine: Label_E2C8 +; Routine: DrawTurnMarker ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -4819,18 +5505,18 @@ Label_E2BB: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_E2C8: +DrawTurnMarker: txa ; CPU:$E2C8 PRG:22C8 8A pha ; CPU:$E2C9 PRG:22C9 48 tya ; CPU:$E2CA PRG:22CA 98 pha ; CPU:$E2CB PRG:22CB 48 lda $01C6 ; CPU:$E2CC PRG:22CC AD C6 01 - bne Label_E2D7 ; CPU:$E2CF PRG:22CF D0 06 + bne DrawTurnMarker_Alt ; CPU:$E2CF PRG:22CF D0 06 ldx #$7D ; CPU:$E2D1 PRG:22D1 A2 7D ldy #$7E ; CPU:$E2D3 PRG:22D3 A0 7E - bne Label_E2DB ; CPU:$E2D5 PRG:22D5 D0 04 + bne DrawTurnMarker_Store ; CPU:$E2D5 PRG:22D5 D0 04 ; ----------------------------------------------------------------------------- -; Routine: Label_E2D7 +; Routine: DrawTurnMarker_Alt ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -4838,11 +5524,11 @@ Label_E2C8: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_E2D7: +DrawTurnMarker_Alt: ldx #$7E ; CPU:$E2D7 PRG:22D7 A2 7E ldy #$7D ; CPU:$E2D9 PRG:22D9 A0 7D ; ----------------------------------------------------------------------------- -; Routine: Label_E2DB +; Routine: DrawTurnMarker_Store ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -4850,18 +5536,18 @@ Label_E2D7: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_E2DB: +DrawTurnMarker_Store: lda #$20 ; CPU:$E2DB PRG:22DB A9 20 - sta ZpFD ; CPU:$E2DD PRG:22DD 85 FD + sta ppu_addr_hi ; CPU:$E2DD PRG:22DD 85 FD lda #$63 ; CPU:$E2DF PRG:22DF A9 63 - sta ZpFC ; CPU:$E2E1 PRG:22E1 85 FC + sta ppu_addr_lo ; CPU:$E2E1 PRG:22E1 85 FC jsr $CBFB ; CPU:$E2E3 PRG:22E3 20 FB CB txa ; CPU:$E2E6 PRG:22E6 8A jsr $CC29 ; CPU:$E2E7 PRG:22E7 20 29 CC lda #$20 ; CPU:$E2EA PRG:22EA A9 20 - sta ZpFD ; CPU:$E2EC PRG:22EC 85 FD + sta ppu_addr_hi ; CPU:$E2EC PRG:22EC 85 FD lda #$83 ; CPU:$E2EE PRG:22EE A9 83 - sta ZpFC ; CPU:$E2F0 PRG:22F0 85 FC + sta ppu_addr_lo ; CPU:$E2F0 PRG:22F0 85 FC jsr $CBFB ; CPU:$E2F2 PRG:22F2 20 FB CB tya ; CPU:$E2F5 PRG:22F5 98 jsr $CC29 ; CPU:$E2F6 PRG:22F6 20 29 CC @@ -4871,7 +5557,7 @@ Label_E2DB: tax ; CPU:$E2FC PRG:22FC AA rts ; CPU:$E2FD PRG:22FD 60 ; ----------------------------------------------------------------------------- -; Routine: Label_E2FE +; Routine: ByteToDecimal3 ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -4879,12 +5565,12 @@ Label_E2DB: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_E2FE: +ByteToDecimal3: ldx #$30 ; CPU:$E2FE PRG:22FE A2 30 stx Zp0C ; CPU:$E300 PRG:2300 86 0C stx Zp0D ; CPU:$E302 PRG:2302 86 0D ; ----------------------------------------------------------------------------- -; Routine: Label_E304 +; Routine: ByteToDecimal3_Hundreds ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -4892,14 +5578,14 @@ Label_E2FE: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_E304: +ByteToDecimal3_Hundreds: sec ; CPU:$E304 PRG:2304 38 sbc #$64 ; CPU:$E305 PRG:2305 E9 64 - bcc Label_E30D ; CPU:$E307 PRG:2307 90 04 + bcc ByteToDecimal3_AfterHundreds ; CPU:$E307 PRG:2307 90 04 inc Zp0C ; CPU:$E309 PRG:2309 E6 0C - bne Label_E304 ; CPU:$E30B PRG:230B D0 F7 + bne ByteToDecimal3_Hundreds ; CPU:$E30B PRG:230B D0 F7 ; ----------------------------------------------------------------------------- -; Routine: Label_E30D +; Routine: ByteToDecimal3_AfterHundreds ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -4907,10 +5593,10 @@ Label_E304: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_E30D: +ByteToDecimal3_AfterHundreds: adc #$64 ; CPU:$E30D PRG:230D 69 64 ; ----------------------------------------------------------------------------- -; Routine: Label_E30F +; Routine: ByteToDecimal3_Tens ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -4918,14 +5604,14 @@ Label_E30D: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_E30F: +ByteToDecimal3_Tens: sec ; CPU:$E30F PRG:230F 38 sbc #$0A ; CPU:$E310 PRG:2310 E9 0A - bcc Label_E318 ; CPU:$E312 PRG:2312 90 04 + bcc ByteToDecimal3_Units ; CPU:$E312 PRG:2312 90 04 inc Zp0D ; CPU:$E314 PRG:2314 E6 0D - bne Label_E30F ; CPU:$E316 PRG:2316 D0 F7 + bne ByteToDecimal3_Tens ; CPU:$E316 PRG:2316 D0 F7 ; ----------------------------------------------------------------------------- -; Routine: Label_E318 +; Routine: ByteToDecimal3_Units ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -4933,12 +5619,12 @@ Label_E30F: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_E318: +ByteToDecimal3_Units: adc #$3A ; CPU:$E318 PRG:2318 69 3A sta Zp0E ; CPU:$E31A PRG:231A 85 0E rts ; CPU:$E31C PRG:231C 60 ; ----------------------------------------------------------------------------- -; Routine: Label_E31D +; Routine: ResetAimPhase ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -4946,12 +5632,12 @@ Label_E318: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_E31D: +ResetAimPhase: lda #$00 ; CPU:$E31D PRG:231D A9 00 sta Zp2A ; CPU:$E31F PRG:231F 85 2A rts ; CPU:$E321 PRG:2321 60 ; ----------------------------------------------------------------------------- -; Routine: Label_E322 +; Routine: ReadPlayerButtons ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -4959,18 +5645,18 @@ Label_E31D: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_E322: +ReadPlayerButtons: lda $0503 ; CPU:$E322 PRG:2322 AD 03 05 - beq Label_E333 ; CPU:$E325 PRG:2325 F0 0C + beq ReadPlayerButtons_CheckPlayer ; CPU:$E325 PRG:2325 F0 0C lda $0585 ; CPU:$E327 PRG:2327 AD 85 05 cmp #$01 ; CPU:$E32A PRG:232A C9 01 - bne Label_E333 ; CPU:$E32C PRG:232C D0 05 + bne ReadPlayerButtons_CheckPlayer ; CPU:$E32C PRG:232C D0 05 pla ; CPU:$E32E PRG:232E 68 pla ; CPU:$E32F PRG:232F 68 lda #$00 ; CPU:$E330 PRG:2330 A9 00 rts ; CPU:$E332 PRG:2332 60 ; ----------------------------------------------------------------------------- -; Routine: Label_E333 +; Routine: ReadPlayerButtons_CheckPlayer ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -4978,15 +5664,15 @@ Label_E322: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_E333: +ReadPlayerButtons_CheckPlayer: ldx $01C6 ; CPU:$E333 PRG:2333 AE C6 01 cpx #$01 ; CPU:$E336 PRG:2336 E0 01 - bne Label_E341 ; CPU:$E338 PRG:2338 D0 07 + bne ReadPlayerButtons_ReturnToCaller ; CPU:$E338 PRG:2338 D0 07 lda $01C7 ; CPU:$E33A PRG:233A AD C7 01 cmp #$02 ; CPU:$E33D PRG:233D C9 02 - beq Label_E349 ; CPU:$E33F PRG:233F F0 08 + beq ReadPlayerButtons_Done ; CPU:$E33F PRG:233F F0 08 ; ----------------------------------------------------------------------------- -; Routine: Label_E341 +; Routine: ReadPlayerButtons_ReturnToCaller ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -4994,13 +5680,13 @@ Label_E333: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_E341: +ReadPlayerButtons_ReturnToCaller: pla ; CPU:$E341 PRG:2341 68 pla ; CPU:$E342 PRG:2342 68 lda $0180,x ; CPU:$E343 PRG:2343 BD 80 01 ora $0182,x ; CPU:$E346 PRG:2346 1D 82 01 ; ----------------------------------------------------------------------------- -; Routine: Label_E349 +; Routine: ReadPlayerButtons_Done ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -5008,10 +5694,10 @@ Label_E341: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_E349: +ReadPlayerButtons_Done: rts ; CPU:$E349 PRG:2349 60 ; ----------------------------------------------------------------------------- -; Routine: Label_E34A +; Routine: TestShootButton ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -5019,12 +5705,12 @@ Label_E349: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_E34A: +TestShootButton: jsr $E322 ; CPU:$E34A PRG:234A 20 22 E3 lda Zp2A ; CPU:$E34D PRG:234D A5 2A and #$07 ; CPU:$E34F PRG:234F 29 07 cmp #$03 ; CPU:$E351 PRG:2351 C9 03 - bne Label_E364 ; CPU:$E353 PRG:2353 D0 0F + bne TestShootButton_Fail ; CPU:$E353 PRG:2353 D0 0F lda $03A0 ; CPU:$E355 PRG:2355 AD A0 03 lsr a ; CPU:$E358 PRG:2358 4A lsr a ; CPU:$E359 PRG:2359 4A @@ -5034,9 +5720,9 @@ Label_E34A: adc #$01 ; CPU:$E35D PRG:235D 69 01 lsr a ; CPU:$E35F PRG:235F 4A cmp Zp2B ; CPU:$E360 PRG:2360 C5 2B - beq Label_E367 ; CPU:$E362 PRG:2362 F0 03 + beq TestShootButton_Ready ; CPU:$E362 PRG:2362 F0 03 ; ----------------------------------------------------------------------------- -; Routine: Label_E364 +; Routine: TestShootButton_Fail ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -5044,11 +5730,11 @@ Label_E34A: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_E364: +TestShootButton_Fail: lda #$00 ; CPU:$E364 PRG:2364 A9 00 rts ; CPU:$E366 PRG:2366 60 ; ----------------------------------------------------------------------------- -; Routine: Label_E367 +; Routine: TestShootButton_Ready ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -5056,14 +5742,14 @@ Label_E364: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_E367: - lda Zp00 ; CPU:$E367 PRG:2367 A5 00 +TestShootButton_Ready: + lda timer_lo ; CPU:$E367 PRG:2367 A5 00 and #$EF ; CPU:$E369 PRG:2369 29 EF - sta Zp00 ; CPU:$E36B PRG:236B 85 00 + sta timer_lo ; CPU:$E36B PRG:236B 85 00 lda #$03 ; CPU:$E36D PRG:236D A9 03 rts ; CPU:$E36F PRG:236F 60 ; ----------------------------------------------------------------------------- -; Routine: Label_E370 +; Routine: UpdateCpuAim ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -5071,14 +5757,14 @@ Label_E367: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_E370: +UpdateCpuAim: jsr $E322 ; CPU:$E370 PRG:2370 20 22 E3 lda Zp2A ; CPU:$E373 PRG:2373 A5 2A and #$07 ; CPU:$E375 PRG:2375 29 07 - bne Label_E37C ; CPU:$E377 PRG:2377 D0 03 + bne UpdateCpuAim_Check ; CPU:$E377 PRG:2377 D0 03 jmp $E40E ; CPU:$E379 PRG:2379 4C 0E E4 ; ----------------------------------------------------------------------------- -; Routine: Label_E37C +; Routine: UpdateCpuAim_Check ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -5086,12 +5772,12 @@ Label_E370: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_E37C: +UpdateCpuAim_Check: cmp #$01 ; CPU:$E37C PRG:237C C9 01 - beq Label_E381 ; CPU:$E37E PRG:237E F0 01 + beq UpdateCpuAim_Steer ; CPU:$E37E PRG:237E F0 01 rts ; CPU:$E380 PRG:2380 60 ; ----------------------------------------------------------------------------- -; Routine: Label_E381 +; Routine: UpdateCpuAim_Steer ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -5099,17 +5785,17 @@ Label_E37C: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_E381: +UpdateCpuAim_Steer: lda $0358 ; CPU:$E381 PRG:2381 AD 58 03 cmp Zp31 ; CPU:$E384 PRG:2384 C5 31 - beq Label_E39A ; CPU:$E386 PRG:2386 F0 12 - bcs Label_E392 ; CPU:$E388 PRG:2388 B0 08 + beq UpdateCpuAim_Steer_LengthMatch ; CPU:$E386 PRG:2386 F0 12 + bcs UpdateCpuAim_Steer_LengthDown ; CPU:$E388 PRG:2388 B0 08 cmp #$7E ; CPU:$E38A PRG:238A C9 7E - beq Label_E39A ; CPU:$E38C PRG:238C F0 0C + beq UpdateCpuAim_Steer_LengthMatch ; CPU:$E38C PRG:238C F0 0C lda #$10 ; CPU:$E38E PRG:238E A9 10 - bne Label_E39C ; CPU:$E390 PRG:2390 D0 0A + bne UpdateCpuAim_Steer_LengthKey ; CPU:$E390 PRG:2390 D0 0A ; ----------------------------------------------------------------------------- -; Routine: Label_E392 +; Routine: UpdateCpuAim_Steer_LengthDown ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -5117,13 +5803,13 @@ Label_E381: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_E392: +UpdateCpuAim_Steer_LengthDown: cmp #$09 ; CPU:$E392 PRG:2392 C9 09 - beq Label_E39A ; CPU:$E394 PRG:2394 F0 04 + beq UpdateCpuAim_Steer_LengthMatch ; CPU:$E394 PRG:2394 F0 04 lda #$20 ; CPU:$E396 PRG:2396 A9 20 - bne Label_E39C ; CPU:$E398 PRG:2398 D0 02 + bne UpdateCpuAim_Steer_LengthKey ; CPU:$E398 PRG:2398 D0 02 ; ----------------------------------------------------------------------------- -; Routine: Label_E39A +; Routine: UpdateCpuAim_Steer_LengthMatch ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -5131,10 +5817,10 @@ Label_E392: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_E39A: +UpdateCpuAim_Steer_LengthMatch: lda #$00 ; CPU:$E39A PRG:239A A9 00 ; ----------------------------------------------------------------------------- -; Routine: Label_E39C +; Routine: UpdateCpuAim_Steer_LengthKey ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -5142,17 +5828,17 @@ Label_E39A: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_E39C: +UpdateCpuAim_Steer_LengthKey: tay ; CPU:$E39C PRG:239C A8 lda Zp30 ; CPU:$E39D PRG:239D A5 30 sec ; CPU:$E39F PRG:239F 38 sbc $03C0 ; CPU:$E3A0 PRG:23A0 ED C0 03 - beq Label_E3AF ; CPU:$E3A3 PRG:23A3 F0 0A - bmi Label_E3AB ; CPU:$E3A5 PRG:23A5 30 04 + beq UpdateCpuAim_Steer_AngleMatch ; CPU:$E3A3 PRG:23A3 F0 0A + bmi UpdateCpuAim_Steer_TurnLeft ; CPU:$E3A5 PRG:23A5 30 04 lda #$80 ; CPU:$E3A7 PRG:23A7 A9 80 - bne Label_E3B1 ; CPU:$E3A9 PRG:23A9 D0 06 + bne UpdateCpuAim_Steer_SetButtons ; CPU:$E3A9 PRG:23A9 D0 06 ; ----------------------------------------------------------------------------- -; Routine: Label_E3AB +; Routine: UpdateCpuAim_Steer_TurnLeft ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -5160,11 +5846,11 @@ Label_E39C: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_E3AB: +UpdateCpuAim_Steer_TurnLeft: lda #$40 ; CPU:$E3AB PRG:23AB A9 40 - bne Label_E3B1 ; CPU:$E3AD PRG:23AD D0 02 + bne UpdateCpuAim_Steer_SetButtons ; CPU:$E3AD PRG:23AD D0 02 ; ----------------------------------------------------------------------------- -; Routine: Label_E3AF +; Routine: UpdateCpuAim_Steer_AngleMatch ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -5172,10 +5858,10 @@ Label_E3AB: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_E3AF: +UpdateCpuAim_Steer_AngleMatch: lda #$00 ; CPU:$E3AF PRG:23AF A9 00 ; ----------------------------------------------------------------------------- -; Routine: Label_E3B1 +; Routine: UpdateCpuAim_Steer_SetButtons ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -5183,17 +5869,17 @@ Label_E3AF: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_E3B1: - sta ZpF8 ; CPU:$E3B1 PRG:23B1 85 F8 +UpdateCpuAim_Steer_SetButtons: + sta ppu_src_lo ; CPU:$E3B1 PRG:23B1 85 F8 tya ; CPU:$E3B3 PRG:23B3 98 - ora ZpF8 ; CPU:$E3B4 PRG:23B4 05 F8 - bne Label_E3BE ; CPU:$E3B6 PRG:23B6 D0 06 + ora ppu_src_lo ; CPU:$E3B4 PRG:23B4 05 F8 + bne UpdateCpuAim_Steer_Done ; CPU:$E3B6 PRG:23B6 D0 06 pha ; CPU:$E3B8 PRG:23B8 48 lda #$03 ; CPU:$E3B9 PRG:23B9 A9 03 sta Zp2A ; CPU:$E3BB PRG:23BB 85 2A pla ; CPU:$E3BD PRG:23BD 68 ; ----------------------------------------------------------------------------- -; Routine: Label_E3BE +; Routine: UpdateCpuAim_Steer_Done ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -5201,10 +5887,10 @@ Label_E3B1: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_E3BE: +UpdateCpuAim_Steer_Done: rts ; CPU:$E3BE PRG:23BE 60 ; ----------------------------------------------------------------------------- -; Routine: Label_E3BF +; Routine: ComputeDeltaVector ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -5212,18 +5898,18 @@ Label_E3BE: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_E3BF: +ComputeDeltaVector: ldx #$00 ; CPU:$E3BF PRG:23BF A2 00 lda Zp2C ; CPU:$E3C1 PRG:23C1 A5 2C sec ; CPU:$E3C3 PRG:23C3 38 sbc Zp26 ; CPU:$E3C4 PRG:23C4 E5 26 tay ; CPU:$E3C6 PRG:23C6 A8 - bcs Label_E3CE ; CPU:$E3C7 PRG:23C7 B0 05 + bcs ComputeDeltaVector_AbsX ; CPU:$E3C7 PRG:23C7 B0 05 eor #$FF ; CPU:$E3C9 PRG:23C9 49 FF adc #$01 ; CPU:$E3CB PRG:23CB 69 01 clc ; CPU:$E3CD PRG:23CD 18 ; ----------------------------------------------------------------------------- -; Routine: Label_E3CE +; Routine: ComputeDeltaVector_AbsX ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -5231,7 +5917,7 @@ Label_E3BF: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_E3CE: +ComputeDeltaVector_AbsX: sta Zp28 ; CPU:$E3CE PRG:23CE 85 28 tya ; CPU:$E3D0 PRG:23D0 98 jsr $E3FB ; CPU:$E3D1 PRG:23D1 20 FB E3 @@ -5242,12 +5928,12 @@ Label_E3CE: sec ; CPU:$E3DC PRG:23DC 38 sbc Zp27 ; CPU:$E3DD PRG:23DD E5 27 tay ; CPU:$E3DF PRG:23DF A8 - bcs Label_E3E7 ; CPU:$E3E0 PRG:23E0 B0 05 + bcs ComputeDeltaVector_AbsY ; CPU:$E3E0 PRG:23E0 B0 05 eor #$FF ; CPU:$E3E2 PRG:23E2 49 FF adc #$01 ; CPU:$E3E4 PRG:23E4 69 01 clc ; CPU:$E3E6 PRG:23E6 18 ; ----------------------------------------------------------------------------- -; Routine: Label_E3E7 +; Routine: ComputeDeltaVector_AbsY ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -5255,7 +5941,7 @@ Label_E3CE: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_E3E7: +ComputeDeltaVector_AbsY: sta Zp29 ; CPU:$E3E7 PRG:23E7 85 29 tya ; CPU:$E3E9 PRG:23E9 98 jsr $E3FB ; CPU:$E3EA PRG:23EA 20 FB E3 @@ -5263,14 +5949,14 @@ Label_E3E7: clc ; CPU:$E3EE PRG:23EE 18 adc Zp24 ; CPU:$E3EF PRG:23EF 65 24 tay ; CPU:$E3F1 PRG:23F1 A8 - sta ZpFC ; CPU:$E3F2 PRG:23F2 85 FC + sta ppu_addr_lo ; CPU:$E3F2 PRG:23F2 85 FC txa ; CPU:$E3F4 PRG:23F4 8A adc Zp25 ; CPU:$E3F5 PRG:23F5 65 25 tax ; CPU:$E3F7 PRG:23F7 AA - sta ZpFD ; CPU:$E3F8 PRG:23F8 85 FD + sta ppu_addr_hi ; CPU:$E3F8 PRG:23F8 85 FD rts ; CPU:$E3FA PRG:23FA 60 ; ----------------------------------------------------------------------------- -; Routine: Label_E3FB +; Routine: ComputeDeltaVector_Square ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -5278,14 +5964,14 @@ Label_E3E7: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_E3FB: - sta ZpFC ; CPU:$E3FB PRG:23FB 85 FC - sta ZpFA ; CPU:$E3FD PRG:23FD 85 FA +ComputeDeltaVector_Square: + sta ppu_addr_lo ; CPU:$E3FB PRG:23FB 85 FC + sta ptr_lo ; CPU:$E3FD PRG:23FD 85 FA sta Zp10,x ; CPU:$E3FF PRG:23FF 95 10 lda #$FF ; CPU:$E401 PRG:2401 A9 FF adc #$00 ; CPU:$E403 PRG:2403 69 00 ; ----------------------------------------------------------------------------- -; Routine: Label_E405 +; Routine: ComputeDeltaVector_StoreHigh ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -5293,13 +5979,13 @@ Label_E3FB: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_E405: +ComputeDeltaVector_StoreHigh: sta Zp11,x ; CPU:$E405 PRG:2405 95 11 - sta ZpFD ; CPU:$E407 PRG:2407 85 FD - sta ZpFB ; CPU:$E409 PRG:2409 85 FB + sta ppu_addr_hi ; CPU:$E407 PRG:2407 85 FD + sta ptr_hi ; CPU:$E409 PRG:2409 85 FB jmp $FD8B ; CPU:$E40B PRG:240B 4C 8B FD ; ----------------------------------------------------------------------------- -; Routine: Label_E40E +; Routine: PlanBestShot ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -5307,12 +5993,12 @@ Label_E405: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_E40E: +PlanBestShot: lda #$00 ; CPU:$E40E PRG:240E A9 00 sta $01C8 ; CPU:$E410 PRG:2410 8D C8 01 sta Zp32 ; CPU:$E413 PRG:2413 85 32 ; ----------------------------------------------------------------------------- -; Routine: Label_E415 +; Routine: PlanBestShot_ScanStart ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -5320,10 +6006,10 @@ Label_E40E: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_E415: +PlanBestShot_ScanStart: sta Zp33 ; CPU:$E415 PRG:2415 85 33 ; ----------------------------------------------------------------------------- -; Routine: Label_E417 +; Routine: PlanBestShot_ScanLoop ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -5331,9 +6017,9 @@ Label_E415: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_E417: +PlanBestShot_ScanLoop: lda Zp32 ; CPU:$E417 PRG:2417 A5 32 - bne Label_E429 ; CPU:$E419 PRG:2419 D0 0E + bne PlanBestShot_BallPoint ; CPU:$E419 PRG:2419 D0 0E lda Zp33 ; CPU:$E41B PRG:241B A5 33 asl a ; CPU:$E41D PRG:241D 0A tax ; CPU:$E41E PRG:241E AA @@ -5342,7 +6028,7 @@ Label_E417: lda $01A1,x ; CPU:$E423 PRG:2423 BD A1 01 jmp $E43B ; CPU:$E426 PRG:2426 4C 3B E4 ; ----------------------------------------------------------------------------- -; Routine: Label_E429 +; Routine: PlanBestShot_BallPoint ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -5350,17 +6036,17 @@ Label_E417: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_E429: +PlanBestShot_BallPoint: ldx Zp33 ; CPU:$E429 PRG:2429 A6 33 lda $0300,x ; CPU:$E42B PRG:242B BD 00 03 and #$C0 ; CPU:$E42E PRG:242E 29 C0 cmp #$80 ; CPU:$E430 PRG:2430 C9 80 - bne Label_E47B ; CPU:$E432 PRG:2432 D0 47 + bne PlanBestShot_AdvanceBall ; CPU:$E432 PRG:2432 D0 47 lda $0330,x ; CPU:$E434 PRG:2434 BD 30 03 tay ; CPU:$E437 PRG:2437 A8 lda $0370,x ; CPU:$E438 PRG:2438 BD 70 03 ; ----------------------------------------------------------------------------- -; Routine: Label_E43B +; Routine: PlanBestShot_Measure ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -5368,7 +6054,7 @@ Label_E429: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_E43B: +PlanBestShot_Measure: sta Zp2D ; CPU:$E43B PRG:243B 85 2D tya ; CPU:$E43D PRG:243D 98 sta Zp2C ; CPU:$E43E PRG:243E 85 2C @@ -5383,7 +6069,7 @@ Label_E43B: tay ; CPU:$E454 PRG:2454 A8 ldx Zp33 ; CPU:$E455 PRG:2455 A6 33 lda Zp32 ; CPU:$E457 PRG:2457 A5 32 - bne Label_E473 ; CPU:$E459 PRG:2459 D0 18 + bne PlanBestShot_StoreBall ; CPU:$E459 PRG:2459 D0 18 tya ; CPU:$E45B PRG:245B 98 sta $0480,x ; CPU:$E45C PRG:245C 9D 80 04 pla ; CPU:$E45F PRG:245F 68 @@ -5391,12 +6077,12 @@ Label_E43B: inc Zp33 ; CPU:$E463 PRG:2463 E6 33 lda Zp33 ; CPU:$E465 PRG:2465 A5 33 cmp $01C0 ; CPU:$E467 PRG:2467 CD C0 01 - bne Label_E417 ; CPU:$E46A PRG:246A D0 AB + bne PlanBestShot_ScanLoop ; CPU:$E46A PRG:246A D0 AB inc Zp32 ; CPU:$E46C PRG:246C E6 32 lda #$01 ; CPU:$E46E PRG:246E A9 01 jmp $E415 ; CPU:$E470 PRG:2470 4C 15 E4 ; ----------------------------------------------------------------------------- -; Routine: Label_E473 +; Routine: PlanBestShot_StoreBall ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -5404,13 +6090,13 @@ Label_E43B: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_E473: +PlanBestShot_StoreBall: tya ; CPU:$E473 PRG:2473 98 sta $049F,x ; CPU:$E474 PRG:2474 9D 9F 04 pla ; CPU:$E477 PRG:2477 68 sta $04A6,x ; CPU:$E478 PRG:2478 9D A6 04 ; ----------------------------------------------------------------------------- -; Routine: Label_E47B +; Routine: PlanBestShot_AdvanceBall ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -5418,18 +6104,18 @@ Label_E473: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_E47B: +PlanBestShot_AdvanceBall: inc Zp33 ; CPU:$E47B PRG:247B E6 33 lda Zp33 ; CPU:$E47D PRG:247D A5 33 cmp #$08 ; CPU:$E47F PRG:247F C9 08 - bne Label_E417 ; CPU:$E481 PRG:2481 D0 94 + bne PlanBestShot_ScanLoop ; CPU:$E481 PRG:2481 D0 94 lda #$00 ; CPU:$E483 PRG:2483 A9 00 sta Zp2F ; CPU:$E485 PRG:2485 85 2F sta Zp2E ; CPU:$E487 PRG:2487 85 2E lda #$01 ; CPU:$E489 PRG:2489 A9 01 sta Zp32 ; CPU:$E48B PRG:248B 85 32 ; ----------------------------------------------------------------------------- -; Routine: Label_E48D +; Routine: PlanBestShot_Evaluate ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -5437,21 +6123,21 @@ Label_E47B: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_E48D: +PlanBestShot_Evaluate: ldx Zp32 ; CPU:$E48D PRG:248D A6 32 lda $0300,x ; CPU:$E48F PRG:248F BD 00 03 and #$C0 ; CPU:$E492 PRG:2492 29 C0 cmp #$80 ; CPU:$E494 PRG:2494 C9 80 - bne Label_E4AA ; CPU:$E496 PRG:2496 D0 12 + bne PlanBestShot_Next ; CPU:$E496 PRG:2496 D0 12 jsr $E71D ; CPU:$E498 PRG:2498 20 1D E7 - bcs Label_E4AA ; CPU:$E49B PRG:249B B0 0D + bcs PlanBestShot_Next ; CPU:$E49B PRG:249B B0 0D jsr $E76D ; CPU:$E49D PRG:249D 20 6D E7 - bcs Label_E4AA ; CPU:$E4A0 PRG:24A0 B0 08 + bcs PlanBestShot_Next ; CPU:$E4A0 PRG:24A0 B0 08 jsr $E7B1 ; CPU:$E4A2 PRG:24A2 20 B1 E7 - bcs Label_E4AA ; CPU:$E4A5 PRG:24A5 B0 03 + bcs PlanBestShot_Next ; CPU:$E4A5 PRG:24A5 B0 03 jsr $E582 ; CPU:$E4A7 PRG:24A7 20 82 E5 ; ----------------------------------------------------------------------------- -; Routine: Label_E4AA +; Routine: PlanBestShot_Next ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -5459,16 +6145,16 @@ Label_E48D: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_E4AA: +PlanBestShot_Next: inc Zp32 ; CPU:$E4AA PRG:24AA E6 32 lda Zp32 ; CPU:$E4AC PRG:24AC A5 32 cmp #$08 ; CPU:$E4AE PRG:24AE C9 08 - bne Label_E48D ; CPU:$E4B0 PRG:24B0 D0 DB + bne PlanBestShot_Evaluate ; CPU:$E4B0 PRG:24B0 D0 DB lda Zp2E ; CPU:$E4B2 PRG:24B2 A5 2E - beq Label_E4B9 ; CPU:$E4B4 PRG:24B4 F0 03 + beq PlanBestShot_Fallback ; CPU:$E4B4 PRG:24B4 F0 03 jmp $E60B ; CPU:$E4B6 PRG:24B6 4C 0B E6 ; ----------------------------------------------------------------------------- -; Routine: Label_E4B9 +; Routine: PlanBestShot_Fallback ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -5476,13 +6162,13 @@ Label_E4AA: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_E4B9: +PlanBestShot_Fallback: lda #$FF ; CPU:$E4B9 PRG:24B9 A9 FF sta Zp2F ; CPU:$E4BB PRG:24BB 85 2F lda #$01 ; CPU:$E4BD PRG:24BD A9 01 sta Zp32 ; CPU:$E4BF PRG:24BF 85 32 ; ----------------------------------------------------------------------------- -; Routine: Label_E4C1 +; Routine: PlanBestShot_FallbackLoop ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -5490,21 +6176,21 @@ Label_E4B9: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_E4C1: +PlanBestShot_FallbackLoop: ldx Zp32 ; CPU:$E4C1 PRG:24C1 A6 32 lda $0300,x ; CPU:$E4C3 PRG:24C3 BD 00 03 and #$C0 ; CPU:$E4C6 PRG:24C6 29 C0 cmp #$80 ; CPU:$E4C8 PRG:24C8 C9 80 - bne Label_E4E6 ; CPU:$E4CA PRG:24CA D0 1A + bne PlanBestShot_FallbackNext ; CPU:$E4CA PRG:24CA D0 1A lda $01C3 ; CPU:$E4CC PRG:24CC AD C3 01 cmp #$02 ; CPU:$E4CF PRG:24CF C9 02 - beq Label_E4DC ; CPU:$E4D1 PRG:24D1 F0 09 + beq PlanBestShot_FallbackAccept ; CPU:$E4D1 PRG:24D1 F0 09 lda #$00 ; CPU:$E4D3 PRG:24D3 A9 00 sta Zp2E ; CPU:$E4D5 PRG:24D5 85 2E jsr $E76D ; CPU:$E4D7 PRG:24D7 20 6D E7 - bcs Label_E4E6 ; CPU:$E4DA PRG:24DA B0 0A + bcs PlanBestShot_FallbackNext ; CPU:$E4DA PRG:24DA B0 0A ; ----------------------------------------------------------------------------- -; Routine: Label_E4DC +; Routine: PlanBestShot_FallbackAccept ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -5512,14 +6198,14 @@ Label_E4C1: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_E4DC: +PlanBestShot_FallbackAccept: lda Zp32 ; CPU:$E4DC PRG:24DC A5 32 sta Zp2E ; CPU:$E4DE PRG:24DE 85 2E lda Zp35 ; CPU:$E4E0 PRG:24E0 A5 35 - beq Label_E4F9 ; CPU:$E4E2 PRG:24E2 F0 15 + beq PlanBestShot_TargetPointY ; CPU:$E4E2 PRG:24E2 F0 15 dec Zp35 ; CPU:$E4E4 PRG:24E4 C6 35 ; ----------------------------------------------------------------------------- -; Routine: Label_E4E6 +; Routine: PlanBestShot_FallbackNext ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -5527,18 +6213,18 @@ Label_E4DC: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_E4E6: +PlanBestShot_FallbackNext: inc Zp32 ; CPU:$E4E6 PRG:24E6 E6 32 lda Zp32 ; CPU:$E4E8 PRG:24E8 A5 32 cmp #$08 ; CPU:$E4EA PRG:24EA C9 08 - bne Label_E4C1 ; CPU:$E4EC PRG:24EC D0 D3 + bne PlanBestShot_FallbackLoop ; CPU:$E4EC PRG:24EC D0 D3 lda Zp2E ; CPU:$E4EE PRG:24EE A5 2E - bne Label_E4F9 ; CPU:$E4F0 PRG:24F0 D0 07 + bne PlanBestShot_TargetPointY ; CPU:$E4F0 PRG:24F0 D0 07 jsr $CDB9 ; CPU:$E4F2 PRG:24F2 20 B9 CD and #$07 ; CPU:$E4F5 PRG:24F5 29 07 sta Zp2E ; CPU:$E4F7 PRG:24F7 85 2E ; ----------------------------------------------------------------------------- -; Routine: Label_E4F9 +; Routine: PlanBestShot_TargetPointY ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -5546,17 +6232,17 @@ Label_E4E6: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_E4F9: +PlanBestShot_TargetPointY: lda #$80 ; CPU:$E4F9 PRG:24F9 A9 80 sta Zp2F ; CPU:$E4FB PRG:24FB 85 2F ldx Zp2E ; CPU:$E4FD PRG:24FD A6 2E lda $0370,x ; CPU:$E4FF PRG:24FF BD 70 03 sta Zp2D ; CPU:$E502 PRG:2502 85 2D cmp $0370 ; CPU:$E504 PRG:2504 CD 70 03 - bne Label_E50B ; CPU:$E507 PRG:2507 D0 02 + bne PlanBestShot_TargetPointX ; CPU:$E507 PRG:2507 D0 02 inc Zp2D ; CPU:$E509 PRG:2509 E6 2D ; ----------------------------------------------------------------------------- -; Routine: Label_E50B +; Routine: PlanBestShot_TargetPointX ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -5564,14 +6250,14 @@ Label_E4F9: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_E50B: +PlanBestShot_TargetPointX: lda $0330,x ; CPU:$E50B PRG:250B BD 30 03 sta Zp2C ; CPU:$E50E PRG:250E 85 2C cmp $0330 ; CPU:$E510 PRG:2510 CD 30 03 - bne Label_E517 ; CPU:$E513 PRG:2513 D0 02 + bne PlanBestShot_AimAtPoint ; CPU:$E513 PRG:2513 D0 02 inc Zp2C ; CPU:$E515 PRG:2515 E6 2C ; ----------------------------------------------------------------------------- -; Routine: Label_E517 +; Routine: PlanBestShot_AimAtPoint ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -5579,7 +6265,7 @@ Label_E50B: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_E517: +PlanBestShot_AimAtPoint: lda $0330 ; CPU:$E517 PRG:2517 AD 30 03 sta Zp26 ; CPU:$E51A PRG:251A 85 26 lda $0370 ; CPU:$E51C PRG:251C AD 70 03 @@ -5590,18 +6276,18 @@ Label_E517: lda Zp2F ; CPU:$E529 PRG:2529 A5 2F ldx #$08 ; CPU:$E52B PRG:252B A2 08 cmp #$78 ; CPU:$E52D PRG:252D C9 78 - bcs Label_E53E ; CPU:$E52F PRG:252F B0 0D + bcs PlanBestShot_PowerBucket ; CPU:$E52F PRG:252F B0 0D dex ; CPU:$E531 PRG:2531 CA dex ; CPU:$E532 PRG:2532 CA cmp #$60 ; CPU:$E533 PRG:2533 C9 60 - bcs Label_E53E ; CPU:$E535 PRG:2535 B0 07 + bcs PlanBestShot_PowerBucket ; CPU:$E535 PRG:2535 B0 07 dex ; CPU:$E537 PRG:2537 CA dex ; CPU:$E538 PRG:2538 CA cmp #$48 ; CPU:$E539 PRG:2539 C9 48 - bcs Label_E53E ; CPU:$E53B PRG:253B B0 01 + bcs PlanBestShot_PowerBucket ; CPU:$E53B PRG:253B B0 01 dex ; CPU:$E53D PRG:253D CA ; ----------------------------------------------------------------------------- -; Routine: Label_E53E +; Routine: PlanBestShot_PowerBucket ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -5609,15 +6295,15 @@ Label_E517: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_E53E: +PlanBestShot_PowerBucket: stx Zp2B ; CPU:$E53E PRG:253E 86 2B lda Zp31 ; CPU:$E540 PRG:2540 A5 31 cmp #$7E ; CPU:$E542 PRG:2542 C9 7E - bcc Label_E54A ; CPU:$E544 PRG:2544 90 04 + bcc PlanBestShot_ClampPowerLow ; CPU:$E544 PRG:2544 90 04 lda #$7E ; CPU:$E546 PRG:2546 A9 7E - bne Label_E550 ; CPU:$E548 PRG:2548 D0 06 + bne PlanBestShot_StorePower ; CPU:$E548 PRG:2548 D0 06 ; ----------------------------------------------------------------------------- -; Routine: Label_E54A +; Routine: PlanBestShot_ClampPowerLow ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -5625,12 +6311,12 @@ Label_E53E: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_E54A: +PlanBestShot_ClampPowerLow: cmp #$09 ; CPU:$E54A PRG:254A C9 09 - bcs Label_E550 ; CPU:$E54C PRG:254C B0 02 + bcs PlanBestShot_StorePower ; CPU:$E54C PRG:254C B0 02 lda #$09 ; CPU:$E54E PRG:254E A9 09 ; ----------------------------------------------------------------------------- -; Routine: Label_E550 +; Routine: PlanBestShot_StorePower ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -5638,7 +6324,7 @@ Label_E54A: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_E550: +PlanBestShot_StorePower: sta Zp31 ; CPU:$E550 PRG:2550 85 31 jsr $E67A ; CPU:$E552 PRG:2552 20 7A E6 sta Zp30 ; CPU:$E555 PRG:2555 85 30 @@ -5647,10 +6333,10 @@ Label_E550: ldx Zp30 ; CPU:$E55B PRG:255B A6 30 ldy Zp2B ; CPU:$E55D PRG:255D A4 2B lda Zp35 ; CPU:$E55F PRG:255F A5 35 - beq Label_E57B ; CPU:$E561 PRG:2561 F0 18 + beq PlanBestShot_SetShot ; CPU:$E561 PRG:2561 F0 18 tya ; CPU:$E563 PRG:2563 98 ; ----------------------------------------------------------------------------- -; Routine: Label_E564 +; Routine: PlanBestShot_VaryLoop ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -5658,16 +6344,16 @@ Label_E550: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_E564: +PlanBestShot_VaryLoop: dey ; CPU:$E564 PRG:2564 88 - beq Label_E570 ; CPU:$E565 PRG:2565 F0 09 + beq PlanBestShot_VaryFar ; CPU:$E565 PRG:2565 F0 09 dey ; CPU:$E567 PRG:2567 88 - beq Label_E570 ; CPU:$E568 PRG:2568 F0 06 + beq PlanBestShot_VaryFar ; CPU:$E568 PRG:2568 F0 06 dec Zp35 ; CPU:$E56A PRG:256A C6 35 - beq Label_E57B ; CPU:$E56C PRG:256C F0 0D - bne Label_E564 ; CPU:$E56E PRG:256E D0 F4 + beq PlanBestShot_SetShot ; CPU:$E56C PRG:256C F0 0D + bne PlanBestShot_VaryLoop ; CPU:$E56E PRG:256E D0 F4 ; ----------------------------------------------------------------------------- -; Routine: Label_E570 +; Routine: PlanBestShot_VaryFar ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -5675,10 +6361,10 @@ Label_E564: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_E570: +PlanBestShot_VaryFar: ldy #$04 ; CPU:$E570 PRG:2570 A0 04 ; ----------------------------------------------------------------------------- -; Routine: Label_E572 +; Routine: PlanBestShot_VaryAngle ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -5686,15 +6372,15 @@ Label_E570: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_E572: +PlanBestShot_VaryAngle: txa ; CPU:$E572 PRG:2572 8A clc ; CPU:$E573 PRG:2573 18 adc #$07 ; CPU:$E574 PRG:2574 69 07 tax ; CPU:$E576 PRG:2576 AA dec Zp35 ; CPU:$E577 PRG:2577 C6 35 - bne Label_E572 ; CPU:$E579 PRG:2579 D0 F7 + bne PlanBestShot_VaryAngle ; CPU:$E579 PRG:2579 D0 F7 ; ----------------------------------------------------------------------------- -; Routine: Label_E57B +; Routine: PlanBestShot_SetShot ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -5702,13 +6388,13 @@ Label_E572: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_E57B: +PlanBestShot_SetShot: stx Zp30 ; CPU:$E57B PRG:257B 86 30 sty Zp2B ; CPU:$E57D PRG:257D 84 2B lda #$00 ; CPU:$E57F PRG:257F A9 00 rts ; CPU:$E581 PRG:2581 60 ; ----------------------------------------------------------------------------- -; Routine: Label_E582 +; Routine: ScoreShotLineup ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -5716,11 +6402,11 @@ Label_E57B: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_E582: +ScoreShotLineup: lda #$00 ; CPU:$E582 PRG:2582 A9 00 sta Zp33 ; CPU:$E584 PRG:2584 85 33 ; ----------------------------------------------------------------------------- -; Routine: Label_E586 +; Routine: ScoreShotLineup_Loop ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -5728,18 +6414,18 @@ Label_E582: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_E586: +ScoreShotLineup_Loop: ldy Zp33 ; CPU:$E586 PRG:2586 A4 33 ldx Zp32 ; CPU:$E588 PRG:2588 A6 32 lda $049F,x ; CPU:$E58A PRG:258A BD 9F 04 sec ; CPU:$E58D PRG:258D 38 sbc $0480,y ; CPU:$E58E PRG:258E F9 80 04 - bpl Label_E598 ; CPU:$E591 PRG:2591 10 05 + bpl ScoreShotLineup_AfterAbs ; CPU:$E591 PRG:2591 10 05 eor #$FF ; CPU:$E593 PRG:2593 49 FF clc ; CPU:$E595 PRG:2595 18 adc #$01 ; CPU:$E596 PRG:2596 69 01 ; ----------------------------------------------------------------------------- -; Routine: Label_E598 +; Routine: ScoreShotLineup_AfterAbs ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -5747,9 +6433,9 @@ Label_E586: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_E598: +ScoreShotLineup_AfterAbs: cmp #$20 ; CPU:$E598 PRG:2598 C9 20 - bcs Label_E5FE ; CPU:$E59A PRG:259A B0 62 + bcs ScoreShotLineup_Next ; CPU:$E59A PRG:259A B0 62 lda $0330,x ; CPU:$E59C PRG:259C BD 30 03 sta Zp26 ; CPU:$E59F PRG:259F 85 26 lda $0370,x ; CPU:$E5A1 PRG:25A1 BD 70 03 @@ -5776,13 +6462,13 @@ Label_E598: clc ; CPU:$E5D1 PRG:25D1 18 adc Zp31 ; CPU:$E5D2 PRG:25D2 65 31 cmp #$80 ; CPU:$E5D4 PRG:25D4 C9 80 - beq Label_E5E7 ; CPU:$E5D6 PRG:25D6 F0 0F - bcc Label_E5DF ; CPU:$E5D8 PRG:25D8 90 05 + beq ScoreShotLineup_Accept ; CPU:$E5D6 PRG:25D6 F0 0F + bcc ScoreShotLineup_Tolerance ; CPU:$E5D8 PRG:25D8 90 05 eor #$FF ; CPU:$E5DA PRG:25DA 49 FF clc ; CPU:$E5DC PRG:25DC 18 adc #$01 ; CPU:$E5DD PRG:25DD 69 01 ; ----------------------------------------------------------------------------- -; Routine: Label_E5DF +; Routine: ScoreShotLineup_Tolerance ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -5790,13 +6476,13 @@ Label_E598: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_E5DF: +ScoreShotLineup_Tolerance: cmp #$4C ; CPU:$E5DF PRG:25DF C9 4C - bcc Label_E5FE ; CPU:$E5E1 PRG:25E1 90 1B + bcc ScoreShotLineup_Next ; CPU:$E5E1 PRG:25E1 90 1B cmp Zp2F ; CPU:$E5E3 PRG:25E3 C5 2F - bcc Label_E5FE ; CPU:$E5E5 PRG:25E5 90 17 + bcc ScoreShotLineup_Next ; CPU:$E5E5 PRG:25E5 90 17 ; ----------------------------------------------------------------------------- -; Routine: Label_E5E7 +; Routine: ScoreShotLineup_Accept ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -5804,14 +6490,14 @@ Label_E5DF: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_E5E7: +ScoreShotLineup_Accept: sta Zp31 ; CPU:$E5E7 PRG:25E7 85 31 lda Zp35 ; CPU:$E5E9 PRG:25E9 A5 35 - beq Label_E5F2 ; CPU:$E5EB PRG:25EB F0 05 + beq ScoreShotLineup_Record ; CPU:$E5EB PRG:25EB F0 05 dec Zp35 ; CPU:$E5ED PRG:25ED C6 35 jmp $E5FE ; CPU:$E5EF PRG:25EF 4C FE E5 ; ----------------------------------------------------------------------------- -; Routine: Label_E5F2 +; Routine: ScoreShotLineup_Record ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -5819,7 +6505,7 @@ Label_E5E7: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_E5F2: +ScoreShotLineup_Record: ldx Zp32 ; CPU:$E5F2 PRG:25F2 A6 32 ldy Zp33 ; CPU:$E5F4 PRG:25F4 A4 33 stx Zp2E ; CPU:$E5F6 PRG:25F6 86 2E @@ -5827,7 +6513,7 @@ Label_E5F2: lda Zp31 ; CPU:$E5FA PRG:25FA A5 31 sta Zp2F ; CPU:$E5FC PRG:25FC 85 2F ; ----------------------------------------------------------------------------- -; Routine: Label_E5FE +; Routine: ScoreShotLineup_Next ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -5835,14 +6521,14 @@ Label_E5F2: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_E5FE: +ScoreShotLineup_Next: inc Zp33 ; CPU:$E5FE PRG:25FE E6 33 lda Zp33 ; CPU:$E600 PRG:2600 A5 33 cmp $01C0 ; CPU:$E602 PRG:2602 CD C0 01 - beq Label_E60A ; CPU:$E605 PRG:2605 F0 03 + beq ScoreShotLineup_Done ; CPU:$E605 PRG:2605 F0 03 jmp $E586 ; CPU:$E607 PRG:2607 4C 86 E5 ; ----------------------------------------------------------------------------- -; Routine: Label_E60A +; Routine: ScoreShotLineup_Done ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -5850,10 +6536,10 @@ Label_E5FE: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_E60A: +ScoreShotLineup_Done: rts ; CPU:$E60A PRG:260A 60 ; ----------------------------------------------------------------------------- -; Routine: Label_E60B +; Routine: ComputePotAimPoint ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -5861,7 +6547,7 @@ Label_E60A: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_E60B: +ComputePotAimPoint: ldx Zp2E ; CPU:$E60B PRG:260B A6 2E lda $0330,x ; CPU:$E60D PRG:260D BD 30 03 sta Zp2C ; CPU:$E610 PRG:2610 85 2C @@ -5878,15 +6564,15 @@ Label_E60B: sta Zp27 ; CPU:$E627 PRG:2627 85 27 jsr $E3BF ; CPU:$E629 PRG:2629 20 BF E3 jsr $FE5A ; CPU:$E62C PRG:262C 20 5A FE - sta ZpFA ; CPU:$E62F PRG:262F 85 FA + sta ptr_lo ; CPU:$E62F PRG:262F 85 FA ldx Zp2E ; CPU:$E631 PRG:2631 A6 2E lda $04A6,x ; CPU:$E633 PRG:2633 BD A6 04 ldx #$0B ; CPU:$E636 PRG:2636 A2 0B cmp #$0F ; CPU:$E638 PRG:2638 C9 0F - bcs Label_E63E ; CPU:$E63A PRG:263A B0 02 + bcs ComputePotAimPoint_Scale ; CPU:$E63A PRG:263A B0 02 ldx #$05 ; CPU:$E63C PRG:263C A2 05 ; ----------------------------------------------------------------------------- -; Routine: Label_E63E +; Routine: ComputePotAimPoint_Scale ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -5894,32 +6580,32 @@ Label_E60B: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_E63E: +ComputePotAimPoint_Scale: txa ; CPU:$E63E PRG:263E 8A clc ; CPU:$E63F PRG:263F 18 - adc ZpFA ; CPU:$E640 PRG:2640 65 FA - sta ZpFD ; CPU:$E642 PRG:2642 85 FD + adc ptr_lo ; CPU:$E640 PRG:2640 65 FA + sta ppu_addr_hi ; CPU:$E642 PRG:2642 85 FD lda #$00 ; CPU:$E644 PRG:2644 A9 00 - sta ZpFC ; CPU:$E646 PRG:2646 85 FC - sta ZpFB ; CPU:$E648 PRG:2648 85 FB + sta ppu_addr_lo ; CPU:$E646 PRG:2646 85 FC + sta ptr_hi ; CPU:$E648 PRG:2648 85 FB jsr $FDD8 ; CPU:$E64A PRG:264A 20 D8 FD - ldx ZpFD ; CPU:$E64D PRG:264D A6 FD - ldy ZpFC ; CPU:$E64F PRG:264F A4 FC - stx ZpFB ; CPU:$E651 PRG:2651 86 FB - sty ZpFA ; CPU:$E653 PRG:2653 84 FA + ldx ppu_addr_hi ; CPU:$E64D PRG:264D A6 FD + ldy ppu_addr_lo ; CPU:$E64F PRG:264F A4 FC + stx ptr_hi ; CPU:$E651 PRG:2651 86 FB + sty ptr_lo ; CPU:$E653 PRG:2653 84 FA lda Zp10 ; CPU:$E655 PRG:2655 A5 10 - sta ZpFC ; CPU:$E657 PRG:2657 85 FC + sta ppu_addr_lo ; CPU:$E657 PRG:2657 85 FC lda Zp11 ; CPU:$E659 PRG:2659 A5 11 - sta ZpFD ; CPU:$E65B PRG:265B 85 FD + sta ppu_addr_hi ; CPU:$E65B PRG:265B 85 FD jsr $FD8B ; CPU:$E65D PRG:265D 20 8B FD txa ; CPU:$E660 PRG:2660 8A clc ; CPU:$E661 PRG:2661 18 adc Zp1C ; CPU:$E662 PRG:2662 65 1C sta Zp2C ; CPU:$E664 PRG:2664 85 2C lda Zp12 ; CPU:$E666 PRG:2666 A5 12 - sta ZpFC ; CPU:$E668 PRG:2668 85 FC + sta ppu_addr_lo ; CPU:$E668 PRG:2668 85 FC lda Zp13 ; CPU:$E66A PRG:266A A5 13 - sta ZpFD ; CPU:$E66C PRG:266C 85 FD + sta ppu_addr_hi ; CPU:$E66C PRG:266C 85 FD jsr $FD8B ; CPU:$E66E PRG:266E 20 8B FD txa ; CPU:$E671 PRG:2671 8A clc ; CPU:$E672 PRG:2672 18 @@ -5927,7 +6613,7 @@ Label_E63E: sta Zp2D ; CPU:$E675 PRG:2675 85 2D jmp $E517 ; CPU:$E677 PRG:2677 4C 17 E5 ; ----------------------------------------------------------------------------- -; Routine: Label_E67A +; Routine: ComputeAngleFromDelta ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -5935,13 +6621,13 @@ Label_E63E: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_E67A: +ComputeAngleFromDelta: lda Zp28 ; CPU:$E67A PRG:267A A5 28 - bne Label_E683 ; CPU:$E67C PRG:267C D0 05 + bne ComputeAngleFromDelta_ZeroY ; CPU:$E67C PRG:267C D0 05 lda #$00 ; CPU:$E67E PRG:267E A9 00 jmp $E6F7 ; CPU:$E680 PRG:2680 4C F7 E6 ; ----------------------------------------------------------------------------- -; Routine: Label_E683 +; Routine: ComputeAngleFromDelta_ZeroY ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -5949,13 +6635,13 @@ Label_E67A: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_E683: +ComputeAngleFromDelta_ZeroY: lda Zp29 ; CPU:$E683 PRG:2683 A5 29 - bne Label_E68C ; CPU:$E685 PRG:2685 D0 05 + bne ComputeAngleFromDelta_Ratio ; CPU:$E685 PRG:2685 D0 05 lda #$40 ; CPU:$E687 PRG:2687 A9 40 jmp $E6F7 ; CPU:$E689 PRG:2689 4C F7 E6 ; ----------------------------------------------------------------------------- -; Routine: Label_E68C +; Routine: ComputeAngleFromDelta_Ratio ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -5963,14 +6649,14 @@ Label_E683: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_E68C: +ComputeAngleFromDelta_Ratio: ldy #$40 ; CPU:$E68C PRG:268C A0 40 cmp Zp28 ; CPU:$E68E PRG:268E C5 28 - bcc Label_E696 ; CPU:$E690 PRG:2690 90 04 + bcc ComputeAngleFromDelta_RatioSetup ; CPU:$E690 PRG:2690 90 04 ldy #$00 ; CPU:$E692 PRG:2692 A0 00 lda Zp28 ; CPU:$E694 PRG:2694 A5 28 ; ----------------------------------------------------------------------------- -; Routine: Label_E696 +; Routine: ComputeAngleFromDelta_RatioSetup ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -5978,38 +6664,38 @@ Label_E68C: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_E696: +ComputeAngleFromDelta_RatioSetup: sty Zp19 ; CPU:$E696 PRG:2696 84 19 sta Zp18 ; CPU:$E698 PRG:2698 85 18 lda Zp28 ; CPU:$E69A PRG:269A A5 28 - sta ZpFC ; CPU:$E69C PRG:269C 85 FC - sta ZpFA ; CPU:$E69E PRG:269E 85 FA + sta ppu_addr_lo ; CPU:$E69C PRG:269C 85 FC + sta ptr_lo ; CPU:$E69E PRG:269E 85 FA lda #$00 ; CPU:$E6A0 PRG:26A0 A9 00 - sta ZpFD ; CPU:$E6A2 PRG:26A2 85 FD - sta ZpFB ; CPU:$E6A4 PRG:26A4 85 FB + sta ppu_addr_hi ; CPU:$E6A2 PRG:26A2 85 FD + sta ptr_hi ; CPU:$E6A4 PRG:26A4 85 FB jsr $FD8B ; CPU:$E6A6 PRG:26A6 20 8B FD stx Zp25 ; CPU:$E6A9 PRG:26A9 86 25 sty Zp24 ; CPU:$E6AB PRG:26AB 84 24 lda Zp29 ; CPU:$E6AD PRG:26AD A5 29 - sta ZpFC ; CPU:$E6AF PRG:26AF 85 FC - sta ZpFA ; CPU:$E6B1 PRG:26B1 85 FA + sta ppu_addr_lo ; CPU:$E6AF PRG:26AF 85 FC + sta ptr_lo ; CPU:$E6B1 PRG:26B1 85 FA lda #$00 ; CPU:$E6B3 PRG:26B3 A9 00 - sta ZpFD ; CPU:$E6B5 PRG:26B5 85 FD + sta ppu_addr_hi ; CPU:$E6B5 PRG:26B5 85 FD jsr $FD8B ; CPU:$E6B7 PRG:26B7 20 8B FD tya ; CPU:$E6BA PRG:26BA 98 clc ; CPU:$E6BB PRG:26BB 18 adc Zp24 ; CPU:$E6BC PRG:26BC 65 24 - sta ZpFC ; CPU:$E6BE PRG:26BE 85 FC + sta ppu_addr_lo ; CPU:$E6BE PRG:26BE 85 FC txa ; CPU:$E6C0 PRG:26C0 8A adc Zp25 ; CPU:$E6C1 PRG:26C1 65 25 - sta ZpFD ; CPU:$E6C3 PRG:26C3 85 FD + sta ppu_addr_hi ; CPU:$E6C3 PRG:26C3 85 FD jsr $FE5A ; CPU:$E6C5 PRG:26C5 20 5A FE - sta ZpFA ; CPU:$E6C8 PRG:26C8 85 FA + sta ptr_lo ; CPU:$E6C8 PRG:26C8 85 FA lda Zp18 ; CPU:$E6CA PRG:26CA A5 18 - sta ZpFD ; CPU:$E6CC PRG:26CC 85 FD + sta ppu_addr_hi ; CPU:$E6CC PRG:26CC 85 FD lda #$00 ; CPU:$E6CE PRG:26CE A9 00 ; ----------------------------------------------------------------------------- -; Routine: Label_E6D0 +; Routine: ComputeAngleFromDelta_Divide ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -6017,13 +6703,13 @@ Label_E696: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_E6D0: - sta ZpFC ; CPU:$E6D0 PRG:26D0 85 FC +ComputeAngleFromDelta_Divide: + sta ppu_addr_lo ; CPU:$E6D0 PRG:26D0 85 FC jsr $FDD8 ; CPU:$E6D2 PRG:26D2 20 D8 FD - lda ZpFC ; CPU:$E6D5 PRG:26D5 A5 FC + lda ppu_addr_lo ; CPU:$E6D5 PRG:26D5 A5 FC ldy #$00 ; CPU:$E6D7 PRG:26D7 A0 00 ; ----------------------------------------------------------------------------- -; Routine: Label_E6D9 +; Routine: ComputeAngleFromDelta_TableLoop ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -6031,14 +6717,14 @@ Label_E6D0: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_E6D9: +ComputeAngleFromDelta_TableLoop: cmp $FECE,y ; CPU:$E6D9 PRG:26D9 D9 CE FE - beq Label_E6ED ; CPU:$E6DC PRG:26DC F0 0F - bcs Label_E6E4 ; CPU:$E6DE PRG:26DE B0 04 + beq ComputeAngleFromDelta_Found ; CPU:$E6DC PRG:26DC F0 0F + bcs ComputeAngleFromDelta_TableUp ; CPU:$E6DE PRG:26DE B0 04 dey ; CPU:$E6E0 PRG:26E0 88 jmp $E6D9 ; CPU:$E6E1 PRG:26E1 4C D9 E6 ; ----------------------------------------------------------------------------- -; Routine: Label_E6E4 +; Routine: ComputeAngleFromDelta_TableUp ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -6046,13 +6732,13 @@ Label_E6D9: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_E6E4: +ComputeAngleFromDelta_TableUp: cmp $FECF,y ; CPU:$E6E4 PRG:26E4 D9 CF FE - bcc Label_E6ED ; CPU:$E6E7 PRG:26E7 90 04 + bcc ComputeAngleFromDelta_Found ; CPU:$E6E7 PRG:26E7 90 04 iny ; CPU:$E6E9 PRG:26E9 C8 jmp $E6D9 ; CPU:$E6EA PRG:26EA 4C D9 E6 ; ----------------------------------------------------------------------------- -; Routine: Label_E6ED +; Routine: ComputeAngleFromDelta_Found ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -6060,15 +6746,15 @@ Label_E6E4: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_E6ED: +ComputeAngleFromDelta_Found: lda Zp19 ; CPU:$E6ED PRG:26ED A5 19 - beq Label_E6F8 ; CPU:$E6EF PRG:26EF F0 07 + beq ComputeAngleFromDelta_Quadrant ; CPU:$E6EF PRG:26EF F0 07 tya ; CPU:$E6F1 PRG:26F1 98 eor #$FF ; CPU:$E6F2 PRG:26F2 49 FF clc ; CPU:$E6F4 PRG:26F4 18 adc #$41 ; CPU:$E6F5 PRG:26F5 69 41 ; ----------------------------------------------------------------------------- -; Routine: Label_E6F7 +; Routine: ComputeAngleFromDelta_Adjust ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -6076,10 +6762,10 @@ Label_E6ED: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_E6F7: +ComputeAngleFromDelta_Adjust: tay ; CPU:$E6F7 PRG:26F7 A8 ; ----------------------------------------------------------------------------- -; Routine: Label_E6F8 +; Routine: ComputeAngleFromDelta_Quadrant ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -6087,17 +6773,17 @@ Label_E6F7: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_E6F8: +ComputeAngleFromDelta_Quadrant: lda Zp11 ; CPU:$E6F8 PRG:26F8 A5 11 - bpl Label_E70F ; CPU:$E6FA PRG:26FA 10 13 + bpl ComputeAngleFromDelta_PosX ; CPU:$E6FA PRG:26FA 10 13 lda Zp13 ; CPU:$E6FC PRG:26FC A5 13 - bpl Label_E706 ; CPU:$E6FE PRG:26FE 10 06 + bpl ComputeAngleFromDelta_Quad2 ; CPU:$E6FE PRG:26FE 10 06 tya ; CPU:$E700 PRG:2700 98 clc ; CPU:$E701 PRG:2701 18 adc #$80 ; CPU:$E702 PRG:2702 69 80 - bne Label_E71C ; CPU:$E704 PRG:2704 D0 16 + bne ComputeAngleFromDelta_Done ; CPU:$E704 PRG:2704 D0 16 ; ----------------------------------------------------------------------------- -; Routine: Label_E706 +; Routine: ComputeAngleFromDelta_Quad2 ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -6105,14 +6791,14 @@ Label_E6F8: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_E706: +ComputeAngleFromDelta_Quad2: tya ; CPU:$E706 PRG:2706 98 eor #$FF ; CPU:$E707 PRG:2707 49 FF clc ; CPU:$E709 PRG:2709 18 adc #$01 ; CPU:$E70A PRG:270A 69 01 jmp $E71C ; CPU:$E70C PRG:270C 4C 1C E7 ; ----------------------------------------------------------------------------- -; Routine: Label_E70F +; Routine: ComputeAngleFromDelta_PosX ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -6120,16 +6806,16 @@ Label_E706: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_E70F: +ComputeAngleFromDelta_PosX: lda Zp13 ; CPU:$E70F PRG:270F A5 13 - bpl Label_E71B ; CPU:$E711 PRG:2711 10 08 + bpl ComputeAngleFromDelta_Quad1 ; CPU:$E711 PRG:2711 10 08 tya ; CPU:$E713 PRG:2713 98 eor #$FF ; CPU:$E714 PRG:2714 49 FF clc ; CPU:$E716 PRG:2716 18 adc #$81 ; CPU:$E717 PRG:2717 69 81 - bne Label_E71C ; CPU:$E719 PRG:2719 D0 01 + bne ComputeAngleFromDelta_Done ; CPU:$E719 PRG:2719 D0 01 ; ----------------------------------------------------------------------------- -; Routine: Label_E71B +; Routine: ComputeAngleFromDelta_Quad1 ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -6137,10 +6823,10 @@ Label_E70F: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_E71B: +ComputeAngleFromDelta_Quad1: tya ; CPU:$E71B PRG:271B 98 ; ----------------------------------------------------------------------------- -; Routine: Label_E71C +; Routine: ComputeAngleFromDelta_Done ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -6148,10 +6834,10 @@ Label_E71B: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_E71C: +ComputeAngleFromDelta_Done: rts ; CPU:$E71C PRG:271C 60 ; ----------------------------------------------------------------------------- -; Routine: Label_E71D +; Routine: FindBlockingBall ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -6159,11 +6845,11 @@ Label_E71C: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_E71D: +FindBlockingBall: lda #$01 ; CPU:$E71D PRG:271D A9 01 sta Zp34 ; CPU:$E71F PRG:271F 85 34 ; ----------------------------------------------------------------------------- -; Routine: Label_E721 +; Routine: FindBlockingBall_Loop ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -6171,27 +6857,27 @@ Label_E71D: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_E721: +FindBlockingBall_Loop: ldx Zp34 ; CPU:$E721 PRG:2721 A6 34 lda $0300,x ; CPU:$E723 PRG:2723 BD 00 03 and #$C0 ; CPU:$E726 PRG:2726 29 C0 cmp #$80 ; CPU:$E728 PRG:2728 C9 80 - bne Label_E763 ; CPU:$E72A PRG:272A D0 37 + bne FindBlockingBall_Next ; CPU:$E72A PRG:272A D0 37 cpx Zp32 ; CPU:$E72C PRG:272C E4 32 - beq Label_E763 ; CPU:$E72E PRG:272E F0 33 + beq FindBlockingBall_Next ; CPU:$E72E PRG:272E F0 33 ldy Zp32 ; CPU:$E730 PRG:2730 A4 32 lda $04A6,x ; CPU:$E732 PRG:2732 BD A6 04 cmp $04A6,y ; CPU:$E735 PRG:2735 D9 A6 04 - bcs Label_E763 ; CPU:$E738 PRG:2738 B0 29 + bcs FindBlockingBall_Next ; CPU:$E738 PRG:2738 B0 29 lda $049F,x ; CPU:$E73A PRG:273A BD 9F 04 sec ; CPU:$E73D PRG:273D 38 sbc $049F,y ; CPU:$E73E PRG:273E F9 9F 04 - bpl Label_E748 ; CPU:$E741 PRG:2741 10 05 + bpl FindBlockingBall_DiffAbs ; CPU:$E741 PRG:2741 10 05 eor #$FF ; CPU:$E743 PRG:2743 49 FF clc ; CPU:$E745 PRG:2745 18 adc #$01 ; CPU:$E746 PRG:2746 69 01 ; ----------------------------------------------------------------------------- -; Routine: Label_E748 +; Routine: FindBlockingBall_DiffAbs ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -6199,22 +6885,22 @@ Label_E721: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_E748: +FindBlockingBall_DiffAbs: cmp #$40 ; CPU:$E748 PRG:2748 C9 40 - bcs Label_E763 ; CPU:$E74A PRG:274A B0 17 + bcs FindBlockingBall_Next ; CPU:$E74A PRG:274A B0 17 jsr $FEA8 ; CPU:$E74C PRG:274C 20 A8 FE ldx Zp34 ; CPU:$E74F PRG:274F A6 34 lda $04A6,x ; CPU:$E751 PRG:2751 BD A6 04 - sta ZpFA ; CPU:$E754 PRG:2754 85 FA + sta ptr_lo ; CPU:$E754 PRG:2754 85 FA lda #$00 ; CPU:$E756 PRG:2756 A9 00 - sta ZpFB ; CPU:$E758 PRG:2758 85 FB + sta ptr_hi ; CPU:$E758 PRG:2758 85 FB jsr $FD8B ; CPU:$E75A PRG:275A 20 8B FD cpx #$0B ; CPU:$E75D PRG:275D E0 0B - bcs Label_E763 ; CPU:$E75F PRG:275F B0 02 + bcs FindBlockingBall_Next ; CPU:$E75F PRG:275F B0 02 sec ; CPU:$E761 PRG:2761 38 rts ; CPU:$E762 PRG:2762 60 ; ----------------------------------------------------------------------------- -; Routine: Label_E763 +; Routine: FindBlockingBall_Next ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -6222,15 +6908,15 @@ Label_E748: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_E763: +FindBlockingBall_Next: inc Zp34 ; CPU:$E763 PRG:2763 E6 34 lda Zp34 ; CPU:$E765 PRG:2765 A5 34 cmp #$08 ; CPU:$E767 PRG:2767 C9 08 - bne Label_E721 ; CPU:$E769 PRG:2769 D0 B6 + bne FindBlockingBall_Loop ; CPU:$E769 PRG:2769 D0 B6 clc ; CPU:$E76B PRG:276B 18 rts ; CPU:$E76C PRG:276C 60 ; ----------------------------------------------------------------------------- -; Routine: Label_E76D +; Routine: FindPocketInPath ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -6238,11 +6924,11 @@ Label_E763: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_E76D: +FindPocketInPath: lda #$00 ; CPU:$E76D PRG:276D A9 00 sta Zp34 ; CPU:$E76F PRG:276F 85 34 ; ----------------------------------------------------------------------------- -; Routine: Label_E771 +; Routine: FindPocketInPath_Loop ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -6250,21 +6936,21 @@ Label_E76D: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_E771: +FindPocketInPath_Loop: ldx Zp34 ; CPU:$E771 PRG:2771 A6 34 ldy Zp32 ; CPU:$E773 PRG:2773 A4 32 lda $0490,x ; CPU:$E775 PRG:2775 BD 90 04 cmp $04A6,y ; CPU:$E778 PRG:2778 D9 A6 04 - bcs Label_E7A6 ; CPU:$E77B PRG:277B B0 29 + bcs FindPocketInPath_Next ; CPU:$E77B PRG:277B B0 29 lda $0480,x ; CPU:$E77D PRG:277D BD 80 04 sec ; CPU:$E780 PRG:2780 38 sbc $049F,y ; CPU:$E781 PRG:2781 F9 9F 04 - bpl Label_E78B ; CPU:$E784 PRG:2784 10 05 + bpl FindPocketInPath_DiffAbs ; CPU:$E784 PRG:2784 10 05 eor #$FF ; CPU:$E786 PRG:2786 49 FF clc ; CPU:$E788 PRG:2788 18 adc #$01 ; CPU:$E789 PRG:2789 69 01 ; ----------------------------------------------------------------------------- -; Routine: Label_E78B +; Routine: FindPocketInPath_DiffAbs ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -6272,22 +6958,22 @@ Label_E771: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_E78B: +FindPocketInPath_DiffAbs: cmp #$40 ; CPU:$E78B PRG:278B C9 40 - bcs Label_E7A6 ; CPU:$E78D PRG:278D B0 17 + bcs FindPocketInPath_Next ; CPU:$E78D PRG:278D B0 17 jsr $FEA8 ; CPU:$E78F PRG:278F 20 A8 FE ldx Zp34 ; CPU:$E792 PRG:2792 A6 34 lda $0490,x ; CPU:$E794 PRG:2794 BD 90 04 - sta ZpFA ; CPU:$E797 PRG:2797 85 FA + sta ptr_lo ; CPU:$E797 PRG:2797 85 FA lda #$00 ; CPU:$E799 PRG:2799 A9 00 - sta ZpFB ; CPU:$E79B PRG:279B 85 FB + sta ptr_hi ; CPU:$E79B PRG:279B 85 FB jsr $FD8B ; CPU:$E79D PRG:279D 20 8B FD cpx #$10 ; CPU:$E7A0 PRG:27A0 E0 10 - bcs Label_E7A6 ; CPU:$E7A2 PRG:27A2 B0 02 + bcs FindPocketInPath_Next ; CPU:$E7A2 PRG:27A2 B0 02 sec ; CPU:$E7A4 PRG:27A4 38 rts ; CPU:$E7A5 PRG:27A5 60 ; ----------------------------------------------------------------------------- -; Routine: Label_E7A6 +; Routine: FindPocketInPath_Next ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -6295,15 +6981,15 @@ Label_E78B: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_E7A6: +FindPocketInPath_Next: inc Zp34 ; CPU:$E7A6 PRG:27A6 E6 34 lda Zp34 ; CPU:$E7A8 PRG:27A8 A5 34 cmp $01C0 ; CPU:$E7AA PRG:27AA CD C0 01 - bne Label_E771 ; CPU:$E7AD PRG:27AD D0 C2 + bne FindPocketInPath_Loop ; CPU:$E7AD PRG:27AD D0 C2 clc ; CPU:$E7AF PRG:27AF 18 rts ; CPU:$E7B0 PRG:27B0 60 ; ----------------------------------------------------------------------------- -; Routine: Label_E7B1 +; Routine: CheckTileCollision ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -6311,11 +6997,11 @@ Label_E7A6: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_E7B1: +CheckTileCollision: lda #$08 ; CPU:$E7B1 PRG:27B1 A9 08 sta Zp34 ; CPU:$E7B3 PRG:27B3 85 34 ; ----------------------------------------------------------------------------- -; Routine: Label_E7B5 +; Routine: CheckTileCollision_Loop ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -6323,15 +7009,15 @@ Label_E7B1: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_E7B5: +CheckTileCollision_Loop: ldx Zp32 ; CPU:$E7B5 PRG:27B5 A6 32 lda Zp34 ; CPU:$E7B7 PRG:27B7 A5 34 cmp $04A6,x ; CPU:$E7B9 PRG:27B9 DD A6 04 - bcc Label_E7C0 ; CPU:$E7BC PRG:27BC 90 02 + bcc CheckTileCollision_Probe ; CPU:$E7BC PRG:27BC 90 02 clc ; CPU:$E7BE PRG:27BE 18 rts ; CPU:$E7BF PRG:27BF 60 ; ----------------------------------------------------------------------------- -; Routine: Label_E7C0 +; Routine: CheckTileCollision_Probe ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -6339,13 +7025,13 @@ Label_E7B5: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_E7C0: +CheckTileCollision_Probe: lda $049F,x ; CPU:$E7C0 PRG:27C0 BD 9F 04 jsr $FEA8 ; CPU:$E7C3 PRG:27C3 20 A8 FE lda Zp34 ; CPU:$E7C6 PRG:27C6 A5 34 - sta ZpFA ; CPU:$E7C8 PRG:27C8 85 FA + sta ptr_lo ; CPU:$E7C8 PRG:27C8 85 FA lda #$00 ; CPU:$E7CA PRG:27CA A9 00 - sta ZpFB ; CPU:$E7CC PRG:27CC 85 FB + sta ptr_hi ; CPU:$E7CC PRG:27CC 85 FB jsr $FD8B ; CPU:$E7CE PRG:27CE 20 8B FD txa ; CPU:$E7D1 PRG:27D1 8A adc $0330 ; CPU:$E7D2 PRG:27D2 6D 30 03 @@ -6368,16 +7054,16 @@ Label_E7C0: tay ; CPU:$E7EE PRG:27EE A8 jsr $FAF9 ; CPU:$E7EF PRG:27EF 20 F9 FA ldy #$00 ; CPU:$E7F2 PRG:27F2 A0 00 - lda (ZpFC),y ; CPU:$E7F4 PRG:27F4 B1 FC + lda (ppu_addr_lo),y ; CPU:$E7F4 PRG:27F4 B1 FC and #$0F ; CPU:$E7F6 PRG:27F6 29 0F cmp #$08 ; CPU:$E7F8 PRG:27F8 C9 08 - bcs Label_E802 ; CPU:$E7FA PRG:27FA B0 06 + bcs CheckTileCollision_Next ; CPU:$E7FA PRG:27FA B0 06 cmp #$05 ; CPU:$E7FC PRG:27FC C9 05 - bcc Label_E802 ; CPU:$E7FE PRG:27FE 90 02 + bcc CheckTileCollision_Next ; CPU:$E7FE PRG:27FE 90 02 sec ; CPU:$E800 PRG:2800 38 rts ; CPU:$E801 PRG:2801 60 ; ----------------------------------------------------------------------------- -; Routine: Label_E802 +; Routine: CheckTileCollision_Next ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -6385,7 +7071,7 @@ Label_E7C0: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_E802: +CheckTileCollision_Next: lda Zp34 ; CPU:$E802 PRG:2802 A5 34 clc ; CPU:$E804 PRG:2804 18 adc #$08 ; CPU:$E805 PRG:2805 69 08 @@ -6408,7 +7094,7 @@ Reset: ldx #$06 ; CPU:$E812 PRG:2812 A2 06 jsr $CB1D ; CPU:$E814 PRG:2814 20 1D CB ; ----------------------------------------------------------------------------- -; Routine: Label_E817 +; Routine: Reset_WaitVblank ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -6416,12 +7102,12 @@ Reset: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_E817: - lda $2002 ; CPU:$E817 PRG:2817 AD 02 20 +Reset_WaitVblank: + lda PPUSTATUS ; CPU:$E817 PRG:2817 AD 02 20 and #$80 ; CPU:$E81A PRG:281A 29 80 - beq Label_E817 ; CPU:$E81C PRG:281C F0 F9 + beq Reset_WaitVblank ; CPU:$E81C PRG:281C F0 F9 ; ----------------------------------------------------------------------------- -; Routine: Label_E81E +; Routine: Reset_WaitVblank2 ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -6429,16 +7115,16 @@ Label_E817: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_E81E: - lda $2002 ; CPU:$E81E PRG:281E AD 02 20 +Reset_WaitVblank2: + lda PPUSTATUS ; CPU:$E81E PRG:281E AD 02 20 and #$80 ; CPU:$E821 PRG:2821 29 80 - beq Label_E81E ; CPU:$E823 PRG:2823 F0 F9 + beq Reset_WaitVblank2 ; CPU:$E823 PRG:2823 F0 F9 jsr $CC7B ; CPU:$E825 PRG:2825 20 7B CC jsr $CA60 ; CPU:$E828 PRG:2828 20 60 CA jsr $C3F5 ; CPU:$E82B PRG:282B 20 F5 C3 ldx #$10 ; CPU:$E82E PRG:282E A2 10 ; ----------------------------------------------------------------------------- -; Routine: Label_E830 +; Routine: Reset_ClearShadowTables ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -6446,20 +7132,20 @@ Label_E81E: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_E830: +Reset_ClearShadowTables: lda #$FF ; CPU:$E830 PRG:2830 A9 FF sta Zp7F,x ; CPU:$E832 PRG:2832 95 7F sta $013F,x ; CPU:$E834 PRG:2834 9D 3F 01 lda #$00 ; CPU:$E837 PRG:2837 A9 00 sta $02FF,x ; CPU:$E839 PRG:2839 9D FF 02 dex ; CPU:$E83C PRG:283C CA - bne Label_E830 ; CPU:$E83D PRG:283D D0 F1 + bne Reset_ClearShadowTables ; CPU:$E83D PRG:283D D0 F1 sta $01C7 ; CPU:$E83F PRG:283F 8D C7 01 lda #$20 ; CPU:$E842 PRG:2842 A9 20 sta Zp02 ; CPU:$E844 PRG:2844 85 02 ldx #$10 ; CPU:$E846 PRG:2846 A2 10 ; ----------------------------------------------------------------------------- -; Routine: Label_E848 +; Routine: Reset_LoadSpritePalettes ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -6467,14 +7153,14 @@ Label_E830: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_E848: +Reset_LoadSpritePalettes: lda $ED3E,x ; CPU:$E848 PRG:2848 BD 3E ED sta Zp8F,x ; CPU:$E84B PRG:284B 95 8F dex ; CPU:$E84D PRG:284D CA - bne Label_E848 ; CPU:$E84E PRG:284E D0 F8 + bne Reset_LoadSpritePalettes ; CPU:$E84E PRG:284E D0 F8 ldx #$10 ; CPU:$E850 PRG:2850 A2 10 ; ----------------------------------------------------------------------------- -; Routine: Label_E852 +; Routine: Reset_CheckSignature ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -6482,20 +7168,28 @@ Label_E848: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_E852: +Reset_CheckSignature: lda $043F,x ; CPU:$E852 PRG:2852 BD 3F 04 cmp $E861,x ; CPU:$E855 PRG:2855 DD 61 E8 - bne Label_E880 ; CPU:$E858 PRG:2858 D0 26 + bne Reset_ColdInit ; CPU:$E858 PRG:2858 D0 26 dex ; CPU:$E85A PRG:285A CA - bne Label_E852 ; CPU:$E85B PRG:285B D0 F5 + bne Reset_CheckSignature ; CPU:$E85B PRG:285B D0 F5 inc Zp5F ; CPU:$E85D PRG:285D E6 5F jmp $E8B3 ; CPU:$E85F PRG:285F 4C B3 E8 ; ---- data $E862-$E87F (30 bytes) ---- ; referenced by `lda $E86F,x` at $E8FF (operand $E86F falls inside this region) +; Two overlapping tables share this block. $E862-$E871 is the sixteen-byte warm-boot +; signature: Reset_CheckSignature compares it against the RAM copy at $0440-$044F with +; `cmp $E861,x`, and a match takes the warm path straight to the title screen instead of +; redoing cold init. The title screen's sixteen-byte attribute row is read from +; $E870-$E87F by EnterTitleScreen_CopyAttrs (`lda $E86F,x` -> $0140-$014F), so its first +; two bytes double as the tail of the signature. The text is the ASCII "JEMINI DAZO!!" +; followed by a zero, a $B1, and the two $81 string delimiters. +BootSignatureText: .byte $4A, $45, $4D, $49, $4E, $49, $20, $44, $41, $5A, $4F, $21, $21, $00, $00, $B1 ; CPU:$E862 PRG:2862 4A 45 4D 49 4E 49 20 44 41 5A 4F 21 21 00 00 B1 .byte $81, $81, $00, $80, $90, $A0, $00, $01, $00, $00, $00, $01, $00, $0B ; CPU:$E872 PRG:2872 81 81 00 80 90 A0 00 01 00 00 00 01 00 0B ; ----------------------------------------------------------------------------- -; Routine: Label_E880 +; Routine: Reset_ColdInit ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -6503,10 +7197,10 @@ Label_E852: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_E880: +Reset_ColdInit: ldx #$10 ; CPU:$E880 PRG:2880 A2 10 ; ----------------------------------------------------------------------------- -; Routine: Label_E882 +; Routine: Reset_CopySignature ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -6514,15 +7208,15 @@ Label_E880: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_E882: +Reset_CopySignature: lda $E861,x ; CPU:$E882 PRG:2882 BD 61 E8 sta $043F,x ; CPU:$E885 PRG:2885 9D 3F 04 dex ; CPU:$E888 PRG:2888 CA - bne Label_E882 ; CPU:$E889 PRG:2889 D0 F7 + bne Reset_CopySignature ; CPU:$E889 PRG:2889 D0 F7 lda #$00 ; CPU:$E88B PRG:288B A9 00 ldx #$06 ; CPU:$E88D PRG:288D A2 06 ; ----------------------------------------------------------------------------- -; Routine: Label_E88F +; Routine: Reset_InitPlayerRecords ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -6530,14 +7224,14 @@ Label_E882: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_E88F: +Reset_InitPlayerRecords: sta $044F,x ; CPU:$E88F PRG:288F 9D 4F 04 sta $0455,x ; CPU:$E892 PRG:2892 9D 55 04 sta $045B,x ; CPU:$E895 PRG:2895 9D 5B 04 sta $0467,x ; CPU:$E898 PRG:2898 9D 67 04 sta $046D,x ; CPU:$E89B PRG:289B 9D 6D 04 dex ; CPU:$E89E PRG:289E CA - bne Label_E88F ; CPU:$E89F PRG:289F D0 EE + bne Reset_InitPlayerRecords ; CPU:$E89F PRG:289F D0 EE sta Zp0F ; CPU:$E8A1 PRG:28A1 85 0F sta $0187 ; CPU:$E8A3 PRG:28A3 8D 87 01 sta Zp5F ; CPU:$E8A6 PRG:28A6 85 5F @@ -6546,7 +7240,7 @@ Label_E88F: sta $0459 ; CPU:$E8AD PRG:28AD 8D 59 04 sta $045F ; CPU:$E8B0 PRG:28B0 8D 5F 04 ; ----------------------------------------------------------------------------- -; Routine: Label_E8B3 +; Routine: EnterTitleScreen ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -6554,7 +7248,7 @@ Label_E88F: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_E8B3: +EnterTitleScreen: jsr $C3BC ; CPU:$E8B3 PRG:28B3 20 BC C3 jsr $CA48 ; CPU:$E8B6 PRG:28B6 20 48 CA jsr $FA6D ; CPU:$E8B9 PRG:28B9 20 6D FA @@ -6575,19 +7269,23 @@ Label_E8B3: jsr $CDD3 ; CPU:$E8DD PRG:28DD 20 D3 CD jsr $CBAE ; CPU:$E8E0 PRG:28E0 20 AE CB jsr $CF9B ; CPU:$E8E3 PRG:28E3 20 9B CF +; Inline command list for RunCommandList: three five-byte records ($03 $03 $1B $03 $03, +; $03 $05 $1C $09 $01, $07 $0D $18 $0D $02) and the $FF terminator at $E8F5. The tracer +; fell through the jsr into the list and decoded the record bytes as undocumented opcodes, +; so this stays .byte with those annotations. .byte $03, $03 ; CPU:$E8E6 PRG:28E6 03 03 -- slo (Zp03,x) (undocumented; ca65 cannot encode) .byte $1B, $03, $03 ; CPU:$E8E8 PRG:28E8 1B 03 03 -- slo $0303,y (undocumented; ca65 cannot encode) .byte $03, $05 ; CPU:$E8EB PRG:28EB 03 05 -- slo (Zp05,x) (undocumented; ca65 cannot encode) .byte $1C, $09, $01 ; CPU:$E8ED PRG:28ED 1C 09 01 -- nop $0109,x (undocumented; ca65 cannot encode) .byte $07, $0D ; CPU:$E8F0 PRG:28F0 07 0D -- slo Zp0D (undocumented; ca65 cannot encode) - clc ; CPU:$E8F2 PRG:28F2 18 - ora $FF02 ; CPU:$E8F3 PRG:28F3 0D 02 FF +; ---- data $E8F2-$E8F5 (4 bytes) ---- + .byte $18, $0D, $02, $FF ; CPU:$E8F2 PRG:28F2 18 0D 02 FF lda #$10 ; CPU:$E8F6 PRG:28F6 A9 10 - sta Zp00 ; CPU:$E8F8 PRG:28F8 85 00 + sta timer_lo ; CPU:$E8F8 PRG:28F8 85 00 jsr $CA42 ; CPU:$E8FA PRG:28FA 20 42 CA ldx #$10 ; CPU:$E8FD PRG:28FD A2 10 ; ----------------------------------------------------------------------------- -; Routine: Label_E8FF +; Routine: EnterTitleScreen_CopyAttrs ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -6595,11 +7293,11 @@ Label_E8B3: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_E8FF: +EnterTitleScreen_CopyAttrs: lda $E86F,x ; CPU:$E8FF PRG:28FF BD 6F E8 sta $013F,x ; CPU:$E902 PRG:2902 9D 3F 01 dex ; CPU:$E905 PRG:2905 CA - bne Label_E8FF ; CPU:$E906 PRG:2906 D0 F7 + bne EnterTitleScreen_CopyAttrs ; CPU:$E906 PRG:2906 D0 F7 jsr $F867 ; CPU:$E908 PRG:2908 20 67 F8 jsr $E202 ; CPU:$E90B PRG:290B 20 02 E2 jsr $E1F2 ; CPU:$E90E PRG:290E 20 F2 E1 @@ -6612,7 +7310,7 @@ Label_E8FF: lda #$08 ; CPU:$E91F PRG:291F A9 08 sta Zp24 ; CPU:$E921 PRG:2921 85 24 ; ----------------------------------------------------------------------------- -; Routine: Label_E923 +; Routine: TitleScreenLoop ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -6620,11 +7318,11 @@ Label_E8FF: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_E923: +TitleScreenLoop: lda #$00 ; CPU:$E923 PRG:2923 A9 00 sta $01C8 ; CPU:$E925 PRG:2925 8D C8 01 ; ----------------------------------------------------------------------------- -; Routine: Label_E928 +; Routine: TitleScreenLoop_WaitFrame ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -6632,21 +7330,21 @@ Label_E923: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_E928: +TitleScreenLoop_WaitFrame: lda $01C8 ; CPU:$E928 PRG:2928 AD C8 01 - beq Label_E928 ; CPU:$E92B PRG:292B F0 FB + beq TitleScreenLoop_WaitFrame ; CPU:$E92B PRG:292B F0 FB jsr $CD0E ; CPU:$E92D PRG:292D 20 0E CD lda $0180 ; CPU:$E930 PRG:2930 AD 80 01 ora $0182 ; CPU:$E933 PRG:2933 0D 82 01 and #$08 ; CPU:$E936 PRG:2936 29 08 - beq Label_E947 ; CPU:$E938 PRG:2938 F0 0D + beq TitleScreenLoop_Animate ; CPU:$E938 PRG:2938 F0 0D lda #$20 ; CPU:$E93A PRG:293A A9 20 - sta Zp00 ; CPU:$E93C PRG:293C 85 00 + sta timer_lo ; CPU:$E93C PRG:293C 85 00 jsr $C3BC ; CPU:$E93E PRG:293E 20 BC C3 jsr $FA6D ; CPU:$E941 PRG:2941 20 6D FA jmp $E9CA ; CPU:$E944 PRG:2944 4C CA E9 ; ----------------------------------------------------------------------------- -; Routine: Label_E947 +; Routine: TitleScreenLoop_Animate ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -6654,20 +7352,20 @@ Label_E928: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_E947: +TitleScreenLoop_Animate: dec Zp24 ; CPU:$E947 PRG:2947 C6 24 - bne Label_E923 ; CPU:$E949 PRG:2949 D0 D8 + bne TitleScreenLoop ; CPU:$E949 PRG:2949 D0 D8 lda #$08 ; CPU:$E94B PRG:294B A9 08 sta Zp24 ; CPU:$E94D PRG:294D 85 24 jsr $E974 ; CPU:$E94F PRG:294F 20 74 E9 lda Zp25 ; CPU:$E952 PRG:2952 A5 25 sec ; CPU:$E954 PRG:2954 38 sbc #$04 ; CPU:$E955 PRG:2955 E9 04 - bcs Label_E95D ; CPU:$E957 PRG:2957 B0 04 + bcs TitleScreenLoop_SetPalette ; CPU:$E957 PRG:2957 B0 04 eor #$FF ; CPU:$E959 PRG:2959 49 FF adc #$01 ; CPU:$E95B PRG:295B 69 01 ; ----------------------------------------------------------------------------- -; Routine: Label_E95D +; Routine: TitleScreenLoop_SetPalette ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -6675,7 +7373,7 @@ Label_E947: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_E95D: +TitleScreenLoop_SetPalette: tay ; CPU:$E95D PRG:295D A8 lda #$B7 ; CPU:$E95E PRG:295E A9 B7 jsr $FA99 ; CPU:$E960 PRG:2960 20 99 FA @@ -6683,11 +7381,11 @@ Label_E95D: inc Zp25 ; CPU:$E965 PRG:2965 E6 25 lda Zp25 ; CPU:$E967 PRG:2967 A5 25 cmp #$08 ; CPU:$E969 PRG:2969 C9 08 - bne Label_E971 ; CPU:$E96B PRG:296B D0 04 + bne TitleScreenLoop_Next ; CPU:$E96B PRG:296B D0 04 lda #$01 ; CPU:$E96D PRG:296D A9 01 sta Zp25 ; CPU:$E96F PRG:296F 85 25 ; ----------------------------------------------------------------------------- -; Routine: Label_E971 +; Routine: TitleScreenLoop_Next ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -6695,10 +7393,10 @@ Label_E95D: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_E971: +TitleScreenLoop_Next: jmp $E923 ; CPU:$E971 PRG:2971 4C 23 E9 ; ----------------------------------------------------------------------------- -; Routine: Label_E974 +; Routine: UpdateTitleColors ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -6706,15 +7404,15 @@ Label_E971: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_E974: +UpdateTitleColors: inc Zp26 ; CPU:$E974 PRG:2974 E6 26 lda Zp26 ; CPU:$E976 PRG:2976 A5 26 cmp #$17 ; CPU:$E978 PRG:2978 C9 17 - bne Label_E980 ; CPU:$E97A PRG:297A D0 04 + bne UpdateTitleColors_Store ; CPU:$E97A PRG:297A D0 04 lda #$00 ; CPU:$E97C PRG:297C A9 00 sta Zp26 ; CPU:$E97E PRG:297E 85 26 ; ----------------------------------------------------------------------------- -; Routine: Label_E980 +; Routine: UpdateTitleColors_Store ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -6722,7 +7420,7 @@ Label_E974: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_E980: +UpdateTitleColors_Store: ldy #$00 ; CPU:$E980 PRG:2980 A0 00 ldx Zp26 ; CPU:$E982 PRG:2982 A6 26 lda $E9A3,x ; CPU:$E984 PRG:2984 BD A3 E9 @@ -6744,11 +7442,16 @@ Label_E980: ; referenced by `lda $E9A3,x` at $E98F (operand $E9A3 falls inside this region) ; referenced by `lda $E9A3,x` at $E99A (operand $E9A3 falls inside this region) ; referenced by `lda $E9B9,x` at $E9CC (operand $E9B9 falls inside this region) +; Colour codes for the title-screen palette cycle. UpdateTitleColors indexes the block with the 23-step counter at Zp26 (0..$16) after passing each code through MapColorCodeToPalette, and writes the result into the $0085-$0087 palette shadow entries; the .byte run holds twenty-two codes, so the final step of the cycle reads the byte at the start of StartGameAttributeRow below. +TitleColorCycleTable: .byte $B1, $B2, $B3, $B4, $B5, $B7, $B6, $B8, $B9, $BA, $BB, $BC, $BB, $BA, $B9, $B8 ; CPU:$E9A3 PRG:29A3 B1 B2 B3 B4 B5 B7 B6 B8 B9 BA BB BC BB BA B9 B8 - .byte $B6, $B7, $B5, $B4, $B3, $B2, $01, $00, $B9, $89, $89, $00, $B0, $8A, $00, $00 ; CPU:$E9B3 PRG:29B3 B6 B7 B5 B4 B3 B2 01 00 B9 89 89 00 B0 8A 00 00 + .byte $B6, $B7, $B5, $B4, $B3, $B2 ; CPU:$E9B3 PRG:29B3 B6 B7 B5 B4 B3 B2 +; StartGame_CopyAttrs reads `lda $E9B9,x` for x = $10 down to 1, so the sixteen attribute bytes it copies into the $0140-$014F shadow are $E9BA-$E9C9; the $B9 at $E9B9 is the dead entry-0 byte of the same base-plus-two convention the tables above use, and doubles as the last step of the title colour cycle. +StartGameAttributeRow: + .byte $01, $00, $B9, $89, $89, $00, $B0, $8A, $00, $00 ; CPU:$E9B9 PRG:29B9 01 00 B9 89 89 00 B0 8A 00 00 .byte $B0, $88, $00, $00, $01, $00, $00 ; CPU:$E9C3 PRG:29C3 B0 88 00 00 01 00 00 ; ----------------------------------------------------------------------------- -; Routine: Label_E9CA +; Routine: StartGame ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -6756,10 +7459,10 @@ Label_E980: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_E9CA: +StartGame: ldx #$10 ; CPU:$E9CA PRG:29CA A2 10 ; ----------------------------------------------------------------------------- -; Routine: Label_E9CC +; Routine: StartGame_CopyAttrs ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -6767,11 +7470,11 @@ Label_E9CA: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_E9CC: +StartGame_CopyAttrs: lda $E9B9,x ; CPU:$E9CC PRG:29CC BD B9 E9 sta $013F,x ; CPU:$E9CF PRG:29CF 9D 3F 01 dex ; CPU:$E9D2 PRG:29D2 CA - bne Label_E9CC ; CPU:$E9D3 PRG:29D3 D0 F7 + bne StartGame_CopyAttrs ; CPU:$E9D3 PRG:29D3 D0 F7 lda #$01 ; CPU:$E9D5 PRG:29D5 A9 01 sta $0187 ; CPU:$E9D7 PRG:29D7 8D 87 01 lda #$03 ; CPU:$E9DA PRG:29DA A9 03 @@ -6787,42 +7490,46 @@ Label_E9CC: ldy #$24 ; CPU:$E9F3 PRG:29F3 A0 24 jsr $CDD3 ; CPU:$E9F5 PRG:29F5 20 D3 CD jsr $CF9B ; CPU:$E9F8 PRG:29F8 20 9B CF +; Inline command list for RunCommandList: three five-byte records ($03 $03 $1B $03 $03, +; $06 $06 $18 $08 $00, $08 $14 $17 $18 $02) and the $FF terminator at $EA0A, left as +; .byte with the tracer's undocumented-opcode annotations. .byte $03, $03 ; CPU:$E9FB PRG:29FB 03 03 -- slo (Zp03,x) (undocumented; ca65 cannot encode) .byte $1B, $03, $03 ; CPU:$E9FD PRG:29FD 1B 03 03 -- slo $0303,y (undocumented; ca65 cannot encode) - asl Zp06 ; CPU:$EA00 PRG:2A00 06 06 - clc ; CPU:$EA02 PRG:2A02 18 - php ; CPU:$EA03 PRG:2A03 08 - brk ; CPU:$EA04 PRG:2A04 00 -; ---- data $EA05-$EBAF (427 bytes) ---- - .byte $08, $14, $17, $18, $02, $FF, $20, $42, $CA, $20, $F2, $E1, $20, $02, $E2, $20 ; CPU:$EA05 PRG:2A05 08 14 17 18 02 FF 20 42 CA 20 F2 E1 20 02 E2 20 - .byte $1A, $E2, $20, $86, $E2, $20, $7D, $FA, $AD, $C7, $01, $0A, $0A, $0A, $0A, $69 ; CPU:$EA15 PRG:2A15 1A E2 20 86 E2 20 7D FA AD C7 01 0A 0A 0A 0A 69 - .byte $5F, $8D, $00, $02, $A9, $F8, $8D, $08, $02, $8D, $04, $02, $8D, $0C, $02, $A2 ; CPU:$EA25 PRG:2A25 5F 8D 00 02 A9 F8 8D 08 02 8D 04 02 8D 0C 02 A2 - .byte $25, $8E, $01, $02, $A9, $00, $8D, $02, $02, $A9, $44, $8D, $03, $02, $A2, $0A ; CPU:$EA35 PRG:2A35 25 8E 01 02 A9 00 8D 02 02 A9 44 8D 03 02 A2 0A - .byte $20, $56, $FF, $A9, $0B, $20, $DA, $C3, $A9, $01, $85, $24, $20, $B9, $CD, $AD ; CPU:$EA45 PRG:2A45 20 56 FF A9 0B 20 DA C3 A9 01 85 24 20 B9 CD AD - .byte $C8, $01, $F0, $F8, $A9, $00, $8D, $C8, $01, $20, $0E, $CD, $AD, $80, $01, $0D ; CPU:$EA55 PRG:2A55 C8 01 F0 F8 A9 00 8D C8 01 20 0E CD AD 80 01 0D - .byte $82, $01, $AA, $29, $08, $F0, $09, $A5, $00, $29, $20, $D0, $09, $4C, $60, $EB ; CPU:$EA65 PRG:2A65 82 01 AA 29 08 F0 09 A5 00 29 20 D0 09 4C 60 EB - .byte $A5, $00, $29, $DF, $85, $00, $8A, $29, $04, $D0, $06, $A9, $00, $85, $00, $F0 ; CPU:$EA75 PRG:2A75 A5 00 29 DF 85 00 8A 29 04 D0 06 A9 00 85 00 F0 - .byte $2B, $A5, $00, $29, $10, $D0, $25, $A9, $10, $85, $00, $EE, $C7, $01, $AD, $C7 ; CPU:$EA85 PRG:2A85 2B A5 00 29 10 D0 25 A9 10 85 00 EE C7 01 AD C7 - .byte $01, $C9, $03, $D0, $05, $A9, $00, $8D, $C7, $01, $AD, $C7, $01, $0A, $0A, $0A ; CPU:$EA95 PRG:2A95 01 C9 03 D0 05 A9 00 8D C7 01 AD C7 01 0A 0A 0A - .byte $0A, $69, $5F, $8D, $00, $02, $20, $67, $F8, $20, $02, $E2, $EE, $C1, $01, $AD ; CPU:$EAA5 PRG:2AA5 0A 69 5F 8D 00 02 20 67 F8 20 02 E2 EE C1 01 AD - .byte $C1, $01, $4A, $4A, $29, $0F, $AA, $BD, $50, $EB, $85, $92, $AD, $80, $01, $0D ; CPU:$EAB5 PRG:2AB5 C1 01 4A 4A 29 0F AA BD 50 EB 85 92 AD 80 01 0D - .byte $82, $01, $AA, $C6, $24, $D0, $41, $A9, $08, $85, $24, $8A, $A0, $01, $29, $20 ; CPU:$EAC5 PRG:2AC5 82 01 AA C6 24 D0 41 A9 08 85 24 8A A0 01 29 20 - .byte $D0, $07, $8A, $29, $10, $F0, $19, $A0, $FF, $98, $18, $6D, $87, $01, $D0, $04 ; CPU:$EAD5 PRG:2AD5 D0 07 8A 29 10 F0 19 A0 FF 98 18 6D 87 01 D0 04 - .byte $A9, $3C, $D0, $06, $C9, $3D, $D0, $02, $A9, $01, $8D, $87, $01, $20, $1A, $E2 ; CPU:$EAE5 PRG:2AE5 A9 3C D0 06 C9 3D D0 02 A9 01 8D 87 01 20 1A E2 - .byte $8A, $29, $80, $F0, $05, $E6, $02, $4C, $06, $EB, $8A, $29, $40, $F0, $09, $C6 ; CPU:$EAF5 PRG:2AF5 8A 29 80 F0 05 E6 02 4C 06 EB 8A 29 40 F0 09 C6 - .byte $02, $20, $86, $E2, $A9, $05, $85, $24, $A5, $02, $C9, $3A, $F0, $03, $4C, $51 ; CPU:$EB05 PRG:2B05 02 20 86 E2 A9 05 85 24 A5 02 C9 3A F0 03 4C 51 - .byte $EA, $AD, $87, $01, $F0, $F8, $C9, $11, $B0, $F4, $AD, $80, $01, $0D, $82, $01 ; CPU:$EB15 PRG:2B15 EA AD 87 01 F0 F8 C9 11 B0 F4 AD 80 01 0D 82 01 - .byte $0D, $81, $01, $0D, $83, $01, $8D, $80, $01, $45, $0A, $2D, $80, $01, $AA, $AD ; CPU:$EB25 PRG:2B25 0D 81 01 0D 83 01 8D 80 01 45 0A 2D 80 01 AA AD - .byte $80, $01, $85, $0A, $8A, $29, $03, $F0, $D5, $48, $20, $BC, $C3, $68, $29, $01 ; CPU:$EB35 PRG:2B35 80 01 85 0A 8A 29 03 F0 D5 48 20 BC C3 68 29 01 - .byte $F0, $CC, $AD, $87, $01, $20, $DA, $C3, $4C, $51, $EA, $09, $0A, $0B, $1B, $2B ; CPU:$EB45 PRG:2B45 F0 CC AD 87 01 20 DA C3 4C 51 EA 09 0A 0B 1B 2B - .byte $3B, $30, $30, $3B, $2B, $1B, $0B, $0A, $09, $FF, $FF, $AD, $87, $01, $8D, $CC ; CPU:$EB55 PRG:2B55 3B 30 30 3B 2B 1B 0B 0A 09 FF FF AD 87 01 8D CC - .byte $01, $A9, $01, $8D, $C4, $01, $A9, $03, $8D, $6A, $03, $8D, $6B, $03, $A9, $00 ; CPU:$EB65 PRG:2B65 01 A9 01 8D C4 01 A9 03 8D 6A 03 8D 6B 03 A9 00 - .byte $8D, $C6, $01, $A2, $0C, $9D, $67, $04, $CA, $D0, $FA, $8D, $C0, $03, $A9, $FF ; CPU:$EB75 PRG:2B75 8D C6 01 A2 0C 9D 67 04 CA D0 FA 8D C0 03 A9 FF - .byte $8D, $C2, $01, $A9, $FD, $8D, $C9, $01, $A9, $E8, $8D, $48, $03, $A9, $C0, $8D ; CPU:$EB85 PRG:2B85 8D C2 01 A9 FD 8D C9 01 A9 E8 8D 48 03 A9 C0 8D - .byte $08, $03, $A9, $30, $8D, $58, $03, $20, $BC, $C3, $A9, $01, $8D, $F8, $03, $AD ; CPU:$EB95 PRG:2B95 08 03 A9 30 8D 58 03 20 BC C3 A9 01 8D F8 03 AD - .byte $C7, $01, $C9, $01, $90, $05, $A9, $02, $8D, $F8, $03 ; CPU:$EBA5 PRG:2BA5 C7 01 C9 01 90 05 A9 02 8D F8 03 +; ---- data $EA00-$EA0A (11 bytes) ---- +; Inline command list consumed by RunCommandList: two five-byte records (column, row, tile, unused, count) terminated by $FF. +TitleCommandList: + .byte $06, $06, $18, $08, $00, $08, $14, $17, $18, $02, $FF ; CPU:$EA00 PRG:2A00 06 06 18 08 00 08 14 17 18 02 FF + jsr $CA42 ; CPU:$EA0B PRG:2A0B 20 42 CA + jsr $E1F2 ; CPU:$EA0E PRG:2A0E 20 F2 E1 + jsr $E202 ; CPU:$EA11 PRG:2A11 20 02 E2 + jsr $E21A ; CPU:$EA14 PRG:2A14 20 1A E2 + jsr $E286 ; CPU:$EA17 PRG:2A17 20 86 E2 + jsr $FA7D ; CPU:$EA1A PRG:2A1A 20 7D FA + lda $01C7 ; CPU:$EA1D PRG:2A1D AD C7 01 + asl a ; CPU:$EA20 PRG:2A20 0A + asl a ; CPU:$EA21 PRG:2A21 0A + asl a ; CPU:$EA22 PRG:2A22 0A + asl a ; CPU:$EA23 PRG:2A23 0A + adc #$5F ; CPU:$EA24 PRG:2A24 69 5F + sta $0200 ; CPU:$EA26 PRG:2A26 8D 00 02 + lda #$F8 ; CPU:$EA29 PRG:2A29 A9 F8 + sta $0208 ; CPU:$EA2B PRG:2A2B 8D 08 02 + sta $0204 ; CPU:$EA2E PRG:2A2E 8D 04 02 + sta $020C ; CPU:$EA31 PRG:2A31 8D 0C 02 + ldx #$25 ; CPU:$EA34 PRG:2A34 A2 25 + stx $0201 ; CPU:$EA36 PRG:2A36 8E 01 02 + lda #$00 ; CPU:$EA39 PRG:2A39 A9 00 + sta $0202 ; CPU:$EA3B PRG:2A3B 8D 02 02 + lda #$44 ; CPU:$EA3E PRG:2A3E A9 44 + sta $0203 ; CPU:$EA40 PRG:2A40 8D 03 02 + ldx #$0A ; CPU:$EA43 PRG:2A43 A2 0A + jsr $FF56 ; CPU:$EA45 PRG:2A45 20 56 FF + lda #$0B ; CPU:$EA48 PRG:2A48 A9 0B + jsr $C3DA ; CPU:$EA4A PRG:2A4A 20 DA C3 + lda #$01 ; CPU:$EA4D PRG:2A4D A9 01 + sta Zp24 ; CPU:$EA4F PRG:2A4F 85 24 ; ----------------------------------------------------------------------------- -; Routine: Label_EBB0 +; Routine: AimLoop ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -6830,7 +7537,292 @@ Label_E9CC: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_EBB0: +AimLoop: + jsr $CDB9 ; CPU:$EA51 PRG:2A51 20 B9 CD + lda $01C8 ; CPU:$EA54 PRG:2A54 AD C8 01 + beq AimLoop ; CPU:$EA57 PRG:2A57 F0 F8 + lda #$00 ; CPU:$EA59 PRG:2A59 A9 00 + sta $01C8 ; CPU:$EA5B PRG:2A5B 8D C8 01 + jsr $CD0E ; CPU:$EA5E PRG:2A5E 20 0E CD + lda $0180 ; CPU:$EA61 PRG:2A61 AD 80 01 + ora $0182 ; CPU:$EA64 PRG:2A64 0D 82 01 + tax ; CPU:$EA67 PRG:2A67 AA + and #$08 ; CPU:$EA68 PRG:2A68 29 08 + beq AimLoop_NoStart ; CPU:$EA6A PRG:2A6A F0 09 + lda timer_lo ; CPU:$EA6C PRG:2A6C A5 00 + and #$20 ; CPU:$EA6E PRG:2A6E 29 20 + bne AimLoop_CheckSelect ; CPU:$EA70 PRG:2A70 D0 09 + jmp $EB60 ; CPU:$EA72 PRG:2A72 4C 60 EB +; ----------------------------------------------------------------------------- +; Routine: AimLoop_NoStart +; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. +; Local: Continues its parent routine along the condition or operation encoded in this label, +; then returns, branches again, or rejoins shared code as documented by the instructions. +; Parameters: Undetermined in Pass 1 unless implied by the caller. +; Returns: Undetermined in Pass 1; status flags and registers may carry results. +; Clobbers: Undetermined in Pass 1. +; ----------------------------------------------------------------------------- +AimLoop_NoStart: + lda timer_lo ; CPU:$EA75 PRG:2A75 A5 00 + and #$DF ; CPU:$EA77 PRG:2A77 29 DF + sta timer_lo ; CPU:$EA79 PRG:2A79 85 00 +; ----------------------------------------------------------------------------- +; Routine: AimLoop_CheckSelect +; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. +; Local: Continues its parent routine along the condition or operation encoded in this label, +; then returns, branches again, or rejoins shared code as documented by the instructions. +; Parameters: Undetermined in Pass 1 unless implied by the caller. +; Returns: Undetermined in Pass 1; status flags and registers may carry results. +; Clobbers: Undetermined in Pass 1. +; ----------------------------------------------------------------------------- +AimLoop_CheckSelect: + txa ; CPU:$EA7B PRG:2A7B 8A + and #$04 ; CPU:$EA7C PRG:2A7C 29 04 + bne AimLoop_CyclePlayers ; CPU:$EA7E PRG:2A7E D0 06 + lda #$00 ; CPU:$EA80 PRG:2A80 A9 00 + sta timer_lo ; CPU:$EA82 PRG:2A82 85 00 + beq AimLoop_Update ; CPU:$EA84 PRG:2A84 F0 2B +; ----------------------------------------------------------------------------- +; Routine: AimLoop_CyclePlayers +; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. +; Local: Continues its parent routine along the condition or operation encoded in this label, +; then returns, branches again, or rejoins shared code as documented by the instructions. +; Parameters: Undetermined in Pass 1 unless implied by the caller. +; Returns: Undetermined in Pass 1; status flags and registers may carry results. +; Clobbers: Undetermined in Pass 1. +; ----------------------------------------------------------------------------- +AimLoop_CyclePlayers: + lda timer_lo ; CPU:$EA86 PRG:2A86 A5 00 + and #$10 ; CPU:$EA88 PRG:2A88 29 10 + bne AimLoop_Update ; CPU:$EA8A PRG:2A8A D0 25 + lda #$10 ; CPU:$EA8C PRG:2A8C A9 10 + sta timer_lo ; CPU:$EA8E PRG:2A8E 85 00 + inc $01C7 ; CPU:$EA90 PRG:2A90 EE C7 01 + lda $01C7 ; CPU:$EA93 PRG:2A93 AD C7 01 + cmp #$03 ; CPU:$EA96 PRG:2A96 C9 03 + bne AimLoop_UpdatePlayers ; CPU:$EA98 PRG:2A98 D0 05 +; ---- data $EA9A-$EA9E (5 bytes) ---- + .byte $A9, $00, $8D, $C7, $01 ; CPU:$EA9A PRG:2A9A A9 00 8D C7 01 +; ----------------------------------------------------------------------------- +; Routine: AimLoop_UpdatePlayers +; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. +; Local: Continues its parent routine along the condition or operation encoded in this label, +; then returns, branches again, or rejoins shared code as documented by the instructions. +; Parameters: Undetermined in Pass 1 unless implied by the caller. +; Returns: Undetermined in Pass 1; status flags and registers may carry results. +; Clobbers: Undetermined in Pass 1. +; ----------------------------------------------------------------------------- +AimLoop_UpdatePlayers: + lda $01C7 ; CPU:$EA9F PRG:2A9F AD C7 01 + asl a ; CPU:$EAA2 PRG:2AA2 0A + asl a ; CPU:$EAA3 PRG:2AA3 0A + asl a ; CPU:$EAA4 PRG:2AA4 0A + asl a ; CPU:$EAA5 PRG:2AA5 0A + adc #$5F ; CPU:$EAA6 PRG:2AA6 69 5F + sta $0200 ; CPU:$EAA8 PRG:2AA8 8D 00 02 + jsr $F867 ; CPU:$EAAB PRG:2AAB 20 67 F8 + jsr $E202 ; CPU:$EAAE PRG:2AAE 20 02 E2 +; ----------------------------------------------------------------------------- +; Routine: AimLoop_Update +; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. +; Local: Continues its parent routine along the condition or operation encoded in this label, +; then returns, branches again, or rejoins shared code as documented by the instructions. +; Parameters: Undetermined in Pass 1 unless implied by the caller. +; Returns: Undetermined in Pass 1; status flags and registers may carry results. +; Clobbers: Undetermined in Pass 1. +; ----------------------------------------------------------------------------- +AimLoop_Update: + inc $01C1 ; CPU:$EAB1 PRG:2AB1 EE C1 01 + lda $01C1 ; CPU:$EAB4 PRG:2AB4 AD C1 01 + lsr a ; CPU:$EAB7 PRG:2AB7 4A + lsr a ; CPU:$EAB8 PRG:2AB8 4A + and #$0F ; CPU:$EAB9 PRG:2AB9 29 0F + tax ; CPU:$EABB PRG:2ABB AA + lda $EB50,x ; CPU:$EABC PRG:2ABC BD 50 EB + sta Zp92 ; CPU:$EABF PRG:2ABF 85 92 + lda $0180 ; CPU:$EAC1 PRG:2AC1 AD 80 01 + ora $0182 ; CPU:$EAC4 PRG:2AC4 0D 82 01 + tax ; CPU:$EAC7 PRG:2AC7 AA + dec Zp24 ; CPU:$EAC8 PRG:2AC8 C6 24 + bne AimLoop_FireCheck ; CPU:$EACA PRG:2ACA D0 41 + lda #$08 ; CPU:$EACC PRG:2ACC A9 08 + sta Zp24 ; CPU:$EACE PRG:2ACE 85 24 + txa ; CPU:$EAD0 PRG:2AD0 8A + ldy #$01 ; CPU:$EAD1 PRG:2AD1 A0 01 + and #$20 ; CPU:$EAD3 PRG:2AD3 29 20 + bne AimLoop_AdjustStage ; CPU:$EAD5 PRG:2AD5 D0 07 + txa ; CPU:$EAD7 PRG:2AD7 8A + and #$10 ; CPU:$EAD8 PRG:2AD8 29 10 + beq AimLoop_IncreasePower ; CPU:$EADA PRG:2ADA F0 19 +; ---- data $EADC-$EADD (2 bytes) ---- + .byte $A0, $FF ; CPU:$EADC PRG:2ADC A0 FF +; ----------------------------------------------------------------------------- +; Routine: AimLoop_AdjustStage +; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. +; Local: Continues its parent routine along the condition or operation encoded in this label, +; then returns, branches again, or rejoins shared code as documented by the instructions. +; Parameters: Undetermined in Pass 1 unless implied by the caller. +; Returns: Undetermined in Pass 1; status flags and registers may carry results. +; Clobbers: Undetermined in Pass 1. +; ----------------------------------------------------------------------------- +AimLoop_AdjustStage: + tya ; CPU:$EADE PRG:2ADE 98 + clc ; CPU:$EADF PRG:2ADF 18 + adc $0187 ; CPU:$EAE0 PRG:2AE0 6D 87 01 + bne AimLoop_ClampStage ; CPU:$EAE3 PRG:2AE3 D0 04 +; ---- data $EAE5-$EAE8 (4 bytes) ---- + .byte $A9, $3C, $D0, $06 ; CPU:$EAE5 PRG:2AE5 A9 3C D0 06 +; ----------------------------------------------------------------------------- +; Routine: AimLoop_ClampStage +; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. +; Local: Continues its parent routine along the condition or operation encoded in this label, +; then returns, branches again, or rejoins shared code as documented by the instructions. +; Parameters: Undetermined in Pass 1 unless implied by the caller. +; Returns: Undetermined in Pass 1; status flags and registers may carry results. +; Clobbers: Undetermined in Pass 1. +; ----------------------------------------------------------------------------- +AimLoop_ClampStage: + cmp #$3D ; CPU:$EAE9 PRG:2AE9 C9 3D + bne AimLoop_StoreStage ; CPU:$EAEB PRG:2AEB D0 02 +; ---- data $EAED-$EAEE (2 bytes) ---- + .byte $A9, $01 ; CPU:$EAED PRG:2AED A9 01 +; ----------------------------------------------------------------------------- +; Routine: AimLoop_StoreStage +; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. +; Local: Continues its parent routine along the condition or operation encoded in this label, +; then returns, branches again, or rejoins shared code as documented by the instructions. +; Parameters: Undetermined in Pass 1 unless implied by the caller. +; Returns: Undetermined in Pass 1; status flags and registers may carry results. +; Clobbers: Undetermined in Pass 1. +; ----------------------------------------------------------------------------- +AimLoop_StoreStage: + sta $0187 ; CPU:$EAEF PRG:2AEF 8D 87 01 + jsr $E21A ; CPU:$EAF2 PRG:2AF2 20 1A E2 +; ----------------------------------------------------------------------------- +; Routine: AimLoop_IncreasePower +; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. +; Local: Continues its parent routine along the condition or operation encoded in this label, +; then returns, branches again, or rejoins shared code as documented by the instructions. +; Parameters: Undetermined in Pass 1 unless implied by the caller. +; Returns: Undetermined in Pass 1; status flags and registers may carry results. +; Clobbers: Undetermined in Pass 1. +; ----------------------------------------------------------------------------- +AimLoop_IncreasePower: + txa ; CPU:$EAF5 PRG:2AF5 8A + and #$80 ; CPU:$EAF6 PRG:2AF6 29 80 + beq AimLoop_DecreasePower ; CPU:$EAF8 PRG:2AF8 F0 05 + inc Zp02 ; CPU:$EAFA PRG:2AFA E6 02 + jmp $EB06 ; CPU:$EAFC PRG:2AFC 4C 06 EB +; ----------------------------------------------------------------------------- +; Routine: AimLoop_DecreasePower +; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. +; Local: Continues its parent routine along the condition or operation encoded in this label, +; then returns, branches again, or rejoins shared code as documented by the instructions. +; Parameters: Undetermined in Pass 1 unless implied by the caller. +; Returns: Undetermined in Pass 1; status flags and registers may carry results. +; Clobbers: Undetermined in Pass 1. +; ----------------------------------------------------------------------------- +AimLoop_DecreasePower: + txa ; CPU:$EAFF PRG:2AFF 8A + and #$40 ; CPU:$EB00 PRG:2B00 29 40 + beq AimLoop_FireCheck ; CPU:$EB02 PRG:2B02 F0 09 +; ---- data $EB04-$EB05 (2 bytes) ---- + .byte $C6, $02 ; CPU:$EB04 PRG:2B04 C6 02 +; ----------------------------------------------------------------------------- +; Routine: AimLoop_UpdatePower +; Global: Refreshes the power-meter display after the power value changed. +; Local: Shared entry of the aiming loop: redraws the power readout and re-arms the input +; repeat timer before testing the fire button. +; Parameters: none. +; Returns: Falls through into AimLoop_FireCheck. +; Clobbers: A, X, Y, Zp24. +; ----------------------------------------------------------------------------- +AimLoop_UpdatePower: + jsr $E286 ; CPU:$EB06 PRG:2B06 20 86 E2 + lda #$05 ; CPU:$EB09 PRG:2B09 A9 05 + sta Zp24 ; CPU:$EB0B PRG:2B0B 85 24 +; ----------------------------------------------------------------------------- +; Routine: AimLoop_FireCheck +; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. +; Local: Continues its parent routine along the condition or operation encoded in this label, +; then returns, branches again, or rejoins shared code as documented by the instructions. +; Parameters: Undetermined in Pass 1 unless implied by the caller. +; Returns: Undetermined in Pass 1; status flags and registers may carry results. +; Clobbers: Undetermined in Pass 1. +; ----------------------------------------------------------------------------- +AimLoop_FireCheck: + lda Zp02 ; CPU:$EB0D PRG:2B0D A5 02 + cmp #$3A ; CPU:$EB0F PRG:2B0F C9 3A + beq *+$05 ; CPU:$EB11 PRG:2B11 F0 03 + jmp $EA51 ; CPU:$EB13 PRG:2B13 4C 51 EA +; ---- data $EB16-$EB5F (74 bytes) ---- + .byte $AD, $87, $01, $F0, $F8, $C9, $11, $B0, $F4, $AD, $80, $01, $0D, $82, $01, $0D ; CPU:$EB16 PRG:2B16 AD 87 01 F0 F8 C9 11 B0 F4 AD 80 01 0D 82 01 0D + .byte $81, $01, $0D, $83, $01, $8D, $80, $01, $45, $0A, $2D, $80, $01, $AA, $AD, $80 ; CPU:$EB26 PRG:2B26 81 01 0D 83 01 8D 80 01 45 0A 2D 80 01 AA AD 80 + .byte $01, $85, $0A, $8A, $29, $03, $F0, $D5, $48, $20, $BC, $C3, $68, $29, $01, $F0 ; CPU:$EB36 PRG:2B36 01 85 0A 8A 29 03 F0 D5 48 20 BC C3 68 29 01 F0 + .byte $CC, $AD, $87, $01, $20, $DA, $C3, $4C, $51, $EA, $09, $0A, $0B, $1B, $2B, $3B ; CPU:$EB46 PRG:2B46 CC AD 87 01 20 DA C3 4C 51 EA 09 0A 0B 1B 2B 3B + .byte $30, $30, $3B, $2B, $1B, $0B, $0A, $09, $FF, $FF ; CPU:$EB56 PRG:2B56 30 30 3B 2B 1B 0B 0A 09 FF FF +; ----------------------------------------------------------------------------- +; Routine: SetupRound +; Global: Starts a round - latches the stage and initialises the round scratch state. +; Local: Copies the stage number to $01CC, sets the player flag and clears the per-round +; arrays before the game loop is re-entered. +; Parameters: $0187 = stage number, $01C7 = player count. +; Returns: Returns to the calling game loop. +; Clobbers: A, X, Y, $01C4-$01CC, $036A/$036B. +; ----------------------------------------------------------------------------- +SetupRound: + lda $0187 ; CPU:$EB60 PRG:2B60 AD 87 01 + sta $01CC ; CPU:$EB63 PRG:2B63 8D CC 01 + lda #$01 ; CPU:$EB66 PRG:2B66 A9 01 + sta $01C4 ; CPU:$EB68 PRG:2B68 8D C4 01 + lda #$03 ; CPU:$EB6B PRG:2B6B A9 03 + sta $036A ; CPU:$EB6D PRG:2B6D 8D 6A 03 + sta $036B ; CPU:$EB70 PRG:2B70 8D 6B 03 + lda #$00 ; CPU:$EB73 PRG:2B73 A9 00 + sta $01C6 ; CPU:$EB75 PRG:2B75 8D C6 01 + ldx #$0C ; CPU:$EB78 PRG:2B78 A2 0C +; ----------------------------------------------------------------------------- +; Routine: ClearRoundState +; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. +; Local: Continues its parent routine along the condition or operation encoded in this label, +; then returns, branches again, or rejoins shared code as documented by the instructions. +; Parameters: Undetermined in Pass 1 unless implied by the caller. +; Returns: Undetermined in Pass 1; status flags and registers may carry results. +; Clobbers: Undetermined in Pass 1. +; ----------------------------------------------------------------------------- +ClearRoundState: + sta $0467,x ; CPU:$EB7A PRG:2B7A 9D 67 04 + dex ; CPU:$EB7D PRG:2B7D CA + bne ClearRoundState ; CPU:$EB7E PRG:2B7E D0 FA + sta $03C0 ; CPU:$EB80 PRG:2B80 8D C0 03 + lda #$FF ; CPU:$EB83 PRG:2B83 A9 FF + sta $01C2 ; CPU:$EB85 PRG:2B85 8D C2 01 + lda #$FD ; CPU:$EB88 PRG:2B88 A9 FD + sta $01C9 ; CPU:$EB8A PRG:2B8A 8D C9 01 + lda #$E8 ; CPU:$EB8D PRG:2B8D A9 E8 + sta $0348 ; CPU:$EB8F PRG:2B8F 8D 48 03 + lda #$C0 ; CPU:$EB92 PRG:2B92 A9 C0 + sta $0308 ; CPU:$EB94 PRG:2B94 8D 08 03 + lda #$30 ; CPU:$EB97 PRG:2B97 A9 30 + sta $0358 ; CPU:$EB99 PRG:2B99 8D 58 03 + jsr $C3BC ; CPU:$EB9C PRG:2B9C 20 BC C3 + lda #$01 ; CPU:$EB9F PRG:2B9F A9 01 + sta $03F8 ; CPU:$EBA1 PRG:2BA1 8D F8 03 + lda $01C7 ; CPU:$EBA4 PRG:2BA4 AD C7 01 + cmp #$01 ; CPU:$EBA7 PRG:2BA7 C9 01 + bcc DrawStageBanner ; CPU:$EBA9 PRG:2BA9 90 05 + lda #$02 ; CPU:$EBAB PRG:2BAB A9 02 + sta $03F8 ; CPU:$EBAD PRG:2BAD 8D F8 03 +; ----------------------------------------------------------------------------- +; Routine: DrawStageBanner +; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. +; Local: Continues its parent routine along the condition or operation encoded in this label, +; then returns, branches again, or rejoins shared code as documented by the instructions. +; Parameters: Undetermined in Pass 1 unless implied by the caller. +; Returns: Undetermined in Pass 1; status flags and registers may carry results. +; Clobbers: Undetermined in Pass 1. +; ----------------------------------------------------------------------------- +DrawStageBanner: ldx $01C6 ; CPU:$EBB0 PRG:2BB0 AE C6 01 lda $0368,x ; CPU:$EBB3 PRG:2BB3 BD 68 03 sta $01C3 ; CPU:$EBB6 PRG:2BB6 8D C3 01 @@ -6851,40 +7843,48 @@ Label_EBB0: lda $0187 ; CPU:$EBDE PRG:2BDE AD 87 01 jsr $E2FE ; CPU:$EBE1 PRG:2BE1 20 FE E2 lda #$21 ; CPU:$EBE4 PRG:2BE4 A9 21 - sta $2006 ; CPU:$EBE6 PRG:2BE6 8D 06 20 + sta PPUADDR ; CPU:$EBE6 PRG:2BE6 8D 06 20 lda #$C9 ; CPU:$EBE9 PRG:2BE9 A9 C9 - sta $2006 ; CPU:$EBEB PRG:2BEB 8D 06 20 + sta PPUADDR ; CPU:$EBEB PRG:2BEB 8D 06 20 jsr $CBC9 ; CPU:$EBEE PRG:2BEE 20 C9 CB .byte $73, $74 ; CPU:$EBF1 PRG:2BF1 73 74 -- rra (Zp74),y (undocumented; ca65 cannot encode) - adc (Zp67,x) ; CPU:$EBF3 PRG:2BF3 61 67 - adc Zp3B ; CPU:$EBF5 PRG:2BF5 65 3B - brk ; CPU:$EBF7 PRG:2BF7 00 -; ---- data $EBF8-$ED4E (343 bytes) ---- -; referenced by `lda $ED3E,x` at $E848 (operand $ED3E falls inside this region) - .byte $A5, $0D, $8D, $07, $20, $A5, $0E, $8D, $07, $20, $20, $C9, $CB, $3B, $73, $74 ; CPU:$EBF8 PRG:2BF8 A5 0D 8D 07 20 A5 0E 8D 07 20 20 C9 CB 3B 73 74 - .byte $61, $72, $74, $00, $20, $42, $CA, $A9, $02, $8D, $42, $01, $A9, $00, $8D, $46 ; CPU:$EC08 PRG:2C08 61 72 74 00 20 42 CA A9 02 8D 42 01 A9 00 8D 46 - .byte $01, $8D, $47, $01, $20, $7D, $FA, $A2, $28, $20, $56, $FF, $20, $6D, $FA, $4C ; CPU:$EC18 PRG:2C18 01 8D 47 01 20 7D FA A2 28 20 56 FF 20 6D FA 4C - .byte $3A, $EC, $00, $01, $02, $03, $00, $01, $02, $00, $00, $01, $02, $05, $00, $01 ; CPU:$EC28 PRG:2C28 3A EC 00 01 02 03 00 01 02 00 00 01 02 05 00 01 - .byte $02, $04, $A2, $10, $BD, $29, $EC, $9D, $3F, $01, $CA, $D0, $F7, $A9, $03, $8D ; CPU:$EC38 PRG:2C38 02 04 A2 10 BD 29 EC 9D 3F 01 CA D0 F7 A9 03 8D - .byte $43, $01, $AD, $87, $01, $29, $03, $18, $69, $06, $8D, $47, $01, $20, $21, $CA ; CPU:$EC48 PRG:2C48 43 01 AD 87 01 29 03 18 69 06 8D 47 01 20 21 CA - .byte $20, $35, $CE, $20, $21, $CA, $A9, $0A, $8D, $8A, $01, $20, $B9, $CD, $29, $1F ; CPU:$EC58 PRG:2C58 20 35 CE 20 21 CA A9 0A 8D 8A 01 20 B9 CD 29 1F - .byte $AA, $8E, $89, $01, $20, $B9, $CD, $29, $1F, $A8, $8C, $88, $01, $20, $97, $F8 ; CPU:$EC68 PRG:2C68 AA 8E 89 01 20 B9 CD 29 1F A8 8C 88 01 20 97 F8 - .byte $CE, $8A, $01, $D0, $E6, $A2, $20, $A0, $00, $20, $A9, $CB, $20, $AE, $CA, $AD ; CPU:$EC78 PRG:2C78 CE 8A 01 D0 E6 A2 20 A0 00 20 A9 CB 20 AE CA AD - .byte $07, $20, $AA, $C9, $DE, $D0, $1F, $20, $B9, $CD, $C9, $60, $90, $18, $E8, $C9 ; CPU:$EC88 PRG:2C88 07 20 AA C9 DE D0 1F 20 B9 CD C9 60 90 18 E8 C9 - .byte $D0, $90, $07, $CA, $CA, $C9, $F0, $90, $01, $CA, $20, $A3, $CA, $8E, $07, $20 ; CPU:$EC98 PRG:2C98 D0 90 07 CA CA C9 F0 90 01 CA 20 A3 CA 8E 07 20 - .byte $20, $AE, $CA, $AD, $07, $20, $20, $5F, $CB, $A5, $FC, $C9, $C0, $D0, $D0, $A5 ; CPU:$ECA8 PRG:2CA8 20 AE CA AD 07 20 20 5F CB A5 FC C9 C0 D0 D0 A5 - .byte $FD, $C9, $23, $D0, $CA, $AD, $C7, $01, $C9, $02, $D0, $0F, $A9, $20, $8D, $06 ; CPU:$ECB8 PRG:2CB8 FD C9 23 D0 CA AD C7 01 C9 02 D0 0F A9 20 8D 06 - .byte $20, $A9, $82, $8D, $06, $20, $A9, $43, $8D, $07, $20, $A2, $08, $A9, $00, $9D ; CPU:$ECC8 PRG:2CC8 20 A9 82 8D 06 20 A9 43 8D 07 20 A2 08 A9 00 9D - .byte $FF, $02, $CA, $D0, $F8, $A9, $00, $8D, $8F, $01, $20, $36, $D5, $A0, $00, $20 ; CPU:$ECD8 PRG:2CD8 FF 02 CA D0 F8 A9 00 8D 8F 01 20 36 D5 A0 00 20 - .byte $14, $CE, $99, $90, $01, $F0, $03, $EE, $8F, $01, $A2, $FE, $20, $61, $CB, $C8 ; CPU:$ECE8 PRG:2CE8 14 CE 99 90 01 F0 03 EE 8F 01 A2 FE 20 61 CB C8 - .byte $20, $14, $CE, $99, $90, $01, $20, $61, $CB, $C8, $C0, $10, $D0, $E1, $CE, $8F ; CPU:$ECF8 PRG:2CF8 20 14 CE 99 90 01 20 61 CB C8 C0 10 D0 E1 CE 8F - .byte $01, $20, $42, $CA, $AD, $C7, $01, $C9, $01, $90, $03, $20, $E5, $E1, $20, $7D ; CPU:$ED08 PRG:2D08 01 20 42 CA AD C7 01 C9 01 90 03 20 E5 E1 20 7D - .byte $FA, $A9, $01, $8D, $CB, $01, $A9, $0D, $20, $DA, $C3, $A2, $02, $20, $74, $F6 ; CPU:$ED18 PRG:2D18 FA A9 01 8D CB 01 A9 0D 20 DA C3 A2 02 20 74 F6 - .byte $A2, $0A, $20, $56, $FF, $A9, $0C, $20, $DA, $C3, $AD, $C7, $01, $C9, $01, $90 ; CPU:$ED28 PRG:2D28 A2 0A 20 56 FF A9 0C 20 DA C3 AD C7 01 C9 01 90 - .byte $16, $20, $7A, $F7, $4C, $4F, $ED, $FF, $30, $10, $11, $FF, $30, $18, $19, $FF ; CPU:$ED38 PRG:2D38 16 20 7A F7 4C 4F ED FF 30 10 11 FF 30 18 19 FF - .byte $30, $14, $15, $FF, $30, $16, $17 ; CPU:$ED48 PRG:2D48 30 14 15 FF 30 16 17 +; ---- data $EBF3-$EBF7 (5 bytes) ---- + .byte $61, $67, $65, $3B, $00 ; CPU:$EBF3 PRG:2BF3 61 67 65 3B 00 + lda Zp0D ; CPU:$EBF8 PRG:2BF8 A5 0D + sta $2007 ; CPU:$EBFA PRG:2BFA 8D 07 20 + lda Zp0E ; CPU:$EBFD PRG:2BFD A5 0E + sta $2007 ; CPU:$EBFF PRG:2BFF 8D 07 20 + jsr $CBC9 ; CPU:$EC02 PRG:2C02 20 C9 CB +; ---- data $EC05-$EC0B (7 bytes) ---- + .byte $3B, $73, $74, $61, $72, $74, $00 ; CPU:$EC05 PRG:2C05 3B 73 74 61 72 74 00 + jsr $CA42 ; CPU:$EC0C PRG:2C0C 20 42 CA + lda #$02 ; CPU:$EC0F PRG:2C0F A9 02 + sta $0142 ; CPU:$EC11 PRG:2C11 8D 42 01 + lda #$00 ; CPU:$EC14 PRG:2C14 A9 00 + sta $0146 ; CPU:$EC16 PRG:2C16 8D 46 01 + sta $0147 ; CPU:$EC19 PRG:2C19 8D 47 01 + jsr $FA7D ; CPU:$EC1C PRG:2C1C 20 7D FA + ldx #$28 ; CPU:$EC1F PRG:2C1F A2 28 + jsr $FF56 ; CPU:$EC21 PRG:2C21 20 56 FF + jsr $FA6D ; CPU:$EC24 PRG:2C24 20 6D FA + jmp $EC3A ; CPU:$EC27 PRG:2C27 4C 3A EC +; ---- data $EC2A-$EC39 (16 bytes) ---- +; Sixteen per-column attribute bytes copied into the attribute shadow at $0140-$014F by LoadStageScene_CopyAttrs; the row differs per stage. +StageAttributeTable: + .byte $00, $01, $02, $03, $00, $01, $02, $00, $00, $01, $02, $05, $00, $01, $02, $04 ; CPU:$EC2A PRG:2C2A 00 01 02 03 00 01 02 00 00 01 02 05 00 01 02 04 ; ----------------------------------------------------------------------------- -; Routine: Label_ED4F +; Routine: LoadStageScene +; Global: Installs the per-stage attribute row and then loads the scene. +; Local: Copies the 16-byte per-stage attribute table at $EC2A into the attribute shadow at +; $0140 (one entry per column), then falls into the scene loader. +; Parameters: $0187 = stage number. +; Returns: Returns once the scene has been built. +; Clobbers: A, X, Y, $0140-$014F. +; ----------------------------------------------------------------------------- +LoadStageScene: + ldx #$10 ; CPU:$EC3A PRG:2C3A A2 10 +; ----------------------------------------------------------------------------- +; Routine: LoadStageScene_CopyAttrs ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -6892,15 +7892,229 @@ Label_EBB0: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_ED4F: +LoadStageScene_CopyAttrs: + lda $EC29,x ; CPU:$EC3C PRG:2C3C BD 29 EC + sta $013F,x ; CPU:$EC3F PRG:2C3F 9D 3F 01 + dex ; CPU:$EC42 PRG:2C42 CA + bne LoadStageScene_CopyAttrs ; CPU:$EC43 PRG:2C43 D0 F7 + lda #$03 ; CPU:$EC45 PRG:2C45 A9 03 + sta $0143 ; CPU:$EC47 PRG:2C47 8D 43 01 + lda $0187 ; CPU:$EC4A PRG:2C4A AD 87 01 + and #$03 ; CPU:$EC4D PRG:2C4D 29 03 + clc ; CPU:$EC4F PRG:2C4F 18 + adc #$06 ; CPU:$EC50 PRG:2C50 69 06 + sta $0147 ; CPU:$EC52 PRG:2C52 8D 47 01 + jsr $CA21 ; CPU:$EC55 PRG:2C55 20 21 CA + jsr $CE35 ; CPU:$EC58 PRG:2C58 20 35 CE + jsr $CA21 ; CPU:$EC5B PRG:2C5B 20 21 CA + lda #$0A ; CPU:$EC5E PRG:2C5E A9 0A + sta $018A ; CPU:$EC60 PRG:2C60 8D 8A 01 +; ----------------------------------------------------------------------------- +; Routine: LoadStageScene_PlaceBalls +; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. +; Local: Continues its parent routine along the condition or operation encoded in this label, +; then returns, branches again, or rejoins shared code as documented by the instructions. +; Parameters: Undetermined in Pass 1 unless implied by the caller. +; Returns: Undetermined in Pass 1; status flags and registers may carry results. +; Clobbers: Undetermined in Pass 1. +; ----------------------------------------------------------------------------- +LoadStageScene_PlaceBalls: + jsr $CDB9 ; CPU:$EC63 PRG:2C63 20 B9 CD + and #$1F ; CPU:$EC66 PRG:2C66 29 1F + tax ; CPU:$EC68 PRG:2C68 AA + stx $0189 ; CPU:$EC69 PRG:2C69 8E 89 01 + jsr $CDB9 ; CPU:$EC6C PRG:2C6C 20 B9 CD + and #$1F ; CPU:$EC6F PRG:2C6F 29 1F + tay ; CPU:$EC71 PRG:2C71 A8 + sty $0188 ; CPU:$EC72 PRG:2C72 8C 88 01 + jsr $F897 ; CPU:$EC75 PRG:2C75 20 97 F8 + dec $018A ; CPU:$EC78 PRG:2C78 CE 8A 01 + bne LoadStageScene_PlaceBalls ; CPU:$EC7B PRG:2C7B D0 E6 + ldx #$20 ; CPU:$EC7D PRG:2C7D A2 20 + ldy #$00 ; CPU:$EC7F PRG:2C7F A0 00 + jsr $CBA9 ; CPU:$EC81 PRG:2C81 20 A9 CB + jsr $CAAE ; CPU:$EC84 PRG:2C84 20 AE CA +; ----------------------------------------------------------------------------- +; Routine: LoadStageScene_VaryTiles +; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. +; Local: Continues its parent routine along the condition or operation encoded in this label, +; then returns, branches again, or rejoins shared code as documented by the instructions. +; Parameters: Undetermined in Pass 1 unless implied by the caller. +; Returns: Undetermined in Pass 1; status flags and registers may carry results. +; Clobbers: Undetermined in Pass 1. +; ----------------------------------------------------------------------------- +LoadStageScene_VaryTiles: + lda $2007 ; CPU:$EC87 PRG:2C87 AD 07 20 + tax ; CPU:$EC8A PRG:2C8A AA + cmp #$DE ; CPU:$EC8B PRG:2C8B C9 DE + bne LoadStageScene_VaryTiles_Next ; CPU:$EC8D PRG:2C8D D0 1F + jsr $CDB9 ; CPU:$EC8F PRG:2C8F 20 B9 CD + cmp #$60 ; CPU:$EC92 PRG:2C92 C9 60 + bcc LoadStageScene_VaryTiles_Next ; CPU:$EC94 PRG:2C94 90 18 + inx ; CPU:$EC96 PRG:2C96 E8 + cmp #$D0 ; CPU:$EC97 PRG:2C97 C9 D0 + bcc LoadStageScene_VaryTiles_Write ; CPU:$EC99 PRG:2C99 90 07 + dex ; CPU:$EC9B PRG:2C9B CA + dex ; CPU:$EC9C PRG:2C9C CA + cmp #$F0 ; CPU:$EC9D PRG:2C9D C9 F0 + bcc LoadStageScene_VaryTiles_Write ; CPU:$EC9F PRG:2C9F 90 01 + dex ; CPU:$ECA1 PRG:2CA1 CA +; ----------------------------------------------------------------------------- +; Routine: LoadStageScene_VaryTiles_Write +; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. +; Local: Continues its parent routine along the condition or operation encoded in this label, +; then returns, branches again, or rejoins shared code as documented by the instructions. +; Parameters: Undetermined in Pass 1 unless implied by the caller. +; Returns: Undetermined in Pass 1; status flags and registers may carry results. +; Clobbers: Undetermined in Pass 1. +; ----------------------------------------------------------------------------- +LoadStageScene_VaryTiles_Write: + jsr $CAA3 ; CPU:$ECA2 PRG:2CA2 20 A3 CA + stx $2007 ; CPU:$ECA5 PRG:2CA5 8E 07 20 + jsr $CAAE ; CPU:$ECA8 PRG:2CA8 20 AE CA + lda $2007 ; CPU:$ECAB PRG:2CAB AD 07 20 +; ----------------------------------------------------------------------------- +; Routine: LoadStageScene_VaryTiles_Next +; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. +; Local: Continues its parent routine along the condition or operation encoded in this label, +; then returns, branches again, or rejoins shared code as documented by the instructions. +; Parameters: Undetermined in Pass 1 unless implied by the caller. +; Returns: Undetermined in Pass 1; status flags and registers may carry results. +; Clobbers: Undetermined in Pass 1. +; ----------------------------------------------------------------------------- +LoadStageScene_VaryTiles_Next: + jsr $CB5F ; CPU:$ECAE PRG:2CAE 20 5F CB + lda ppu_addr_lo ; CPU:$ECB1 PRG:2CB1 A5 FC + cmp #$C0 ; CPU:$ECB3 PRG:2CB3 C9 C0 + bne LoadStageScene_VaryTiles ; CPU:$ECB5 PRG:2CB5 D0 D0 + lda ppu_addr_hi ; CPU:$ECB7 PRG:2CB7 A5 FD + cmp #$23 ; CPU:$ECB9 PRG:2CB9 C9 23 + bne LoadStageScene_VaryTiles ; CPU:$ECBB PRG:2CBB D0 CA + lda $01C7 ; CPU:$ECBD PRG:2CBD AD C7 01 + cmp #$02 ; CPU:$ECC0 PRG:2CC0 C9 02 + bne LoadStageScene_LoadLayout ; CPU:$ECC2 PRG:2CC2 D0 0F + lda #$20 ; CPU:$ECC4 PRG:2CC4 A9 20 + sta $2006 ; CPU:$ECC6 PRG:2CC6 8D 06 20 + lda #$82 ; CPU:$ECC9 PRG:2CC9 A9 82 + sta $2006 ; CPU:$ECCB PRG:2CCB 8D 06 20 + lda #$43 ; CPU:$ECCE PRG:2CCE A9 43 + sta $2007 ; CPU:$ECD0 PRG:2CD0 8D 07 20 +; ----------------------------------------------------------------------------- +; Routine: LoadStageScene_LoadLayout +; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. +; Local: Continues its parent routine along the condition or operation encoded in this label, +; then returns, branches again, or rejoins shared code as documented by the instructions. +; Parameters: Undetermined in Pass 1 unless implied by the caller. +; Returns: Undetermined in Pass 1; status flags and registers may carry results. +; Clobbers: Undetermined in Pass 1. +; ----------------------------------------------------------------------------- +LoadStageScene_LoadLayout: + ldx #$08 ; CPU:$ECD3 PRG:2CD3 A2 08 +; ----------------------------------------------------------------------------- +; Routine: LoadStageScene_LoadLayout_Clear +; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. +; Local: Continues its parent routine along the condition or operation encoded in this label, +; then returns, branches again, or rejoins shared code as documented by the instructions. +; Parameters: Undetermined in Pass 1 unless implied by the caller. +; Returns: Undetermined in Pass 1; status flags and registers may carry results. +; Clobbers: Undetermined in Pass 1. +; ----------------------------------------------------------------------------- +LoadStageScene_LoadLayout_Clear: + lda #$00 ; CPU:$ECD5 PRG:2CD5 A9 00 + sta $02FF,x ; CPU:$ECD7 PRG:2CD7 9D FF 02 + dex ; CPU:$ECDA PRG:2CDA CA + bne LoadStageScene_LoadLayout_Clear ; CPU:$ECDB PRG:2CDB D0 F8 + lda #$00 ; CPU:$ECDD PRG:2CDD A9 00 + sta $018F ; CPU:$ECDF PRG:2CDF 8D 8F 01 + jsr $D536 ; CPU:$ECE2 PRG:2CE2 20 36 D5 + ldy #$00 ; CPU:$ECE5 PRG:2CE5 A0 00 +; ----------------------------------------------------------------------------- +; Routine: LoadStageScene_LoadLayout_Loop +; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. +; Local: Continues its parent routine along the condition or operation encoded in this label, +; then returns, branches again, or rejoins shared code as documented by the instructions. +; Parameters: Undetermined in Pass 1 unless implied by the caller. +; Returns: Undetermined in Pass 1; status flags and registers may carry results. +; Clobbers: Undetermined in Pass 1. +; ----------------------------------------------------------------------------- +LoadStageScene_LoadLayout_Loop: + jsr $CE14 ; CPU:$ECE7 PRG:2CE7 20 14 CE + sta $0190,y ; CPU:$ECEA PRG:2CEA 99 90 01 + beq LoadStageScene_LoadLayout_Next ; CPU:$ECED PRG:2CED F0 03 + inc $018F ; CPU:$ECEF PRG:2CEF EE 8F 01 +; ----------------------------------------------------------------------------- +; Routine: LoadStageScene_LoadLayout_Next +; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. +; Local: Continues its parent routine along the condition or operation encoded in this label, +; then returns, branches again, or rejoins shared code as documented by the instructions. +; Parameters: Undetermined in Pass 1 unless implied by the caller. +; Returns: Undetermined in Pass 1; status flags and registers may carry results. +; Clobbers: Undetermined in Pass 1. +; ----------------------------------------------------------------------------- +LoadStageScene_LoadLayout_Next: + ldx #$FE ; CPU:$ECF2 PRG:2CF2 A2 FE + jsr $CB61 ; CPU:$ECF4 PRG:2CF4 20 61 CB + iny ; CPU:$ECF7 PRG:2CF7 C8 + jsr $CE14 ; CPU:$ECF8 PRG:2CF8 20 14 CE + sta $0190,y ; CPU:$ECFB PRG:2CFB 99 90 01 + jsr $CB61 ; CPU:$ECFE PRG:2CFE 20 61 CB + iny ; CPU:$ED01 PRG:2D01 C8 + cpy #$10 ; CPU:$ED02 PRG:2D02 C0 10 + bne LoadStageScene_LoadLayout_Loop ; CPU:$ED04 PRG:2D04 D0 E1 + dec $018F ; CPU:$ED06 PRG:2D06 CE 8F 01 + jsr $CA42 ; CPU:$ED09 PRG:2D09 20 42 CA + lda $01C7 ; CPU:$ED0C PRG:2D0C AD C7 01 + cmp #$01 ; CPU:$ED0F PRG:2D0F C9 01 + bcc LoadStageScene_StartPlay ; CPU:$ED11 PRG:2D11 90 03 + jsr $E1E5 ; CPU:$ED13 PRG:2D13 20 E5 E1 +; ----------------------------------------------------------------------------- +; Routine: LoadStageScene_StartPlay +; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. +; Local: Continues its parent routine along the condition or operation encoded in this label, +; then returns, branches again, or rejoins shared code as documented by the instructions. +; Parameters: Undetermined in Pass 1 unless implied by the caller. +; Returns: Undetermined in Pass 1; status flags and registers may carry results. +; Clobbers: Undetermined in Pass 1. +; ----------------------------------------------------------------------------- +LoadStageScene_StartPlay: + jsr $FA7D ; CPU:$ED16 PRG:2D16 20 7D FA + lda #$01 ; CPU:$ED19 PRG:2D19 A9 01 + sta $01CB ; CPU:$ED1B PRG:2D1B 8D CB 01 + lda #$0D ; CPU:$ED1E PRG:2D1E A9 0D + jsr $C3DA ; CPU:$ED20 PRG:2D20 20 DA C3 + ldx #$02 ; CPU:$ED23 PRG:2D23 A2 02 + jsr $F674 ; CPU:$ED25 PRG:2D25 20 74 F6 + ldx #$0A ; CPU:$ED28 PRG:2D28 A2 0A + jsr $FF56 ; CPU:$ED2A PRG:2D2A 20 56 FF + lda #$0C ; CPU:$ED2D PRG:2D2D A9 0C + jsr $C3DA ; CPU:$ED2F PRG:2D2F 20 DA C3 + lda $01C7 ; CPU:$ED32 PRG:2D32 AD C7 01 + cmp #$01 ; CPU:$ED35 PRG:2D35 C9 01 + bcc InitBallSlots ; CPU:$ED37 PRG:2D37 90 16 + jsr $F77A ; CPU:$ED39 PRG:2D39 20 7A F7 + jmp $ED4F ; CPU:$ED3C PRG:2D3C 4C 4F ED +; ---- data $ED3F-$ED4E (16 bytes) ---- +; Four four-byte sprite palette entries ($FF $30 $10 $11 / $FF $30 $18 $19 / $FF $30 $14 $15 / $FF $30 $16 $17) copied into the $0090-$009F palette shadow by Reset_LoadSpritePalettes. +SpritePaletteTable: + .byte $FF, $30, $10, $11, $FF, $30, $18, $19, $FF, $30, $14, $15, $FF, $30, $16, $17 ; CPU:$ED3F PRG:2D3F FF 30 10 11 FF 30 18 19 FF 30 14 15 FF 30 16 17 +; ----------------------------------------------------------------------------- +; Routine: InitBallSlots +; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. +; Local: Continues its parent routine along the condition or operation encoded in this label, +; then returns, branches again, or rejoins shared code as documented by the instructions. +; Parameters: Undetermined in Pass 1 unless implied by the caller. +; Returns: Undetermined in Pass 1; status flags and registers may carry results. +; Clobbers: Undetermined in Pass 1. +; ----------------------------------------------------------------------------- +InitBallSlots: lda #$00 ; CPU:$ED4F PRG:2D4F A9 00 - sta Zp01 ; CPU:$ED51 PRG:2D51 85 01 + sta timer_hi ; CPU:$ED51 PRG:2D51 85 01 lda $018F ; CPU:$ED53 PRG:2D53 AD 8F 01 sta $018E ; CPU:$ED56 PRG:2D56 8D 8E 01 ldy #$00 ; CPU:$ED59 PRG:2D59 A0 00 ldx #$00 ; CPU:$ED5B PRG:2D5B A2 00 ; ----------------------------------------------------------------------------- -; Routine: Label_ED5D +; Routine: InitBallSlots_Loop ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -6908,7 +8122,7 @@ Label_ED4F: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_ED5D: +InitBallSlots_Loop: tya ; CPU:$ED5D PRG:2D5D 98 sta $0310,y ; CPU:$ED5E PRG:2D5E 99 10 03 lda #$00 ; CPU:$ED61 PRG:2D61 A9 00 @@ -6921,12 +8135,12 @@ Label_ED5D: jsr $F998 ; CPU:$ED74 PRG:2D74 20 98 F9 lda $0190,x ; CPU:$ED77 PRG:2D77 BD 90 01 sta $0330,y ; CPU:$ED7A PRG:2D7A 99 30 03 - bne Label_ED86 ; CPU:$ED7D PRG:2D7D D0 07 + bne InitBallSlots_MarkActive ; CPU:$ED7D PRG:2D7D D0 07 lda #$00 ; CPU:$ED7F PRG:2D7F A9 00 sta $0300,y ; CPU:$ED81 PRG:2D81 99 00 03 - beq Label_ED8B ; CPU:$ED84 PRG:2D84 F0 05 + beq InitBallSlots_Next ; CPU:$ED84 PRG:2D84 F0 05 ; ----------------------------------------------------------------------------- -; Routine: Label_ED86 +; Routine: InitBallSlots_MarkActive ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -6934,11 +8148,11 @@ Label_ED5D: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_ED86: +InitBallSlots_MarkActive: lda #$A1 ; CPU:$ED86 PRG:2D86 A9 A1 sta $0300,y ; CPU:$ED88 PRG:2D88 99 00 03 ; ----------------------------------------------------------------------------- -; Routine: Label_ED8B +; Routine: InitBallSlots_Next ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -6946,28 +8160,28 @@ Label_ED86: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_ED8B: +InitBallSlots_Next: inx ; CPU:$ED8B PRG:2D8B E8 lda $0190,x ; CPU:$ED8C PRG:2D8C BD 90 01 sta $0370,y ; CPU:$ED8F PRG:2D8F 99 70 03 inx ; CPU:$ED92 PRG:2D92 E8 iny ; CPU:$ED93 PRG:2D93 C8 cpy #$08 ; CPU:$ED94 PRG:2D94 C0 08 - bne Label_ED5D ; CPU:$ED96 PRG:2D96 D0 C5 + bne InitBallSlots_Loop ; CPU:$ED96 PRG:2D96 D0 C5 lda #$18 ; CPU:$ED98 PRG:2D98 A9 18 - sta Zp00 ; CPU:$ED9A PRG:2D9A 85 00 + sta timer_lo ; CPU:$ED9A PRG:2D9A 85 00 lda $01C2 ; CPU:$ED9C PRG:2D9C AD C2 01 sta $03A0 ; CPU:$ED9F PRG:2D9F 8D A0 03 lda $01C9 ; CPU:$EDA2 PRG:2DA2 AD C9 01 sta $03B0 ; CPU:$EDA5 PRG:2DA5 8D B0 03 lda $01CB ; CPU:$EDA8 PRG:2DA8 AD CB 01 - beq Label_EDB7 ; CPU:$EDAB PRG:2DAB F0 0A + beq InitBallSlots_BeginPlay ; CPU:$EDAB PRG:2DAB F0 0A lda #$01 ; CPU:$EDAD PRG:2DAD A9 01 jsr $C3DA ; CPU:$EDAF PRG:2DAF 20 DA C3 ldx #$02 ; CPU:$EDB2 PRG:2DB2 A2 02 jsr $FF56 ; CPU:$EDB4 PRG:2DB4 20 56 FF ; ----------------------------------------------------------------------------- -; Routine: Label_EDB7 +; Routine: InitBallSlots_BeginPlay ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -6975,10 +8189,10 @@ Label_ED8B: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_EDB7: +InitBallSlots_BeginPlay: jsr $E31D ; CPU:$EDB7 PRG:2DB7 20 1D E3 ; ----------------------------------------------------------------------------- -; Routine: Label_EDBA +; Routine: PlayPhaseLoop ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -6986,11 +8200,11 @@ Label_EDB7: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_EDBA: +PlayPhaseLoop: jsr $CDB9 ; CPU:$EDBA PRG:2DBA 20 B9 CD jsr $CD0E ; CPU:$EDBD PRG:2DBD 20 0E CD lda $01C8 ; CPU:$EDC0 PRG:2DC0 AD C8 01 - beq Label_EDBA ; CPU:$EDC3 PRG:2DC3 F0 F5 + beq PlayPhaseLoop ; CPU:$EDC3 PRG:2DC3 F0 F5 lda #$00 ; CPU:$EDC5 PRG:2DC5 A9 00 sta $01C8 ; CPU:$EDC7 PRG:2DC7 8D C8 01 inc $01C1 ; CPU:$EDCA PRG:2DCA EE C1 01 @@ -7005,19 +8219,19 @@ Label_EDBA: sta Zp8F ; CPU:$EDDD PRG:2DDD 85 8F lda $F772,x ; CPU:$EDDF PRG:2DDF BD 72 F7 sta Zp8B ; CPU:$EDE2 PRG:2DE2 85 8B - lda Zp00 ; CPU:$EDE4 PRG:2DE4 A5 00 + lda timer_lo ; CPU:$EDE4 PRG:2DE4 A5 00 and #$08 ; CPU:$EDE6 PRG:2DE6 29 08 - beq Label_EE30 ; CPU:$EDE8 PRG:2DE8 F0 46 + beq BallPhysicsBegin ; CPU:$EDE8 PRG:2DE8 F0 46 jsr $E01E ; CPU:$EDEA PRG:2DEA 20 1E E0 jsr $E34A ; CPU:$EDED PRG:2DED 20 4A E3 and #$03 ; CPU:$EDF0 PRG:2DF0 29 03 - beq Label_EE2C ; CPU:$EDF2 PRG:2DF2 F0 38 - lda Zp00 ; CPU:$EDF4 PRG:2DF4 A5 00 + beq BallPhysicsBegin_Alt ; CPU:$EDF2 PRG:2DF2 F0 38 + lda timer_lo ; CPU:$EDF4 PRG:2DF4 A5 00 and #$10 ; CPU:$EDF6 PRG:2DF6 29 10 - bne Label_EE30 ; CPU:$EDF8 PRG:2DF8 D0 36 + bne BallPhysicsBegin ; CPU:$EDF8 PRG:2DF8 D0 36 lda $03A0 ; CPU:$EDFA PRG:2DFA AD A0 03 and #$F0 ; CPU:$EDFD PRG:2DFD 29 F0 - beq Label_EE30 ; CPU:$EDFF PRG:2DFF F0 2F + beq BallPhysicsBegin ; CPU:$EDFF PRG:2DFF F0 2F lda #$00 ; CPU:$EE01 PRG:2E01 A9 00 sta $01CB ; CPU:$EE03 PRG:2E03 8D CB 01 lda #$A1 ; CPU:$EE06 PRG:2E06 A9 A1 @@ -7034,10 +8248,10 @@ Label_EDBA: lda #$02 ; CPU:$EE21 PRG:2E21 A9 02 jsr $C3DA ; CPU:$EE23 PRG:2E23 20 DA C3 lda #$07 ; CPU:$EE26 PRG:2E26 A9 07 - sta Zp00 ; CPU:$EE28 PRG:2E28 85 00 - bne Label_EE30 ; CPU:$EE2A PRG:2E2A D0 04 + sta timer_lo ; CPU:$EE28 PRG:2E28 85 00 + bne BallPhysicsBegin ; CPU:$EE2A PRG:2E2A D0 04 ; ----------------------------------------------------------------------------- -; Routine: Label_EE2C +; Routine: BallPhysicsBegin_Alt ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -7045,11 +8259,11 @@ Label_EDBA: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_EE2C: +BallPhysicsBegin_Alt: lda #$08 ; CPU:$EE2C PRG:2E2C A9 08 - sta Zp00 ; CPU:$EE2E PRG:2E2E 85 00 + sta timer_lo ; CPU:$EE2E PRG:2E2E 85 00 ; ----------------------------------------------------------------------------- -; Routine: Label_EE30 +; Routine: BallPhysicsBegin ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -7057,14 +8271,14 @@ Label_EE2C: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_EE30: +BallPhysicsBegin: lda #$02 ; CPU:$EE30 PRG:2E30 A9 02 sta Zp06 ; CPU:$EE32 PRG:2E32 85 06 - lda Zp01 ; CPU:$EE34 PRG:2E34 A5 01 + lda timer_hi ; CPU:$EE34 PRG:2E34 A5 01 and #$90 ; CPU:$EE36 PRG:2E36 29 90 - sta Zp01 ; CPU:$EE38 PRG:2E38 85 01 + sta timer_hi ; CPU:$EE38 PRG:2E38 85 01 ; ----------------------------------------------------------------------------- -; Routine: Label_EE3A +; Routine: BallPhysicsPass ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -7072,11 +8286,11 @@ Label_EE30: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_EE3A: +BallPhysicsPass: lda #$02 ; CPU:$EE3A PRG:2E3A A9 02 sta Zp05 ; CPU:$EE3C PRG:2E3C 85 05 ; ----------------------------------------------------------------------------- -; Routine: Label_EE3E +; Routine: BallPhysicsStep ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -7084,21 +8298,21 @@ Label_EE3A: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_EE3E: - lda Zp01 ; CPU:$EE3E PRG:2E3E A5 01 +BallPhysicsStep: + lda timer_hi ; CPU:$EE3E PRG:2E3E A5 01 and #$F7 ; CPU:$EE40 PRG:2E40 29 F7 - sta Zp01 ; CPU:$EE42 PRG:2E42 85 01 + sta timer_hi ; CPU:$EE42 PRG:2E42 85 01 tax ; CPU:$EE44 PRG:2E44 AA lda Zp02 ; CPU:$EE45 PRG:2E45 A5 02 clc ; CPU:$EE47 PRG:2E47 18 adc Zp03 ; CPU:$EE48 PRG:2E48 65 03 sta Zp03 ; CPU:$EE4A PRG:2E4A 85 03 - bcc Label_EE53 ; CPU:$EE4C PRG:2E4C 90 05 + bcc BallPhysicsStep_Skip ; CPU:$EE4C PRG:2E4C 90 05 txa ; CPU:$EE4E PRG:2E4E 8A ora #$08 ; CPU:$EE4F PRG:2E4F 09 08 - sta Zp01 ; CPU:$EE51 PRG:2E51 85 01 + sta timer_hi ; CPU:$EE51 PRG:2E51 85 01 ; ----------------------------------------------------------------------------- -; Routine: Label_EE53 +; Routine: BallPhysicsStep_Skip ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -7106,11 +8320,11 @@ Label_EE3E: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_EE53: +BallPhysicsStep_Skip: ldy #$00 ; CPU:$EE53 PRG:2E53 A0 00 sty Zp07 ; CPU:$EE55 PRG:2E55 84 07 ; ----------------------------------------------------------------------------- -; Routine: Label_EE57 +; Routine: BallSlotUpdate ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -7118,21 +8332,21 @@ Label_EE53: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_EE57: +BallSlotUpdate: ldy Zp07 ; CPU:$EE57 PRG:2E57 A4 07 lda $0300,y ; CPU:$EE59 PRG:2E59 B9 00 03 tax ; CPU:$EE5C PRG:2E5C AA and #$40 ; CPU:$EE5D PRG:2E5D 29 40 - bne Label_EE6F ; CPU:$EE5F PRG:2E5F D0 0E + bne BallSlotUpdate_Case ; CPU:$EE5F PRG:2E5F D0 0E txa ; CPU:$EE61 PRG:2E61 8A and #$1F ; CPU:$EE62 PRG:2E62 29 1F cmp #$01 ; CPU:$EE64 PRG:2E64 C9 01 - beq Label_EE79 ; CPU:$EE66 PRG:2E66 F0 11 + beq BallSlotUpdate_State1 ; CPU:$EE66 PRG:2E66 F0 11 cmp #$02 ; CPU:$EE68 PRG:2E68 C9 02 - bne Label_EE6F ; CPU:$EE6A PRG:2E6A D0 03 + bne BallSlotUpdate_Case ; CPU:$EE6A PRG:2E6A D0 03 jmp $EF31 ; CPU:$EE6C PRG:2E6C 4C 31 EF ; ----------------------------------------------------------------------------- -; Routine: Label_EE6F +; Routine: BallSlotUpdate_Case ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -7140,12 +8354,12 @@ Label_EE57: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_EE6F: +BallSlotUpdate_Case: cmp #$03 ; CPU:$EE6F PRG:2E6F C9 03 - bne Label_EE76 ; CPU:$EE71 PRG:2E71 D0 03 + bne BallSlotUpdate_Next ; CPU:$EE71 PRG:2E71 D0 03 jmp $EEF0 ; CPU:$EE73 PRG:2E73 4C F0 EE ; ----------------------------------------------------------------------------- -; Routine: Label_EE76 +; Routine: BallSlotUpdate_Next ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -7153,10 +8367,10 @@ Label_EE6F: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_EE76: +BallSlotUpdate_Next: jmp $F206 ; CPU:$EE76 PRG:2E76 4C 06 F2 ; ----------------------------------------------------------------------------- -; Routine: Label_EE79 +; Routine: BallSlotUpdate_State1 ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -7164,12 +8378,12 @@ Label_EE76: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_EE79: +BallSlotUpdate_State1: lda $01CB ; CPU:$EE79 PRG:2E79 AD CB 01 - beq Label_EE80 ; CPU:$EE7C PRG:2E7C F0 02 - bne Label_EEB9 ; CPU:$EE7E PRG:2E7E D0 39 + beq BallLaunch ; CPU:$EE7C PRG:2E7C F0 02 + bne BallAppearAnim ; CPU:$EE7E PRG:2E7E D0 39 ; ----------------------------------------------------------------------------- -; Routine: Label_EE80 +; Routine: BallLaunch ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -7177,18 +8391,18 @@ Label_EE79: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_EE80: +BallLaunch: lda $03C0,y ; CPU:$EE80 PRG:2E80 B9 C0 03 jsr $FF0E ; CPU:$EE83 PRG:2E83 20 0E FF - lda ZpFC ; CPU:$EE86 PRG:2E86 A5 FC + lda ppu_addr_lo ; CPU:$EE86 PRG:2E86 A5 FC sta $0380,y ; CPU:$EE88 PRG:2E88 99 80 03 - lda ZpFD ; CPU:$EE8B PRG:2E8B A5 FD + lda ppu_addr_hi ; CPU:$EE8B PRG:2E8B A5 FD sta $0390,y ; CPU:$EE8D PRG:2E8D 99 90 03 lda $03C0,y ; CPU:$EE90 PRG:2E90 B9 C0 03 jsr $FEA8 ; CPU:$EE93 PRG:2E93 20 A8 FE - lda ZpFC ; CPU:$EE96 PRG:2E96 A5 FC + lda ppu_addr_lo ; CPU:$EE96 PRG:2E96 A5 FC sta $0340,y ; CPU:$EE98 PRG:2E98 99 40 03 - lda ZpFD ; CPU:$EE9B PRG:2E9B A5 FD + lda ppu_addr_hi ; CPU:$EE9B PRG:2E9B A5 FD sta $0350,y ; CPU:$EE9D PRG:2E9D 99 50 03 lda #$02 ; CPU:$EEA0 PRG:2EA0 A9 02 sta $03F0,y ; CPU:$EEA2 PRG:2EA2 99 F0 03 @@ -7201,7 +8415,7 @@ Label_EE80: jsr $F990 ; CPU:$EEB3 PRG:2EB3 20 90 F9 jmp $EF31 ; CPU:$EEB6 PRG:2EB6 4C 31 EF ; ----------------------------------------------------------------------------- -; Routine: Label_EEB9 +; Routine: BallAppearAnim ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -7209,25 +8423,25 @@ Label_EE80: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_EEB9: +BallAppearAnim: lda $0340,y ; CPU:$EEB9 PRG:2EB9 B9 40 03 cmp #$07 ; CPU:$EEBC PRG:2EBC C9 07 - beq Label_EEE6 ; CPU:$EEBE PRG:2EBE F0 26 + beq BallAppearAnim_Done ; CPU:$EEBE PRG:2EBE F0 26 tax ; CPU:$EEC0 PRG:2EC0 AA lda $EEE9,x ; CPU:$EEC1 PRG:2EC1 BD E9 EE sta $0410,y ; CPU:$EEC4 PRG:2EC4 99 10 04 ldx Zp07 ; CPU:$EEC7 PRG:2EC7 A6 07 dec $0350,x ; CPU:$EEC9 PRG:2EC9 DE 50 03 - bne Label_EEE0 ; CPU:$EECC PRG:2ECC D0 12 + bne BallAppearAnim_Next ; CPU:$EECC PRG:2ECC D0 12 lda #$06 ; CPU:$EECE PRG:2ECE A9 06 sta $0350,x ; CPU:$EED0 PRG:2ED0 9D 50 03 inc $0340,x ; CPU:$EED3 PRG:2ED3 FE 40 03 lda $0340,x ; CPU:$EED6 PRG:2ED6 BD 40 03 cmp #$07 ; CPU:$EED9 PRG:2ED9 C9 07 - bne Label_EEE0 ; CPU:$EEDB PRG:2EDB D0 03 + bne BallAppearAnim_Next ; CPU:$EEDB PRG:2EDB D0 03 jsr $F990 ; CPU:$EEDD PRG:2EDD 20 90 F9 ; ----------------------------------------------------------------------------- -; Routine: Label_EEE0 +; Routine: BallAppearAnim_Next ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -7235,12 +8449,12 @@ Label_EEB9: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_EEE0: - lda Zp01 ; CPU:$EEE0 PRG:2EE0 A5 01 +BallAppearAnim_Next: + lda timer_hi ; CPU:$EEE0 PRG:2EE0 A5 01 ora #$40 ; CPU:$EEE2 PRG:2EE2 09 40 - sta Zp01 ; CPU:$EEE4 PRG:2EE4 85 01 + sta timer_hi ; CPU:$EEE4 PRG:2EE4 85 01 ; ----------------------------------------------------------------------------- -; Routine: Label_EEE6 +; Routine: BallAppearAnim_Done ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -7248,13 +8462,15 @@ Label_EEE0: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_EEE6: +BallAppearAnim_Done: jmp $F206 ; CPU:$EEE6 PRG:2EE6 4C 06 F2 ; ---- data $EEE9-$EEEF (7 bytes) ---- ; referenced by `lda $EEE9,x` at $EEC1 (operand $EEE9 falls inside this region) +; Seven per-step values played into $0410+slot while a ball appears, indexed by the ball's animation step at $0340 in BallAppearAnim. +BallAppearTiles: .byte $40, $40, $44, $48, $4C, $50, $54 ; CPU:$EEE9 PRG:2EE9 40 40 44 48 4C 50 54 ; ----------------------------------------------------------------------------- -; Routine: Label_EEF0 +; Routine: BallSinkAnim ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -7262,32 +8478,32 @@ Label_EEE6: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_EEF0: +BallSinkAnim: lda $0340,y ; CPU:$EEF0 PRG:2EF0 B9 40 03 cmp #$07 ; CPU:$EEF3 PRG:2EF3 C9 07 - beq Label_EF27 ; CPU:$EEF5 PRG:2EF5 F0 30 + beq BallSinkAnim_Done ; CPU:$EEF5 PRG:2EF5 F0 30 tax ; CPU:$EEF7 PRG:2EF7 AA lda $EF2A,x ; CPU:$EEF8 PRG:2EF8 BD 2A EF sta $0410,y ; CPU:$EEFB PRG:2EFB 99 10 04 - lda Zp01 ; CPU:$EEFE PRG:2EFE A5 01 + lda timer_hi ; CPU:$EEFE PRG:2EFE A5 01 ora #$20 ; CPU:$EF00 PRG:2F00 09 20 - sta Zp01 ; CPU:$EF02 PRG:2F02 85 01 + sta timer_hi ; CPU:$EF02 PRG:2F02 85 01 ldx Zp07 ; CPU:$EF04 PRG:2F04 A6 07 dec $0350,x ; CPU:$EF06 PRG:2F06 DE 50 03 - bne Label_EF27 ; CPU:$EF09 PRG:2F09 D0 1C + bne BallSinkAnim_Done ; CPU:$EF09 PRG:2F09 D0 1C lda #$06 ; CPU:$EF0B PRG:2F0B A9 06 sta $0350,x ; CPU:$EF0D PRG:2F0D 9D 50 03 inc $0340,x ; CPU:$EF10 PRG:2F10 FE 40 03 lda $0340,x ; CPU:$EF13 PRG:2F13 BD 40 03 cmp #$07 ; CPU:$EF16 PRG:2F16 C9 07 - bne Label_EF27 ; CPU:$EF18 PRG:2F18 D0 0D + bne BallSinkAnim_Done ; CPU:$EF18 PRG:2F18 D0 0D lda #$03 ; CPU:$EF1A PRG:2F1A A9 03 sta $0300,x ; CPU:$EF1C PRG:2F1C 9D 00 03 lda $0310,x ; CPU:$EF1F PRG:2F1F BD 10 03 - beq Label_EF27 ; CPU:$EF22 PRG:2F22 F0 03 + beq BallSinkAnim_Done ; CPU:$EF22 PRG:2F22 F0 03 dec $018E ; CPU:$EF24 PRG:2F24 CE 8E 01 ; ----------------------------------------------------------------------------- -; Routine: Label_EF27 +; Routine: BallSinkAnim_Done ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -7295,13 +8511,15 @@ Label_EEF0: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_EF27: +BallSinkAnim_Done: jmp $F206 ; CPU:$EF27 PRG:2F27 4C 06 F2 ; ---- data $EF2A-$EF30 (7 bytes) ---- ; referenced by `lda $EF2A,x` at $EEF8 (operand $EF2A falls inside this region) +; Seven per-step values played into $0410+slot while a ball sinks, indexed by the ball's animation step at $0340 in BallSinkAnim. +BallSinkTiles: .byte $00, $3C, $38, $34, $30, $2C, $28 ; CPU:$EF2A PRG:2F2A 00 3C 38 34 30 2C 28 ; ----------------------------------------------------------------------------- -; Routine: Label_EF31 +; Routine: BallMove ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -7309,13 +8527,13 @@ Label_EF27: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_EF31: - lda Zp00 ; CPU:$EF31 PRG:2F31 A5 00 +BallMove: + lda timer_lo ; CPU:$EF31 PRG:2F31 A5 00 and #$01 ; CPU:$EF33 PRG:2F33 29 01 - bne Label_EF3A ; CPU:$EF35 PRG:2F35 D0 03 + bne BallMove_Step ; CPU:$EF35 PRG:2F35 D0 03 jmp $F206 ; CPU:$EF37 PRG:2F37 4C 06 F2 ; ----------------------------------------------------------------------------- -; Routine: Label_EF3A +; Routine: BallMove_Step ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -7323,20 +8541,20 @@ Label_EF31: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_EF3A: +BallMove_Step: lda $03A0,y ; CPU:$EF3A PRG:2F3A B9 A0 03 tax ; CPU:$EF3D PRG:2F3D AA - beq Label_EF50 ; CPU:$EF3E PRG:2F3E F0 10 - lda Zp01 ; CPU:$EF40 PRG:2F40 A5 01 + beq BallMove_Stopped ; CPU:$EF3E PRG:2F3E F0 10 + lda timer_hi ; CPU:$EF40 PRG:2F40 A5 01 ora #$02 ; CPU:$EF42 PRG:2F42 09 02 - sta Zp01 ; CPU:$EF44 PRG:2F44 85 01 + sta timer_hi ; CPU:$EF44 PRG:2F44 85 01 txa ; CPU:$EF46 PRG:2F46 8A clc ; CPU:$EF47 PRG:2F47 18 adc $03B0,y ; CPU:$EF48 PRG:2F48 79 B0 03 sta $03B0,y ; CPU:$EF4B PRG:2F4B 99 B0 03 - bcs Label_EF53 ; CPU:$EF4E PRG:2F4E B0 03 + bcs BallMove_Advance ; CPU:$EF4E PRG:2F4E B0 03 ; ----------------------------------------------------------------------------- -; Routine: Label_EF50 +; Routine: BallMove_Stopped ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -7344,10 +8562,10 @@ Label_EF3A: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_EF50: +BallMove_Stopped: jmp $F1F6 ; CPU:$EF50 PRG:2F50 4C F6 F1 ; ----------------------------------------------------------------------------- -; Routine: Label_EF53 +; Routine: BallMove_Advance ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -7355,7 +8573,7 @@ Label_EF50: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_EF53: +BallMove_Advance: lda $0320,y ; CPU:$EF53 PRG:2F53 B9 20 03 clc ; CPU:$EF56 PRG:2F56 18 adc $0340,y ; CPU:$EF57 PRG:2F57 79 40 03 @@ -7372,13 +8590,13 @@ Label_EF53: adc $0390,y ; CPU:$EF71 PRG:2F71 79 90 03 sta Zp1F ; CPU:$EF74 PRG:2F74 85 1F cmp $0370,y ; CPU:$EF76 PRG:2F76 D9 70 03 - bne Label_EF84 ; CPU:$EF79 PRG:2F79 D0 09 + bne BallMove_CheckTile ; CPU:$EF79 PRG:2F79 D0 09 txa ; CPU:$EF7B PRG:2F7B 8A cmp $0330,y ; CPU:$EF7C PRG:2F7C D9 30 03 - bne Label_EF84 ; CPU:$EF7F PRG:2F7F D0 03 + bne BallMove_CheckTile ; CPU:$EF7F PRG:2F7F D0 03 jmp $F1E2 ; CPU:$EF81 PRG:2F81 4C E2 F1 ; ----------------------------------------------------------------------------- -; Routine: Label_EF84 +; Routine: BallMove_CheckTile ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -7386,7 +8604,7 @@ Label_EF53: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_EF84: +BallMove_CheckTile: lda Zp1F ; CPU:$EF84 PRG:2F84 A5 1F lsr a ; CPU:$EF86 PRG:2F86 4A lsr a ; CPU:$EF87 PRG:2F87 4A @@ -7396,16 +8614,16 @@ Label_EF84: lsr a ; CPU:$EF8C PRG:2F8C 4A lsr a ; CPU:$EF8D PRG:2F8D 4A lsr a ; CPU:$EF8E PRG:2F8E 4A - sta ZpFC ; CPU:$EF8F PRG:2F8F 85 FC + sta ppu_addr_lo ; CPU:$EF8F PRG:2F8F 85 FC cmp $03D0,y ; CPU:$EF91 PRG:2F91 D9 D0 03 - bne Label_EFB8 ; CPU:$EF94 PRG:2F94 D0 22 + bne BallMove_ReadTile ; CPU:$EF94 PRG:2F94 D0 22 txa ; CPU:$EF96 PRG:2F96 8A cmp $03E0,y ; CPU:$EF97 PRG:2F97 D9 E0 03 - bne Label_EFB8 ; CPU:$EF9A PRG:2F9A D0 1C + bne BallMove_ReadTile ; CPU:$EF9A PRG:2F9A D0 1C lda $03F0,y ; CPU:$EF9C PRG:2F9C B9 F0 03 sta Zp26 ; CPU:$EF9F PRG:2F9F 85 26 cmp #$02 ; CPU:$EFA1 PRG:2FA1 C9 02 - beq Label_EFB8 ; CPU:$EFA3 PRG:2FA3 F0 13 + beq BallMove_ReadTile ; CPU:$EFA3 PRG:2FA3 F0 13 lda $03D0,y ; CPU:$EFA5 PRG:2FA5 B9 D0 03 sta Zp24 ; CPU:$EFA8 PRG:2FA8 85 24 lda $03E0,y ; CPU:$EFAA PRG:2FAA B9 E0 03 @@ -7413,7 +8631,7 @@ Label_EF84: ldy Zp07 ; CPU:$EFAF PRG:2FAF A4 07 jmp $EFD9 ; CPU:$EFB1 PRG:2FB1 4C D9 EF ; ----------------------------------------------------------------------------- -; Routine: Label_EFB4 +; Routine: BallMove_OffTable ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -7421,11 +8639,11 @@ Label_EF84: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_EFB4: +BallMove_OffTable: lda #$10 ; CPU:$EFB4 PRG:2FB4 A9 10 - bne Label_EFD5 ; CPU:$EFB6 PRG:2FB6 D0 1D + bne BallMove_StoreTile ; CPU:$EFB6 PRG:2FB6 D0 1D ; ----------------------------------------------------------------------------- -; Routine: Label_EFB8 +; Routine: BallMove_ReadTile ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -7433,23 +8651,23 @@ Label_EFB4: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_EFB8: - ldy ZpFC ; CPU:$EFB8 PRG:2FB8 A4 FC +BallMove_ReadTile: + ldy ppu_addr_lo ; CPU:$EFB8 PRG:2FB8 A4 FC sty Zp24 ; CPU:$EFBA PRG:2FBA 84 24 stx Zp25 ; CPU:$EFBC PRG:2FBC 86 25 cpx #$03 ; CPU:$EFBE PRG:2FBE E0 03 - bcc Label_EFB4 ; CPU:$EFC0 PRG:2FC0 90 F2 + bcc BallMove_OffTable ; CPU:$EFC0 PRG:2FC0 90 F2 cpx #$1D ; CPU:$EFC2 PRG:2FC2 E0 1D - bcs Label_EFB4 ; CPU:$EFC4 PRG:2FC4 B0 EE + bcs BallMove_OffTable ; CPU:$EFC4 PRG:2FC4 B0 EE cpy #$08 ; CPU:$EFC6 PRG:2FC6 C0 08 - bcc Label_EFB4 ; CPU:$EFC8 PRG:2FC8 90 EA + bcc BallMove_OffTable ; CPU:$EFC8 PRG:2FC8 90 EA cpy #$1B ; CPU:$EFCA PRG:2FCA C0 1B - bcs Label_EFB4 ; CPU:$EFCC PRG:2FCC B0 E6 + bcs BallMove_OffTable ; CPU:$EFCC PRG:2FCC B0 E6 jsr $FAF9 ; CPU:$EFCE PRG:2FCE 20 F9 FA ldx #$00 ; CPU:$EFD1 PRG:2FD1 A2 00 - lda (ZpFC,x) ; CPU:$EFD3 PRG:2FD3 A1 FC + lda (ppu_addr_lo,x) ; CPU:$EFD3 PRG:2FD3 A1 FC ; ----------------------------------------------------------------------------- -; Routine: Label_EFD5 +; Routine: BallMove_StoreTile ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -7457,11 +8675,11 @@ Label_EFB8: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_EFD5: +BallMove_StoreTile: sta Zp26 ; CPU:$EFD5 PRG:2FD5 85 26 ldy Zp07 ; CPU:$EFD7 PRG:2FD7 A4 07 ; ----------------------------------------------------------------------------- -; Routine: Label_EFD9 +; Routine: BallMove_SubTile ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -7469,23 +8687,23 @@ Label_EFD5: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_EFD9: +BallMove_SubTile: lda Zp1F ; CPU:$EFD9 PRG:2FD9 A5 1F and #$07 ; CPU:$EFDB PRG:2FDB 29 07 - sta ZpF9 ; CPU:$EFDD PRG:2FDD 85 F9 + sta ppu_src_hi ; CPU:$EFDD PRG:2FDD 85 F9 lda Zp1D ; CPU:$EFDF PRG:2FDF A5 1D and #$07 ; CPU:$EFE1 PRG:2FE1 29 07 - sta ZpF8 ; CPU:$EFE3 PRG:2FE3 85 F8 + sta ppu_src_lo ; CPU:$EFE3 PRG:2FE3 85 F8 lda Zp26 ; CPU:$EFE5 PRG:2FE5 A5 26 tax ; CPU:$EFE7 PRG:2FE7 AA and #$10 ; CPU:$EFE8 PRG:2FE8 29 10 - beq Label_F045 ; CPU:$EFEA PRG:2FEA F0 59 - lda Zp00 ; CPU:$EFEC PRG:2FEC A5 00 + beq BallMove_TestTile ; CPU:$EFEA PRG:2FEA F0 59 + lda timer_lo ; CPU:$EFEC PRG:2FEC A5 00 and #$04 ; CPU:$EFEE PRG:2FEE 29 04 - bne Label_EFF5 ; CPU:$EFF0 PRG:2FF0 D0 03 + bne BallPocketed ; CPU:$EFF0 PRG:2FF0 D0 03 jmp $F045 ; CPU:$EFF2 PRG:2FF2 4C 45 F0 ; ----------------------------------------------------------------------------- -; Routine: Label_EFF5 +; Routine: BallPocketed ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -7493,7 +8711,7 @@ Label_EFD9: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_EFF5: +BallPocketed: lda #$83 ; CPU:$EFF5 PRG:2FF5 A9 83 sta $0300,y ; CPU:$EFF7 PRG:2FF7 99 00 03 lda #$00 ; CPU:$EFFA PRG:2FFA A9 00 @@ -7501,15 +8719,15 @@ Label_EFF5: lda #$01 ; CPU:$EFFF PRG:2FFF A9 01 sta $0350,y ; CPU:$F001 PRG:3001 99 50 03 lda $0310,y ; CPU:$F004 PRG:3004 B9 10 03 - bne Label_F037 ; CPU:$F007 PRG:3007 D0 2E - lda Zp01 ; CPU:$F009 PRG:3009 A5 01 + bne BallPocketed_CueBall ; CPU:$F007 PRG:3007 D0 2E + lda timer_hi ; CPU:$F009 PRG:3009 A5 01 ora #$30 ; CPU:$F00B PRG:300B 09 30 - sta Zp01 ; CPU:$F00D PRG:300D 85 01 + sta timer_hi ; CPU:$F00D PRG:300D 85 01 lda #$06 ; CPU:$F00F PRG:300F A9 06 jsr $C3DA ; CPU:$F011 PRG:3011 20 DA C3 jmp $F1F6 ; CPU:$F014 PRG:3014 4C F6 F1 ; ----------------------------------------------------------------------------- -; Routine: Label_F017 +; Routine: SinkRemainingBalls ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -7517,10 +8735,10 @@ Label_EFF5: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_F017: +SinkRemainingBalls: ldy #$00 ; CPU:$F017 PRG:3017 A0 00 ; ----------------------------------------------------------------------------- -; Routine: Label_F019 +; Routine: SinkRemainingBalls_Loop ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -7528,11 +8746,11 @@ Label_F017: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_F019: +SinkRemainingBalls_Loop: lda $0300,y ; CPU:$F019 PRG:3019 B9 00 03 and #$C2 ; CPU:$F01C PRG:301C 29 C2 cmp #$82 ; CPU:$F01E PRG:301E C9 82 - bne Label_F031 ; CPU:$F020 PRG:3020 D0 0F + bne SinkRemainingBalls_Next ; CPU:$F020 PRG:3020 D0 0F lda #$83 ; CPU:$F022 PRG:3022 A9 83 sta $0300,y ; CPU:$F024 PRG:3024 99 00 03 lda #$00 ; CPU:$F027 PRG:3027 A9 00 @@ -7540,7 +8758,7 @@ Label_F019: lda #$01 ; CPU:$F02C PRG:302C A9 01 sta $0350,y ; CPU:$F02E PRG:302E 99 50 03 ; ----------------------------------------------------------------------------- -; Routine: Label_F031 +; Routine: SinkRemainingBalls_Next ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -7548,13 +8766,13 @@ Label_F019: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_F031: +SinkRemainingBalls_Next: iny ; CPU:$F031 PRG:3031 C8 cpy Zp08 ; CPU:$F032 PRG:3032 C4 08 - bne Label_F019 ; CPU:$F034 PRG:3034 D0 E3 + bne SinkRemainingBalls_Loop ; CPU:$F034 PRG:3034 D0 E3 rts ; CPU:$F036 PRG:3036 60 ; ----------------------------------------------------------------------------- -; Routine: Label_F037 +; Routine: BallPocketed_CueBall ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -7562,15 +8780,15 @@ Label_F031: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_F037: - lda Zp01 ; CPU:$F037 PRG:3037 A5 01 +BallPocketed_CueBall: + lda timer_hi ; CPU:$F037 PRG:3037 A5 01 ora #$20 ; CPU:$F039 PRG:3039 09 20 - sta Zp01 ; CPU:$F03B PRG:303B 85 01 + sta timer_hi ; CPU:$F03B PRG:303B 85 01 lda #$07 ; CPU:$F03D PRG:303D A9 07 jsr $C3DA ; CPU:$F03F PRG:303F 20 DA C3 jmp $F1F6 ; CPU:$F042 PRG:3042 4C F6 F1 ; ----------------------------------------------------------------------------- -; Routine: Label_F045 +; Routine: BallMove_TestTile ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -7578,13 +8796,13 @@ Label_F037: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_F045: +BallMove_TestTile: txa ; CPU:$F045 PRG:3045 8A and #$0F ; CPU:$F046 PRG:3046 29 0F - bne Label_F04D ; CPU:$F048 PRG:3048 D0 03 + bne BallBounce ; CPU:$F048 PRG:3048 D0 03 jmp $F1D3 ; CPU:$F04A PRG:304A 4C D3 F1 ; ----------------------------------------------------------------------------- -; Routine: Label_F04D +; Routine: BallBounce ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -7592,24 +8810,24 @@ Label_F045: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_F04D: +BallBounce: lda $0380,y ; CPU:$F04D PRG:304D B9 80 03 - sta ZpFA ; CPU:$F050 PRG:3050 85 FA + sta ptr_lo ; CPU:$F050 PRG:3050 85 FA lda $0390,y ; CPU:$F052 PRG:3052 B9 90 03 - sta ZpFB ; CPU:$F055 PRG:3055 85 FB + sta ptr_hi ; CPU:$F055 PRG:3055 85 FB lda $0340,y ; CPU:$F057 PRG:3057 B9 40 03 - sta ZpFC ; CPU:$F05A PRG:305A 85 FC + sta ppu_addr_lo ; CPU:$F05A PRG:305A 85 FC lda $0350,y ; CPU:$F05C PRG:305C B9 50 03 - sta ZpFD ; CPU:$F05F PRG:305F 85 FD + sta ppu_addr_hi ; CPU:$F05F PRG:305F 85 FD lda Zp26 ; CPU:$F061 PRG:3061 A5 26 and #$C0 ; CPU:$F063 PRG:3063 29 C0 - beq Label_F07E ; CPU:$F065 PRG:3065 F0 17 + beq BallBounce_JumpTable ; CPU:$F065 PRG:3065 F0 17 cmp #$40 ; CPU:$F067 PRG:3067 C9 40 - bne Label_F071 ; CPU:$F069 PRG:3069 D0 06 + bne BallBounce_Test80 ; CPU:$F069 PRG:3069 D0 06 jsr $FF18 ; CPU:$F06B PRG:306B 20 18 FF jmp $F07E ; CPU:$F06E PRG:306E 4C 7E F0 ; ----------------------------------------------------------------------------- -; Routine: Label_F071 +; Routine: BallBounce_Test80 ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -7617,13 +8835,13 @@ Label_F04D: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_F071: +BallBounce_Test80: cmp #$80 ; CPU:$F071 PRG:3071 C9 80 - bne Label_F07B ; CPU:$F073 PRG:3073 D0 06 + bne BallBounce_TestC0 ; CPU:$F073 PRG:3073 D0 06 jsr $FF2B ; CPU:$F075 PRG:3075 20 2B FF jmp $F07E ; CPU:$F078 PRG:3078 4C 7E F0 ; ----------------------------------------------------------------------------- -; Routine: Label_F07B +; Routine: BallBounce_TestC0 ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -7631,10 +8849,10 @@ Label_F071: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_F07B: +BallBounce_TestC0: jsr $FF43 ; CPU:$F07B PRG:307B 20 43 FF ; ----------------------------------------------------------------------------- -; Routine: Label_F07E +; Routine: BallBounce_JumpTable ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -7642,7 +8860,7 @@ Label_F07B: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_F07E: +BallBounce_JumpTable: lda #$D2 ; CPU:$F07E PRG:307E A9 D2 sta Zp16 ; CPU:$F080 PRG:3080 85 16 lda #$F1 ; CPU:$F082 PRG:3082 A9 F1 @@ -7661,12 +8879,14 @@ Label_F07E: ; ---- data $F098-$F0CD (54 bytes) ---- ; referenced by `lda $F099,x` at $F08F (operand $F099 falls inside this region) ; referenced by `lda $F098,x` at $F093 (operand $F098 falls inside this region) +; Twenty-seven sixteen-bit handler addresses for the tile-collision dispatch. The dispatcher pushes the word and rts-es into it, so each stored word is the handler minus one; the entry is chosen from the field tile the ball just hit. +TileCollisionTable: .byte $CF, $F0, $AD, $F0, $AD, $F0, $DE, $F0, $F1, $F0, $54, $F1, $5A, $F1, $60, $F1 ; CPU:$F098 PRG:3098 CF F0 AD F0 AD F0 DE F0 F1 F0 54 F1 5A F1 60 F1 .byte $80, $F1, $86, $F1, $8C, $F1, $B9, $F0, $03, $29, $0F, $C9, $02, $F0, $0B, $C9 ; CPU:$F0A8 PRG:30A8 80 F1 86 F1 8C F1 B9 F0 03 29 0F C9 02 F0 0B C9 .byte $08, $B0, $0C, $C9, $06, $90, $08, $4C, $D3, $F1, $A5, $26, $99, $F0, $03, $20 ; CPU:$F0B8 PRG:30B8 08 B0 0C C9 06 90 08 4C D3 F1 A5 26 99 F0 03 20 .byte $24, $FE, $20, $37, $FE, $4C ; CPU:$F0C8 PRG:30C8 24 FE 20 37 FE 4C ; ----------------------------------------------------------------------------- -; Routine: Label_F0CE +; Routine: BallTileHandler5 ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -7674,17 +8894,17 @@ Label_F07E: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_F0CE: +BallTileHandler5: txs ; CPU:$F0CE PRG:30CE 9A sbc (ZpA5),y ; CPU:$F0CF PRG:30CF F1 A5 sed ; CPU:$F0D1 PRG:30D1 F8 clc ; CPU:$F0D2 PRG:30D2 18 - adc ZpF9 ; CPU:$F0D3 PRG:30D3 65 F9 + adc ppu_src_hi ; CPU:$F0D3 PRG:30D3 65 F9 cmp #$0C ; CPU:$F0D5 PRG:30D5 C9 0C - bcc Label_F0DC ; CPU:$F0D7 PRG:30D7 90 03 + bcc BallTileHandler5_Reflect ; CPU:$F0D7 PRG:30D7 90 03 jmp $F1D3 ; CPU:$F0D9 PRG:30D9 4C D3 F1 ; ----------------------------------------------------------------------------- -; Routine: Label_F0DC +; Routine: BallTileHandler5_Reflect ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -7692,10 +8912,10 @@ Label_F0CE: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_F0DC: +BallTileHandler5_Reflect: jmp $F16A ; CPU:$F0DC PRG:30DC 4C 6A F1 ; ----------------------------------------------------------------------------- -; Routine: Label_F0DF +; Routine: BallTileHandler8 ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -7703,16 +8923,16 @@ Label_F0DC: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_F0DF: - lda ZpF9 ; CPU:$F0DF PRG:30DF A5 F9 +BallTileHandler8: + lda ppu_src_hi ; CPU:$F0DF PRG:30DF A5 F9 cmp #$06 ; CPU:$F0E1 PRG:30E1 C9 06 - bcs Label_F0EF ; CPU:$F0E3 PRG:30E3 B0 0A - lda ZpFB ; CPU:$F0E5 PRG:30E5 A5 FB - bpl Label_F0EF ; CPU:$F0E7 PRG:30E7 10 06 + bcs BallTileHandler8_Exit ; CPU:$F0E3 PRG:30E3 B0 0A + lda ptr_hi ; CPU:$F0E5 PRG:30E5 A5 FB + bpl BallTileHandler8_Exit ; CPU:$F0E7 PRG:30E7 10 06 jsr $FE37 ; CPU:$F0E9 PRG:30E9 20 37 FE jmp $F19A ; CPU:$F0EC PRG:30EC 4C 9A F1 ; ----------------------------------------------------------------------------- -; Routine: Label_F0EF +; Routine: BallTileHandler8_Exit ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -7720,13 +8940,13 @@ Label_F0DF: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_F0EF: +BallTileHandler8_Exit: jmp $F193 ; CPU:$F0EF PRG:30EF 4C 93 F1 - lda ZpF8 ; CPU:$F0F2 PRG:30F2 A5 F8 + lda ppu_src_lo ; CPU:$F0F2 PRG:30F2 A5 F8 cmp #$06 ; CPU:$F0F4 PRG:30F4 C9 06 - bcs Label_F0DF ; CPU:$F0F6 PRG:30F6 B0 E7 - lda ZpFD ; CPU:$F0F8 PRG:30F8 A5 FD - bpl Label_F0DF ; CPU:$F0FA PRG:30FA 10 E3 + bcs BallTileHandler8 ; CPU:$F0F6 PRG:30F6 B0 E7 + lda ppu_addr_hi ; CPU:$F0F8 PRG:30F8 A5 FD + bpl BallTileHandler8 ; CPU:$F0FA PRG:30FA 10 E3 jsr $F149 ; CPU:$F0FC PRG:30FC 20 49 F1 jmp $F0DF ; CPU:$F0FF PRG:30FF 4C DF F0 ; ---- data $F102-$F124 (35 bytes) ---- @@ -7734,7 +8954,7 @@ Label_F0EF: .byte $FA, $A5, $FD, $E5, $FB, $10, $0B, $20, $92, $CB, $A9, $F1, $85, $17, $A9, $99 ; CPU:$F112 PRG:3112 FA A5 FD E5 FB 10 0B 20 92 CB A9 F1 85 17 A9 99 .byte $85, $16, $60 ; CPU:$F122 PRG:3122 85 16 60 ; ----------------------------------------------------------------------------- -; Routine: Label_F125 +; Routine: BallReflectX ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -7742,24 +8962,24 @@ Label_F0EF: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_F125: - lda ZpF9 ; CPU:$F125 PRG:3125 A5 F9 +BallReflectX: + lda ppu_src_hi ; CPU:$F125 PRG:3125 A5 F9 clc ; CPU:$F127 PRG:3127 18 - adc ZpF8 ; CPU:$F128 PRG:3128 65 F8 + adc ppu_src_lo ; CPU:$F128 PRG:3128 65 F8 cmp #$0A ; CPU:$F12A PRG:312A C9 0A - bcc Label_F148 ; CPU:$F12C PRG:312C 90 1A - lda ZpFC ; CPU:$F12E PRG:312E A5 FC + bcc BallReflectX_Done ; CPU:$F12C PRG:312C 90 1A + lda ppu_addr_lo ; CPU:$F12E PRG:312E A5 FC clc ; CPU:$F130 PRG:3130 18 - adc ZpFA ; CPU:$F131 PRG:3131 65 FA + adc ptr_lo ; CPU:$F131 PRG:3131 65 FA tax ; CPU:$F133 PRG:3133 AA - lda ZpFD ; CPU:$F134 PRG:3134 A5 FD - adc ZpFB ; CPU:$F136 PRG:3136 65 FB - bmi Label_F148 ; CPU:$F138 PRG:3138 30 0E - bne Label_F13F ; CPU:$F13A PRG:313A D0 03 + lda ppu_addr_hi ; CPU:$F134 PRG:3134 A5 FD + adc ptr_hi ; CPU:$F136 PRG:3136 65 FB + bmi BallReflectX_Done ; CPU:$F138 PRG:3138 30 0E + bne BallReflectX_Do ; CPU:$F13A PRG:313A D0 03 txa ; CPU:$F13C PRG:313C 8A - beq Label_F148 ; CPU:$F13D PRG:313D F0 09 + beq BallReflectX_Done ; CPU:$F13D PRG:313D F0 09 ; ----------------------------------------------------------------------------- -; Routine: Label_F13F +; Routine: BallReflectX_Do ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -7767,12 +8987,12 @@ Label_F125: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_F13F: +BallReflectX_Do: jsr $F149 ; CPU:$F13F PRG:313F 20 49 F1 jsr $CB92 ; CPU:$F142 PRG:3142 20 92 CB jsr $FE24 ; CPU:$F145 PRG:3145 20 24 FE ; ----------------------------------------------------------------------------- -; Routine: Label_F148 +; Routine: BallReflectX_Done ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -7780,10 +9000,10 @@ Label_F13F: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_F148: +BallReflectX_Done: rts ; CPU:$F148 PRG:3148 60 ; ----------------------------------------------------------------------------- -; Routine: Label_F149 +; Routine: BallFlipXVelocity ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -7791,18 +9011,22 @@ Label_F148: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_F149: +BallFlipXVelocity: jsr $FE24 ; CPU:$F149 PRG:3149 20 24 FE lda #$99 ; CPU:$F14C PRG:314C A9 99 sta Zp16 ; CPU:$F14E PRG:314E 85 16 lda #$F1 ; CPU:$F150 PRG:3150 A9 F1 sta Zp17 ; CPU:$F152 PRG:3152 85 17 rts ; CPU:$F154 PRG:3154 60 -; ---- data $F155-$F169 (21 bytes) ---- - .byte $20, $02, $F1, $4C, $DF, $F0, $20, $25, $F1, $4C, $DF, $F0, $A5, $F9, $18, $65 ; CPU:$F155 PRG:3155 20 02 F1 4C DF F0 20 25 F1 4C DF F0 A5 F9 18 65 - .byte $F8, $C9, $05, $B0, $29 ; CPU:$F165 PRG:3165 F8 C9 05 B0 29 +; ---- data $F155-$F160 (12 bytes) ---- + .byte $20, $02, $F1, $4C, $DF, $F0, $20, $25, $F1, $4C, $DF, $F0 ; CPU:$F155 PRG:3155 20 02 F1 4C DF F0 20 25 F1 4C DF F0 + lda ppu_src_hi ; CPU:$F161 PRG:3161 A5 F9 + clc ; CPU:$F163 PRG:3163 18 + adc ppu_src_lo ; CPU:$F164 PRG:3164 65 F8 + cmp #$05 ; CPU:$F166 PRG:3166 C9 05 + bcs BallBounceExit ; CPU:$F168 PRG:3168 B0 29 ; ----------------------------------------------------------------------------- -; Routine: Label_F16A +; Routine: BallReflectVector ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -7810,13 +9034,13 @@ Label_F149: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_F16A: - lda ZpFC ; CPU:$F16A PRG:316A A5 FC +BallReflectVector: + lda ppu_addr_lo ; CPU:$F16A PRG:316A A5 FC clc ; CPU:$F16C PRG:316C 18 - adc ZpFA ; CPU:$F16D PRG:316D 65 FA - lda ZpFD ; CPU:$F16F PRG:316F A5 FD - adc ZpFB ; CPU:$F171 PRG:3171 65 FB - bpl Label_F193 ; CPU:$F173 PRG:3173 10 1E + adc ptr_lo ; CPU:$F16D PRG:316D 65 FA + lda ppu_addr_hi ; CPU:$F16F PRG:316F A5 FD + adc ptr_hi ; CPU:$F171 PRG:3171 65 FB + bpl BallBounceExit ; CPU:$F173 PRG:3173 10 1E jsr $FE24 ; CPU:$F175 PRG:3175 20 24 FE jsr $CB92 ; CPU:$F178 PRG:3178 20 92 CB jsr $FE24 ; CPU:$F17B PRG:317B 20 24 FE @@ -7825,7 +9049,7 @@ Label_F16A: .byte $20, $02, $F1, $4C, $61, $F1, $20, $25, $F1, $4C, $61, $F1, $20, $25, $F1, $4C ; CPU:$F181 PRG:3181 20 02 F1 4C 61 F1 20 25 F1 4C 61 F1 20 25 F1 4C .byte $81, $F1 ; CPU:$F191 PRG:3191 81 F1 ; ----------------------------------------------------------------------------- -; Routine: Label_F193 +; Routine: BallBounceExit ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -7833,14 +9057,14 @@ Label_F16A: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_F193: +BallBounceExit: lda Zp17 ; CPU:$F193 PRG:3193 A5 17 pha ; CPU:$F195 PRG:3195 48 lda Zp16 ; CPU:$F196 PRG:3196 A5 16 pha ; CPU:$F198 PRG:3198 48 rts ; CPU:$F199 PRG:3199 60 ; ----------------------------------------------------------------------------- -; Routine: Label_F19A +; Routine: BallBounceCommit ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -7848,18 +9072,18 @@ Label_F193: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_F19A: +BallBounceCommit: lda #$05 ; CPU:$F19A PRG:319A A9 05 jsr $C3DA ; CPU:$F19C PRG:319C 20 DA C3 lda Zp26 ; CPU:$F19F PRG:319F A5 26 and #$C0 ; CPU:$F1A1 PRG:31A1 29 C0 - beq Label_F1BC ; CPU:$F1A3 PRG:31A3 F0 17 + beq BallBounceCommit_Store ; CPU:$F1A3 PRG:31A3 F0 17 cmp #$40 ; CPU:$F1A5 PRG:31A5 C9 40 - bne Label_F1AF ; CPU:$F1A7 PRG:31A7 D0 06 + bne BallBounceCommit_Test80 ; CPU:$F1A7 PRG:31A7 D0 06 jsr $FF50 ; CPU:$F1A9 PRG:31A9 20 50 FF jmp $F1BC ; CPU:$F1AC PRG:31AC 4C BC F1 ; ----------------------------------------------------------------------------- -; Routine: Label_F1AF +; Routine: BallBounceCommit_Test80 ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -7867,13 +9091,13 @@ Label_F19A: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_F1AF: +BallBounceCommit_Test80: cmp #$80 ; CPU:$F1AF PRG:31AF C9 80 - bne Label_F1B9 ; CPU:$F1B1 PRG:31B1 D0 06 + bne BallBounceCommit_TestC0 ; CPU:$F1B1 PRG:31B1 D0 06 jsr $FF3D ; CPU:$F1B3 PRG:31B3 20 3D FF jmp $F1BC ; CPU:$F1B6 PRG:31B6 4C BC F1 ; ----------------------------------------------------------------------------- -; Routine: Label_F1B9 +; Routine: BallBounceCommit_TestC0 ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -7881,10 +9105,10 @@ Label_F1AF: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_F1B9: +BallBounceCommit_TestC0: jsr $FF25 ; CPU:$F1B9 PRG:31B9 20 25 FF ; ----------------------------------------------------------------------------- -; Routine: Label_F1BC +; Routine: BallBounceCommit_Store ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -7892,18 +9116,18 @@ Label_F1B9: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_F1BC: - lda ZpFA ; CPU:$F1BC PRG:31BC A5 FA +BallBounceCommit_Store: + lda ptr_lo ; CPU:$F1BC PRG:31BC A5 FA sta $0380,y ; CPU:$F1BE PRG:31BE 99 80 03 - lda ZpFB ; CPU:$F1C1 PRG:31C1 A5 FB + lda ptr_hi ; CPU:$F1C1 PRG:31C1 A5 FB sta $0390,y ; CPU:$F1C3 PRG:31C3 99 90 03 - lda ZpFC ; CPU:$F1C6 PRG:31C6 A5 FC + lda ppu_addr_lo ; CPU:$F1C6 PRG:31C6 A5 FC sta $0340,y ; CPU:$F1C8 PRG:31C8 99 40 03 - lda ZpFD ; CPU:$F1CB PRG:31CB A5 FD + lda ppu_addr_hi ; CPU:$F1CB PRG:31CB A5 FD sta $0350,y ; CPU:$F1CD PRG:31CD 99 50 03 jmp $F1F6 ; CPU:$F1D0 PRG:31D0 4C F6 F1 ; ----------------------------------------------------------------------------- -; Routine: Label_F1D3 +; Routine: BallRememberTile ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -7911,7 +9135,7 @@ Label_F1BC: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_F1D3: +BallRememberTile: lda Zp24 ; CPU:$F1D3 PRG:31D3 A5 24 sta $03D0,y ; CPU:$F1D5 PRG:31D5 99 D0 03 lda Zp25 ; CPU:$F1D8 PRG:31D8 A5 25 @@ -7919,7 +9143,7 @@ Label_F1D3: lda Zp26 ; CPU:$F1DD PRG:31DD A5 26 sta $03F0,y ; CPU:$F1DF PRG:31DF 99 F0 03 ; ----------------------------------------------------------------------------- -; Routine: Label_F1E2 +; Routine: BallCommitPosition ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -7927,7 +9151,7 @@ Label_F1D3: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_F1E2: +BallCommitPosition: lda Zp1C ; CPU:$F1E2 PRG:31E2 A5 1C sta $0320,y ; CPU:$F1E4 PRG:31E4 99 20 03 lda Zp1D ; CPU:$F1E7 PRG:31E7 A5 1D @@ -7937,7 +9161,7 @@ Label_F1E2: lda Zp1F ; CPU:$F1F1 PRG:31F1 A5 1F sta $0370,y ; CPU:$F1F3 PRG:31F3 99 70 03 ; ----------------------------------------------------------------------------- -; Routine: Label_F1F6 +; Routine: BallDecelerate ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -7945,16 +9169,16 @@ Label_F1E2: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_F1F6: - lda Zp01 ; CPU:$F1F6 PRG:31F6 A5 01 +BallDecelerate: + lda timer_hi ; CPU:$F1F6 PRG:31F6 A5 01 and #$08 ; CPU:$F1F8 PRG:31F8 29 08 - beq Label_F206 ; CPU:$F1FA PRG:31FA F0 0A + beq BallSlotAdvance ; CPU:$F1FA PRG:31FA F0 0A ldx Zp07 ; CPU:$F1FC PRG:31FC A6 07 lda $03A0,x ; CPU:$F1FE PRG:31FE BD A0 03 - beq Label_F206 ; CPU:$F201 PRG:3201 F0 03 + beq BallSlotAdvance ; CPU:$F201 PRG:3201 F0 03 dec $03A0,x ; CPU:$F203 PRG:3203 DE A0 03 ; ----------------------------------------------------------------------------- -; Routine: Label_F206 +; Routine: BallSlotAdvance ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -7962,14 +9186,14 @@ Label_F1F6: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_F206: +BallSlotAdvance: inc Zp07 ; CPU:$F206 PRG:3206 E6 07 lda Zp07 ; CPU:$F208 PRG:3208 A5 07 cmp #$08 ; CPU:$F20A PRG:320A C9 08 - beq Label_F211 ; CPU:$F20C PRG:320C F0 03 + beq BallPhysicsNextStep ; CPU:$F20C PRG:320C F0 03 jmp $EE57 ; CPU:$F20E PRG:320E 4C 57 EE ; ----------------------------------------------------------------------------- -; Routine: Label_F211 +; Routine: BallPhysicsNextStep ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -7977,12 +9201,12 @@ Label_F206: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_F211: +BallPhysicsNextStep: dec Zp05 ; CPU:$F211 PRG:3211 C6 05 - beq Label_F218 ; CPU:$F213 PRG:3213 F0 03 + beq BallFrameEnd ; CPU:$F213 PRG:3213 F0 03 jmp $EE3E ; CPU:$F215 PRG:3215 4C 3E EE ; ----------------------------------------------------------------------------- -; Routine: Label_F218 +; Routine: BallFrameEnd ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -7990,13 +9214,13 @@ Label_F211: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_F218: - lda Zp00 ; CPU:$F218 PRG:3218 A5 00 +BallFrameEnd: + lda timer_lo ; CPU:$F218 PRG:3218 A5 00 and #$01 ; CPU:$F21A PRG:321A 29 01 - bne Label_F221 ; CPU:$F21C PRG:321C D0 03 + bne BallCollisionScan ; CPU:$F21C PRG:321C D0 03 jmp $F2EC ; CPU:$F21E PRG:321E 4C EC F2 ; ----------------------------------------------------------------------------- -; Routine: Label_F221 +; Routine: BallCollisionScan ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -8004,11 +9228,11 @@ Label_F218: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_F221: +BallCollisionScan: lda #$00 ; CPU:$F221 PRG:3221 A9 00 sta Zp07 ; CPU:$F223 PRG:3223 85 07 ; ----------------------------------------------------------------------------- -; Routine: Label_F225 +; Routine: BallCollisionScan_Loop ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -8016,15 +9240,15 @@ Label_F221: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_F225: +BallCollisionScan_Loop: ldy Zp07 ; CPU:$F225 PRG:3225 A4 07 lda $0300,y ; CPU:$F227 PRG:3227 B9 00 03 and #$7F ; CPU:$F22A PRG:322A 29 7F cmp #$22 ; CPU:$F22C PRG:322C C9 22 - beq Label_F233 ; CPU:$F22E PRG:322E F0 03 + beq BallCollisionScan_Pair ; CPU:$F22E PRG:322E F0 03 jmp $F2DB ; CPU:$F230 PRG:3230 4C DB F2 ; ----------------------------------------------------------------------------- -; Routine: Label_F233 +; Routine: BallCollisionScan_Pair ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -8032,12 +9256,12 @@ Label_F225: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_F233: +BallCollisionScan_Pair: ldx Zp07 ; CPU:$F233 PRG:3233 A6 07 inx ; CPU:$F235 PRG:3235 E8 stx Zp08 ; CPU:$F236 PRG:3236 86 08 ; ----------------------------------------------------------------------------- -; Routine: Label_F238 +; Routine: BallCollisionScan_Inner ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -8045,13 +9269,13 @@ Label_F233: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_F238: +BallCollisionScan_Inner: lda $0300,x ; CPU:$F238 PRG:3238 BD 00 03 and #$7F ; CPU:$F23B PRG:323B 29 7F cmp #$22 ; CPU:$F23D PRG:323D C9 22 - beq Label_F244 ; CPU:$F23F PRG:323F F0 03 + beq BallCollisionScan_Test ; CPU:$F23F PRG:323F F0 03 ; ----------------------------------------------------------------------------- -; Routine: Label_F241 +; Routine: BallCollisionScan_Next ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -8059,10 +9283,10 @@ Label_F238: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_F241: +BallCollisionScan_Next: jmp $F2CB ; CPU:$F241 PRG:3241 4C CB F2 ; ----------------------------------------------------------------------------- -; Routine: Label_F244 +; Routine: BallCollisionScan_Test ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -8070,19 +9294,19 @@ Label_F241: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_F244: +BallCollisionScan_Test: lda $03A0,y ; CPU:$F244 PRG:3244 B9 A0 03 ora $03A0,x ; CPU:$F247 PRG:3247 1D A0 03 - beq Label_F241 ; CPU:$F24A PRG:324A F0 F5 + beq BallCollisionScan_Next ; CPU:$F24A PRG:324A F0 F5 lda $0330,x ; CPU:$F24C PRG:324C BD 30 03 sec ; CPU:$F24F PRG:324F 38 sbc $0330,y ; CPU:$F250 PRG:3250 F9 30 03 sta Zp28 ; CPU:$F253 PRG:3253 85 28 - bcs Label_F25B ; CPU:$F255 PRG:3255 B0 04 + bcs BallCollisionScan_DX ; CPU:$F255 PRG:3255 B0 04 eor #$FF ; CPU:$F257 PRG:3257 49 FF adc #$01 ; CPU:$F259 PRG:3259 69 01 ; ----------------------------------------------------------------------------- -; Routine: Label_F25B +; Routine: BallCollisionScan_DX ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -8090,19 +9314,19 @@ Label_F244: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_F25B: +BallCollisionScan_DX: cmp #$0C ; CPU:$F25B PRG:325B C9 0C - bcs Label_F241 ; CPU:$F25D PRG:325D B0 E2 - sta ZpF8 ; CPU:$F25F PRG:325F 85 F8 + bcs BallCollisionScan_Next ; CPU:$F25D PRG:325D B0 E2 + sta ppu_src_lo ; CPU:$F25F PRG:325F 85 F8 lda $0370,x ; CPU:$F261 PRG:3261 BD 70 03 sec ; CPU:$F264 PRG:3264 38 sbc $0370,y ; CPU:$F265 PRG:3265 F9 70 03 sta Zp29 ; CPU:$F268 PRG:3268 85 29 - bcs Label_F270 ; CPU:$F26A PRG:326A B0 04 + bcs BallCollisionScan_DY ; CPU:$F26A PRG:326A B0 04 eor #$FF ; CPU:$F26C PRG:326C 49 FF adc #$01 ; CPU:$F26E PRG:326E 69 01 ; ----------------------------------------------------------------------------- -; Routine: Label_F270 +; Routine: BallCollisionScan_DY ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -8110,52 +9334,52 @@ Label_F25B: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_F270: +BallCollisionScan_DY: cmp #$0C ; CPU:$F270 PRG:3270 C9 0C - bcs Label_F241 ; CPU:$F272 PRG:3272 B0 CD - sta ZpF9 ; CPU:$F274 PRG:3274 85 F9 + bcs BallCollisionScan_Next ; CPU:$F272 PRG:3272 B0 CD + sta ppu_src_hi ; CPU:$F274 PRG:3274 85 F9 jsr $FB99 ; CPU:$F276 PRG:3276 20 99 FB - bcs Label_F241 ; CPU:$F279 PRG:3279 B0 C6 - lda Zp01 ; CPU:$F27B PRG:327B A5 01 + bcs BallCollisionScan_Next ; CPU:$F279 PRG:3279 B0 C6 + lda timer_hi ; CPU:$F27B PRG:327B A5 01 ora #$01 ; CPU:$F27D PRG:327D 09 01 - sta Zp01 ; CPU:$F27F PRG:327F 85 01 - lda Zp00 ; CPU:$F281 PRG:3281 A5 00 + sta timer_hi ; CPU:$F27F PRG:327F 85 01 + lda timer_lo ; CPU:$F281 PRG:3281 A5 00 and #$02 ; CPU:$F283 PRG:3283 29 02 - beq Label_F241 ; CPU:$F285 PRG:3285 F0 BA + beq BallCollisionScan_Next ; CPU:$F285 PRG:3285 F0 BA ldy Zp08 ; CPU:$F287 PRG:3287 A4 08 - sty ZpFE ; CPU:$F289 PRG:3289 84 FE + sty ppu_addr_src_lo ; CPU:$F289 PRG:3289 84 FE ldx #$04 ; CPU:$F28B PRG:328B A2 04 - stx ZpFF ; CPU:$F28D PRG:328D 86 FF + stx ppu_addr_src_hi ; CPU:$F28D PRG:328D 86 FF jsr $FBC2 ; CPU:$F28F PRG:328F 20 C2 FB ldy Zp07 ; CPU:$F292 PRG:3292 A4 07 - sty ZpFE ; CPU:$F294 PRG:3294 84 FE + sty ppu_addr_src_lo ; CPU:$F294 PRG:3294 84 FE ldx #$00 ; CPU:$F296 PRG:3296 A2 00 - stx ZpFF ; CPU:$F298 PRG:3298 86 FF + stx ppu_addr_src_hi ; CPU:$F298 PRG:3298 86 FF jsr $FBC2 ; CPU:$F29A PRG:329A 20 C2 FB lda Zp16 ; CPU:$F29D PRG:329D A5 16 sec ; CPU:$F29F PRG:329F 38 sbc Zp12 ; CPU:$F2A0 PRG:32A0 E5 12 lda Zp17 ; CPU:$F2A2 PRG:32A2 A5 17 sbc Zp13 ; CPU:$F2A4 PRG:32A4 E5 13 - bpl Label_F2CB ; CPU:$F2A6 PRG:32A6 10 23 + bpl BallCollisionScan_NextInner ; CPU:$F2A6 PRG:32A6 10 23 lda #$04 ; CPU:$F2A8 PRG:32A8 A9 04 jsr $C3DA ; CPU:$F2AA PRG:32AA 20 DA C3 lda Zp07 ; CPU:$F2AD PRG:32AD A5 07 sta Zp05 ; CPU:$F2AF PRG:32AF 85 05 ldy #$00 ; CPU:$F2B1 PRG:32B1 A0 00 - sty ZpFE ; CPU:$F2B3 PRG:32B3 84 FE + sty ppu_addr_src_lo ; CPU:$F2B3 PRG:32B3 84 FE ldx #$04 ; CPU:$F2B5 PRG:32B5 A2 04 - stx ZpFF ; CPU:$F2B7 PRG:32B7 86 FF + stx ppu_addr_src_hi ; CPU:$F2B7 PRG:32B7 86 FF jsr $FC6C ; CPU:$F2B9 PRG:32B9 20 6C FC lda Zp08 ; CPU:$F2BC PRG:32BC A5 08 sta Zp05 ; CPU:$F2BE PRG:32BE 85 05 ldy #$04 ; CPU:$F2C0 PRG:32C0 A0 04 - sty ZpFE ; CPU:$F2C2 PRG:32C2 84 FE + sty ppu_addr_src_lo ; CPU:$F2C2 PRG:32C2 84 FE ldx #$00 ; CPU:$F2C4 PRG:32C4 A2 00 - stx ZpFF ; CPU:$F2C6 PRG:32C6 86 FF + stx ppu_addr_src_hi ; CPU:$F2C6 PRG:32C6 86 FF jsr $FC6C ; CPU:$F2C8 PRG:32C8 20 6C FC ; ----------------------------------------------------------------------------- -; Routine: Label_F2CB +; Routine: BallCollisionScan_NextInner ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -8163,17 +9387,17 @@ Label_F270: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_F2CB: +BallCollisionScan_NextInner: ldy Zp07 ; CPU:$F2CB PRG:32CB A4 07 inc Zp08 ; CPU:$F2CD PRG:32CD E6 08 ldx Zp08 ; CPU:$F2CF PRG:32CF A6 08 cpx #$08 ; CPU:$F2D1 PRG:32D1 E0 08 - beq Label_F2DB ; CPU:$F2D3 PRG:32D3 F0 06 + beq BallCollisionScan_NextOuter ; CPU:$F2D3 PRG:32D3 F0 06 jmp $F238 ; CPU:$F2D5 PRG:32D5 4C 38 F2 ; ---- data $F2D8-$F2DA (3 bytes) ---- .byte $20, $6C, $FC ; CPU:$F2D8 PRG:32D8 20 6C FC ; ----------------------------------------------------------------------------- -; Routine: Label_F2DB +; Routine: BallCollisionScan_NextOuter ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -8181,14 +9405,14 @@ Label_F2CB: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_F2DB: +BallCollisionScan_NextOuter: iny ; CPU:$F2DB PRG:32DB C8 sty Zp07 ; CPU:$F2DC PRG:32DC 84 07 cpy #$07 ; CPU:$F2DE PRG:32DE C0 07 - beq Label_F2E5 ; CPU:$F2E0 PRG:32E0 F0 03 + beq BallCollisionScan_Repeat ; CPU:$F2E0 PRG:32E0 F0 03 jmp $F225 ; CPU:$F2E2 PRG:32E2 4C 25 F2 ; ----------------------------------------------------------------------------- -; Routine: Label_F2E5 +; Routine: BallCollisionScan_Repeat ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -8196,12 +9420,12 @@ Label_F2DB: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_F2E5: +BallCollisionScan_Repeat: dec Zp06 ; CPU:$F2E5 PRG:32E5 C6 06 - beq Label_F2EC ; CPU:$F2E7 PRG:32E7 F0 03 + beq BallUpdateEnd ; CPU:$F2E7 PRG:32E7 F0 03 jmp $EE3A ; CPU:$F2E9 PRG:32E9 4C 3A EE ; ----------------------------------------------------------------------------- -; Routine: Label_F2EC +; Routine: BallUpdateEnd ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -8209,18 +9433,18 @@ Label_F2E5: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_F2EC: +BallUpdateEnd: jsr $F683 ; CPU:$F2EC PRG:32EC 20 83 F6 lda Zp5F ; CPU:$F2EF PRG:32EF A5 5F cmp #$3A ; CPU:$F2F1 PRG:32F1 C9 3A - bne Label_F302 ; CPU:$F2F3 PRG:32F3 D0 0D + bne BallUpdateEnd_Idle ; CPU:$F2F3 PRG:32F3 D0 0D lda $0180 ; CPU:$F2F5 PRG:32F5 AD 80 01 ora $0182 ; CPU:$F2F8 PRG:32F8 0D 82 01 and #$04 ; CPU:$F2FB PRG:32FB 29 04 - beq Label_F302 ; CPU:$F2FD PRG:32FD F0 03 + beq BallUpdateEnd_Idle ; CPU:$F2FD PRG:32FD F0 03 jmp $F3D2 ; CPU:$F2FF PRG:32FF 4C D2 F3 ; ----------------------------------------------------------------------------- -; Routine: Label_F302 +; Routine: BallUpdateEnd_Idle ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -8228,16 +9452,16 @@ Label_F2EC: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_F302: - lda Zp00 ; CPU:$F302 PRG:3302 A5 00 +BallUpdateEnd_Idle: + lda timer_lo ; CPU:$F302 PRG:3302 A5 00 and #$01 ; CPU:$F304 PRG:3304 29 01 - beq Label_F30F ; CPU:$F306 PRG:3306 F0 07 - lda Zp01 ; CPU:$F308 PRG:3308 A5 01 + beq BallUpdateEnd_Next ; CPU:$F306 PRG:3306 F0 07 + lda timer_hi ; CPU:$F308 PRG:3308 A5 01 tax ; CPU:$F30A PRG:330A AA and #$22 ; CPU:$F30B PRG:330B 29 22 - beq Label_F312 ; CPU:$F30D PRG:330D F0 03 + beq RoundFinish ; CPU:$F30D PRG:330D F0 03 ; ----------------------------------------------------------------------------- -; Routine: Label_F30F +; Routine: BallUpdateEnd_Next ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -8245,10 +9469,10 @@ Label_F302: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_F30F: +BallUpdateEnd_Next: jmp $EDBA ; CPU:$F30F PRG:330F 4C BA ED ; ----------------------------------------------------------------------------- -; Routine: Label_F312 +; Routine: RoundFinish ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -8256,15 +9480,15 @@ Label_F30F: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_F312: +RoundFinish: lda #$00 ; CPU:$F312 PRG:3312 A9 00 sta $01CB ; CPU:$F314 PRG:3314 8D CB 01 txa ; CPU:$F317 PRG:3317 8A and #$10 ; CPU:$F318 PRG:3318 29 10 - beq Label_F31F ; CPU:$F31A PRG:331A F0 03 + beq RoundFinish_Collect ; CPU:$F31A PRG:331A F0 03 jmp $F41B ; CPU:$F31C PRG:331C 4C 1B F4 ; ----------------------------------------------------------------------------- -; Routine: Label_F31F +; Routine: RoundFinish_Collect ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -8272,13 +9496,13 @@ Label_F312: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_F31F: +RoundFinish_Collect: ldx #$00 ; CPU:$F31F PRG:331F A2 00 stx Zp37 ; CPU:$F321 PRG:3321 86 37 stx Zp35 ; CPU:$F323 PRG:3323 86 35 ldy #$00 ; CPU:$F325 PRG:3325 A0 00 ; ----------------------------------------------------------------------------- -; Routine: Label_F327 +; Routine: RoundFinish_Collect_Loop ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -8286,18 +9510,18 @@ Label_F31F: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_F327: +RoundFinish_Collect_Loop: lda $0300,y ; CPU:$F327 PRG:3327 B9 00 03 and #$03 ; CPU:$F32A PRG:332A 29 03 cmp #$02 ; CPU:$F32C PRG:332C C9 02 - beq Label_F341 ; CPU:$F32E PRG:332E F0 11 + beq RoundFinish_Collect_X ; CPU:$F32E PRG:332E F0 11 cmp #$03 ; CPU:$F330 PRG:3330 C9 03 - bne Label_F33D ; CPU:$F332 PRG:3332 D0 09 + bne RoundFinish_Collect_Empty ; CPU:$F332 PRG:3332 D0 09 jsr $F9CE ; CPU:$F334 PRG:3334 20 CE F9 jsr $F9B0 ; CPU:$F337 PRG:3337 20 B0 F9 jsr $E24F ; CPU:$F33A PRG:333A 20 4F E2 ; ----------------------------------------------------------------------------- -; Routine: Label_F33D +; Routine: RoundFinish_Collect_Empty ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -8305,11 +9529,11 @@ Label_F327: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_F33D: +RoundFinish_Collect_Empty: lda #$00 ; CPU:$F33D PRG:333D A9 00 - beq Label_F344 ; CPU:$F33F PRG:333F F0 03 + beq RoundFinish_Collect_Store ; CPU:$F33F PRG:333F F0 03 ; ----------------------------------------------------------------------------- -; Routine: Label_F341 +; Routine: RoundFinish_Collect_X ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -8317,10 +9541,10 @@ Label_F33D: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_F341: +RoundFinish_Collect_X: lda $0330,y ; CPU:$F341 PRG:3341 B9 30 03 ; ----------------------------------------------------------------------------- -; Routine: Label_F344 +; Routine: RoundFinish_Collect_Store ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -8328,7 +9552,7 @@ Label_F341: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_F344: +RoundFinish_Collect_Store: sta $0190,x ; CPU:$F344 PRG:3344 9D 90 01 inx ; CPU:$F347 PRG:3347 E8 lda $0370,y ; CPU:$F348 PRG:3348 B9 70 03 @@ -8336,15 +9560,15 @@ Label_F344: inx ; CPU:$F34E PRG:334E E8 iny ; CPU:$F34F PRG:334F C8 cpy #$08 ; CPU:$F350 PRG:3350 C0 08 - bne Label_F327 ; CPU:$F352 PRG:3352 D0 D3 + bne RoundFinish_Collect_Loop ; CPU:$F352 PRG:3352 D0 D3 ldx $018F ; CPU:$F354 PRG:3354 AE 8F 01 lda $018E ; CPU:$F357 PRG:3357 AD 8E 01 sta $018F ; CPU:$F35A PRG:335A 8D 8F 01 cpx $018E ; CPU:$F35D PRG:335D EC 8E 01 - bne Label_F365 ; CPU:$F360 PRG:3360 D0 03 + bne RoundFinish_Score ; CPU:$F360 PRG:3360 D0 03 jmp $F413 ; CPU:$F362 PRG:3362 4C 13 F4 ; ----------------------------------------------------------------------------- -; Routine: Label_F365 +; Routine: RoundFinish_Score ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -8352,15 +9576,15 @@ Label_F344: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_F365: +RoundFinish_Score: txa ; CPU:$F365 PRG:3365 8A clc ; CPU:$F366 PRG:3366 18 sbc $018E ; CPU:$F367 PRG:3367 ED 8E 01 asl a ; CPU:$F36A PRG:336A 0A - beq Label_F377 ; CPU:$F36B PRG:336B F0 0A + beq RoundFinish_Advance ; CPU:$F36B PRG:336B F0 0A tax ; CPU:$F36D PRG:336D AA ; ----------------------------------------------------------------------------- -; Routine: Label_F36E +; Routine: RoundFinish_Score_Loop ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -8368,13 +9592,13 @@ Label_F365: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_F36E: +RoundFinish_Score_Loop: jsr $F9B0 ; CPU:$F36E PRG:336E 20 B0 F9 dex ; CPU:$F371 PRG:3371 CA - bne Label_F36E ; CPU:$F372 PRG:3372 D0 FA + bne RoundFinish_Score_Loop ; CPU:$F372 PRG:3372 D0 FA jsr $E24F ; CPU:$F374 PRG:3374 20 4F E2 ; ----------------------------------------------------------------------------- -; Routine: Label_F377 +; Routine: RoundFinish_Advance ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -8382,15 +9606,15 @@ Label_F36E: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_F377: +RoundFinish_Advance: lda #$03 ; CPU:$F377 PRG:3377 A9 03 sta $01C5 ; CPU:$F379 PRG:3379 8D C5 01 jsr $E2A2 ; CPU:$F37C PRG:337C 20 A2 E2 lda $018E ; CPU:$F37F PRG:337F AD 8E 01 - beq Label_F387 ; CPU:$F382 PRG:3382 F0 03 + beq RoundFinish_Clear ; CPU:$F382 PRG:3382 F0 03 jmp $ED4F ; CPU:$F384 PRG:3384 4C 4F ED ; ----------------------------------------------------------------------------- -; Routine: Label_F387 +; Routine: RoundFinish_Clear ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -8398,10 +9622,10 @@ Label_F377: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_F387: +RoundFinish_Clear: jsr $C3BC ; CPU:$F387 PRG:3387 20 BC C3 lda $01CA ; CPU:$F38A PRG:338A AD CA 01 - bne Label_F3BB ; CPU:$F38D PRG:338D D0 2C + bne RoundFinish_Tail ; CPU:$F38D PRG:338D D0 2C lda #$0F ; CPU:$F38F PRG:338F A9 0F jsr $C3DA ; CPU:$F391 PRG:3391 20 DA C3 jsr $F84C ; CPU:$F394 PRG:3394 20 4C F8 @@ -8414,7 +9638,7 @@ Label_F387: jsr $F674 ; CPU:$F3A8 PRG:33A8 20 74 F6 ldx #$C8 ; CPU:$F3AB PRG:33AB A2 C8 ; ----------------------------------------------------------------------------- -; Routine: Label_F3AD +; Routine: RoundFinish_Wait ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -8422,15 +9646,15 @@ Label_F387: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_F3AD: +RoundFinish_Wait: jsr $F9F9 ; CPU:$F3AD PRG:33AD 20 F9 F9 jsr $E19D ; CPU:$F3B0 PRG:33B0 20 9D E1 dex ; CPU:$F3B3 PRG:33B3 CA - bne Label_F3AD ; CPU:$F3B4 PRG:33B4 D0 F7 + bne RoundFinish_Wait ; CPU:$F3B4 PRG:33B4 D0 F7 ldx #$04 ; CPU:$F3B6 PRG:33B6 A2 04 jsr $F674 ; CPU:$F3B8 PRG:33B8 20 74 F6 ; ----------------------------------------------------------------------------- -; Routine: Label_F3BB +; Routine: RoundFinish_Tail ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -8438,7 +9662,7 @@ Label_F3AD: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_F3BB: +RoundFinish_Tail: lda #$0E ; CPU:$F3BB PRG:33BB A9 0E jsr $C3DA ; CPU:$F3BD PRG:33BD 20 DA C3 ldx #$14 ; CPU:$F3C0 PRG:33C0 A2 14 @@ -8449,7 +9673,7 @@ Label_F3BB: ldx #$3C ; CPU:$F3CD PRG:33CD A2 3C jsr $FF56 ; CPU:$F3CF PRG:33CF 20 56 FF ; ----------------------------------------------------------------------------- -; Routine: Label_F3D2 +; Routine: StartNextRound ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -8457,16 +9681,16 @@ Label_F3BB: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_F3D2: +StartNextRound: jsr $C3BC ; CPU:$F3D2 PRG:33D2 20 BC C3 inc $0187 ; CPU:$F3D5 PRG:33D5 EE 87 01 lda $0187 ; CPU:$F3D8 PRG:33D8 AD 87 01 cmp #$3D ; CPU:$F3DB PRG:33DB C9 3D - bne Label_F3E4 ; CPU:$F3DD PRG:33DD D0 05 + bne StartNextRound_Store ; CPU:$F3DD PRG:33DD D0 05 lda #$01 ; CPU:$F3DF PRG:33DF A9 01 sta $0187 ; CPU:$F3E1 PRG:33E1 8D 87 01 ; ----------------------------------------------------------------------------- -; Routine: Label_F3E4 +; Routine: StartNextRound_Store ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -8474,7 +9698,7 @@ Label_F3D2: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_F3E4: +StartNextRound_Store: jsr $E25C ; CPU:$F3E4 PRG:33E4 20 5C E2 ldx $01C6 ; CPU:$F3E7 PRG:33E7 AE C6 01 lda $01C3 ; CPU:$F3EA PRG:33EA AD C3 01 @@ -8485,10 +9709,10 @@ Label_F3E4: sta $01CB ; CPU:$F3F8 PRG:33F8 8D CB 01 lda $0187 ; CPU:$F3FB PRG:33FB AD 87 01 cmp $01CC ; CPU:$F3FE PRG:33FE CD CC 01 - beq Label_F406 ; CPU:$F401 PRG:3401 F0 03 + beq StartNextRound_AllStagesDone ; CPU:$F401 PRG:3401 F0 03 jmp $EBB0 ; CPU:$F403 PRG:3403 4C B0 EB ; ----------------------------------------------------------------------------- -; Routine: Label_F406 +; Routine: StartNextRound_AllStagesDone ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -8496,13 +9720,13 @@ Label_F3E4: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_F406: +StartNextRound_AllStagesDone: lda $01C7 ; CPU:$F406 PRG:3406 AD C7 01 cmp #$02 ; CPU:$F409 PRG:3409 C9 02 - bne Label_F410 ; CPU:$F40B PRG:340B D0 03 + bne StartNextRound_ShowEnding ; CPU:$F40B PRG:340B D0 03 jmp $EBB0 ; CPU:$F40D PRG:340D 4C B0 EB ; ----------------------------------------------------------------------------- -; Routine: Label_F410 +; Routine: StartNextRound_ShowEnding ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -8510,10 +9734,10 @@ Label_F406: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_F410: +StartNextRound_ShowEnding: jmp $F56C ; CPU:$F410 PRG:3410 4C 6C F5 ; ----------------------------------------------------------------------------- -; Routine: Label_F413 +; Routine: RoundFinish_NoPotPenalty ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -8521,12 +9745,12 @@ Label_F410: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_F413: +RoundFinish_NoPotPenalty: dec $01C5 ; CPU:$F413 PRG:3413 CE C5 01 - beq Label_F41B ; CPU:$F416 PRG:3416 F0 03 + beq TurnEnd_CheckTable ; CPU:$F416 PRG:3416 F0 03 jmp $F49B ; CPU:$F418 PRG:3418 4C 9B F4 ; ----------------------------------------------------------------------------- -; Routine: Label_F41B +; Routine: TurnEnd_CheckTable ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -8534,20 +9758,20 @@ Label_F413: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_F41B: +TurnEnd_CheckTable: inc Zp37 ; CPU:$F41B PRG:341B E6 37 lda Zp37 ; CPU:$F41D PRG:341D A5 37 sta Zp35 ; CPU:$F41F PRG:341F 85 35 jsr $C3BC ; CPU:$F421 PRG:3421 20 BC C3 lda $018E ; CPU:$F424 PRG:3424 AD 8E 01 - beq Label_F435 ; CPU:$F427 PRG:3427 F0 0C + beq TurnEnd_TableCleared ; CPU:$F427 PRG:3427 F0 0C jsr $F017 ; CPU:$F429 PRG:3429 20 17 F0 - lda Zp01 ; CPU:$F42C PRG:342C A5 01 + lda timer_hi ; CPU:$F42C PRG:342C A5 01 ora #$10 ; CPU:$F42E PRG:342E 09 10 - sta Zp01 ; CPU:$F430 PRG:3430 85 01 + sta timer_hi ; CPU:$F430 PRG:3430 85 01 jmp $EDBA ; CPU:$F432 PRG:3432 4C BA ED ; ----------------------------------------------------------------------------- -; Routine: Label_F435 +; Routine: TurnEnd_TableCleared ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -8555,19 +9779,19 @@ Label_F41B: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_F435: +TurnEnd_TableCleared: lda #$01 ; CPU:$F435 PRG:3435 A9 01 sta $01CB ; CPU:$F437 PRG:3437 8D CB 01 lda #$03 ; CPU:$F43A PRG:343A A9 03 sta $01C5 ; CPU:$F43C PRG:343C 8D C5 01 lda $01C7 ; CPU:$F43F PRG:343F AD C7 01 cmp #$02 ; CPU:$F442 PRG:3442 C9 02 - bne Label_F44D ; CPU:$F444 PRG:3444 D0 07 + bne TurnEnd_TableCleared_DecCount ; CPU:$F444 PRG:3444 D0 07 lda $01C6 ; CPU:$F446 PRG:3446 AD C6 01 - beq Label_F44D ; CPU:$F449 PRG:3449 F0 02 - bne Label_F457 ; CPU:$F44B PRG:344B D0 0A + beq TurnEnd_TableCleared_DecCount ; CPU:$F449 PRG:3449 F0 02 + bne TurnEnd_TableCleared_Continue ; CPU:$F44B PRG:344B D0 0A ; ----------------------------------------------------------------------------- -; Routine: Label_F44D +; Routine: TurnEnd_TableCleared_DecCount ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -8575,13 +9799,13 @@ Label_F435: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_F44D: +TurnEnd_TableCleared_DecCount: dec $01C3 ; CPU:$F44D PRG:344D CE C3 01 lda $01C3 ; CPU:$F450 PRG:3450 AD C3 01 cmp #$FF ; CPU:$F453 PRG:3453 C9 FF - beq Label_F476 ; CPU:$F455 PRG:3455 F0 1F + beq TurnEnd_PlayerOut ; CPU:$F455 PRG:3455 F0 1F ; ----------------------------------------------------------------------------- -; Routine: Label_F457 +; Routine: TurnEnd_TableCleared_Continue ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -8589,7 +9813,7 @@ Label_F44D: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_F457: +TurnEnd_TableCleared_Continue: jsr $CBAE ; CPU:$F457 PRG:3457 20 AE CB jsr $FA6D ; CPU:$F45A PRG:345A 20 6D FA jsr $E25C ; CPU:$F45D PRG:345D 20 5C E2 @@ -8602,7 +9826,7 @@ Label_F457: jsr $C3DA ; CPU:$F470 PRG:3470 20 DA C3 jmp $F49B ; CPU:$F473 PRG:3473 4C 9B F4 ; ----------------------------------------------------------------------------- -; Routine: Label_F476 +; Routine: TurnEnd_PlayerOut ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -8610,15 +9834,15 @@ Label_F457: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_F476: +TurnEnd_PlayerOut: jsr $F7E8 ; CPU:$F476 PRG:3476 20 E8 F7 jsr $FA2B ; CPU:$F479 PRG:3479 20 2B FA - bcc Label_F487 ; CPU:$F47C PRG:347C 90 09 + bcc TurnEnd_PlayerOut_CheckCountdown ; CPU:$F47C PRG:347C 90 09 jsr $F81A ; CPU:$F47E PRG:347E 20 1A F8 jsr $FA56 ; CPU:$F481 PRG:3481 20 56 FA jsr $E20D ; CPU:$F484 PRG:3484 20 0D E2 ; ----------------------------------------------------------------------------- -; Routine: Label_F487 +; Routine: TurnEnd_PlayerOut_CheckCountdown ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -8626,17 +9850,17 @@ Label_F476: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_F487: +TurnEnd_PlayerOut_CheckCountdown: dec $03F8 ; CPU:$F487 PRG:3487 CE F8 03 - beq Label_F4F6 ; CPU:$F48A PRG:348A F0 6A + beq ShowGameOverScreen ; CPU:$F48A PRG:348A F0 6A lda $01C7 ; CPU:$F48C PRG:348C AD C7 01 cmp #$02 ; CPU:$F48F PRG:348F C9 02 - beq Label_F4F6 ; CPU:$F491 PRG:3491 F0 63 + beq ShowGameOverScreen ; CPU:$F491 PRG:3491 F0 63 lda #$0C ; CPU:$F493 PRG:3493 A9 0C jsr $C3DA ; CPU:$F495 PRG:3495 20 DA C3 jmp $F4B1 ; CPU:$F498 PRG:3498 4C B1 F4 ; ----------------------------------------------------------------------------- -; Routine: Label_F49B +; Routine: TurnEnd_SaveCounts ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -8644,7 +9868,7 @@ Label_F487: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_F49B: +TurnEnd_SaveCounts: ldx $01C6 ; CPU:$F49B PRG:349B AE C6 01 lda $01C5 ; CPU:$F49E PRG:349E AD C5 01 sta $036A,x ; CPU:$F4A1 PRG:34A1 9D 6A 03 @@ -8652,9 +9876,9 @@ Label_F49B: sta $0368,x ; CPU:$F4A7 PRG:34A7 9D 68 03 lda $03F8 ; CPU:$F4AA PRG:34AA AD F8 03 cmp #$02 ; CPU:$F4AD PRG:34AD C9 02 - bne Label_F4DF ; CPU:$F4AF PRG:34AF D0 2E + bne TurnEnd_StartTurn ; CPU:$F4AF PRG:34AF D0 2E ; ----------------------------------------------------------------------------- -; Routine: Label_F4B1 +; Routine: TurnEnd_NextPlayer ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -8662,7 +9886,7 @@ Label_F49B: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_F4B1: +TurnEnd_NextPlayer: lda #$01 ; CPU:$F4B1 PRG:34B1 A9 01 sta $01CB ; CPU:$F4B3 PRG:34B3 8D CB 01 inc $01C6 ; CPU:$F4B6 PRG:34B6 EE C6 01 @@ -8680,7 +9904,7 @@ Label_F4B1: jsr $E2A2 ; CPU:$F4D9 PRG:34D9 20 A2 E2 jsr $F77A ; CPU:$F4DC PRG:34DC 20 7A F7 ; ----------------------------------------------------------------------------- -; Routine: Label_F4DF +; Routine: TurnEnd_StartTurn ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -8688,7 +9912,7 @@ Label_F4B1: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_F4DF: +TurnEnd_StartTurn: lda #$01 ; CPU:$F4DF PRG:34DF A9 01 sta $01C4 ; CPU:$F4E1 PRG:34E1 8D C4 01 sta $01CA ; CPU:$F4E4 PRG:34E4 8D CA 01 @@ -8698,7 +9922,7 @@ Label_F4DF: jsr $E2C8 ; CPU:$F4F0 PRG:34F0 20 C8 E2 jmp $ED4F ; CPU:$F4F3 PRG:34F3 4C 4F ED ; ----------------------------------------------------------------------------- -; Routine: Label_F4F6 +; Routine: ShowGameOverScreen ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -8706,7 +9930,7 @@ Label_F4DF: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_F4F6: +ShowGameOverScreen: jsr $F87F ; CPU:$F4F6 PRG:34F6 20 7F F8 jsr $E20D ; CPU:$F4F9 PRG:34F9 20 0D E2 jsr $C3BC ; CPU:$F4FC PRG:34FC 20 BC C3 @@ -8719,25 +9943,24 @@ Label_F4F6: lda #$55 ; CPU:$F50F PRG:350F A9 55 jsr $F669 ; CPU:$F511 PRG:3511 20 69 F6 lda #$21 ; CPU:$F514 PRG:3514 A9 21 - sta $2006 ; CPU:$F516 PRG:3516 8D 06 20 + sta PPUADDR ; CPU:$F516 PRG:3516 8D 06 20 lda #$CB ; CPU:$F519 PRG:3519 A9 CB - sta $2006 ; CPU:$F51B PRG:351B 8D 06 20 + sta PPUADDR ; CPU:$F51B PRG:351B 8D 06 20 jsr $CBC9 ; CPU:$F51E PRG:351E 20 C9 CB .byte $67, $61 ; CPU:$F521 PRG:3521 67 61 -- rra Zp61 (undocumented; ca65 cannot encode) - adc $3B65 ; CPU:$F523 PRG:3523 6D 65 3B - .byte $6F, $76, $65 ; CPU:$F526 PRG:3526 6F 76 65 -- rra $6576 (undocumented; ca65 cannot encode) - .byte $72, $00, $20 ; CPU:$F529 PRG:3529 72 00 20 -- rra $2000 (undocumented; ca65 cannot encode) - .byte $42, $CA ; CPU:$F52C PRG:352C 42 CA -- nop #$CA (undocumented; ca65 cannot encode) +; ---- data $F523-$F52A (8 bytes) ---- + .byte $6D, $65, $3B, $6F, $76, $65, $72, $00 ; CPU:$F523 PRG:3523 6D 65 3B 6F 76 65 72 00 + jsr $CA42 ; CPU:$F52B PRG:352B 20 42 CA lda #$00 ; CPU:$F52E PRG:352E A9 00 sta $0146 ; CPU:$F530 PRG:3530 8D 46 01 jsr $FA7D ; CPU:$F533 PRG:3533 20 7D FA lda Zp5F ; CPU:$F536 PRG:3536 A5 5F cmp #$0A ; CPU:$F538 PRG:3538 C9 0A - bne Label_F540 ; CPU:$F53A PRG:353A D0 04 + bne ShowGameOverScreen_SpawnAlt ; CPU:$F53A PRG:353A D0 04 lda #$08 ; CPU:$F53C PRG:353C A9 08 - bne Label_F542 ; CPU:$F53E PRG:353E D0 02 + bne ShowGameOverScreen_QueueSpawn ; CPU:$F53E PRG:353E D0 02 ; ----------------------------------------------------------------------------- -; Routine: Label_F540 +; Routine: ShowGameOverScreen_SpawnAlt ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -8745,10 +9968,10 @@ Label_F4F6: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_F540: +ShowGameOverScreen_SpawnAlt: lda #$10 ; CPU:$F540 PRG:3540 A9 10 ; ----------------------------------------------------------------------------- -; Routine: Label_F542 +; Routine: ShowGameOverScreen_QueueSpawn ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -8756,13 +9979,13 @@ Label_F540: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_F542: +ShowGameOverScreen_QueueSpawn: jsr $C3DA ; CPU:$F542 PRG:3542 20 DA C3 ldx #$02 ; CPU:$F545 PRG:3545 A2 02 jsr $FF56 ; CPU:$F547 PRG:3547 20 56 FF ldy #$28 ; CPU:$F54A PRG:354A A0 28 ; ----------------------------------------------------------------------------- -; Routine: Label_F54C +; Routine: ShowGameOverScreen_WaitLoop ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -8770,14 +9993,14 @@ Label_F542: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_F54C: +ShowGameOverScreen_WaitLoop: lda $0503 ; CPU:$F54C PRG:354C AD 03 05 - bne Label_F557 ; CPU:$F54F PRG:354F D0 06 + bne ShowGameOverScreen_CheckInput ; CPU:$F54F PRG:354F D0 06 dey ; CPU:$F551 PRG:3551 88 - bne Label_F557 ; CPU:$F552 PRG:3552 D0 03 + bne ShowGameOverScreen_CheckInput ; CPU:$F552 PRG:3552 D0 03 jmp $E8B3 ; CPU:$F554 PRG:3554 4C B3 E8 ; ----------------------------------------------------------------------------- -; Routine: Label_F557 +; Routine: ShowGameOverScreen_CheckInput ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -8785,17 +10008,17 @@ Label_F54C: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_F557: +ShowGameOverScreen_CheckInput: ldx #$01 ; CPU:$F557 PRG:3557 A2 01 jsr $FF56 ; CPU:$F559 PRG:3559 20 56 FF jsr $CD0E ; CPU:$F55C PRG:355C 20 0E CD lda $0180 ; CPU:$F55F PRG:355F AD 80 01 ora $0182 ; CPU:$F562 PRG:3562 0D 82 01 and #$08 ; CPU:$F565 PRG:3565 29 08 - beq Label_F54C ; CPU:$F567 PRG:3567 F0 E3 + beq ShowGameOverScreen_WaitLoop ; CPU:$F567 PRG:3567 F0 E3 jmp $E8B3 ; CPU:$F569 PRG:3569 4C B3 E8 ; ----------------------------------------------------------------------------- -; Routine: Label_F56C +; Routine: ShowEndingScreen ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -8803,12 +10026,12 @@ Label_F557: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_F56C: +ShowEndingScreen: jsr $FA2B ; CPU:$F56C PRG:356C 20 2B FA - bcc Label_F574 ; CPU:$F56F PRG:356F 90 03 + bcc ShowEndingScreen_SwapPlayer ; CPU:$F56F PRG:356F 90 03 jsr $FA56 ; CPU:$F571 PRG:3571 20 56 FA ; ----------------------------------------------------------------------------- -; Routine: Label_F574 +; Routine: ShowEndingScreen_SwapPlayer ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -8816,16 +10039,16 @@ Label_F56C: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_F574: +ShowEndingScreen_SwapPlayer: lda $01C6 ; CPU:$F574 PRG:3574 AD C6 01 pha ; CPU:$F577 PRG:3577 48 eor #$01 ; CPU:$F578 PRG:3578 49 01 sta $01C6 ; CPU:$F57A PRG:357A 8D C6 01 jsr $FA2B ; CPU:$F57D PRG:357D 20 2B FA - bcc Label_F585 ; CPU:$F580 PRG:3580 90 03 + bcc ShowEndingScreen_RestorePlayer ; CPU:$F580 PRG:3580 90 03 jsr $FA56 ; CPU:$F582 PRG:3582 20 56 FA ; ----------------------------------------------------------------------------- -; Routine: Label_F585 +; Routine: ShowEndingScreen_RestorePlayer ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -8833,7 +10056,7 @@ Label_F574: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_F585: +ShowEndingScreen_RestorePlayer: pla ; CPU:$F585 PRG:3585 68 sta $01C6 ; CPU:$F586 PRG:3586 8D C6 01 jsr $F87F ; CPU:$F589 PRG:3589 20 7F F8 @@ -8852,17 +10075,17 @@ Label_F585: ldx #$0A ; CPU:$F5AA PRG:35AA A2 0A ldy #$F0 ; CPU:$F5AC PRG:35AC A0 F0 jsr $CDD3 ; CPU:$F5AE PRG:35AE 20 D3 CD - lda ZpF0 ; CPU:$F5B1 PRG:35B1 A5 F0 + lda ppu_ctrl_shadow ; CPU:$F5B1 PRG:35B1 A5 F0 ora #$04 ; CPU:$F5B3 PRG:35B3 09 04 - sta $2000 ; CPU:$F5B5 PRG:35B5 8D 00 20 + sta PPUCTRL ; CPU:$F5B5 PRG:35B5 8D 00 20 ldx #$21 ; CPU:$F5B8 PRG:35B8 A2 21 - stx $2006 ; CPU:$F5BA PRG:35BA 8E 06 20 + stx PPUADDR ; CPU:$F5BA PRG:35BA 8E 06 20 ldy #$A4 ; CPU:$F5BD PRG:35BD A0 A4 - sty $2006 ; CPU:$F5BF PRG:35BF 8C 06 20 + sty PPUADDR ; CPU:$F5BF PRG:35BF 8C 06 20 ldy #$0D ; CPU:$F5C2 PRG:35C2 A0 0D lda #$E0 ; CPU:$F5C4 PRG:35C4 A9 E0 ; ----------------------------------------------------------------------------- -; Routine: Label_F5C6 +; Routine: ShowEndingScreen_ClearRow1 ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -8870,16 +10093,16 @@ Label_F585: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_F5C6: - sta $2007 ; CPU:$F5C6 PRG:35C6 8D 07 20 +ShowEndingScreen_ClearRow1: + sta PPUDATA ; CPU:$F5C6 PRG:35C6 8D 07 20 dey ; CPU:$F5C9 PRG:35C9 88 - bne Label_F5C6 ; CPU:$F5CA PRG:35CA D0 FA + bne ShowEndingScreen_ClearRow1 ; CPU:$F5CA PRG:35CA D0 FA ldy #$BB ; CPU:$F5CC PRG:35CC A0 BB - stx $2006 ; CPU:$F5CE PRG:35CE 8E 06 20 - sty $2006 ; CPU:$F5D1 PRG:35D1 8C 06 20 + stx PPUADDR ; CPU:$F5CE PRG:35CE 8E 06 20 + sty PPUADDR ; CPU:$F5D1 PRG:35D1 8C 06 20 ldy #$0D ; CPU:$F5D4 PRG:35D4 A0 0D ; ----------------------------------------------------------------------------- -; Routine: Label_F5D6 +; Routine: ShowEndingScreen_ClearRow2 ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -8887,13 +10110,19 @@ Label_F5C6: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_F5D6: - sta $2007 ; CPU:$F5D6 PRG:35D6 8D 07 20 +ShowEndingScreen_ClearRow2: + sta PPUDATA ; CPU:$F5D6 PRG:35D6 8D 07 20 dey ; CPU:$F5D9 PRG:35D9 88 - bne Label_F5D6 ; CPU:$F5DA PRG:35DA D0 FA - lda ZpF0 ; CPU:$F5DC PRG:35DC A5 F0 - sta $2000 ; CPU:$F5DE PRG:35DE 8D 00 20 + bne ShowEndingScreen_ClearRow2 ; CPU:$F5DA PRG:35DA D0 FA + lda ppu_ctrl_shadow ; CPU:$F5DC PRG:35DC A5 F0 + sta PPUCTRL ; CPU:$F5DE PRG:35DE 8D 00 20 jsr $CF9B ; CPU:$F5E1 PRG:35E1 20 9B CF +; EndingCommandList: four five-byte records - $03 $03 $1B $03 $03, $03 $05 $1C $09 $03, +; $07 $0E $17 $15 $00 and $0D $18 $13 $18 $02 - terminated by the $FF at $F5F8, the 21 +; bytes RunCommandList walks after the jsr above. The tracer decoded the record bytes as +; undocumented opcodes (hence the annotations), the third record's last byte at $F5F2 comes +; out as a one-byte `brk` line of its own, and the fourth record opens the block below. +EndingCommandList: .byte $03, $03 ; CPU:$F5E4 PRG:35E4 03 03 -- slo (Zp03,x) (undocumented; ca65 cannot encode) .byte $1B, $03, $03 ; CPU:$F5E6 PRG:35E6 1B 03 03 -- slo $0303,y (undocumented; ca65 cannot encode) .byte $03, $05 ; CPU:$F5E9 PRG:35E9 03 05 -- slo (Zp05,x) (undocumented; ca65 cannot encode) @@ -8902,6 +10131,12 @@ Label_F5D6: .byte $17, $15 ; CPU:$F5F0 PRG:35F0 17 15 -- slo Zp15,y (undocumented; ca65 cannot encode) brk ; CPU:$F5F2 PRG:35F2 00 ; ---- data $F5F3-$F653 (97 bytes) ---- +; Continuation of EndingCommandList, then the ending screen's code. The block opens with the +; fourth list record $0D $18 $13 $18 $02 and the $FF terminator at $F5F8, and holds from +; $F5F9 the code RunCommandList resumes at: an attribute-row copy, three HUD refreshes, a +; spawn request and an A-button loop that returns to the title screen. It ends with the +; sixteen-byte attribute row $F644-$F653 that the copy reads. Because the CDL capture never +; reached the ending screen, this whole run is still emitted as .byte rather than code. .byte $0D, $18, $13, $18, $02, $FF, $A2, $10, $BD, $43, $F6, $9D, $3F, $01, $CA, $D0 ; CPU:$F5F3 PRG:35F3 0D 18 13 18 02 FF A2 10 BD 43 F6 9D 3F 01 CA D0 .byte $F7, $20, $42, $CA, $20, $F2, $E1, $20, $02, $E2, $20, $7D, $FA, $A9, $0B, $20 ; CPU:$F603 PRG:3603 F7 20 42 CA 20 F2 E1 20 02 E2 20 7D FA A9 0B 20 .byte $DA, $C3, $A9, $0A, $85, $24, $A9, $00, $85, $26, $85, $27, $AD, $C8, $01, $F0 ; CPU:$F613 PRG:3613 DA C3 A9 0A 85 24 A9 00 85 26 85 27 AD C8 01 F0 @@ -8910,7 +10145,7 @@ Label_F5D6: .byte $E8, $00, $B0, $8C, $8C, $00, $80, $90, $A0, $00, $B3, $85, $85, $00, $01, $00 ; CPU:$F643 PRG:3643 E8 00 B0 8C 8C 00 80 90 A0 00 B3 85 85 00 01 00 .byte $0B ; CPU:$F653 PRG:3653 0B ; ----------------------------------------------------------------------------- -; Routine: Label_F654 +; Routine: FillNametable ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -8918,20 +10153,20 @@ Label_F5D6: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_F654: +FillNametable: pha ; CPU:$F654 PRG:3654 48 ldx #$20 ; CPU:$F655 PRG:3655 A2 20 ldy #$00 ; CPU:$F657 PRG:3657 A0 00 jsr $CBA9 ; CPU:$F659 PRG:3659 20 A9 CB ldx #$03 ; CPU:$F65C PRG:365C A2 03 ldy #$C0 ; CPU:$F65E PRG:365E A0 C0 - stx ZpF9 ; CPU:$F660 PRG:3660 86 F9 - sty ZpF8 ; CPU:$F662 PRG:3662 84 F8 + stx ppu_src_hi ; CPU:$F660 PRG:3660 86 F9 + sty ppu_src_lo ; CPU:$F662 PRG:3662 84 F8 pla ; CPU:$F664 PRG:3664 68 jsr $CB2B ; CPU:$F665 PRG:3665 20 2B CB rts ; CPU:$F668 PRG:3668 60 ; ----------------------------------------------------------------------------- -; Routine: Label_F669 +; Routine: FillAttributeTable ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -8939,10 +10174,10 @@ Label_F654: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_F669: +FillAttributeTable: ldx #$40 ; CPU:$F669 PRG:3669 A2 40 ; ----------------------------------------------------------------------------- -; Routine: Label_F66B +; Routine: FillAttributeTable_Loop ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -8950,13 +10185,13 @@ Label_F669: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_F66B: +FillAttributeTable_Loop: sta a:$00FF,x ; CPU:$F66B PRG:366B 9D FF 00 dex ; CPU:$F66E PRG:366E CA - bne Label_F66B ; CPU:$F66F PRG:366F D0 FA + bne FillAttributeTable_Loop ; CPU:$F66F PRG:366F D0 FA jmp $CD9D ; CPU:$F671 PRG:3671 4C 9D CD ; ----------------------------------------------------------------------------- -; Routine: Label_F674 +; Routine: WaitForObjectSlot ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -8964,7 +10199,7 @@ Label_F66B: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_F674: +WaitForObjectSlot: txa ; CPU:$F674 PRG:3674 8A pha ; CPU:$F675 PRG:3675 48 ldx #$02 ; CPU:$F676 PRG:3676 A2 02 @@ -8972,7 +10207,7 @@ Label_F674: pla ; CPU:$F67B PRG:367B 68 tax ; CPU:$F67C PRG:367C AA ; ----------------------------------------------------------------------------- -; Routine: Label_F67D +; Routine: WaitForObjectSlot_Spin ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -8980,12 +10215,12 @@ Label_F674: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_F67D: +WaitForObjectSlot_Spin: lda $0500,x ; CPU:$F67D PRG:367D BD 00 05 - bne Label_F67D ; CPU:$F680 PRG:3680 D0 FB + bne WaitForObjectSlot_Spin ; CPU:$F680 PRG:3680 D0 FB rts ; CPU:$F682 PRG:3682 60 ; ----------------------------------------------------------------------------- -; Routine: Label_F683 +; Routine: BuildBallSprites ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -8993,22 +10228,22 @@ Label_F67D: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_F683: +BuildBallSprites: ldy #$00 ; CPU:$F683 PRG:3683 A0 00 sty Zp07 ; CPU:$F685 PRG:3685 84 07 lda #$F0 ; CPU:$F687 PRG:3687 A9 F0 - sta ZpF6 ; CPU:$F689 PRG:3689 85 F6 + sta ppu_addr_temp_lo ; CPU:$F689 PRG:3689 85 F6 lda #$10 ; CPU:$F68B PRG:368B A9 10 - sta ZpF7 ; CPU:$F68D PRG:368D 85 F7 + sta ppu_addr_temp_hi ; CPU:$F68D PRG:368D 85 F7 lda Zp04 ; CPU:$F68F PRG:368F A5 04 and #$01 ; CPU:$F691 PRG:3691 29 01 - beq Label_F69D ; CPU:$F693 PRG:3693 F0 08 + beq BuildBallSprites_Loop ; CPU:$F693 PRG:3693 F0 08 lda #$E0 ; CPU:$F695 PRG:3695 A9 E0 - sta ZpF6 ; CPU:$F697 PRG:3697 85 F6 + sta ppu_addr_temp_lo ; CPU:$F697 PRG:3697 85 F6 lda #$F0 ; CPU:$F699 PRG:3699 A9 F0 - sta ZpF7 ; CPU:$F69B PRG:369B 85 F7 + sta ppu_addr_temp_hi ; CPU:$F69B PRG:369B 85 F7 ; ----------------------------------------------------------------------------- -; Routine: Label_F69D +; Routine: BuildBallSprites_Loop ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -9016,17 +10251,17 @@ Label_F683: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_F69D: +BuildBallSprites_Loop: ldy Zp07 ; CPU:$F69D PRG:369D A4 07 ldx $0300,y ; CPU:$F69F PRG:369F BE 00 03 - lda ZpF6 ; CPU:$F6A2 PRG:36A2 A5 F6 + lda ppu_addr_temp_lo ; CPU:$F6A2 PRG:36A2 A5 F6 clc ; CPU:$F6A4 PRG:36A4 18 - adc ZpF7 ; CPU:$F6A5 PRG:36A5 65 F7 - sta ZpF6 ; CPU:$F6A7 PRG:36A7 85 F6 + adc ppu_addr_temp_hi ; CPU:$F6A5 PRG:36A5 65 F7 + sta ppu_addr_temp_lo ; CPU:$F6A7 PRG:36A7 85 F6 txa ; CPU:$F6A9 PRG:36A9 8A and #$80 ; CPU:$F6AA PRG:36AA 29 80 - bne Label_F6C1 ; CPU:$F6AC PRG:36AC D0 13 - ldx ZpF6 ; CPU:$F6AE PRG:36AE A6 F6 + bne BuildBallSprites_CheckSpecial ; CPU:$F6AC PRG:36AC D0 13 + ldx ppu_addr_temp_lo ; CPU:$F6AE PRG:36AE A6 F6 lda #$F8 ; CPU:$F6B0 PRG:36B0 A9 F8 sta $0200,x ; CPU:$F6B2 PRG:36B2 9D 00 02 sta $0204,x ; CPU:$F6B5 PRG:36B5 9D 04 02 @@ -9034,7 +10269,7 @@ Label_F69D: sta $020C,x ; CPU:$F6BB PRG:36BB 9D 0C 02 jmp $F71A ; CPU:$F6BE PRG:36BE 4C 1A F7 ; ----------------------------------------------------------------------------- -; Routine: Label_F6C1 +; Routine: BuildBallSprites_CheckSpecial ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -9042,16 +10277,16 @@ Label_F69D: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_F6C1: +BuildBallSprites_CheckSpecial: txa ; CPU:$F6C1 PRG:36C1 8A and #$40 ; CPU:$F6C2 PRG:36C2 29 40 - beq Label_F6CF ; CPU:$F6C4 PRG:36C4 F0 09 + beq BuildBallSprites_Draw2x2 ; CPU:$F6C4 PRG:36C4 F0 09 txa ; CPU:$F6C6 PRG:36C6 8A - ldx ZpF6 ; CPU:$F6C7 PRG:36C7 A6 F6 + ldx ppu_addr_temp_lo ; CPU:$F6C7 PRG:36C7 A6 F6 jsr $F728 ; CPU:$F6C9 PRG:36C9 20 28 F7 jmp $F71A ; CPU:$F6CC PRG:36CC 4C 1A F7 ; ----------------------------------------------------------------------------- -; Routine: Label_F6CF +; Routine: BuildBallSprites_Draw2x2 ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -9059,8 +10294,8 @@ Label_F6C1: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_F6CF: - ldx ZpF6 ; CPU:$F6CF PRG:36CF A6 F6 +BuildBallSprites_Draw2x2: + ldx ppu_addr_temp_lo ; CPU:$F6CF PRG:36CF A6 F6 lda $0330,y ; CPU:$F6D1 PRG:36D1 B9 30 03 sta $0204,x ; CPU:$F6D4 PRG:36D4 9D 04 02 sta $020C,x ; CPU:$F6D7 PRG:36D7 9D 0C 02 @@ -9090,7 +10325,7 @@ Label_F6CF: adc #$01 ; CPU:$F715 PRG:3715 69 01 sta $020D,x ; CPU:$F717 PRG:3717 9D 0D 02 ; ----------------------------------------------------------------------------- -; Routine: Label_F71A +; Routine: BuildBallSprites_Next ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -9098,14 +10333,14 @@ Label_F6CF: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_F71A: +BuildBallSprites_Next: inc Zp07 ; CPU:$F71A PRG:371A E6 07 lda Zp07 ; CPU:$F71C PRG:371C A5 07 cmp #$0E ; CPU:$F71E PRG:371E C9 0E - beq Label_F725 ; CPU:$F720 PRG:3720 F0 03 + beq BuildBallSprites_Done ; CPU:$F720 PRG:3720 F0 03 jmp $F69D ; CPU:$F722 PRG:3722 4C 9D F6 ; ----------------------------------------------------------------------------- -; Routine: Label_F725 +; Routine: BuildBallSprites_Done ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -9113,11 +10348,11 @@ Label_F71A: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_F725: +BuildBallSprites_Done: inc Zp04 ; CPU:$F725 PRG:3725 E6 04 rts ; CPU:$F727 PRG:3727 60 ; ----------------------------------------------------------------------------- -; Routine: Label_F728 +; Routine: DrawBlinkingBallSprite ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -9125,19 +10360,19 @@ Label_F725: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_F728: +DrawBlinkingBallSprite: lda #$F8 ; CPU:$F728 PRG:3728 A9 F8 sta $0204,x ; CPU:$F72A PRG:372A 9D 04 02 sta $0208,x ; CPU:$F72D PRG:372D 9D 08 02 sta $020C,x ; CPU:$F730 PRG:3730 9D 0C 02 - lda Zp00 ; CPU:$F733 PRG:3733 A5 00 + lda timer_lo ; CPU:$F733 PRG:3733 A5 00 and #$08 ; CPU:$F735 PRG:3735 29 08 - bne Label_F73F ; CPU:$F737 PRG:3737 D0 06 + bne DrawBlinkingBallSprite_Visible ; CPU:$F737 PRG:3737 D0 06 lda #$F8 ; CPU:$F739 PRG:3739 A9 F8 sta $0200,x ; CPU:$F73B PRG:373B 9D 00 02 rts ; CPU:$F73E PRG:373E 60 ; ----------------------------------------------------------------------------- -; Routine: Label_F73F +; Routine: DrawBlinkingBallSprite_Visible ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -9145,7 +10380,7 @@ Label_F728: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_F73F: +DrawBlinkingBallSprite_Visible: lda $0320,y ; CPU:$F73F PRG:373F B9 20 03 sec ; CPU:$F742 PRG:3742 38 sbc #$04 ; CPU:$F743 PRG:3743 E9 04 @@ -9166,10 +10401,12 @@ Label_F73F: ; referenced by `lda $F762,x` at $EDD5 (operand $F762 falls inside this region) ; referenced by `lda $F76A,x` at $EDDA (operand $F76A falls inside this region) ; referenced by `lda $F772,x` at $EDDF (operand $F772 falls inside this region) +; First of three parallel eight-byte colour sequences ($F762, $F76A, $F772) indexed by (($01C1 frame counter) >> 2) & 7 on every frame. The values are NES colour codes stored into the palette shadow at $008B, $008F and $0092, giving the aiming display its rotating three-colour shimmer; this .byte run holds sequences 0 and 1, and $F772 holds sequence 2. +AimPhaseTable0: .byte $10, $00, $0C, $0E, $0E, $0C, $00, $10, $32, $22, $12, $02, $01, $02, $12, $22 ; CPU:$F762 PRG:3762 10 00 0C 0E 0E 0C 00 10 32 22 12 02 01 02 12 22 .byte $0A, $0B, $1B, $2B, $3B, $2B, $1B, $0B ; CPU:$F772 PRG:3772 0A 0B 1B 2B 3B 2B 1B 0B ; ----------------------------------------------------------------------------- -; Routine: Label_F77A +; Routine: ShowPlayerShotText ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -9177,19 +10414,29 @@ Label_F73F: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_F77A: +ShowPlayerShotText: ldx #$21 ; CPU:$F77A PRG:377A A2 21 ldy #$C9 ; CPU:$F77C PRG:377C A0 C9 lda #$0F ; CPU:$F77E PRG:377E A9 0F jsr $F7A7 ; CPU:$F780 PRG:3780 20 A7 F7 jsr $CBDC ; CPU:$F783 PRG:3783 20 DC CB - sta (Zp70,x) ; CPU:$F786 PRG:3786 81 70 - jmp ($7961) ; CPU:$F788 PRG:3788 6C 61 79 -; ---- data $F78B-$F7A4 (26 bytes) ---- - .byte $65, $72, $81, $00, $AD, $C6, $01, $18, $69, $31, $20, $29, $CC, $20, $DC, $CB ; CPU:$F78B PRG:378B 65 72 81 00 AD C6 01 18 69 31 20 29 CC 20 DC CB - .byte $81, $73, $68, $6F, $74, $81, $00, $A2, $3C, $4C ; CPU:$F79B PRG:379B 81 73 68 6F 74 81 00 A2 3C 4C +; ---- data $F786-$F78E (9 bytes) ---- +; Inline string "player" (leading $81 control byte, $00 terminator). +StrPlayer1: + .byte $81, $70, $6C, $61, $79, $65, $72, $81, $00 ; CPU:$F786 PRG:3786 81 70 6C 61 79 65 72 81 00 + lda $01C6 ; CPU:$F78F PRG:378F AD C6 01 + clc ; CPU:$F792 PRG:3792 18 + adc #$31 ; CPU:$F793 PRG:3793 69 31 + jsr $CC29 ; CPU:$F795 PRG:3795 20 29 CC + jsr $CBDC ; CPU:$F798 PRG:3798 20 DC CB +; ---- data $F79B-$F7A1 (7 bytes) ---- +; Inline string "shot" (leading $81 control byte, $00 terminator). +StrShot: + .byte $81, $73, $68, $6F, $74, $81, $00 ; CPU:$F79B PRG:379B 81 73 68 6F 74 81 00 + ldx #$3C ; CPU:$F7A2 PRG:37A2 A2 3C + jmp $F7CB ; CPU:$F7A4 PRG:37A4 4C CB F7 ; ----------------------------------------------------------------------------- -; Routine: Label_F7A5 +; Routine: BeginVramOverlay ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -9197,30 +10444,19 @@ Label_F77A: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_F7A5: - .byte $CB, $F7 ; CPU:$F7A5 PRG:37A5 CB F7 -- axs #$F7 (undocumented; ca65 cannot encode) -; ----------------------------------------------------------------------------- -; Routine: Label_F7A7 -; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. -; Local: Continues its parent routine along the condition or operation encoded in this label, -; then returns, branches again, or rejoins shared code as documented by the instructions. -; Parameters: Undetermined in Pass 1 unless implied by the caller. -; Returns: Undetermined in Pass 1; status flags and registers may carry results. -; Clobbers: Undetermined in Pass 1. -; ----------------------------------------------------------------------------- -Label_F7A7: - sta ZpF8 ; CPU:$F7A7 PRG:37A7 85 F8 - stx ZpEA ; CPU:$F7A9 PRG:37A9 86 EA - sty ZpE9 ; CPU:$F7AB PRG:37AB 84 E9 +BeginVramOverlay: + sta ppu_src_lo ; CPU:$F7A7 PRG:37A7 85 F8 + stx vram_read_addr_hi ; CPU:$F7A9 PRG:37A9 86 EA + sty vram_read_addr_lo ; CPU:$F7AB PRG:37AB 84 E9 jsr $CBAE ; CPU:$F7AD PRG:37AD 20 AE CB lda #$04 ; CPU:$F7B0 PRG:37B0 A9 04 - sta ZpEC ; CPU:$F7B2 PRG:37B2 85 EC + sta vram_read_dst_hi ; CPU:$F7B2 PRG:37B2 85 EC lda #$20 ; CPU:$F7B4 PRG:37B4 A9 20 - sta ZpEB ; CPU:$F7B6 PRG:37B6 85 EB - lda ZpF8 ; CPU:$F7B8 PRG:37B8 A5 F8 - sta ZpE8 ; CPU:$F7BA PRG:37BA 85 E8 + sta vram_read_dst_lo ; CPU:$F7B6 PRG:37B6 85 EB + lda ppu_src_lo ; CPU:$F7B8 PRG:37B8 A5 F8 + sta vram_read_len ; CPU:$F7BA PRG:37BA 85 E8 ; ----------------------------------------------------------------------------- -; Routine: Label_F7BC +; Routine: BeginVramOverlay_Wait ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -9228,19 +10464,34 @@ Label_F7A7: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_F7BC: - lda ZpE8 ; CPU:$F7BC PRG:37BC A5 E8 - bne Label_F7BC ; CPU:$F7BE PRG:37BE D0 FC - ldx ZpEA ; CPU:$F7C0 PRG:37C0 A6 EA - ldy ZpE9 ; CPU:$F7C2 PRG:37C2 A4 E9 - stx ZpFD ; CPU:$F7C4 PRG:37C4 86 FD - sty ZpFC ; CPU:$F7C6 PRG:37C6 84 FC +BeginVramOverlay_Wait: + lda vram_read_len ; CPU:$F7BC PRG:37BC A5 E8 + bne BeginVramOverlay_Wait ; CPU:$F7BE PRG:37BE D0 FC + ldx vram_read_addr_hi ; CPU:$F7C0 PRG:37C0 A6 EA + ldy vram_read_addr_lo ; CPU:$F7C2 PRG:37C2 A4 E9 + stx ppu_addr_hi ; CPU:$F7C4 PRG:37C4 86 FD + sty ppu_addr_lo ; CPU:$F7C6 PRG:37C6 84 FC jmp $CBFB ; CPU:$F7C8 PRG:37C8 4C FB CB -; ---- data $F7CB-$F7E7 (29 bytes) ---- - .byte $20, $56, $FF, $A6, $EA, $A4, $E9, $86, $FD, $84, $FC, $20, $FB, $CB, $A6, $F8 ; CPU:$F7CB PRG:37CB 20 56 FF A6 EA A4 E9 86 FD 84 FC 20 FB CB A6 F8 - .byte $A0, $00, $B9, $20, $04, $20, $29, $CC, $C8, $CA, $D0, $F6, $60 ; CPU:$F7DB PRG:37DB A0 00 B9 20 04 20 29 CC C8 CA D0 F6 60 ; ----------------------------------------------------------------------------- -; Routine: Label_F7E8 +; Routine: RestoreVramOverlay +; Global: Waits for a frame and then writes the overlay buffer at $0420 back to VRAM. +; Local: Shared re-entry point of the VRAM read-back routine: re-latches the saved +; destination address, starts a queued write and streams the $0420 buffer into it. +; Parameters: vram_read_addr_lo/hi = destination, ppu_src_lo = length. +; Returns: Returns after the buffer has been queued. +; Clobbers: A, X, Y, ptr, ppu_addr, the VRAM write queue. +; ----------------------------------------------------------------------------- +RestoreVramOverlay: + jsr $FF56 ; CPU:$F7CB PRG:37CB 20 56 FF + ldx vram_read_addr_hi ; CPU:$F7CE PRG:37CE A6 EA + ldy vram_read_addr_lo ; CPU:$F7D0 PRG:37D0 A4 E9 + stx ppu_addr_hi ; CPU:$F7D2 PRG:37D2 86 FD + sty ppu_addr_lo ; CPU:$F7D4 PRG:37D4 84 FC + jsr $CBFB ; CPU:$F7D6 PRG:37D6 20 FB CB + ldx ppu_src_lo ; CPU:$F7D9 PRG:37D9 A6 F8 + ldy #$00 ; CPU:$F7DB PRG:37DB A0 00 +; ----------------------------------------------------------------------------- +; Routine: RestoreVramOverlay_Loop ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -9248,20 +10499,45 @@ Label_F7BC: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_F7E8: +RestoreVramOverlay_Loop: + lda $0420,y ; CPU:$F7DD PRG:37DD B9 20 04 + jsr $CC29 ; CPU:$F7E0 PRG:37E0 20 29 CC + iny ; CPU:$F7E3 PRG:37E3 C8 + dex ; CPU:$F7E4 PRG:37E4 CA + bne RestoreVramOverlay_Loop ; CPU:$F7E5 PRG:37E5 D0 F6 + rts ; CPU:$F7E7 PRG:37E7 60 +; ----------------------------------------------------------------------------- +; Routine: ShowPlayerGameOverText +; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. +; Local: Continues its parent routine along the condition or operation encoded in this label, +; then returns, branches again, or rejoins shared code as documented by the instructions. +; Parameters: Undetermined in Pass 1 unless implied by the caller. +; Returns: Undetermined in Pass 1; status flags and registers may carry results. +; Clobbers: Undetermined in Pass 1. +; ----------------------------------------------------------------------------- +ShowPlayerGameOverText: ldx #$21 ; CPU:$F7E8 PRG:37E8 A2 21 ldy #$C6 ; CPU:$F7EA PRG:37EA A0 C6 lda #$14 ; CPU:$F7EC PRG:37EC A9 14 jsr $F7A7 ; CPU:$F7EE PRG:37EE 20 A7 F7 jsr $CBDC ; CPU:$F7F1 PRG:37F1 20 DC CB - sta (Zp70,x) ; CPU:$F7F4 PRG:37F4 81 70 - jmp ($7961) ; CPU:$F7F6 PRG:37F6 6C 61 79 -; ---- data $F7F9-$F819 (33 bytes) ---- - .byte $65, $72, $81, $00, $AD, $C6, $01, $18, $69, $31, $20, $29, $CC, $20, $DC, $CB ; CPU:$F7F9 PRG:37F9 65 72 81 00 AD C6 01 18 69 31 20 29 CC 20 DC CB - .byte $81, $67, $61, $6D, $65, $81, $6F, $76, $65, $72, $81, $00, $A2, $64, $4C, $CB ; CPU:$F809 PRG:3809 81 67 61 6D 65 81 6F 76 65 72 81 00 A2 64 4C CB - .byte $F7 ; CPU:$F819 PRG:3819 F7 +; ---- data $F7F4-$F7FC (9 bytes) ---- +; Inline string "player", used by the second high-score screen. +StrPlayer2: + .byte $81, $70, $6C, $61, $79, $65, $72, $81, $00 ; CPU:$F7F4 PRG:37F4 81 70 6C 61 79 65 72 81 00 + lda $01C6 ; CPU:$F7FD PRG:37FD AD C6 01 + clc ; CPU:$F800 PRG:3800 18 + adc #$31 ; CPU:$F801 PRG:3801 69 31 + jsr $CC29 ; CPU:$F803 PRG:3803 20 29 CC + jsr $CBDC ; CPU:$F806 PRG:3806 20 DC CB +; ---- data $F809-$F814 (12 bytes) ---- +; Inline string "game over" (the $81 bytes separate the two words). +StrGameOver: + .byte $81, $67, $61, $6D, $65, $81, $6F, $76, $65, $72, $81, $00 ; CPU:$F809 PRG:3809 81 67 61 6D 65 81 6F 76 65 72 81 00 + ldx #$64 ; CPU:$F815 PRG:3815 A2 64 + jmp $F7CB ; CPU:$F817 PRG:3817 4C CB F7 ; ----------------------------------------------------------------------------- -; Routine: Label_F81A +; Routine: ShowPlayerHiScoreText ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -9269,20 +10545,29 @@ Label_F7E8: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_F81A: +ShowPlayerHiScoreText: ldx #$21 ; CPU:$F81A PRG:381A A2 21 ldy #$C6 ; CPU:$F81C PRG:381C A0 C6 lda #$14 ; CPU:$F81E PRG:381E A9 14 jsr $F7A7 ; CPU:$F820 PRG:3820 20 A7 F7 jsr $CBDC ; CPU:$F823 PRG:3823 20 DC CB - sta (Zp70,x) ; CPU:$F826 PRG:3826 81 70 - jmp ($7961) ; CPU:$F828 PRG:3828 6C 61 79 -; ---- data $F82B-$F84B (33 bytes) ---- - .byte $65, $72, $81, $00, $AD, $C6, $01, $18, $69, $31, $20, $29, $CC, $20, $DC, $CB ; CPU:$F82B PRG:382B 65 72 81 00 AD C6 01 18 69 31 20 29 CC 20 DC CB - .byte $81, $68, $69, $60, $73, $63, $6F, $72, $65, $5F, $5F, $00, $A2, $64, $4C, $CB ; CPU:$F83B PRG:383B 81 68 69 60 73 63 6F 72 65 5F 5F 00 A2 64 4C CB - .byte $F7 ; CPU:$F84B PRG:384B F7 +; ---- data $F826-$F82E (9 bytes) ---- +; Inline string "player", used by the third high-score screen. +StrPlayer3: + .byte $81, $70, $6C, $61, $79, $65, $72, $81, $00 ; CPU:$F826 PRG:3826 81 70 6C 61 79 65 72 81 00 + lda $01C6 ; CPU:$F82F PRG:382F AD C6 01 + clc ; CPU:$F832 PRG:3832 18 + adc #$31 ; CPU:$F833 PRG:3833 69 31 + jsr $CC29 ; CPU:$F835 PRG:3835 20 29 CC + jsr $CBDC ; CPU:$F838 PRG:3838 20 DC CB +; ---- data $F83B-$F846 (12 bytes) ---- +; Inline string "hi`score__" - the backtick and underscores are the game's own glyph choices. +StrHiScore: + .byte $81, $68, $69, $60, $73, $63, $6F, $72, $65, $5F, $5F, $00 ; CPU:$F83B PRG:383B 81 68 69 60 73 63 6F 72 65 5F 5F 00 + ldx #$64 ; CPU:$F847 PRG:3847 A2 64 + jmp $F7CB ; CPU:$F849 PRG:3849 4C CB F7 ; ----------------------------------------------------------------------------- -; Routine: Label_F84C +; Routine: ShowPerfectText ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -9290,22 +10575,20 @@ Label_F81A: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_F84C: +ShowPerfectText: ldx #$21 ; CPU:$F84C PRG:384C A2 21 ldy #$CB ; CPU:$F84E PRG:384E A0 CB lda #$09 ; CPU:$F850 PRG:3850 A9 09 jsr $F7A7 ; CPU:$F852 PRG:3852 20 A7 F7 jsr $CBDC ; CPU:$F855 PRG:3855 20 DC CB - sta (Zp70,x) ; CPU:$F858 PRG:3858 81 70 - adc Zp72 ; CPU:$F85A PRG:385A 65 72 - ror Zp65 ; CPU:$F85C PRG:385C 66 65 - .byte $63, $74 ; CPU:$F85E PRG:385E 63 74 -- rra (Zp74,x) (undocumented; ca65 cannot encode) - .byte $5F, $00, $A2 ; CPU:$F860 PRG:3860 5F 00 A2 -- sre $A200,x (undocumented; ca65 cannot encode) - .byte $FA, $4C, $CB ; CPU:$F863 PRG:3863 FA 4C CB -- nop $CB4C,x (undocumented; ca65 cannot encode) -; ---- data $F866-$F866 (1 bytes) ---- - .byte $F7 ; CPU:$F866 PRG:3866 F7 +; ---- data $F858-$F861 (10 bytes) ---- +; Inline string "perfect_" shown after a perfect (one-shot) game. +StrPerfect: + .byte $81, $70, $65, $72, $66, $65, $63, $74, $5F, $00 ; CPU:$F858 PRG:3858 81 70 65 72 66 65 63 74 5F 00 + ldx #$FA ; CPU:$F862 PRG:3862 A2 FA + jmp $F7CB ; CPU:$F864 PRG:3864 4C CB F7 ; ----------------------------------------------------------------------------- -; Routine: Label_F867 +; Routine: LoadHighScore ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -9313,7 +10596,7 @@ Label_F84C: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_F867: +LoadHighScore: lda $01C7 ; CPU:$F867 PRG:3867 AD C7 01 asl a ; CPU:$F86A PRG:386A 0A adc $01C7 ; CPU:$F86B PRG:386B 6D C7 01 @@ -9321,7 +10604,7 @@ Label_F867: tax ; CPU:$F86F PRG:386F AA ldy #$00 ; CPU:$F870 PRG:3870 A0 00 ; ----------------------------------------------------------------------------- -; Routine: Label_F872 +; Routine: LoadHighScore_Loop ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -9329,16 +10612,16 @@ Label_F867: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_F872: +LoadHighScore_Loop: lda $0450,x ; CPU:$F872 PRG:3872 BD 50 04 sta $0462,y ; CPU:$F875 PRG:3875 99 62 04 inx ; CPU:$F878 PRG:3878 E8 iny ; CPU:$F879 PRG:3879 C8 cpy #$06 ; CPU:$F87A PRG:387A C0 06 - bne Label_F872 ; CPU:$F87C PRG:387C D0 F4 + bne LoadHighScore_Loop ; CPU:$F87C PRG:387C D0 F4 rts ; CPU:$F87E PRG:387E 60 ; ----------------------------------------------------------------------------- -; Routine: Label_F87F +; Routine: SaveHighScore ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -9346,7 +10629,7 @@ Label_F872: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_F87F: +SaveHighScore: lda $01C7 ; CPU:$F87F PRG:387F AD C7 01 asl a ; CPU:$F882 PRG:3882 0A adc $01C7 ; CPU:$F883 PRG:3883 6D C7 01 @@ -9354,7 +10637,7 @@ Label_F87F: tax ; CPU:$F887 PRG:3887 AA ldy #$00 ; CPU:$F888 PRG:3888 A0 00 ; ----------------------------------------------------------------------------- -; Routine: Label_F88A +; Routine: SaveHighScore_Loop ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -9362,33 +10645,28 @@ Label_F87F: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_F88A: +SaveHighScore_Loop: lda $0462,y ; CPU:$F88A PRG:388A B9 62 04 sta $0450,x ; CPU:$F88D PRG:388D 9D 50 04 inx ; CPU:$F890 PRG:3890 E8 iny ; CPU:$F891 PRG:3891 C8 cpy #$06 ; CPU:$F892 PRG:3892 C0 06 - bne Label_F88A ; CPU:$F894 PRG:3894 D0 F4 + bne SaveHighScore_Loop ; CPU:$F894 PRG:3894 D0 F4 rts ; CPU:$F896 PRG:3896 60 -; ---- data $F897-$F98F (249 bytes) ---- - .byte $C0, $1E, $D0, $01, $60, $C0, $1D, $F0, $1B, $C0, $1F, $D0, $07, $A0, $FF, $8C ; CPU:$F897 PRG:3897 C0 1E D0 01 60 C0 1D F0 1B C0 1F D0 07 A0 FF 8C - .byte $88, $01, $D0, $10, $E0, $1F, $D0, $75, $AD, $8A, $01, $29, $01, $F0, $05, $A2 ; CPU:$F8A7 PRG:38A7 88 01 D0 10 E0 1F D0 75 AD 8A 01 29 01 F0 05 A2 - .byte $FF, $8E, $89, $01, $AE, $89, $01, $E0, $FF, $F0, $12, $AC, $88, $01, $C0, $FF ; CPU:$F8B7 PRG:38B7 FF 8E 89 01 AE 89 01 E0 FF F0 12 AC 88 01 C0 FF - .byte $F0, $0B, $20, $F7, $CA, $20, $89, $F9, $A9, $DA, $8D, $07, $20, $AE, $89, $01 ; CPU:$F8C7 PRG:38C7 F0 0B 20 F7 CA 20 89 F9 A9 DA 8D 07 20 AE 89 01 - .byte $E0, $1F, $F0, $13, $AC, $88, $01, $C0, $FF, $F0, $0C, $E8, $20, $F7, $CA, $20 ; CPU:$F8D7 PRG:38D7 E0 1F F0 13 AC 88 01 C0 FF F0 0C E8 20 F7 CA 20 - .byte $89, $F9, $A9, $DB, $8D, $07, $20, $AE, $89, $01, $E0, $FF, $F0, $13, $AC, $88 ; CPU:$F8E7 PRG:38E7 89 F9 A9 DB 8D 07 20 AE 89 01 E0 FF F0 13 AC 88 - .byte $01, $C0, $1D, $F0, $0C, $C8, $20, $F7, $CA, $20, $89, $F9, $A9, $D9, $8D, $07 ; CPU:$F8F7 PRG:38F7 01 C0 1D F0 0C C8 20 F7 CA 20 89 F9 A9 D9 8D 07 - .byte $20, $AE, $89, $01, $E0, $1F, $F0, $8C, $AC, $88, $01, $C0, $1D, $F0, $85, $E8 ; CPU:$F907 PRG:3907 20 AE 89 01 E0 1F F0 8C AC 88 01 C0 1D F0 85 E8 - .byte $C8, $20, $F7, $CA, $20, $89, $F9, $A9, $D8, $8D, $07, $20, $60, $20, $F7, $CA ; CPU:$F917 PRG:3917 C8 20 F7 CA 20 89 F9 A9 D8 8D 07 20 60 20 F7 CA - .byte $86, $FD, $84, $FC, $20, $89, $F9, $AD, $07, $20, $AD, $07, $20, $C9, $DC, $90 ; CPU:$F927 PRG:3927 86 FD 84 FC 20 89 F9 AD 07 20 AD 07 20 C9 DC 90 - .byte $50, $C9, $DF, $B0, $4C, $AD, $07, $20, $C9, $DC, $90, $45, $C9, $DF, $B0, $41 ; CPU:$F937 PRG:3937 50 C9 DF B0 4C AD 07 20 C9 DC 90 45 C9 DF B0 41 - .byte $A5, $FC, $18, $69, $20, $A8, $A5, $FD, $69, $00, $AA, $20, $89, $F9, $AD, $07 ; CPU:$F947 PRG:3947 A5 FC 18 69 20 A8 A5 FD 69 00 AA 20 89 F9 AD 07 - .byte $20, $AD, $07, $20, $C9, $DC, $90, $29, $C9, $DF, $B0, $25, $AD, $07, $20, $C9 ; CPU:$F957 PRG:3957 20 AD 07 20 C9 DC 90 29 C9 DF B0 25 AD 07 20 C9 - .byte $DC, $90, $1E, $C9, $DF, $B0, $1A, $20, $A3, $CA, $A9, $DA, $8D, $07, $20, $A9 ; CPU:$F967 PRG:3967 DC 90 1E C9 DF B0 1A 20 A3 CA A9 DA 8D 07 20 A9 - .byte $DB, $8D, $07, $20, $20, $89, $F9, $A9, $D9, $8D, $07, $20, $A9, $D8, $8D, $07 ; CPU:$F977 PRG:3977 DB 8D 07 20 20 89 F9 A9 D9 8D 07 20 A9 D8 8D 07 - .byte $20, $60, $8E, $06, $20, $8C, $06, $20, $60 ; CPU:$F987 PRG:3987 20 60 8E 06 20 8C 06 20 60 ; ----------------------------------------------------------------------------- -; Routine: Label_F990 +; Routine: StampBallMarker +; Global: Draws or clears the four tiles of the ball marker pocket. +; Local: The pocket row/column is in $0188/$0189; each of the four corners is drawn only if +; the surrounding cells hold the pocket tiles, otherwise the marker is faded out. +; Parameters: $0188 = pocket row, $0189 = pocket column, $018A = pocket index bits. +; Returns: none. +; Clobbers: A, X, Y, ppu_addr. +; ----------------------------------------------------------------------------- +StampBallMarker: + cpy #$1E ; CPU:$F897 PRG:3897 C0 1E + bne StampBallMarker_CheckRow ; CPU:$F899 PRG:3899 D0 01 +; ----------------------------------------------------------------------------- +; Routine: StampBallMarker_Done ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -9396,13 +10674,221 @@ Label_F88A: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_F990: +StampBallMarker_Done: + rts ; CPU:$F89B PRG:389B 60 +; ----------------------------------------------------------------------------- +; Routine: StampBallMarker_CheckRow +; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. +; Local: Continues its parent routine along the condition or operation encoded in this label, +; then returns, branches again, or rejoins shared code as documented by the instructions. +; Parameters: Undetermined in Pass 1 unless implied by the caller. +; Returns: Undetermined in Pass 1; status flags and registers may carry results. +; Clobbers: Undetermined in Pass 1. +; ----------------------------------------------------------------------------- +StampBallMarker_CheckRow: + cpy #$1D ; CPU:$F89C PRG:389C C0 1D + beq StampBallMarker_TopLeft ; CPU:$F89E PRG:389E F0 1B + cpy #$1F ; CPU:$F8A0 PRG:38A0 C0 1F + bne StampBallMarker_CheckColumn ; CPU:$F8A2 PRG:38A2 D0 07 + ldy #$FF ; CPU:$F8A4 PRG:38A4 A0 FF + sty $0188 ; CPU:$F8A6 PRG:38A6 8C 88 01 + bne StampBallMarker_TopLeft ; CPU:$F8A9 PRG:38A9 D0 10 +; ----------------------------------------------------------------------------- +; Routine: StampBallMarker_CheckColumn +; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. +; Local: Continues its parent routine along the condition or operation encoded in this label, +; then returns, branches again, or rejoins shared code as documented by the instructions. +; Parameters: Undetermined in Pass 1 unless implied by the caller. +; Returns: Undetermined in Pass 1; status flags and registers may carry results. +; Clobbers: Undetermined in Pass 1. +; ----------------------------------------------------------------------------- +StampBallMarker_CheckColumn: + cpx #$1F ; CPU:$F8AB PRG:38AB E0 1F + bne StampBallMarker_IfEmpty ; CPU:$F8AD PRG:38AD D0 75 + lda $018A ; CPU:$F8AF PRG:38AF AD 8A 01 + and #$01 ; CPU:$F8B2 PRG:38B2 29 01 + beq StampBallMarker_TopLeft ; CPU:$F8B4 PRG:38B4 F0 05 + ldx #$FF ; CPU:$F8B6 PRG:38B6 A2 FF + stx $0189 ; CPU:$F8B8 PRG:38B8 8E 89 01 +; ----------------------------------------------------------------------------- +; Routine: StampBallMarker_TopLeft +; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. +; Local: Continues its parent routine along the condition or operation encoded in this label, +; then returns, branches again, or rejoins shared code as documented by the instructions. +; Parameters: Undetermined in Pass 1 unless implied by the caller. +; Returns: Undetermined in Pass 1; status flags and registers may carry results. +; Clobbers: Undetermined in Pass 1. +; ----------------------------------------------------------------------------- +StampBallMarker_TopLeft: + ldx $0189 ; CPU:$F8BB PRG:38BB AE 89 01 + cpx #$FF ; CPU:$F8BE PRG:38BE E0 FF + beq StampBallMarker_TopRight ; CPU:$F8C0 PRG:38C0 F0 12 + ldy $0188 ; CPU:$F8C2 PRG:38C2 AC 88 01 + cpy #$FF ; CPU:$F8C5 PRG:38C5 C0 FF + beq StampBallMarker_TopRight ; CPU:$F8C7 PRG:38C7 F0 0B + jsr $CAF7 ; CPU:$F8C9 PRG:38C9 20 F7 CA + jsr $F989 ; CPU:$F8CC PRG:38CC 20 89 F9 + lda #$DA ; CPU:$F8CF PRG:38CF A9 DA + sta $2007 ; CPU:$F8D1 PRG:38D1 8D 07 20 +; ----------------------------------------------------------------------------- +; Routine: StampBallMarker_TopRight +; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. +; Local: Continues its parent routine along the condition or operation encoded in this label, +; then returns, branches again, or rejoins shared code as documented by the instructions. +; Parameters: Undetermined in Pass 1 unless implied by the caller. +; Returns: Undetermined in Pass 1; status flags and registers may carry results. +; Clobbers: Undetermined in Pass 1. +; ----------------------------------------------------------------------------- +StampBallMarker_TopRight: + ldx $0189 ; CPU:$F8D4 PRG:38D4 AE 89 01 + cpx #$1F ; CPU:$F8D7 PRG:38D7 E0 1F + beq StampBallMarker_BottomLeft ; CPU:$F8D9 PRG:38D9 F0 13 + ldy $0188 ; CPU:$F8DB PRG:38DB AC 88 01 + cpy #$FF ; CPU:$F8DE PRG:38DE C0 FF + beq StampBallMarker_BottomLeft ; CPU:$F8E0 PRG:38E0 F0 0C + inx ; CPU:$F8E2 PRG:38E2 E8 + jsr $CAF7 ; CPU:$F8E3 PRG:38E3 20 F7 CA + jsr $F989 ; CPU:$F8E6 PRG:38E6 20 89 F9 + lda #$DB ; CPU:$F8E9 PRG:38E9 A9 DB + sta $2007 ; CPU:$F8EB PRG:38EB 8D 07 20 +; ----------------------------------------------------------------------------- +; Routine: StampBallMarker_BottomLeft +; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. +; Local: Continues its parent routine along the condition or operation encoded in this label, +; then returns, branches again, or rejoins shared code as documented by the instructions. +; Parameters: Undetermined in Pass 1 unless implied by the caller. +; Returns: Undetermined in Pass 1; status flags and registers may carry results. +; Clobbers: Undetermined in Pass 1. +; ----------------------------------------------------------------------------- +StampBallMarker_BottomLeft: + ldx $0189 ; CPU:$F8EE PRG:38EE AE 89 01 + cpx #$FF ; CPU:$F8F1 PRG:38F1 E0 FF + beq StampBallMarker_BottomRight ; CPU:$F8F3 PRG:38F3 F0 13 + ldy $0188 ; CPU:$F8F5 PRG:38F5 AC 88 01 + cpy #$1D ; CPU:$F8F8 PRG:38F8 C0 1D + beq StampBallMarker_BottomRight ; CPU:$F8FA PRG:38FA F0 0C + iny ; CPU:$F8FC PRG:38FC C8 + jsr $CAF7 ; CPU:$F8FD PRG:38FD 20 F7 CA + jsr $F989 ; CPU:$F900 PRG:3900 20 89 F9 + lda #$D9 ; CPU:$F903 PRG:3903 A9 D9 + sta $2007 ; CPU:$F905 PRG:3905 8D 07 20 +; ----------------------------------------------------------------------------- +; Routine: StampBallMarker_BottomRight +; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. +; Local: Continues its parent routine along the condition or operation encoded in this label, +; then returns, branches again, or rejoins shared code as documented by the instructions. +; Parameters: Undetermined in Pass 1 unless implied by the caller. +; Returns: Undetermined in Pass 1; status flags and registers may carry results. +; Clobbers: Undetermined in Pass 1. +; ----------------------------------------------------------------------------- +StampBallMarker_BottomRight: + ldx $0189 ; CPU:$F908 PRG:3908 AE 89 01 + cpx #$1F ; CPU:$F90B PRG:390B E0 1F + beq StampBallMarker_Done ; CPU:$F90D PRG:390D F0 8C + ldy $0188 ; CPU:$F90F PRG:390F AC 88 01 + cpy #$1D ; CPU:$F912 PRG:3912 C0 1D + beq StampBallMarker_Done ; CPU:$F914 PRG:3914 F0 85 + inx ; CPU:$F916 PRG:3916 E8 + iny ; CPU:$F917 PRG:3917 C8 + jsr $CAF7 ; CPU:$F918 PRG:3918 20 F7 CA + jsr $F989 ; CPU:$F91B PRG:391B 20 89 F9 + lda #$D8 ; CPU:$F91E PRG:391E A9 D8 + sta $2007 ; CPU:$F920 PRG:3920 8D 07 20 + rts ; CPU:$F923 PRG:3923 60 +; ----------------------------------------------------------------------------- +; Routine: StampBallMarker_IfEmpty +; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. +; Local: Continues its parent routine along the condition or operation encoded in this label, +; then returns, branches again, or rejoins shared code as documented by the instructions. +; Parameters: Undetermined in Pass 1 unless implied by the caller. +; Returns: Undetermined in Pass 1; status flags and registers may carry results. +; Clobbers: Undetermined in Pass 1. +; ----------------------------------------------------------------------------- +StampBallMarker_IfEmpty: + jsr $CAF7 ; CPU:$F924 PRG:3924 20 F7 CA + stx ppu_addr_hi ; CPU:$F927 PRG:3927 86 FD + sty ppu_addr_lo ; CPU:$F929 PRG:3929 84 FC + jsr $F989 ; CPU:$F92B PRG:392B 20 89 F9 + lda $2007 ; CPU:$F92E PRG:392E AD 07 20 + lda $2007 ; CPU:$F931 PRG:3931 AD 07 20 + cmp #$DC ; CPU:$F934 PRG:3934 C9 DC + bcc StampBallMarker_Abort ; CPU:$F936 PRG:3936 90 50 + cmp #$DF ; CPU:$F938 PRG:3938 C9 DF + bcs StampBallMarker_Abort ; CPU:$F93A PRG:393A B0 4C + lda $2007 ; CPU:$F93C PRG:393C AD 07 20 + cmp #$DC ; CPU:$F93F PRG:393F C9 DC + bcc StampBallMarker_Abort ; CPU:$F941 PRG:3941 90 45 + cmp #$DF ; CPU:$F943 PRG:3943 C9 DF + bcs StampBallMarker_Abort ; CPU:$F945 PRG:3945 B0 41 + lda ppu_addr_lo ; CPU:$F947 PRG:3947 A5 FC + clc ; CPU:$F949 PRG:3949 18 + adc #$20 ; CPU:$F94A PRG:394A 69 20 + tay ; CPU:$F94C PRG:394C A8 + lda ppu_addr_hi ; CPU:$F94D PRG:394D A5 FD + adc #$00 ; CPU:$F94F PRG:394F 69 00 + tax ; CPU:$F951 PRG:3951 AA + jsr $F989 ; CPU:$F952 PRG:3952 20 89 F9 + lda $2007 ; CPU:$F955 PRG:3955 AD 07 20 + lda $2007 ; CPU:$F958 PRG:3958 AD 07 20 + cmp #$DC ; CPU:$F95B PRG:395B C9 DC + bcc StampBallMarker_Abort ; CPU:$F95D PRG:395D 90 29 + cmp #$DF ; CPU:$F95F PRG:395F C9 DF + bcs StampBallMarker_Abort ; CPU:$F961 PRG:3961 B0 25 + lda $2007 ; CPU:$F963 PRG:3963 AD 07 20 + cmp #$DC ; CPU:$F966 PRG:3966 C9 DC + bcc StampBallMarker_Abort ; CPU:$F968 PRG:3968 90 1E + cmp #$DF ; CPU:$F96A PRG:396A C9 DF + bcs StampBallMarker_Abort ; CPU:$F96C PRG:396C B0 1A + jsr $CAA3 ; CPU:$F96E PRG:396E 20 A3 CA + lda #$DA ; CPU:$F971 PRG:3971 A9 DA + sta $2007 ; CPU:$F973 PRG:3973 8D 07 20 + lda #$DB ; CPU:$F976 PRG:3976 A9 DB + sta $2007 ; CPU:$F978 PRG:3978 8D 07 20 + jsr $F989 ; CPU:$F97B PRG:397B 20 89 F9 + lda #$D9 ; CPU:$F97E PRG:397E A9 D9 + sta $2007 ; CPU:$F980 PRG:3980 8D 07 20 + lda #$D8 ; CPU:$F983 PRG:3983 A9 D8 + sta $2007 ; CPU:$F985 PRG:3985 8D 07 20 +; ----------------------------------------------------------------------------- +; Routine: StampBallMarker_Abort +; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. +; Local: Continues its parent routine along the condition or operation encoded in this label, +; then returns, branches again, or rejoins shared code as documented by the instructions. +; Parameters: Undetermined in Pass 1 unless implied by the caller. +; Returns: Undetermined in Pass 1; status flags and registers may carry results. +; Clobbers: Undetermined in Pass 1. +; ----------------------------------------------------------------------------- +StampBallMarker_Abort: + rts ; CPU:$F988 PRG:3988 60 +; ----------------------------------------------------------------------------- +; Routine: SetPpuAddr +; Global: Latches a VRAM address into PPUADDR. +; Local: The eight uses are the address-and-write idiom of the ball-marker stamper, which +; deliberately keeps the PPUADDR latch open across the following PPUDATA stores. +; Parameters: X = address high byte, Y = address low byte. +; Returns: none. +; Clobbers: none. +; ----------------------------------------------------------------------------- +SetPpuAddr: + stx $2006 ; CPU:$F989 PRG:3989 8E 06 20 + sty $2006 ; CPU:$F98C PRG:398C 8C 06 20 + rts ; CPU:$F98F PRG:398F 60 +; ----------------------------------------------------------------------------- +; Routine: SetBallSpriteAttributes +; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. +; Local: Continues its parent routine along the condition or operation encoded in this label, +; then returns, branches again, or rejoins shared code as documented by the instructions. +; Parameters: Undetermined in Pass 1 unless implied by the caller. +; Returns: Undetermined in Pass 1; status flags and registers may carry results. +; Clobbers: Undetermined in Pass 1. +; ----------------------------------------------------------------------------- +SetBallSpriteAttributes: lda $0310,y ; CPU:$F990 PRG:3990 B9 10 03 asl a ; CPU:$F993 PRG:3993 0A asl a ; CPU:$F994 PRG:3994 0A sta $0410,y ; CPU:$F995 PRG:3995 99 10 04 ; ----------------------------------------------------------------------------- -; Routine: Label_F998 +; Routine: SetBallSpriteTile ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -9410,13 +10896,13 @@ Label_F990: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_F998: +SetBallSpriteTile: lda $0310,y ; CPU:$F998 PRG:3998 B9 10 03 lsr a ; CPU:$F99B PRG:399B 4A sta $0400,y ; CPU:$F99C PRG:399C 99 00 04 rts ; CPU:$F99F PRG:399F 60 ; ----------------------------------------------------------------------------- -; Routine: Label_F9A0 +; Routine: IncrementPlayerBallCount ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -9424,14 +10910,14 @@ Label_F998: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_F9A0: +IncrementPlayerBallCount: inc $01C3 ; CPU:$F9A0 PRG:39A0 EE C3 01 lda $01C3 ; CPU:$F9A3 PRG:39A3 AD C3 01 cmp #$64 ; CPU:$F9A6 PRG:39A6 C9 64 - bne Label_F9AD ; CPU:$F9A8 PRG:39A8 D0 03 + bne IncrementPlayerBallCount_Redraw ; CPU:$F9A8 PRG:39A8 D0 03 dec $01C3 ; CPU:$F9AA PRG:39AA CE C3 01 ; ----------------------------------------------------------------------------- -; Routine: Label_F9AD +; Routine: IncrementPlayerBallCount_Redraw ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -9439,10 +10925,10 @@ Label_F9A0: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_F9AD: +IncrementPlayerBallCount_Redraw: jmp $E25C ; CPU:$F9AD PRG:39AD 4C 5C E2 ; ----------------------------------------------------------------------------- -; Routine: Label_F9B0 +; Routine: IncrementTurnBallCount ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -9450,14 +10936,14 @@ Label_F9AD: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_F9B0: +IncrementTurnBallCount: inc $01C4 ; CPU:$F9B0 PRG:39B0 EE C4 01 lda $01C4 ; CPU:$F9B3 PRG:39B3 AD C4 01 cmp #$64 ; CPU:$F9B6 PRG:39B6 C9 64 - bne Label_F9BD ; CPU:$F9B8 PRG:39B8 D0 03 + bne IncrementTurnBallCount_CheckBonus ; CPU:$F9B8 PRG:39B8 D0 03 dec $01C4 ; CPU:$F9BA PRG:39BA CE C4 01 ; ----------------------------------------------------------------------------- -; Routine: Label_F9BD +; Routine: IncrementTurnBallCount_CheckBonus ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -9465,18 +10951,18 @@ Label_F9B0: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_F9BD: +IncrementTurnBallCount_CheckBonus: cmp #$14 ; CPU:$F9BD PRG:39BD C9 14 - beq Label_F9A0 ; CPU:$F9BF PRG:39BF F0 DF + beq IncrementPlayerBallCount ; CPU:$F9BF PRG:39BF F0 DF cmp #$19 ; CPU:$F9C1 PRG:39C1 C9 19 - beq Label_F9A0 ; CPU:$F9C3 PRG:39C3 F0 DB + beq IncrementPlayerBallCount ; CPU:$F9C3 PRG:39C3 F0 DB cmp #$1E ; CPU:$F9C5 PRG:39C5 C9 1E - beq Label_F9A0 ; CPU:$F9C7 PRG:39C7 F0 D7 + beq IncrementPlayerBallCount ; CPU:$F9C7 PRG:39C7 F0 D7 cmp #$23 ; CPU:$F9C9 PRG:39C9 C9 23 - bcs Label_F9A0 ; CPU:$F9CB PRG:39CB B0 D3 + bcs IncrementPlayerBallCount ; CPU:$F9CB PRG:39CB B0 D3 rts ; CPU:$F9CD PRG:39CD 60 ; ----------------------------------------------------------------------------- -; Routine: Label_F9CE +; Routine: CountUpScore ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -9484,7 +10970,7 @@ Label_F9BD: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_F9CE: +CountUpScore: txa ; CPU:$F9CE PRG:39CE 8A pha ; CPU:$F9CF PRG:39CF 48 tya ; CPU:$F9D0 PRG:39D0 98 @@ -9492,7 +10978,7 @@ Label_F9CE: lda $0310,y ; CPU:$F9D2 PRG:39D2 B9 10 03 tax ; CPU:$F9D5 PRG:39D5 AA ; ----------------------------------------------------------------------------- -; Routine: Label_F9D6 +; Routine: CountUpScore_MultiplierLoop ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -9500,10 +10986,10 @@ Label_F9CE: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_F9D6: +CountUpScore_MultiplierLoop: ldy $01C4 ; CPU:$F9D6 PRG:39D6 AC C4 01 ; ----------------------------------------------------------------------------- -; Routine: Label_F9D9 +; Routine: CountUpScore_PointLoop ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -9511,13 +10997,13 @@ Label_F9D6: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_F9D9: +CountUpScore_PointLoop: jsr $F9F9 ; CPU:$F9D9 PRG:39D9 20 F9 F9 jsr $E19D ; CPU:$F9DC PRG:39DC 20 9D E1 lda #$00 ; CPU:$F9DF PRG:39DF A9 00 sta $01C8 ; CPU:$F9E1 PRG:39E1 8D C8 01 ; ----------------------------------------------------------------------------- -; Routine: Label_F9E4 +; Routine: CountUpScore_WaitFrame ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -9525,22 +11011,22 @@ Label_F9D9: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_F9E4: +CountUpScore_WaitFrame: lda $01C8 ; CPU:$F9E4 PRG:39E4 AD C8 01 - beq Label_F9E4 ; CPU:$F9E7 PRG:39E7 F0 FB + beq CountUpScore_WaitFrame ; CPU:$F9E7 PRG:39E7 F0 FB lda #$00 ; CPU:$F9E9 PRG:39E9 A9 00 sta $01C8 ; CPU:$F9EB PRG:39EB 8D C8 01 dey ; CPU:$F9EE PRG:39EE 88 - bne Label_F9D9 ; CPU:$F9EF PRG:39EF D0 E8 + bne CountUpScore_PointLoop ; CPU:$F9EF PRG:39EF D0 E8 dex ; CPU:$F9F1 PRG:39F1 CA - bne Label_F9D6 ; CPU:$F9F2 PRG:39F2 D0 E2 + bne CountUpScore_MultiplierLoop ; CPU:$F9F2 PRG:39F2 D0 E2 pla ; CPU:$F9F4 PRG:39F4 68 tay ; CPU:$F9F5 PRG:39F5 A8 pla ; CPU:$F9F6 PRG:39F6 68 tax ; CPU:$F9F7 PRG:39F7 AA rts ; CPU:$F9F8 PRG:39F8 60 ; ----------------------------------------------------------------------------- -; Routine: Label_F9F9 +; Routine: AddScoreDigit ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -9548,7 +11034,7 @@ Label_F9E4: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_F9F9: +AddScoreDigit: lda #$09 ; CPU:$F9F9 PRG:39F9 A9 09 jsr $C3DA ; CPU:$F9FB PRG:39FB 20 DA C3 txa ; CPU:$F9FE PRG:39FE 8A @@ -9558,7 +11044,7 @@ Label_F9F9: jsr $FA4A ; CPU:$FA02 PRG:3A02 20 4A FA ldy #$06 ; CPU:$FA05 PRG:3A05 A0 06 ; ----------------------------------------------------------------------------- -; Routine: Label_FA07 +; Routine: AddScoreDigit_Loop ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -9566,21 +11052,21 @@ Label_F9F9: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_FA07: +AddScoreDigit_Loop: inc $0468,x ; CPU:$FA07 PRG:3A07 FE 68 04 lda $0468,x ; CPU:$FA0A PRG:3A0A BD 68 04 cmp #$0A ; CPU:$FA0D PRG:3A0D C9 0A - bne Label_FA26 ; CPU:$FA0F PRG:3A0F D0 15 + bne ScoreRoutine_Return ; CPU:$FA0F PRG:3A0F D0 15 lda #$00 ; CPU:$FA11 PRG:3A11 A9 00 sta $0468,x ; CPU:$FA13 PRG:3A13 9D 68 04 dex ; CPU:$FA16 PRG:3A16 CA dey ; CPU:$FA17 PRG:3A17 88 - bne Label_FA07 ; CPU:$FA18 PRG:3A18 D0 ED + bne AddScoreDigit_Loop ; CPU:$FA18 PRG:3A18 D0 ED lda #$09 ; CPU:$FA1A PRG:3A1A A9 09 inx ; CPU:$FA1C PRG:3A1C E8 ldy #$06 ; CPU:$FA1D PRG:3A1D A0 06 ; ----------------------------------------------------------------------------- -; Routine: Label_FA1F +; Routine: AddScoreDigit_Overflow ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -9588,13 +11074,13 @@ Label_FA07: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_FA1F: +AddScoreDigit_Overflow: sta $0468,x ; CPU:$FA1F PRG:3A1F 9D 68 04 inx ; CPU:$FA22 PRG:3A22 E8 dey ; CPU:$FA23 PRG:3A23 88 - bne Label_FA1F ; CPU:$FA24 PRG:3A24 D0 F9 + bne AddScoreDigit_Overflow ; CPU:$FA24 PRG:3A24 D0 F9 ; ----------------------------------------------------------------------------- -; Routine: Label_FA26 +; Routine: ScoreRoutine_Return ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -9602,14 +11088,14 @@ Label_FA1F: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_FA26: +ScoreRoutine_Return: pla ; CPU:$FA26 PRG:3A26 68 tay ; CPU:$FA27 PRG:3A27 A8 pla ; CPU:$FA28 PRG:3A28 68 tax ; CPU:$FA29 PRG:3A29 AA rts ; CPU:$FA2A PRG:3A2A 60 ; ----------------------------------------------------------------------------- -; Routine: Label_FA2B +; Routine: CompareScoreToHighScore ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -9617,7 +11103,7 @@ Label_FA26: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_FA2B: +CompareScoreToHighScore: txa ; CPU:$FA2B PRG:3A2B 8A pha ; CPU:$FA2C PRG:3A2C 48 tya ; CPU:$FA2D PRG:3A2D 98 @@ -9625,7 +11111,7 @@ Label_FA2B: jsr $FA4A ; CPU:$FA2F PRG:3A2F 20 4A FA ldy #$00 ; CPU:$FA32 PRG:3A32 A0 00 ; ----------------------------------------------------------------------------- -; Routine: Label_FA34 +; Routine: CompareScoreToHighScore_Loop ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -9633,14 +11119,14 @@ Label_FA2B: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_FA34: +CompareScoreToHighScore_Loop: lda $0463,x ; CPU:$FA34 PRG:3A34 BD 63 04 cmp $0462,y ; CPU:$FA37 PRG:3A37 D9 62 04 - bcc Label_FA26 ; CPU:$FA3A PRG:3A3A 90 EA - beq Label_FA40 ; CPU:$FA3C PRG:3A3C F0 02 - bcs Label_FA26 ; CPU:$FA3E PRG:3A3E B0 E6 + bcc ScoreRoutine_Return ; CPU:$FA3A PRG:3A3A 90 EA + beq CompareScoreToHighScore_Next ; CPU:$FA3C PRG:3A3C F0 02 + bcs ScoreRoutine_Return ; CPU:$FA3E PRG:3A3E B0 E6 ; ----------------------------------------------------------------------------- -; Routine: Label_FA40 +; Routine: CompareScoreToHighScore_Next ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -9648,15 +11134,15 @@ Label_FA34: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_FA40: +CompareScoreToHighScore_Next: inx ; CPU:$FA40 PRG:3A40 E8 iny ; CPU:$FA41 PRG:3A41 C8 cpy #$06 ; CPU:$FA42 PRG:3A42 C0 06 - bne Label_FA34 ; CPU:$FA44 PRG:3A44 D0 EE + bne CompareScoreToHighScore_Loop ; CPU:$FA44 PRG:3A44 D0 EE sec ; CPU:$FA46 PRG:3A46 38 jmp $FA26 ; CPU:$FA47 PRG:3A47 4C 26 FA ; ----------------------------------------------------------------------------- -; Routine: Label_FA4A +; Routine: GetPlayerScoreIndex ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -9664,7 +11150,7 @@ Label_FA40: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_FA4A: +GetPlayerScoreIndex: lda $01C6 ; CPU:$FA4A PRG:3A4A AD C6 01 asl a ; CPU:$FA4D PRG:3A4D 0A adc $01C6 ; CPU:$FA4E PRG:3A4E 6D C6 01 @@ -9673,7 +11159,7 @@ Label_FA4A: tax ; CPU:$FA54 PRG:3A54 AA rts ; CPU:$FA55 PRG:3A55 60 ; ----------------------------------------------------------------------------- -; Routine: Label_FA56 +; Routine: CopyScoreToHighScore ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -9681,7 +11167,7 @@ Label_FA4A: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_FA56: +CopyScoreToHighScore: txa ; CPU:$FA56 PRG:3A56 8A pha ; CPU:$FA57 PRG:3A57 48 tya ; CPU:$FA58 PRG:3A58 98 @@ -9689,7 +11175,7 @@ Label_FA56: jsr $FA4A ; CPU:$FA5A PRG:3A5A 20 4A FA ldy #$00 ; CPU:$FA5D PRG:3A5D A0 00 ; ----------------------------------------------------------------------------- -; Routine: Label_FA5F +; Routine: CopyScoreToHighScore_Loop ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -9697,16 +11183,16 @@ Label_FA56: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_FA5F: +CopyScoreToHighScore_Loop: lda $0463,x ; CPU:$FA5F PRG:3A5F BD 63 04 sta $0462,y ; CPU:$FA62 PRG:3A62 99 62 04 inx ; CPU:$FA65 PRG:3A65 E8 iny ; CPU:$FA66 PRG:3A66 C8 cpy #$06 ; CPU:$FA67 PRG:3A67 C0 06 - bne Label_FA5F ; CPU:$FA69 PRG:3A69 D0 F4 - beq Label_FA40 ; CPU:$FA6B PRG:3A6B F0 D3 + bne CopyScoreToHighScore_Loop ; CPU:$FA69 PRG:3A69 D0 F4 + beq CompareScoreToHighScore_Next ; CPU:$FA6B PRG:3A6B F0 D3 ; ----------------------------------------------------------------------------- -; Routine: Label_FA6D +; Routine: FadeOutPalette ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -9714,10 +11200,10 @@ Label_FA5F: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_FA6D: +FadeOutPalette: ldy #$00 ; CPU:$FA6D PRG:3A6D A0 00 ; ----------------------------------------------------------------------------- -; Routine: Label_FA6F +; Routine: FadeOutPalette_Loop ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -9725,16 +11211,16 @@ Label_FA6D: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_FA6F: +FadeOutPalette_Loop: jsr $FA8B ; CPU:$FA6F PRG:3A6F 20 8B FA ldx #$03 ; CPU:$FA72 PRG:3A72 A2 03 jsr $FF56 ; CPU:$FA74 PRG:3A74 20 56 FF iny ; CPU:$FA77 PRG:3A77 C8 cpy #$06 ; CPU:$FA78 PRG:3A78 C0 06 - bne Label_FA6F ; CPU:$FA7A PRG:3A7A D0 F3 + bne FadeOutPalette_Loop ; CPU:$FA7A PRG:3A7A D0 F3 rts ; CPU:$FA7C PRG:3A7C 60 ; ----------------------------------------------------------------------------- -; Routine: Label_FA7D +; Routine: FadeInPalette ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -9742,10 +11228,10 @@ Label_FA6F: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_FA7D: +FadeInPalette: ldy #$05 ; CPU:$FA7D PRG:3A7D A0 05 ; ----------------------------------------------------------------------------- -; Routine: Label_FA7F +; Routine: FadeInPalette_Loop ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -9753,15 +11239,15 @@ Label_FA7D: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_FA7F: +FadeInPalette_Loop: jsr $FA8B ; CPU:$FA7F PRG:3A7F 20 8B FA ldx #$03 ; CPU:$FA82 PRG:3A82 A2 03 jsr $FF56 ; CPU:$FA84 PRG:3A84 20 56 FF dey ; CPU:$FA87 PRG:3A87 88 - bpl Label_FA7F ; CPU:$FA88 PRG:3A88 10 F5 + bpl FadeInPalette_Loop ; CPU:$FA88 PRG:3A88 10 F5 rts ; CPU:$FA8A PRG:3A8A 60 ; ----------------------------------------------------------------------------- -; Routine: Label_FA8B +; Routine: BuildPaletteFromShadeTable ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -9769,10 +11255,10 @@ Label_FA7F: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_FA8B: +BuildPaletteFromShadeTable: ldx #$10 ; CPU:$FA8B PRG:3A8B A2 10 ; ----------------------------------------------------------------------------- -; Routine: Label_FA8D +; Routine: BuildPaletteFromShadeTable_Loop ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -9780,15 +11266,15 @@ Label_FA8B: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_FA8D: +BuildPaletteFromShadeTable_Loop: lda $013F,x ; CPU:$FA8D PRG:3A8D BD 3F 01 jsr $FA99 ; CPU:$FA90 PRG:3A90 20 99 FA sta Zp7F,x ; CPU:$FA93 PRG:3A93 95 7F dex ; CPU:$FA95 PRG:3A95 CA - bne Label_FA8D ; CPU:$FA96 PRG:3A96 D0 F5 + bne BuildPaletteFromShadeTable_Loop ; CPU:$FA96 PRG:3A96 D0 F5 rts ; CPU:$FA98 PRG:3A98 60 ; ----------------------------------------------------------------------------- -; Routine: Label_FA99 +; Routine: MapColorCodeToPalette ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -9796,23 +11282,23 @@ Label_FA8D: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_FA99: +MapColorCodeToPalette: asl a ; CPU:$FA99 PRG:3A99 0A - bcs Label_FAB4 ; CPU:$FA9A PRG:3A9A B0 18 - beq Label_FAB1 ; CPU:$FA9C PRG:3A9C F0 13 + bcs MapColorCodeToPalette_High ; CPU:$FA9A PRG:3A9A B0 18 + beq MapColorCodeToPalette_Disabled ; CPU:$FA9C PRG:3A9C F0 13 asl a ; CPU:$FA9E PRG:3A9E 0A - sta ZpF6 ; CPU:$FA9F PRG:3A9F 85 F6 + sta ppu_addr_temp_lo ; CPU:$FA9F PRG:3A9F 85 F6 tya ; CPU:$FAA1 PRG:3AA1 98 cmp #$04 ; CPU:$FAA2 PRG:3AA2 C9 04 - bcs Label_FAB1 ; CPU:$FAA4 PRG:3AA4 B0 0B - sty ZpF7 ; CPU:$FAA6 PRG:3AA6 84 F7 - adc ZpF6 ; CPU:$FAA8 PRG:3AA8 65 F6 + bcs MapColorCodeToPalette_Disabled ; CPU:$FAA4 PRG:3AA4 B0 0B + sty ppu_addr_temp_hi ; CPU:$FAA6 PRG:3AA6 84 F7 + adc ppu_addr_temp_lo ; CPU:$FAA8 PRG:3AA8 65 F6 tay ; CPU:$FAAA PRG:3AAA A8 lda $FAC5,y ; CPU:$FAAB PRG:3AAB B9 C5 FA - ldy ZpF7 ; CPU:$FAAE PRG:3AAE A4 F7 + ldy ppu_addr_temp_hi ; CPU:$FAAE PRG:3AAE A4 F7 rts ; CPU:$FAB0 PRG:3AB0 60 ; ----------------------------------------------------------------------------- -; Routine: Label_FAB1 +; Routine: MapColorCodeToPalette_Disabled ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -9820,11 +11306,11 @@ Label_FA99: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_FAB1: +MapColorCodeToPalette_Disabled: lda #$FF ; CPU:$FAB1 PRG:3AB1 A9 FF rts ; CPU:$FAB3 PRG:3AB3 60 ; ----------------------------------------------------------------------------- -; Routine: Label_FAB4 +; Routine: MapColorCodeToPalette_High ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -9832,9 +11318,9 @@ Label_FAB1: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_FAB4: +MapColorCodeToPalette_High: lsr a ; CPU:$FAB4 PRG:3AB4 4A - sta ZpF6 ; CPU:$FAB5 PRG:3AB5 85 F6 + sta ppu_addr_temp_lo ; CPU:$FAB5 PRG:3AB5 85 F6 tya ; CPU:$FAB7 PRG:3AB7 98 asl a ; CPU:$FAB8 PRG:3AB8 0A asl a ; CPU:$FAB9 PRG:3AB9 0A @@ -9844,16 +11330,18 @@ Label_FAB4: clc ; CPU:$FABE PRG:3ABE 18 adc #$01 ; CPU:$FABF PRG:3ABF 69 01 clc ; CPU:$FAC1 PRG:3AC1 18 - adc ZpF6 ; CPU:$FAC2 PRG:3AC2 65 F6 + adc ppu_addr_temp_lo ; CPU:$FAC2 PRG:3AC2 65 F6 cmp #$40 ; CPU:$FAC4 PRG:3AC4 C9 40 - bcs Label_FAB1 ; CPU:$FAC6 PRG:3AC6 B0 E9 + bcs MapColorCodeToPalette_Disabled ; CPU:$FAC6 PRG:3AC6 B0 E9 rts ; CPU:$FAC8 PRG:3AC8 60 ; ---- data $FAC9-$FAF8 (48 bytes) ---- +; Twelve four-entry rows of NES colour numbers, indexed as 4 * colour code + row by MapColorCodeToPalette. Colour code 0 is rejected by the caller, which is why the code bases the table at $FAC5 and code 1 row 0 lands here. +PaletteColorTable: .byte $30, $10, $00, $0C, $00, $0C, $09, $FF, $09, $09, $FF, $FF, $12, $02, $01, $0C ; CPU:$FAC9 PRG:3AC9 30 10 00 0C 00 0C 09 FF 09 09 FF FF 12 02 01 0C .byte $0B, $0A, $09, $FF, $14, $03, $01, $0C, $25, $24, $04, $FF, $1A, $0A, $09, $FF ; CPU:$FAD9 PRG:3AD9 0B 0A 09 FF 14 03 01 0C 25 24 04 FF 1A 0A 09 FF .byte $3B, $21, $1C, $0C, $26, $17, $07, $08, $16, $06, $07, $08, $28, $27, $18, $08 ; CPU:$FAE9 PRG:3AE9 3B 21 1C 0C 26 17 07 08 16 06 07 08 28 27 18 08 ; ----------------------------------------------------------------------------- -; Routine: Label_FAF9 +; Routine: ComputeFieldCellAddress ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -9861,29 +11349,29 @@ Label_FAB4: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_FAF9: - stx ZpF7 ; CPU:$FAF9 PRG:3AF9 86 F7 +ComputeFieldCellAddress: + stx ppu_addr_temp_hi ; CPU:$FAF9 PRG:3AF9 86 F7 lda $FB10,y ; CPU:$FAFB PRG:3AFB B9 10 FB asl a ; CPU:$FAFE PRG:3AFE 0A - sta ZpFC ; CPU:$FAFF PRG:3AFF 85 FC + sta ppu_addr_lo ; CPU:$FAFF PRG:3AFF 85 FC lda #$00 ; CPU:$FB01 PRG:3B01 A9 00 adc #$06 ; CPU:$FB03 PRG:3B03 69 06 - sta ZpFD ; CPU:$FB05 PRG:3B05 85 FD - lda ZpF7 ; CPU:$FB07 PRG:3B07 A5 F7 + sta ppu_addr_hi ; CPU:$FB05 PRG:3B05 85 FD + lda ppu_addr_temp_hi ; CPU:$FB07 PRG:3B07 A5 F7 sec ; CPU:$FB09 PRG:3B09 38 sbc #$03 ; CPU:$FB0A PRG:3B0A E9 03 clc ; CPU:$FB0C PRG:3B0C 18 - adc ZpFC ; CPU:$FB0D PRG:3B0D 65 FC - sta ZpFC ; CPU:$FB0F PRG:3B0F 85 FC + adc ppu_addr_lo ; CPU:$FB0D PRG:3B0D 65 FC + sta ppu_addr_lo ; CPU:$FB0F PRG:3B0F 85 FC lda #$00 ; CPU:$FB11 PRG:3B11 A9 00 - adc ZpFD ; CPU:$FB13 PRG:3B13 65 FD - sta ZpFD ; CPU:$FB15 PRG:3B15 85 FD + adc ppu_addr_hi ; CPU:$FB13 PRG:3B13 65 FD + sta ppu_addr_hi ; CPU:$FB15 PRG:3B15 85 FD rts ; CPU:$FB17 PRG:3B17 60 ; ---- data $FB18-$FB2B (20 bytes) ---- .byte $00, $0D, $1A, $27, $34, $41, $4E, $5B, $68, $75, $82, $8F, $9C, $A9, $B6, $C3 ; CPU:$FB18 PRG:3B18 00 0D 1A 27 34 41 4E 5B 68 75 82 8F 9C A9 B6 C3 .byte $D0, $DD, $EA, $F7 ; CPU:$FB28 PRG:3B28 D0 DD EA F7 ; ----------------------------------------------------------------------------- -; Routine: Label_FB2C +; Routine: ComputeCollisionAngle ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -9891,15 +11379,15 @@ Label_FAF9: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_FB2C: - lda ZpF8 ; CPU:$FB2C PRG:3B2C A5 F8 +ComputeCollisionAngle: + lda ppu_src_lo ; CPU:$FB2C PRG:3B2C A5 F8 cmp #$09 ; CPU:$FB2E PRG:3B2E C9 09 - bcc Label_FB55 ; CPU:$FB30 PRG:3B30 90 23 - lda ZpF9 ; CPU:$FB32 PRG:3B32 A5 F9 + bcc ComputeCollisionAngle_Shallow ; CPU:$FB30 PRG:3B30 90 23 + lda ppu_src_hi ; CPU:$FB32 PRG:3B32 A5 F9 cmp #$09 ; CPU:$FB34 PRG:3B34 C9 09 - bcc Label_FB39 ; CPU:$FB36 PRG:3B36 90 01 + bcc ComputeCollisionAngle_Steep ; CPU:$FB36 PRG:3B36 90 01 ; ----------------------------------------------------------------------------- -; Routine: Label_FB38 +; Routine: ComputeCollisionAngle_Reject ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -9907,10 +11395,10 @@ Label_FB2C: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_FB38: +ComputeCollisionAngle_Reject: rts ; CPU:$FB38 PRG:3B38 60 ; ----------------------------------------------------------------------------- -; Routine: Label_FB39 +; Routine: ComputeCollisionAngle_Steep ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -9918,21 +11406,21 @@ Label_FB38: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_FB39: +ComputeCollisionAngle_Steep: tax ; CPU:$FB39 PRG:3B39 AA lda $FB90,x ; CPU:$FB3A PRG:3B3A BD 90 FB tay ; CPU:$FB3D PRG:3B3D A8 iny ; CPU:$FB3E PRG:3B3E C8 - sty ZpF6 ; CPU:$FB3F PRG:3B3F 84 F6 - lda ZpF8 ; CPU:$FB41 PRG:3B41 A5 F8 - cmp ZpF6 ; CPU:$FB43 PRG:3B43 C5 F6 - bcs Label_FB38 ; CPU:$FB45 PRG:3B45 B0 F1 + sty ppu_addr_temp_lo ; CPU:$FB3F PRG:3B3F 84 F6 + lda ppu_src_lo ; CPU:$FB41 PRG:3B41 A5 F8 + cmp ppu_addr_temp_lo ; CPU:$FB43 PRG:3B43 C5 F6 + bcs ComputeCollisionAngle_Reject ; CPU:$FB45 PRG:3B45 B0 F1 dey ; CPU:$FB47 PRG:3B47 88 - sty ZpF8 ; CPU:$FB48 PRG:3B48 84 F8 + sty ppu_src_lo ; CPU:$FB48 PRG:3B48 84 F8 txa ; CPU:$FB4A PRG:3B4A 8A asl a ; CPU:$FB4B PRG:3B4B 0A ; ----------------------------------------------------------------------------- -; Routine: Label_FB4C +; Routine: ComputeCollisionAngle_Mirror ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -9940,14 +11428,14 @@ Label_FB39: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_FB4C: +ComputeCollisionAngle_Mirror: asl a ; CPU:$FB4C PRG:3B4C 0A eor #$FF ; CPU:$FB4D PRG:3B4D 49 FF clc ; CPU:$FB4F PRG:3B4F 18 adc #$41 ; CPU:$FB50 PRG:3B50 69 41 jmp $FB69 ; CPU:$FB52 PRG:3B52 4C 69 FB ; ----------------------------------------------------------------------------- -; Routine: Label_FB55 +; Routine: ComputeCollisionAngle_Shallow ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -9955,22 +11443,22 @@ Label_FB4C: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_FB55: +ComputeCollisionAngle_Shallow: tax ; CPU:$FB55 PRG:3B55 AA lda $FB90,x ; CPU:$FB56 PRG:3B56 BD 90 FB tay ; CPU:$FB59 PRG:3B59 A8 iny ; CPU:$FB5A PRG:3B5A C8 - sty ZpF6 ; CPU:$FB5B PRG:3B5B 84 F6 - lda ZpF9 ; CPU:$FB5D PRG:3B5D A5 F9 - cmp ZpF6 ; CPU:$FB5F PRG:3B5F C5 F6 - bcs Label_FB38 ; CPU:$FB61 PRG:3B61 B0 D5 + sty ppu_addr_temp_lo ; CPU:$FB5B PRG:3B5B 84 F6 + lda ppu_src_hi ; CPU:$FB5D PRG:3B5D A5 F9 + cmp ppu_addr_temp_lo ; CPU:$FB5F PRG:3B5F C5 F6 + bcs ComputeCollisionAngle_Reject ; CPU:$FB61 PRG:3B61 B0 D5 dey ; CPU:$FB63 PRG:3B63 88 - sty ZpF9 ; CPU:$FB64 PRG:3B64 84 F9 + sty ppu_src_hi ; CPU:$FB64 PRG:3B64 84 F9 txa ; CPU:$FB66 PRG:3B66 8A asl a ; CPU:$FB67 PRG:3B67 0A asl a ; CPU:$FB68 PRG:3B68 0A ; ----------------------------------------------------------------------------- -; Routine: Label_FB69 +; Routine: ComputeCollisionAngle_ApplySigns ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -9978,20 +11466,20 @@ Label_FB55: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_FB69: +ComputeCollisionAngle_ApplySigns: tax ; CPU:$FB69 PRG:3B69 AA clc ; CPU:$FB6A PRG:3B6A 18 lda Zp29 ; CPU:$FB6B PRG:3B6B A5 29 - bmi Label_FB7A ; CPU:$FB6D PRG:3B6D 30 0B + bmi ComputeCollisionAngle_Quadrant1 ; CPU:$FB6D PRG:3B6D 30 0B lda Zp28 ; CPU:$FB6F PRG:3B6F A5 28 - bpl Label_FB8D ; CPU:$FB71 PRG:3B71 10 1A + bpl ComputeCollisionAngle_Quadrant3 ; CPU:$FB71 PRG:3B71 10 1A txa ; CPU:$FB73 PRG:3B73 8A eor #$FF ; CPU:$FB74 PRG:3B74 49 FF adc #$01 ; CPU:$FB76 PRG:3B76 69 01 clc ; CPU:$FB78 PRG:3B78 18 rts ; CPU:$FB79 PRG:3B79 60 ; ----------------------------------------------------------------------------- -; Routine: Label_FB7A +; Routine: ComputeCollisionAngle_Quadrant1 ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -9999,17 +11487,17 @@ Label_FB69: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_FB7A: +ComputeCollisionAngle_Quadrant1: lda Zp28 ; CPU:$FB7A PRG:3B7A A5 28 - bmi Label_FB87 ; CPU:$FB7C PRG:3B7C 30 09 - stx ZpF6 ; CPU:$FB7E PRG:3B7E 86 F6 + bmi ComputeCollisionAngle_Quadrant2 ; CPU:$FB7C PRG:3B7C 30 09 + stx ppu_addr_temp_lo ; CPU:$FB7E PRG:3B7E 86 F6 lda #$80 ; CPU:$FB80 PRG:3B80 A9 80 sec ; CPU:$FB82 PRG:3B82 38 - sbc ZpF6 ; CPU:$FB83 PRG:3B83 E5 F6 + sbc ppu_addr_temp_lo ; CPU:$FB83 PRG:3B83 E5 F6 clc ; CPU:$FB85 PRG:3B85 18 rts ; CPU:$FB86 PRG:3B86 60 ; ----------------------------------------------------------------------------- -; Routine: Label_FB87 +; Routine: ComputeCollisionAngle_Quadrant2 ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -10017,14 +11505,14 @@ Label_FB7A: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_FB87: +ComputeCollisionAngle_Quadrant2: txa ; CPU:$FB87 PRG:3B87 8A clc ; CPU:$FB88 PRG:3B88 18 adc #$80 ; CPU:$FB89 PRG:3B89 69 80 clc ; CPU:$FB8B PRG:3B8B 18 rts ; CPU:$FB8C PRG:3B8C 60 ; ----------------------------------------------------------------------------- -; Routine: Label_FB8D +; Routine: ComputeCollisionAngle_Quadrant3 ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -10032,12 +11520,12 @@ Label_FB87: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_FB8D: +ComputeCollisionAngle_Quadrant3: txa ; CPU:$FB8D PRG:3B8D 8A clc ; CPU:$FB8E PRG:3B8E 18 rts ; CPU:$FB8F PRG:3B8F 60 ; ----------------------------------------------------------------------------- -; Routine: Label_FB90 +; Routine: CollisionAngleLimitTable ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -10045,15 +11533,13 @@ Label_FB8D: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_FB90: +CollisionAngleLimitTable: .byte $0B, $0B ; CPU:$FB90 PRG:3B90 0B 0B -- anc #$0B (undocumented; ca65 cannot encode) .byte $0B, $0B ; CPU:$FB92 PRG:3B92 0B 0B -- anc #$0B (undocumented; ca65 cannot encode) - asl a ; CPU:$FB94 PRG:3B94 0A - asl a ; CPU:$FB95 PRG:3B95 0A - ora #$09 ; CPU:$FB96 PRG:3B96 09 09 - php ; CPU:$FB98 PRG:3B98 08 +; ---- data $FB94-$FB98 (5 bytes) ---- + .byte $0A, $0A, $09, $09, $08 ; CPU:$FB94 PRG:3B94 0A 0A 09 09 08 ; ----------------------------------------------------------------------------- -; Routine: Label_FB99 +; Routine: ResolveBallCollision ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -10061,15 +11547,15 @@ Label_FB90: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_FB99: +ResolveBallCollision: jsr $FB2C ; CPU:$FB99 PRG:3B99 20 2C FB - bcs Label_FBC1 ; CPU:$FB9C PRG:3B9C B0 23 + bcs ResolveBallCollision_Done ; CPU:$FB9C PRG:3B9C B0 23 pha ; CPU:$FB9E PRG:3B9E 48 jsr $FEA8 ; CPU:$FB9F PRG:3B9F 20 A8 FE - lda ZpFD ; CPU:$FBA2 PRG:3BA2 A5 FD + lda ppu_addr_hi ; CPU:$FBA2 PRG:3BA2 A5 FD asl a ; CPU:$FBA4 PRG:3BA4 0A ; ----------------------------------------------------------------------------- -; Routine: Label_FBA5 +; Routine: ResolveBallCollision_Rotate ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -10077,26 +11563,26 @@ Label_FB99: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_FBA5: - lda ZpFD ; CPU:$FBA5 PRG:3BA5 A5 FD +ResolveBallCollision_Rotate: + lda ppu_addr_hi ; CPU:$FBA5 PRG:3BA5 A5 FD ror a ; CPU:$FBA7 PRG:3BA7 6A sta Zp21 ; CPU:$FBA8 PRG:3BA8 85 21 - lda ZpFC ; CPU:$FBAA PRG:3BAA A5 FC + lda ppu_addr_lo ; CPU:$FBAA PRG:3BAA A5 FC ror a ; CPU:$FBAC PRG:3BAC 6A sta Zp20 ; CPU:$FBAD PRG:3BAD 85 20 pla ; CPU:$FBAF PRG:3BAF 68 jsr $FF0E ; CPU:$FBB0 PRG:3BB0 20 0E FF - lda ZpFD ; CPU:$FBB3 PRG:3BB3 A5 FD + lda ppu_addr_hi ; CPU:$FBB3 PRG:3BB3 A5 FD asl a ; CPU:$FBB5 PRG:3BB5 0A - lda ZpFD ; CPU:$FBB6 PRG:3BB6 A5 FD + lda ppu_addr_hi ; CPU:$FBB6 PRG:3BB6 A5 FD ror a ; CPU:$FBB8 PRG:3BB8 6A sta Zp23 ; CPU:$FBB9 PRG:3BB9 85 23 - lda ZpFC ; CPU:$FBBB PRG:3BBB A5 FC + lda ppu_addr_lo ; CPU:$FBBB PRG:3BBB A5 FC ror a ; CPU:$FBBD PRG:3BBD 6A sta Zp22 ; CPU:$FBBE PRG:3BBE 85 22 clc ; CPU:$FBC0 PRG:3BC0 18 ; ----------------------------------------------------------------------------- -; Routine: Label_FBC1 +; Routine: ResolveBallCollision_Done ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -10104,10 +11590,10 @@ Label_FBA5: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_FBC1: +ResolveBallCollision_Done: rts ; CPU:$FBC1 PRG:3BC1 60 ; ----------------------------------------------------------------------------- -; Routine: Label_FBC2 +; Routine: ComputeBallVelocity ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -10115,17 +11601,17 @@ Label_FBC1: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_FBC2: +ComputeBallVelocity: lda $03A0,y ; CPU:$FBC2 PRG:3BC2 B9 A0 03 lsr a ; CPU:$FBC5 PRG:3BC5 4A - bne Label_FBD1 ; CPU:$FBC6 PRG:3BC6 D0 09 + bne ComputeBallVelocity_Moving ; CPU:$FBC6 PRG:3BC6 D0 09 sta Zp10,x ; CPU:$FBC8 PRG:3BC8 95 10 sta Zp11,x ; CPU:$FBCA PRG:3BCA 95 11 sta Zp12,x ; CPU:$FBCC PRG:3BCC 95 12 sta Zp13,x ; CPU:$FBCE PRG:3BCE 95 13 rts ; CPU:$FBD0 PRG:3BD0 60 ; ----------------------------------------------------------------------------- -; Routine: Label_FBD1 +; Routine: ComputeBallVelocity_Moving ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -10133,46 +11619,46 @@ Label_FBC2: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_FBD1: - sta ZpFA ; CPU:$FBD1 PRG:3BD1 85 FA +ComputeBallVelocity_Moving: + sta ptr_lo ; CPU:$FBD1 PRG:3BD1 85 FA pha ; CPU:$FBD3 PRG:3BD3 48 lda $0340,y ; CPU:$FBD4 PRG:3BD4 B9 40 03 - sta ZpFC ; CPU:$FBD7 PRG:3BD7 85 FC + sta ppu_addr_lo ; CPU:$FBD7 PRG:3BD7 85 FC lda $0350,y ; CPU:$FBD9 PRG:3BD9 B9 50 03 - sta ZpFD ; CPU:$FBDC PRG:3BDC 85 FD + sta ppu_addr_hi ; CPU:$FBDC PRG:3BDC 85 FD lda #$00 ; CPU:$FBDE PRG:3BDE A9 00 - sta ZpFB ; CPU:$FBE0 PRG:3BE0 85 FB + sta ptr_hi ; CPU:$FBE0 PRG:3BE0 85 FB jsr $FD8B ; CPU:$FBE2 PRG:3BE2 20 8B FD jsr $FE4A ; CPU:$FBE5 PRG:3BE5 20 4A FE sty Zp1C ; CPU:$FBE8 PRG:3BE8 84 1C stx Zp1D ; CPU:$FBEA PRG:3BEA 86 1D lda Zp20 ; CPU:$FBEC PRG:3BEC A5 20 - sta ZpFA ; CPU:$FBEE PRG:3BEE 85 FA + sta ptr_lo ; CPU:$FBEE PRG:3BEE 85 FA lda Zp21 ; CPU:$FBF0 PRG:3BF0 A5 21 - sta ZpFB ; CPU:$FBF2 PRG:3BF2 85 FB + sta ptr_hi ; CPU:$FBF2 PRG:3BF2 85 FB jsr $FD8B ; CPU:$FBF4 PRG:3BF4 20 8B FD sty Zp24 ; CPU:$FBF7 PRG:3BF7 84 24 stx Zp25 ; CPU:$FBF9 PRG:3BF9 86 25 - ldy ZpFE ; CPU:$FBFB PRG:3BFB A4 FE + ldy ppu_addr_src_lo ; CPU:$FBFB PRG:3BFB A4 FE lda $0380,y ; CPU:$FBFD PRG:3BFD B9 80 03 - sta ZpFC ; CPU:$FC00 PRG:3C00 85 FC + sta ppu_addr_lo ; CPU:$FC00 PRG:3C00 85 FC lda $0390,y ; CPU:$FC02 PRG:3C02 B9 90 03 - sta ZpFD ; CPU:$FC05 PRG:3C05 85 FD + sta ppu_addr_hi ; CPU:$FC05 PRG:3C05 85 FD pla ; CPU:$FC07 PRG:3C07 68 - sta ZpFA ; CPU:$FC08 PRG:3C08 85 FA + sta ptr_lo ; CPU:$FC08 PRG:3C08 85 FA lda #$00 ; CPU:$FC0A PRG:3C0A A9 00 - sta ZpFB ; CPU:$FC0C PRG:3C0C 85 FB + sta ptr_hi ; CPU:$FC0C PRG:3C0C 85 FB jsr $FD8B ; CPU:$FC0E PRG:3C0E 20 8B FD jsr $FE4A ; CPU:$FC11 PRG:3C11 20 4A FE sty Zp1E ; CPU:$FC14 PRG:3C14 84 1E stx Zp1F ; CPU:$FC16 PRG:3C16 86 1F lda Zp22 ; CPU:$FC18 PRG:3C18 A5 22 - sta ZpFA ; CPU:$FC1A PRG:3C1A 85 FA + sta ptr_lo ; CPU:$FC1A PRG:3C1A 85 FA lda Zp23 ; CPU:$FC1C PRG:3C1C A5 23 - sta ZpFB ; CPU:$FC1E PRG:3C1E 85 FB + sta ptr_hi ; CPU:$FC1E PRG:3C1E 85 FB jsr $FD8B ; CPU:$FC20 PRG:3C20 20 8B FD tya ; CPU:$FC23 PRG:3C23 98 - ldy ZpFF ; CPU:$FC24 PRG:3C24 A4 FF + ldy ppu_addr_src_hi ; CPU:$FC24 PRG:3C24 A4 FF clc ; CPU:$FC26 PRG:3C26 18 adc Zp24 ; CPU:$FC27 PRG:3C27 65 24 sta a:$0012,y ; CPU:$FC29 PRG:3C29 99 12 00 @@ -10180,27 +11666,27 @@ Label_FBD1: adc Zp25 ; CPU:$FC2D PRG:3C2D 65 25 sta a:$0013,y ; CPU:$FC2F PRG:3C2F 99 13 00 lda Zp1E ; CPU:$FC32 PRG:3C32 A5 1E - sta ZpFC ; CPU:$FC34 PRG:3C34 85 FC + sta ppu_addr_lo ; CPU:$FC34 PRG:3C34 85 FC lda Zp1F ; CPU:$FC36 PRG:3C36 A5 1F - sta ZpFD ; CPU:$FC38 PRG:3C38 85 FD + sta ppu_addr_hi ; CPU:$FC38 PRG:3C38 85 FD lda Zp20 ; CPU:$FC3A PRG:3C3A A5 20 - sta ZpFA ; CPU:$FC3C PRG:3C3C 85 FA + sta ptr_lo ; CPU:$FC3C PRG:3C3C 85 FA lda Zp21 ; CPU:$FC3E PRG:3C3E A5 21 - sta ZpFB ; CPU:$FC40 PRG:3C40 85 FB + sta ptr_hi ; CPU:$FC40 PRG:3C40 85 FB jsr $FD8B ; CPU:$FC42 PRG:3C42 20 8B FD sty Zp24 ; CPU:$FC45 PRG:3C45 84 24 stx Zp25 ; CPU:$FC47 PRG:3C47 86 25 lda Zp1C ; CPU:$FC49 PRG:3C49 A5 1C - sta ZpFC ; CPU:$FC4B PRG:3C4B 85 FC + sta ppu_addr_lo ; CPU:$FC4B PRG:3C4B 85 FC lda Zp1D ; CPU:$FC4D PRG:3C4D A5 1D - sta ZpFD ; CPU:$FC4F PRG:3C4F 85 FD + sta ppu_addr_hi ; CPU:$FC4F PRG:3C4F 85 FD lda Zp22 ; CPU:$FC51 PRG:3C51 A5 22 - sta ZpFA ; CPU:$FC53 PRG:3C53 85 FA + sta ptr_lo ; CPU:$FC53 PRG:3C53 85 FA lda Zp23 ; CPU:$FC55 PRG:3C55 A5 23 - sta ZpFB ; CPU:$FC57 PRG:3C57 85 FB + sta ptr_hi ; CPU:$FC57 PRG:3C57 85 FB jsr $FD8B ; CPU:$FC59 PRG:3C59 20 8B FD tya ; CPU:$FC5C PRG:3C5C 98 - ldy ZpFF ; CPU:$FC5D PRG:3C5D A4 FF + ldy ppu_addr_src_hi ; CPU:$FC5D PRG:3C5D A4 FF sec ; CPU:$FC5F PRG:3C5F 38 sbc Zp24 ; CPU:$FC60 PRG:3C60 E5 24 sta a:$0010,y ; CPU:$FC62 PRG:3C62 99 10 00 @@ -10209,7 +11695,7 @@ Label_FBD1: sta a:$0011,y ; CPU:$FC68 PRG:3C68 99 11 00 rts ; CPU:$FC6B PRG:3C6B 60 ; ----------------------------------------------------------------------------- -; Routine: Label_FC6C +; Routine: ProjectObjectPosition ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -10217,33 +11703,33 @@ Label_FBD1: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_FC6C: +ProjectObjectPosition: lda a:$0010,y ; CPU:$FC6C PRG:3C6C B9 10 00 - sta ZpFC ; CPU:$FC6F PRG:3C6F 85 FC + sta ppu_addr_lo ; CPU:$FC6F PRG:3C6F 85 FC lda a:$0011,y ; CPU:$FC71 PRG:3C71 B9 11 00 - sta ZpFD ; CPU:$FC74 PRG:3C74 85 FD + sta ppu_addr_hi ; CPU:$FC74 PRG:3C74 85 FD jsr $FE4A ; CPU:$FC76 PRG:3C76 20 4A FE sty Zp18 ; CPU:$FC79 PRG:3C79 84 18 stx Zp19 ; CPU:$FC7B PRG:3C7B 86 19 lda Zp20 ; CPU:$FC7D PRG:3C7D A5 20 - sta ZpFA ; CPU:$FC7F PRG:3C7F 85 FA + sta ptr_lo ; CPU:$FC7F PRG:3C7F 85 FA lda Zp21 ; CPU:$FC81 PRG:3C81 A5 21 - sta ZpFB ; CPU:$FC83 PRG:3C83 85 FB + sta ptr_hi ; CPU:$FC83 PRG:3C83 85 FB jsr $FD8B ; CPU:$FC85 PRG:3C85 20 8B FD sty Zp24 ; CPU:$FC88 PRG:3C88 84 24 stx Zp25 ; CPU:$FC8A PRG:3C8A 86 25 - ldx ZpFF ; CPU:$FC8C PRG:3C8C A6 FF + ldx ppu_addr_src_hi ; CPU:$FC8C PRG:3C8C A6 FF lda Zp12,x ; CPU:$FC8E PRG:3C8E B5 12 - sta ZpFC ; CPU:$FC90 PRG:3C90 85 FC + sta ppu_addr_lo ; CPU:$FC90 PRG:3C90 85 FC lda Zp13,x ; CPU:$FC92 PRG:3C92 B5 13 - sta ZpFD ; CPU:$FC94 PRG:3C94 85 FD + sta ppu_addr_hi ; CPU:$FC94 PRG:3C94 85 FD jsr $FE4A ; CPU:$FC96 PRG:3C96 20 4A FE sty Zp1A ; CPU:$FC99 PRG:3C99 84 1A stx Zp1B ; CPU:$FC9B PRG:3C9B 86 1B lda Zp22 ; CPU:$FC9D PRG:3C9D A5 22 - sta ZpFA ; CPU:$FC9F PRG:3C9F 85 FA + sta ptr_lo ; CPU:$FC9F PRG:3C9F 85 FA lda Zp23 ; CPU:$FCA1 PRG:3CA1 A5 23 - sta ZpFB ; CPU:$FCA3 PRG:3CA3 85 FB + sta ptr_hi ; CPU:$FCA3 PRG:3CA3 85 FB jsr $FD8B ; CPU:$FCA5 PRG:3CA5 20 8B FD tya ; CPU:$FCA8 PRG:3CA8 98 sec ; CPU:$FCA9 PRG:3CA9 38 @@ -10253,71 +11739,71 @@ Label_FC6C: sbc Zp25 ; CPU:$FCAF PRG:3CAF E5 25 sta Zp1F ; CPU:$FCB1 PRG:3CB1 85 1F lda Zp18 ; CPU:$FCB3 PRG:3CB3 A5 18 - sta ZpFC ; CPU:$FCB5 PRG:3CB5 85 FC + sta ppu_addr_lo ; CPU:$FCB5 PRG:3CB5 85 FC lda Zp19 ; CPU:$FCB7 PRG:3CB7 A5 19 - sta ZpFD ; CPU:$FCB9 PRG:3CB9 85 FD + sta ppu_addr_hi ; CPU:$FCB9 PRG:3CB9 85 FD lda Zp22 ; CPU:$FCBB PRG:3CBB A5 22 - sta ZpFA ; CPU:$FCBD PRG:3CBD 85 FA + sta ptr_lo ; CPU:$FCBD PRG:3CBD 85 FA lda Zp23 ; CPU:$FCBF PRG:3CBF A5 23 - sta ZpFB ; CPU:$FCC1 PRG:3CC1 85 FB + sta ptr_hi ; CPU:$FCC1 PRG:3CC1 85 FB jsr $FD8B ; CPU:$FCC3 PRG:3CC3 20 8B FD sty Zp24 ; CPU:$FCC6 PRG:3CC6 84 24 stx Zp25 ; CPU:$FCC8 PRG:3CC8 86 25 lda Zp1A ; CPU:$FCCA PRG:3CCA A5 1A - sta ZpFC ; CPU:$FCCC PRG:3CCC 85 FC + sta ppu_addr_lo ; CPU:$FCCC PRG:3CCC 85 FC lda Zp1B ; CPU:$FCCE PRG:3CCE A5 1B - sta ZpFD ; CPU:$FCD0 PRG:3CD0 85 FD + sta ppu_addr_hi ; CPU:$FCD0 PRG:3CD0 85 FD lda Zp20 ; CPU:$FCD2 PRG:3CD2 A5 20 - sta ZpFA ; CPU:$FCD4 PRG:3CD4 85 FA + sta ptr_lo ; CPU:$FCD4 PRG:3CD4 85 FA lda Zp21 ; CPU:$FCD6 PRG:3CD6 A5 21 - sta ZpFB ; CPU:$FCD8 PRG:3CD8 85 FB + sta ptr_hi ; CPU:$FCD8 PRG:3CD8 85 FB jsr $FD8B ; CPU:$FCDA PRG:3CDA 20 8B FD tya ; CPU:$FCDD PRG:3CDD 98 clc ; CPU:$FCDE PRG:3CDE 18 adc Zp24 ; CPU:$FCDF PRG:3CDF 65 24 sta Zp1C ; CPU:$FCE1 PRG:3CE1 85 1C - sta ZpFC ; CPU:$FCE3 PRG:3CE3 85 FC + sta ppu_addr_lo ; CPU:$FCE3 PRG:3CE3 85 FC txa ; CPU:$FCE5 PRG:3CE5 8A adc Zp25 ; CPU:$FCE6 PRG:3CE6 65 25 sta Zp1D ; CPU:$FCE8 PRG:3CE8 85 1D - sta ZpFD ; CPU:$FCEA PRG:3CEA 85 FD + sta ppu_addr_hi ; CPU:$FCEA PRG:3CEA 85 FD jsr $FE4A ; CPU:$FCEC PRG:3CEC 20 4A FE - sty ZpFA ; CPU:$FCEF PRG:3CEF 84 FA - stx ZpFB ; CPU:$FCF1 PRG:3CF1 86 FB + sty ptr_lo ; CPU:$FCEF PRG:3CEF 84 FA + stx ptr_hi ; CPU:$FCF1 PRG:3CF1 86 FB jsr $FD8B ; CPU:$FCF3 PRG:3CF3 20 8B FD sty Zp24 ; CPU:$FCF6 PRG:3CF6 84 24 stx Zp25 ; CPU:$FCF8 PRG:3CF8 86 25 lda Zp1E ; CPU:$FCFA PRG:3CFA A5 1E - sta ZpFC ; CPU:$FCFC PRG:3CFC 85 FC + sta ppu_addr_lo ; CPU:$FCFC PRG:3CFC 85 FC lda Zp1F ; CPU:$FCFE PRG:3CFE A5 1F - sta ZpFD ; CPU:$FD00 PRG:3D00 85 FD + sta ppu_addr_hi ; CPU:$FD00 PRG:3D00 85 FD jsr $FE4A ; CPU:$FD02 PRG:3D02 20 4A FE - sty ZpFA ; CPU:$FD05 PRG:3D05 84 FA - stx ZpFB ; CPU:$FD07 PRG:3D07 86 FB + sty ptr_lo ; CPU:$FD05 PRG:3D05 84 FA + stx ptr_hi ; CPU:$FD07 PRG:3D07 86 FB jsr $FD8B ; CPU:$FD09 PRG:3D09 20 8B FD tya ; CPU:$FD0C PRG:3D0C 98 clc ; CPU:$FD0D PRG:3D0D 18 adc Zp24 ; CPU:$FD0E PRG:3D0E 65 24 - sta ZpFC ; CPU:$FD10 PRG:3D10 85 FC + sta ppu_addr_lo ; CPU:$FD10 PRG:3D10 85 FC txa ; CPU:$FD12 PRG:3D12 8A adc Zp25 ; CPU:$FD13 PRG:3D13 65 25 - asl ZpFC ; CPU:$FD15 PRG:3D15 06 FC + asl ppu_addr_lo ; CPU:$FD15 PRG:3D15 06 FC rol a ; CPU:$FD17 PRG:3D17 2A - asl ZpFC ; CPU:$FD18 PRG:3D18 06 FC + asl ppu_addr_lo ; CPU:$FD18 PRG:3D18 06 FC rol a ; CPU:$FD1A PRG:3D1A 2A - asl ZpFC ; CPU:$FD1B PRG:3D1B 06 FC + asl ppu_addr_lo ; CPU:$FD1B PRG:3D1B 06 FC rol a ; CPU:$FD1D PRG:3D1D 2A - asl ZpFC ; CPU:$FD1E PRG:3D1E 06 FC + asl ppu_addr_lo ; CPU:$FD1E PRG:3D1E 06 FC rol a ; CPU:$FD20 PRG:3D20 2A - asl ZpFC ; CPU:$FD21 PRG:3D21 06 FC + asl ppu_addr_lo ; CPU:$FD21 PRG:3D21 06 FC rol a ; CPU:$FD23 PRG:3D23 2A - asl ZpFC ; CPU:$FD24 PRG:3D24 06 FC + asl ppu_addr_lo ; CPU:$FD24 PRG:3D24 06 FC rol a ; CPU:$FD26 PRG:3D26 2A - bcc Label_FD2D ; CPU:$FD27 PRG:3D27 90 04 + bcc ProjectObjectPosition_Skip ; CPU:$FD27 PRG:3D27 90 04 lda #$FF ; CPU:$FD29 PRG:3D29 A9 FF - bne Label_FD32 ; CPU:$FD2B PRG:3D2B D0 05 + bne ProjectObjectPosition_Store ; CPU:$FD2B PRG:3D2B D0 05 ; ----------------------------------------------------------------------------- -; Routine: Label_FD2D +; Routine: ProjectObjectPosition_Skip ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -10325,11 +11811,11 @@ Label_FC6C: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_FD2D: - sta ZpFD ; CPU:$FD2D PRG:3D2D 85 FD +ProjectObjectPosition_Skip: + sta ppu_addr_hi ; CPU:$FD2D PRG:3D2D 85 FD jsr $FE5A ; CPU:$FD2F PRG:3D2F 20 5A FE ; ----------------------------------------------------------------------------- -; Routine: Label_FD32 +; Routine: ProjectObjectPosition_Store ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -10337,22 +11823,22 @@ Label_FD2D: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_FD32: +ProjectObjectPosition_Store: ldx Zp05 ; CPU:$FD32 PRG:3D32 A6 05 sta $03A0,x ; CPU:$FD34 PRG:3D34 9D A0 03 lda Zp1C ; CPU:$FD37 PRG:3D37 A5 1C - sta ZpFC ; CPU:$FD39 PRG:3D39 85 FC + sta ppu_addr_lo ; CPU:$FD39 PRG:3D39 85 FC lda Zp1D ; CPU:$FD3B PRG:3D3B A5 1D - sta ZpFD ; CPU:$FD3D PRG:3D3D 85 FD + sta ppu_addr_hi ; CPU:$FD3D PRG:3D3D 85 FD jsr $FD60 ; CPU:$FD3F PRG:3D3F 20 60 FD ldx Zp05 ; CPU:$FD42 PRG:3D42 A6 05 sta $0350,x ; CPU:$FD44 PRG:3D44 9D 50 03 tya ; CPU:$FD47 PRG:3D47 98 sta $0340,x ; CPU:$FD48 PRG:3D48 9D 40 03 lda Zp1E ; CPU:$FD4B PRG:3D4B A5 1E - sta ZpFC ; CPU:$FD4D PRG:3D4D 85 FC + sta ppu_addr_lo ; CPU:$FD4D PRG:3D4D 85 FC lda Zp1F ; CPU:$FD4F PRG:3D4F A5 1F - sta ZpFD ; CPU:$FD51 PRG:3D51 85 FD + sta ppu_addr_hi ; CPU:$FD51 PRG:3D51 85 FD jsr $FD60 ; CPU:$FD53 PRG:3D53 20 60 FD ldx Zp05 ; CPU:$FD56 PRG:3D56 A6 05 sta $0390,x ; CPU:$FD58 PRG:3D58 9D 90 03 @@ -10360,7 +11846,7 @@ Label_FD32: sta $0380,x ; CPU:$FD5C PRG:3D5C 9D 80 03 rts ; CPU:$FD5F PRG:3D5F 60 ; ----------------------------------------------------------------------------- -; Routine: Label_FD60 +; Routine: ProjectCoordinate ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -10368,29 +11854,29 @@ Label_FD32: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_FD60: - asl ZpFC ; CPU:$FD60 PRG:3D60 06 FC - rol ZpFD ; CPU:$FD62 PRG:3D62 26 FD +ProjectCoordinate: + asl ppu_addr_lo ; CPU:$FD60 PRG:3D60 06 FC + rol ppu_addr_hi ; CPU:$FD62 PRG:3D62 26 FD lda $03A0,x ; CPU:$FD64 PRG:3D64 BD A0 03 - sta ZpFA ; CPU:$FD67 PRG:3D67 85 FA + sta ptr_lo ; CPU:$FD67 PRG:3D67 85 FA lda #$00 ; CPU:$FD69 PRG:3D69 A9 00 - sta ZpFB ; CPU:$FD6B PRG:3D6B 85 FB + sta ptr_hi ; CPU:$FD6B PRG:3D6B 85 FB jsr $FDFE ; CPU:$FD6D PRG:3D6D 20 FE FD txa ; CPU:$FD70 PRG:3D70 8A - asl ZpFC ; CPU:$FD71 PRG:3D71 06 FC + asl ppu_addr_lo ; CPU:$FD71 PRG:3D71 06 FC rol a ; CPU:$FD73 PRG:3D73 2A - asl ZpFC ; CPU:$FD74 PRG:3D74 06 FC + asl ppu_addr_lo ; CPU:$FD74 PRG:3D74 06 FC rol a ; CPU:$FD76 PRG:3D76 2A - beq Label_FD88 ; CPU:$FD77 PRG:3D77 F0 0F + beq ProjectCoordinate_Done ; CPU:$FD77 PRG:3D77 F0 0F cmp #$FF ; CPU:$FD79 PRG:3D79 C9 FF - beq Label_FD88 ; CPU:$FD7B PRG:3D7B F0 0B + beq ProjectCoordinate_Done ; CPU:$FD7B PRG:3D7B F0 0B ldy #$00 ; CPU:$FD7D PRG:3D7D A0 00 tax ; CPU:$FD7F PRG:3D7F AA - bpl Label_FD85 ; CPU:$FD80 PRG:3D80 10 03 + bpl ProjectCoordinate_High ; CPU:$FD80 PRG:3D80 10 03 lda #$FF ; CPU:$FD82 PRG:3D82 A9 FF rts ; CPU:$FD84 PRG:3D84 60 ; ----------------------------------------------------------------------------- -; Routine: Label_FD85 +; Routine: ProjectCoordinate_High ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -10398,11 +11884,11 @@ Label_FD60: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_FD85: +ProjectCoordinate_High: lda #$01 ; CPU:$FD85 PRG:3D85 A9 01 rts ; CPU:$FD87 PRG:3D87 60 ; ----------------------------------------------------------------------------- -; Routine: Label_FD88 +; Routine: ProjectCoordinate_Done ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -10410,11 +11896,11 @@ Label_FD85: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_FD88: - ldy ZpFC ; CPU:$FD88 PRG:3D88 A4 FC +ProjectCoordinate_Done: + ldy ppu_addr_lo ; CPU:$FD88 PRG:3D88 A4 FC rts ; CPU:$FD8A PRG:3D8A 60 ; ----------------------------------------------------------------------------- -; Routine: Label_FD8B +; Routine: Multiply16 ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -10422,15 +11908,15 @@ Label_FD88: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_FD8B: +Multiply16: lda #$00 ; CPU:$FD8B PRG:3D8B A9 00 - sta ZpF6 ; CPU:$FD8D PRG:3D8D 85 F6 - sta ZpF7 ; CPU:$FD8F PRG:3D8F 85 F7 - lda ZpFD ; CPU:$FD91 PRG:3D91 A5 FD - beq Label_FD98 ; CPU:$FD93 PRG:3D93 F0 03 + sta ppu_addr_temp_lo ; CPU:$FD8D PRG:3D8D 85 F6 + sta ppu_addr_temp_hi ; CPU:$FD8F PRG:3D8F 85 F7 + lda ppu_addr_hi ; CPU:$FD91 PRG:3D91 A5 FD + beq Multiply16_LowByte ; CPU:$FD93 PRG:3D93 F0 03 jsr $FDA8 ; CPU:$FD95 PRG:3D95 20 A8 FD ; ----------------------------------------------------------------------------- -; Routine: Label_FD98 +; Routine: Multiply16_LowByte ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -10438,17 +11924,17 @@ Label_FD8B: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_FD98: - lda ZpFC ; CPU:$FD98 PRG:3D98 A5 FC - sta ZpFD ; CPU:$FD9A PRG:3D9A 85 FD +Multiply16_LowByte: + lda ppu_addr_lo ; CPU:$FD98 PRG:3D98 A5 FC + sta ppu_addr_hi ; CPU:$FD9A PRG:3D9A 85 FD jsr $FDA8 ; CPU:$FD9C PRG:3D9C 20 A8 FD - ldx ZpF7 ; CPU:$FD9F PRG:3D9F A6 F7 - stx ZpFD ; CPU:$FDA1 PRG:3DA1 86 FD - ldy ZpF6 ; CPU:$FDA3 PRG:3DA3 A4 F6 - sty ZpFC ; CPU:$FDA5 PRG:3DA5 84 FC + ldx ppu_addr_temp_hi ; CPU:$FD9F PRG:3D9F A6 F7 + stx ppu_addr_hi ; CPU:$FDA1 PRG:3DA1 86 FD + ldy ppu_addr_temp_lo ; CPU:$FDA3 PRG:3DA3 A4 F6 + sty ppu_addr_lo ; CPU:$FDA5 PRG:3DA5 84 FC rts ; CPU:$FDA7 PRG:3DA7 60 ; ----------------------------------------------------------------------------- -; Routine: Label_FDA8 +; Routine: MultiplyByte16 ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -10456,10 +11942,10 @@ Label_FD98: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_FDA8: +MultiplyByte16: ldx #$04 ; CPU:$FDA8 PRG:3DA8 A2 04 ; ----------------------------------------------------------------------------- -; Routine: Label_FDAA +; Routine: MultiplyByte16_Loop ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -10467,20 +11953,20 @@ Label_FDA8: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_FDAA: - asl ZpF6 ; CPU:$FDAA PRG:3DAA 06 F6 - rol ZpF7 ; CPU:$FDAC PRG:3DAC 26 F7 - asl ZpFD ; CPU:$FDAE PRG:3DAE 06 FD - bcc Label_FDBF ; CPU:$FDB0 PRG:3DB0 90 0D - lda ZpF6 ; CPU:$FDB2 PRG:3DB2 A5 F6 +MultiplyByte16_Loop: + asl ppu_addr_temp_lo ; CPU:$FDAA PRG:3DAA 06 F6 + rol ppu_addr_temp_hi ; CPU:$FDAC PRG:3DAC 26 F7 + asl ppu_addr_hi ; CPU:$FDAE PRG:3DAE 06 FD + bcc MultiplyByte16_NextBit ; CPU:$FDB0 PRG:3DB0 90 0D + lda ppu_addr_temp_lo ; CPU:$FDB2 PRG:3DB2 A5 F6 clc ; CPU:$FDB4 PRG:3DB4 18 - adc ZpFA ; CPU:$FDB5 PRG:3DB5 65 FA - sta ZpF6 ; CPU:$FDB7 PRG:3DB7 85 F6 - lda ZpF7 ; CPU:$FDB9 PRG:3DB9 A5 F7 - adc ZpFB ; CPU:$FDBB PRG:3DBB 65 FB - sta ZpF7 ; CPU:$FDBD PRG:3DBD 85 F7 + adc ptr_lo ; CPU:$FDB5 PRG:3DB5 65 FA + sta ppu_addr_temp_lo ; CPU:$FDB7 PRG:3DB7 85 F6 + lda ppu_addr_temp_hi ; CPU:$FDB9 PRG:3DB9 A5 F7 + adc ptr_hi ; CPU:$FDBB PRG:3DBB 65 FB + sta ppu_addr_temp_hi ; CPU:$FDBD PRG:3DBD 85 F7 ; ----------------------------------------------------------------------------- -; Routine: Label_FDBF +; Routine: MultiplyByte16_NextBit ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -10488,20 +11974,20 @@ Label_FDAA: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_FDBF: - asl ZpF6 ; CPU:$FDBF PRG:3DBF 06 F6 - rol ZpF7 ; CPU:$FDC1 PRG:3DC1 26 F7 - asl ZpFD ; CPU:$FDC3 PRG:3DC3 06 FD - bcc Label_FDD4 ; CPU:$FDC5 PRG:3DC5 90 0D - lda ZpF6 ; CPU:$FDC7 PRG:3DC7 A5 F6 +MultiplyByte16_NextBit: + asl ppu_addr_temp_lo ; CPU:$FDBF PRG:3DBF 06 F6 + rol ppu_addr_temp_hi ; CPU:$FDC1 PRG:3DC1 26 F7 + asl ppu_addr_hi ; CPU:$FDC3 PRG:3DC3 06 FD + bcc MultiplyByte16_NextPair ; CPU:$FDC5 PRG:3DC5 90 0D + lda ppu_addr_temp_lo ; CPU:$FDC7 PRG:3DC7 A5 F6 clc ; CPU:$FDC9 PRG:3DC9 18 - adc ZpFA ; CPU:$FDCA PRG:3DCA 65 FA - sta ZpF6 ; CPU:$FDCC PRG:3DCC 85 F6 - lda ZpF7 ; CPU:$FDCE PRG:3DCE A5 F7 - adc ZpFB ; CPU:$FDD0 PRG:3DD0 65 FB - sta ZpF7 ; CPU:$FDD2 PRG:3DD2 85 F7 + adc ptr_lo ; CPU:$FDCA PRG:3DCA 65 FA + sta ppu_addr_temp_lo ; CPU:$FDCC PRG:3DCC 85 F6 + lda ppu_addr_temp_hi ; CPU:$FDCE PRG:3DCE A5 F7 + adc ptr_hi ; CPU:$FDD0 PRG:3DD0 65 FB + sta ppu_addr_temp_hi ; CPU:$FDD2 PRG:3DD2 85 F7 ; ----------------------------------------------------------------------------- -; Routine: Label_FDD4 +; Routine: MultiplyByte16_NextPair ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -10509,12 +11995,12 @@ Label_FDBF: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_FDD4: +MultiplyByte16_NextPair: dex ; CPU:$FDD4 PRG:3DD4 CA - bne Label_FDAA ; CPU:$FDD5 PRG:3DD5 D0 D3 + bne MultiplyByte16_Loop ; CPU:$FDD5 PRG:3DD5 D0 D3 rts ; CPU:$FDD7 PRG:3DD7 60 ; ----------------------------------------------------------------------------- -; Routine: Label_FDD8 +; Routine: Divide16 ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -10522,13 +12008,13 @@ Label_FDD4: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_FDD8: +Divide16: lda #$00 ; CPU:$FDD8 PRG:3DD8 A9 00 - sta ZpF6 ; CPU:$FDDA PRG:3DDA 85 F6 - sta ZpF7 ; CPU:$FDDC PRG:3DDC 85 F7 + sta ppu_addr_temp_lo ; CPU:$FDDA PRG:3DDA 85 F6 + sta ppu_addr_temp_hi ; CPU:$FDDC PRG:3DDC 85 F7 ldx #$10 ; CPU:$FDDE PRG:3DDE A2 10 ; ----------------------------------------------------------------------------- -; Routine: Label_FDE0 +; Routine: Divide16_Loop ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -10536,23 +12022,23 @@ Label_FDD8: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_FDE0: - asl ZpFC ; CPU:$FDE0 PRG:3DE0 06 FC - rol ZpFD ; CPU:$FDE2 PRG:3DE2 26 FD - rol ZpF6 ; CPU:$FDE4 PRG:3DE4 26 F6 - rol ZpF7 ; CPU:$FDE6 PRG:3DE6 26 F7 - lda ZpF6 ; CPU:$FDE8 PRG:3DE8 A5 F6 +Divide16_Loop: + asl ppu_addr_lo ; CPU:$FDE0 PRG:3DE0 06 FC + rol ppu_addr_hi ; CPU:$FDE2 PRG:3DE2 26 FD + rol ppu_addr_temp_lo ; CPU:$FDE4 PRG:3DE4 26 F6 + rol ppu_addr_temp_hi ; CPU:$FDE6 PRG:3DE6 26 F7 + lda ppu_addr_temp_lo ; CPU:$FDE8 PRG:3DE8 A5 F6 sec ; CPU:$FDEA PRG:3DEA 38 - sbc ZpFA ; CPU:$FDEB PRG:3DEB E5 FA + sbc ptr_lo ; CPU:$FDEB PRG:3DEB E5 FA tay ; CPU:$FDED PRG:3DED A8 - lda ZpF7 ; CPU:$FDEE PRG:3DEE A5 F7 - sbc ZpFB ; CPU:$FDF0 PRG:3DF0 E5 FB - bcc Label_FDFA ; CPU:$FDF2 PRG:3DF2 90 06 - inc ZpFC ; CPU:$FDF4 PRG:3DF4 E6 FC - sta ZpF7 ; CPU:$FDF6 PRG:3DF6 85 F7 - sty ZpF6 ; CPU:$FDF8 PRG:3DF8 84 F6 + lda ppu_addr_temp_hi ; CPU:$FDEE PRG:3DEE A5 F7 + sbc ptr_hi ; CPU:$FDF0 PRG:3DF0 E5 FB + bcc Divide16_Borrow ; CPU:$FDF2 PRG:3DF2 90 06 + inc ppu_addr_lo ; CPU:$FDF4 PRG:3DF4 E6 FC + sta ppu_addr_temp_hi ; CPU:$FDF6 PRG:3DF6 85 F7 + sty ppu_addr_temp_lo ; CPU:$FDF8 PRG:3DF8 84 F6 ; ----------------------------------------------------------------------------- -; Routine: Label_FDFA +; Routine: Divide16_Borrow ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -10560,12 +12046,12 @@ Label_FDE0: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_FDFA: +Divide16_Borrow: dex ; CPU:$FDFA PRG:3DFA CA - bne Label_FDE0 ; CPU:$FDFB PRG:3DFB D0 E3 + bne Divide16_Loop ; CPU:$FDFB PRG:3DFB D0 E3 rts ; CPU:$FDFD PRG:3DFD 60 ; ----------------------------------------------------------------------------- -; Routine: Label_FDFE +; Routine: SignedDivide16 ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -10573,13 +12059,13 @@ Label_FDFA: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_FDFE: - lda ZpFB ; CPU:$FDFE PRG:3DFE A5 FB +SignedDivide16: + lda ptr_hi ; CPU:$FDFE PRG:3DFE A5 FB php ; CPU:$FE00 PRG:3E00 08 - bpl Label_FE06 ; CPU:$FE01 PRG:3E01 10 03 + bpl SignedDivide16_DivisorDone ; CPU:$FE01 PRG:3E01 10 03 jsr $FE37 ; CPU:$FE03 PRG:3E03 20 37 FE ; ----------------------------------------------------------------------------- -; Routine: Label_FE06 +; Routine: SignedDivide16_DivisorDone ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -10587,13 +12073,13 @@ Label_FDFE: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_FE06: - lda ZpFD ; CPU:$FE06 PRG:3E06 A5 FD +SignedDivide16_DivisorDone: + lda ppu_addr_hi ; CPU:$FE06 PRG:3E06 A5 FD php ; CPU:$FE08 PRG:3E08 08 - bpl Label_FE0E ; CPU:$FE09 PRG:3E09 10 03 + bpl SignedDivide16_Divide ; CPU:$FE09 PRG:3E09 10 03 jsr $FE24 ; CPU:$FE0B PRG:3E0B 20 24 FE ; ----------------------------------------------------------------------------- -; Routine: Label_FE0E +; Routine: SignedDivide16_Divide ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -10601,14 +12087,14 @@ Label_FE06: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_FE0E: +SignedDivide16_Divide: jsr $FDD8 ; CPU:$FE0E PRG:3E0E 20 D8 FD plp ; CPU:$FE11 PRG:3E11 28 - bpl Label_FE1F ; CPU:$FE12 PRG:3E12 10 0B + bpl SignedDivide16_CheckDivisor ; CPU:$FE12 PRG:3E12 10 0B plp ; CPU:$FE14 PRG:3E14 28 - bmi Label_FE1A ; CPU:$FE15 PRG:3E15 30 03 + bmi SignedDivide16_Return ; CPU:$FE15 PRG:3E15 30 03 ; ----------------------------------------------------------------------------- -; Routine: Label_FE17 +; Routine: SignedDivide16_Negate ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -10616,10 +12102,10 @@ Label_FE0E: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_FE17: +SignedDivide16_Negate: jsr $FE24 ; CPU:$FE17 PRG:3E17 20 24 FE ; ----------------------------------------------------------------------------- -; Routine: Label_FE1A +; Routine: SignedDivide16_Return ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -10627,12 +12113,12 @@ Label_FE17: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_FE1A: - ldx ZpFD ; CPU:$FE1A PRG:3E1A A6 FD - ldy ZpFC ; CPU:$FE1C PRG:3E1C A4 FC +SignedDivide16_Return: + ldx ppu_addr_hi ; CPU:$FE1A PRG:3E1A A6 FD + ldy ppu_addr_lo ; CPU:$FE1C PRG:3E1C A4 FC rts ; CPU:$FE1E PRG:3E1E 60 ; ----------------------------------------------------------------------------- -; Routine: Label_FE1F +; Routine: SignedDivide16_CheckDivisor ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -10640,12 +12126,12 @@ Label_FE1A: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_FE1F: +SignedDivide16_CheckDivisor: plp ; CPU:$FE1F PRG:3E1F 28 - bmi Label_FE17 ; CPU:$FE20 PRG:3E20 30 F5 - bpl Label_FE1A ; CPU:$FE22 PRG:3E22 10 F6 + bmi SignedDivide16_Negate ; CPU:$FE20 PRG:3E20 30 F5 + bpl SignedDivide16_Return ; CPU:$FE22 PRG:3E22 10 F6 ; ----------------------------------------------------------------------------- -; Routine: Label_FE24 +; Routine: NegatePpuAddr ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -10653,18 +12139,18 @@ Label_FE1F: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_FE24: - lda ZpFC ; CPU:$FE24 PRG:3E24 A5 FC +NegatePpuAddr: + lda ppu_addr_lo ; CPU:$FE24 PRG:3E24 A5 FC eor #$FF ; CPU:$FE26 PRG:3E26 49 FF - sta ZpFC ; CPU:$FE28 PRG:3E28 85 FC - lda ZpFD ; CPU:$FE2A PRG:3E2A A5 FD + sta ppu_addr_lo ; CPU:$FE28 PRG:3E28 85 FC + lda ppu_addr_hi ; CPU:$FE2A PRG:3E2A A5 FD eor #$FF ; CPU:$FE2C PRG:3E2C 49 FF - sta ZpFD ; CPU:$FE2E PRG:3E2E 85 FD - inc ZpFC ; CPU:$FE30 PRG:3E30 E6 FC - bne Label_FE36 ; CPU:$FE32 PRG:3E32 D0 02 - inc ZpFD ; CPU:$FE34 PRG:3E34 E6 FD + sta ppu_addr_hi ; CPU:$FE2E PRG:3E2E 85 FD + inc ppu_addr_lo ; CPU:$FE30 PRG:3E30 E6 FC + bne NegatePpuAddr_Done ; CPU:$FE32 PRG:3E32 D0 02 + inc ppu_addr_hi ; CPU:$FE34 PRG:3E34 E6 FD ; ----------------------------------------------------------------------------- -; Routine: Label_FE36 +; Routine: NegatePpuAddr_Done ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -10672,10 +12158,10 @@ Label_FE24: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_FE36: +NegatePpuAddr_Done: rts ; CPU:$FE36 PRG:3E36 60 ; ----------------------------------------------------------------------------- -; Routine: Label_FE37 +; Routine: NegatePtr ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -10683,18 +12169,18 @@ Label_FE36: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_FE37: - lda ZpFA ; CPU:$FE37 PRG:3E37 A5 FA +NegatePtr: + lda ptr_lo ; CPU:$FE37 PRG:3E37 A5 FA eor #$FF ; CPU:$FE39 PRG:3E39 49 FF - sta ZpFA ; CPU:$FE3B PRG:3E3B 85 FA - lda ZpFB ; CPU:$FE3D PRG:3E3D A5 FB + sta ptr_lo ; CPU:$FE3B PRG:3E3B 85 FA + lda ptr_hi ; CPU:$FE3D PRG:3E3D A5 FB eor #$FF ; CPU:$FE3F PRG:3E3F 49 FF - sta ZpFB ; CPU:$FE41 PRG:3E41 85 FB - inc ZpFA ; CPU:$FE43 PRG:3E43 E6 FA - bne Label_FE49 ; CPU:$FE45 PRG:3E45 D0 02 - inc ZpFB ; CPU:$FE47 PRG:3E47 E6 FB + sta ptr_hi ; CPU:$FE41 PRG:3E41 85 FB + inc ptr_lo ; CPU:$FE43 PRG:3E43 E6 FA + bne NegatePtr_Done ; CPU:$FE45 PRG:3E45 D0 02 + inc ptr_hi ; CPU:$FE47 PRG:3E47 E6 FB ; ----------------------------------------------------------------------------- -; Routine: Label_FE49 +; Routine: NegatePtr_Done ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -10702,10 +12188,10 @@ Label_FE37: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_FE49: +NegatePtr_Done: rts ; CPU:$FE49 PRG:3E49 60 ; ----------------------------------------------------------------------------- -; Routine: Label_FE4A +; Routine: SignExtendFixed ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -10713,19 +12199,19 @@ Label_FE49: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_FE4A: - lda ZpFD ; CPU:$FE4A PRG:3E4A A5 FD +SignExtendFixed: + lda ppu_addr_hi ; CPU:$FE4A PRG:3E4A A5 FD tay ; CPU:$FE4C PRG:3E4C A8 - sta ZpFC ; CPU:$FE4D PRG:3E4D 85 FC + sta ppu_addr_lo ; CPU:$FE4D PRG:3E4D 85 FC asl a ; CPU:$FE4F PRG:3E4F 0A lda #$00 ; CPU:$FE50 PRG:3E50 A9 00 adc #$FF ; CPU:$FE52 PRG:3E52 69 FF eor #$FF ; CPU:$FE54 PRG:3E54 49 FF - sta ZpFD ; CPU:$FE56 PRG:3E56 85 FD + sta ppu_addr_hi ; CPU:$FE56 PRG:3E56 85 FD tax ; CPU:$FE58 PRG:3E58 AA rts ; CPU:$FE59 PRG:3E59 60 ; ----------------------------------------------------------------------------- -; Routine: Label_FE5A +; Routine: SquareRoot16 ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -10733,17 +12219,17 @@ Label_FE4A: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_FE5A: +SquareRoot16: lda #$00 ; CPU:$FE5A PRG:3E5A A9 00 - sta ZpF8 ; CPU:$FE5C PRG:3E5C 85 F8 - sta ZpF9 ; CPU:$FE5E PRG:3E5E 85 F9 - sta ZpFA ; CPU:$FE60 PRG:3E60 85 FA - sta ZpFB ; CPU:$FE62 PRG:3E62 85 FB - sta ZpF7 ; CPU:$FE64 PRG:3E64 85 F7 + sta ppu_src_lo ; CPU:$FE5C PRG:3E5C 85 F8 + sta ppu_src_hi ; CPU:$FE5E PRG:3E5E 85 F9 + sta ptr_lo ; CPU:$FE60 PRG:3E60 85 FA + sta ptr_hi ; CPU:$FE62 PRG:3E62 85 FB + sta ppu_addr_temp_hi ; CPU:$FE64 PRG:3E64 85 F7 lda #$08 ; CPU:$FE66 PRG:3E66 A9 08 - sta ZpF6 ; CPU:$FE68 PRG:3E68 85 F6 + sta ppu_addr_temp_lo ; CPU:$FE68 PRG:3E68 85 F6 ; ----------------------------------------------------------------------------- -; Routine: Label_FE6A +; Routine: SquareRoot16_Loop ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -10751,28 +12237,28 @@ Label_FE5A: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_FE6A: - asl ZpFC ; CPU:$FE6A PRG:3E6A 06 FC - rol ZpFD ; CPU:$FE6C PRG:3E6C 26 FD - rol ZpFA ; CPU:$FE6E PRG:3E6E 26 FA - rol ZpFB ; CPU:$FE70 PRG:3E70 26 FB - asl ZpFC ; CPU:$FE72 PRG:3E72 06 FC - rol ZpFD ; CPU:$FE74 PRG:3E74 26 FD - rol ZpFA ; CPU:$FE76 PRG:3E76 26 FA - rol ZpFB ; CPU:$FE78 PRG:3E78 26 FB - inc ZpF8 ; CPU:$FE7A PRG:3E7A E6 F8 - lda ZpFA ; CPU:$FE7C PRG:3E7C A5 FA +SquareRoot16_Loop: + asl ppu_addr_lo ; CPU:$FE6A PRG:3E6A 06 FC + rol ppu_addr_hi ; CPU:$FE6C PRG:3E6C 26 FD + rol ptr_lo ; CPU:$FE6E PRG:3E6E 26 FA + rol ptr_hi ; CPU:$FE70 PRG:3E70 26 FB + asl ppu_addr_lo ; CPU:$FE72 PRG:3E72 06 FC + rol ppu_addr_hi ; CPU:$FE74 PRG:3E74 26 FD + rol ptr_lo ; CPU:$FE76 PRG:3E76 26 FA + rol ptr_hi ; CPU:$FE78 PRG:3E78 26 FB + inc ppu_src_lo ; CPU:$FE7A PRG:3E7A E6 F8 + lda ptr_lo ; CPU:$FE7C PRG:3E7C A5 FA sec ; CPU:$FE7E PRG:3E7E 38 - sbc ZpF8 ; CPU:$FE7F PRG:3E7F E5 F8 + sbc ppu_src_lo ; CPU:$FE7F PRG:3E7F E5 F8 tax ; CPU:$FE81 PRG:3E81 AA - lda ZpFB ; CPU:$FE82 PRG:3E82 A5 FB - sbc ZpF9 ; CPU:$FE84 PRG:3E84 E5 F9 - bcs Label_FE8E ; CPU:$FE86 PRG:3E86 B0 06 - dec ZpF8 ; CPU:$FE88 PRG:3E88 C6 F8 + lda ptr_hi ; CPU:$FE82 PRG:3E82 A5 FB + sbc ppu_src_hi ; CPU:$FE84 PRG:3E84 E5 F9 + bcs SquareRoot16_Subtract ; CPU:$FE86 PRG:3E86 B0 06 + dec ppu_src_lo ; CPU:$FE88 PRG:3E88 C6 F8 clc ; CPU:$FE8A PRG:3E8A 18 jmp $FE95 ; CPU:$FE8B PRG:3E8B 4C 95 FE ; ----------------------------------------------------------------------------- -; Routine: Label_FE8E +; Routine: SquareRoot16_Subtract ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -10780,13 +12266,13 @@ Label_FE6A: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_FE8E: - sta ZpFB ; CPU:$FE8E PRG:3E8E 85 FB - stx ZpFA ; CPU:$FE90 PRG:3E90 86 FA - inc ZpF8 ; CPU:$FE92 PRG:3E92 E6 F8 +SquareRoot16_Subtract: + sta ptr_hi ; CPU:$FE8E PRG:3E8E 85 FB + stx ptr_lo ; CPU:$FE90 PRG:3E90 86 FA + inc ppu_src_lo ; CPU:$FE92 PRG:3E92 E6 F8 sec ; CPU:$FE94 PRG:3E94 38 ; ----------------------------------------------------------------------------- -; Routine: Label_FE95 +; Routine: SquareRoot16_Next ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -10794,19 +12280,19 @@ Label_FE8E: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_FE95: - rol ZpF7 ; CPU:$FE95 PRG:3E95 26 F7 - asl ZpF8 ; CPU:$FE97 PRG:3E97 06 F8 - rol ZpF9 ; CPU:$FE99 PRG:3E99 26 F9 - dec ZpF6 ; CPU:$FE9B PRG:3E9B C6 F6 - bne Label_FE6A ; CPU:$FE9D PRG:3E9D D0 CB +SquareRoot16_Next: + rol ppu_addr_temp_hi ; CPU:$FE95 PRG:3E95 26 F7 + asl ppu_src_lo ; CPU:$FE97 PRG:3E97 06 F8 + rol ppu_src_hi ; CPU:$FE99 PRG:3E99 26 F9 + dec ppu_addr_temp_lo ; CPU:$FE9B PRG:3E9B C6 F6 + bne SquareRoot16_Loop ; CPU:$FE9D PRG:3E9D D0 CB lda #$00 ; CPU:$FE9F PRG:3E9F A9 00 - sta ZpFD ; CPU:$FEA1 PRG:3EA1 85 FD - lda ZpF7 ; CPU:$FEA3 PRG:3EA3 A5 F7 - sta ZpFC ; CPU:$FEA5 PRG:3EA5 85 FC + sta ppu_addr_hi ; CPU:$FEA1 PRG:3EA1 85 FD + lda ppu_addr_temp_hi ; CPU:$FEA3 PRG:3EA3 A5 F7 + sta ppu_addr_lo ; CPU:$FEA5 PRG:3EA5 85 FC rts ; CPU:$FEA7 PRG:3EA7 60 ; ----------------------------------------------------------------------------- -; Routine: Label_FEA8 +; Routine: GetSine ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -10814,20 +12300,20 @@ Label_FE95: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_FEA8: +GetSine: pha ; CPU:$FEA8 PRG:3EA8 48 ldx #$00 ; CPU:$FEA9 PRG:3EA9 A2 00 - stx ZpFC ; CPU:$FEAB PRG:3EAB 86 FC + stx ppu_addr_lo ; CPU:$FEAB PRG:3EAB 86 FC ldx #$01 ; CPU:$FEAD PRG:3EAD A2 01 - stx ZpFD ; CPU:$FEAF PRG:3EAF 86 FD + stx ppu_addr_hi ; CPU:$FEAF PRG:3EAF 86 FD and #$7F ; CPU:$FEB1 PRG:3EB1 29 7F cmp #$40 ; CPU:$FEB3 PRG:3EB3 C9 40 - beq Label_FEC5 ; CPU:$FEB5 PRG:3EB5 F0 0E - bcc Label_FEBD ; CPU:$FEB7 PRG:3EB7 90 04 + beq GetSine_Ninety ; CPU:$FEB5 PRG:3EB5 F0 0E + bcc GetSine_Lookup ; CPU:$FEB7 PRG:3EB7 90 04 eor #$FF ; CPU:$FEB9 PRG:3EB9 49 FF adc #$80 ; CPU:$FEBB PRG:3EBB 69 80 ; ----------------------------------------------------------------------------- -; Routine: Label_FEBD +; Routine: GetSine_Lookup ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -10835,13 +12321,13 @@ Label_FEA8: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_FEBD: +GetSine_Lookup: tax ; CPU:$FEBD PRG:3EBD AA lda $FECE,x ; CPU:$FEBE PRG:3EBE BD CE FE - sta ZpFC ; CPU:$FEC1 PRG:3EC1 85 FC - dec ZpFD ; CPU:$FEC3 PRG:3EC3 C6 FD + sta ppu_addr_lo ; CPU:$FEC1 PRG:3EC1 85 FC + dec ppu_addr_hi ; CPU:$FEC3 PRG:3EC3 C6 FD ; ----------------------------------------------------------------------------- -; Routine: Label_FEC5 +; Routine: GetSine_Ninety ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -10849,14 +12335,14 @@ Label_FEBD: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_FEC5: +GetSine_Ninety: pla ; CPU:$FEC5 PRG:3EC5 68 - bpl Label_FECD ; CPU:$FEC6 PRG:3EC6 10 05 + bpl GetSine_Done ; CPU:$FEC6 PRG:3EC6 10 05 pha ; CPU:$FEC8 PRG:3EC8 48 jsr $FE24 ; CPU:$FEC9 PRG:3EC9 20 24 FE pla ; CPU:$FECC PRG:3ECC 68 ; ----------------------------------------------------------------------------- -; Routine: Label_FECD +; Routine: GetSine_Done ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -10864,33 +12350,22 @@ Label_FEC5: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_FECD: +GetSine_Done: rts ; CPU:$FECD PRG:3ECD 60 ; ---- data $FECE-$FEFD (48 bytes) ---- ; referenced by `cmp $FECE,y` at $E6D9 (operand $FECE falls inside this region) ; referenced by `cmp $FECF,y` at $E6E4 (operand $FECF falls inside this region) ; referenced by `lda $FECE,x` at $FEBE (operand $FECE falls inside this region) +; Sixty-four bytes of round(256 * sin(angle)) for angle = 0..63 sixty-fourths of a quarter turn, looked up by GetSine after it folds the sign and mirrors past the 90-degree entry. The table runs $FECE-$FF0D, so its tail is emitted as the $FEFE and $FF0B data blocks. +SineTable: .byte $00, $06, $0C, $12, $19, $1F, $25, $2B, $31, $38, $3E, $44, $4A, $50, $56, $5C ; CPU:$FECE PRG:3ECE 00 06 0C 12 19 1F 25 2B 31 38 3E 44 4A 50 56 5C .byte $61, $67, $6D, $73, $78, $7E, $83, $88, $8E, $93, $98, $9D, $A2, $A7, $AB, $B0 ; CPU:$FEDE PRG:3EDE 61 67 6D 73 78 7E 83 88 8E 93 98 9D A2 A7 AB B0 .byte $B5, $B9, $BD, $C1, $C5, $C9, $CD, $D1, $D4, $D8, $DB, $DE, $E1, $E4, $E7, $EA ; CPU:$FEEE PRG:3EEE B5 B9 BD C1 C5 C9 CD D1 D4 D8 DB DE E1 E4 E7 EA -; ----------------------------------------------------------------------------- -; Routine: Label_FEFE -; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. -; Local: Continues its parent routine along the condition or operation encoded in this label, -; then returns, branches again, or rejoins shared code as documented by the instructions. -; Parameters: Undetermined in Pass 1 unless implied by the caller. -; Returns: Undetermined in Pass 1; status flags and registers may carry results. -; Clobbers: Undetermined in Pass 1. -; ----------------------------------------------------------------------------- -Label_FEFE: - cpx $F1EE ; CPU:$FEFE PRG:3EFE EC EE F1 - .byte $F3, $F4 ; CPU:$FF01 PRG:3F01 F3 F4 -- isc (ZpF4),y (undocumented; ca65 cannot encode) - inc ZpF8,x ; CPU:$FF03 PRG:3F03 F6 F8 - sbc $FCFB,y ; CPU:$FF05 PRG:3F05 F9 FB FC - sbc $FEFE,x ; CPU:$FF08 PRG:3F08 FD FE FE +; ---- data $FEFE-$FF0A (13 bytes) ---- + .byte $EC, $EE, $F1, $F3, $F4, $F6, $F8, $F9, $FB, $FC, $FD, $FE, $FE ; CPU:$FEFE PRG:3EFE EC EE F1 F3 F4 F6 F8 F9 FB FC FD FE FE .byte $FF, $FF, $FF ; CPU:$FF0B PRG:3F0B FF FF FF -- isc $FFFF,x (undocumented; ca65 cannot encode) ; ----------------------------------------------------------------------------- -; Routine: Label_FF0E +; Routine: GetCosine ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -10898,11 +12373,11 @@ Label_FEFE: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_FF0E: +GetCosine: clc ; CPU:$FF0E PRG:3F0E 18 adc #$40 ; CPU:$FF0F PRG:3F0F 69 40 ; ----------------------------------------------------------------------------- -; Routine: Label_FF11 +; Routine: GetCosine_Lookup ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -10910,13 +12385,13 @@ Label_FF0E: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_FF11: +GetCosine_Lookup: jsr $FEA8 ; CPU:$FF11 PRG:3F11 20 A8 FE sec ; CPU:$FF14 PRG:3F14 38 sbc #$40 ; CPU:$FF15 PRG:3F15 E9 40 rts ; CPU:$FF17 PRG:3F17 60 ; ----------------------------------------------------------------------------- -; Routine: Label_FF18 +; Routine: RotateVector90 ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -10924,16 +12399,16 @@ Label_FF11: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_FF18: - lda ZpF9 ; CPU:$FF18 PRG:3F18 A5 F9 - ldx ZpF8 ; CPU:$FF1A PRG:3F1A A6 F8 - stx ZpF9 ; CPU:$FF1C PRG:3F1C 86 F9 +RotateVector90: + lda ppu_src_hi ; CPU:$FF18 PRG:3F18 A5 F9 + ldx ppu_src_lo ; CPU:$FF1A PRG:3F1A A6 F8 + stx ppu_src_hi ; CPU:$FF1C PRG:3F1C 86 F9 eor #$FF ; CPU:$FF1E PRG:3F1E 49 FF clc ; CPU:$FF20 PRG:3F20 18 adc #$08 ; CPU:$FF21 PRG:3F21 69 08 - sta ZpF8 ; CPU:$FF23 PRG:3F23 85 F8 + sta ppu_src_lo ; CPU:$FF23 PRG:3F23 85 F8 ; ----------------------------------------------------------------------------- -; Routine: Label_FF25 +; Routine: RotateCoord90 ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -10941,11 +12416,11 @@ Label_FF18: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_FF25: +RotateCoord90: jsr $CB92 ; CPU:$FF25 PRG:3F25 20 92 CB jmp $FE24 ; CPU:$FF28 PRG:3F28 4C 24 FE ; ----------------------------------------------------------------------------- -; Routine: Label_FF2B +; Routine: RotateVector180 ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -10953,19 +12428,19 @@ Label_FF25: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_FF2B: - lda ZpF9 ; CPU:$FF2B PRG:3F2B A5 F9 +RotateVector180: + lda ppu_src_hi ; CPU:$FF2B PRG:3F2B A5 F9 eor #$FF ; CPU:$FF2D PRG:3F2D 49 FF clc ; CPU:$FF2F PRG:3F2F 18 adc #$08 ; CPU:$FF30 PRG:3F30 69 08 - sta ZpF9 ; CPU:$FF32 PRG:3F32 85 F9 - lda ZpF8 ; CPU:$FF34 PRG:3F34 A5 F8 + sta ppu_src_hi ; CPU:$FF32 PRG:3F32 85 F9 + lda ppu_src_lo ; CPU:$FF34 PRG:3F34 A5 F8 eor #$FF ; CPU:$FF36 PRG:3F36 49 FF clc ; CPU:$FF38 PRG:3F38 18 adc #$08 ; CPU:$FF39 PRG:3F39 69 08 - sta ZpF8 ; CPU:$FF3B PRG:3F3B 85 F8 + sta ppu_src_lo ; CPU:$FF3B PRG:3F3B 85 F8 ; ----------------------------------------------------------------------------- -; Routine: Label_FF3D +; Routine: RotateCoord180 ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -10973,11 +12448,11 @@ Label_FF2B: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_FF3D: +RotateCoord180: jsr $FE24 ; CPU:$FF3D PRG:3F3D 20 24 FE jmp $FE37 ; CPU:$FF40 PRG:3F40 4C 37 FE ; ----------------------------------------------------------------------------- -; Routine: Label_FF43 +; Routine: RotateVector270 ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -10985,16 +12460,16 @@ Label_FF3D: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_FF43: - lda ZpF8 ; CPU:$FF43 PRG:3F43 A5 F8 - ldx ZpF9 ; CPU:$FF45 PRG:3F45 A6 F9 - stx ZpF8 ; CPU:$FF47 PRG:3F47 86 F8 +RotateVector270: + lda ppu_src_lo ; CPU:$FF43 PRG:3F43 A5 F8 + ldx ppu_src_hi ; CPU:$FF45 PRG:3F45 A6 F9 + stx ppu_src_lo ; CPU:$FF47 PRG:3F47 86 F8 eor #$FF ; CPU:$FF49 PRG:3F49 49 FF clc ; CPU:$FF4B PRG:3F4B 18 adc #$08 ; CPU:$FF4C PRG:3F4C 69 08 - sta ZpF9 ; CPU:$FF4E PRG:3F4E 85 F9 + sta ppu_src_hi ; CPU:$FF4E PRG:3F4E 85 F9 ; ----------------------------------------------------------------------------- -; Routine: Label_FF50 +; Routine: RotateCoord270 ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -11002,11 +12477,11 @@ Label_FF43: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_FF50: +RotateCoord270: jsr $FE24 ; CPU:$FF50 PRG:3F50 20 24 FE jmp $CB92 ; CPU:$FF53 PRG:3F53 4C 92 CB ; ----------------------------------------------------------------------------- -; Routine: Label_FF56 +; Routine: WaitFrames ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -11014,11 +12489,11 @@ Label_FF50: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_FF56: +WaitFrames: lda #$00 ; CPU:$FF56 PRG:3F56 A9 00 sta $01C8 ; CPU:$FF58 PRG:3F58 8D C8 01 ; ----------------------------------------------------------------------------- -; Routine: Label_FF5B +; Routine: WaitFrames_Loop ; Global: Contextual control-flow entry identified from its parent routine and incoming branch usage. ; Local: Continues its parent routine along the condition or operation encoded in this label, ; then returns, branches again, or rejoins shared code as documented by the instructions. @@ -11026,11 +12501,11 @@ Label_FF56: ; Returns: Undetermined in Pass 1; status flags and registers may carry results. ; Clobbers: Undetermined in Pass 1. ; ----------------------------------------------------------------------------- -Label_FF5B: +WaitFrames_Loop: lda $01C8 ; CPU:$FF5B PRG:3F5B AD C8 01 - beq Label_FF5B ; CPU:$FF5E PRG:3F5E F0 FB + beq WaitFrames_Loop ; CPU:$FF5E PRG:3F5E F0 FB dex ; CPU:$FF60 PRG:3F60 CA - bne Label_FF56 ; CPU:$FF61 PRG:3F61 D0 F3 + bne WaitFrames ; CPU:$FF61 PRG:3F61 D0 F3 rts ; CPU:$FF63 PRG:3F63 60 ; ----------------------------------------------------------------------------- ; Routine: IrqHandler @@ -11058,17 +12533,17 @@ NmiHandler: pha ; CPU:$FF67 PRG:3F67 48 tya ; CPU:$FF68 PRG:3F68 98 pha ; CPU:$FF69 PRG:3F69 48 - lda ZpF1 ; CPU:$FF6A PRG:3F6A A5 F1 + lda ppu_mask_shadow ; CPU:$FF6A PRG:3F6A A5 F1 and #$E7 ; CPU:$FF6C PRG:3F6C 29 E7 - sta $2001 ; CPU:$FF6E PRG:3F6E 8D 01 20 + sta PPUMASK ; CPU:$FF6E PRG:3F6E 8D 01 20 lda #$01 ; CPU:$FF71 PRG:3F71 A9 01 sta $01C8 ; CPU:$FF73 PRG:3F73 8D C8 01 - lda $2002 ; CPU:$FF76 PRG:3F76 AD 02 20 + lda PPUSTATUS ; CPU:$FF76 PRG:3F76 AD 02 20 jsr $CB25 ; CPU:$FF79 PRG:3F79 20 25 CB jsr $CC8F ; CPU:$FF7C PRG:3F7C 20 8F CC jsr $CA52 ; CPU:$FF7F PRG:3F7F 20 52 CA - lda ZpF1 ; CPU:$FF82 PRG:3F82 A5 F1 - sta $2001 ; CPU:$FF84 PRG:3F84 8D 01 20 + lda ppu_mask_shadow ; CPU:$FF82 PRG:3F82 A5 F1 + sta PPUMASK ; CPU:$FF84 PRG:3F84 8D 01 20 jsr $C003 ; CPU:$FF87 PRG:3F87 20 03 C0 pla ; CPU:$FF8A PRG:3F8A 68 tay ; CPU:$FF8B PRG:3F8B A8 @@ -11076,12 +12551,20 @@ NmiHandler: tax ; CPU:$FF8D PRG:3F8D AA pla ; CPU:$FF8E PRG:3F8E 68 rti ; CPU:$FF8F PRG:3F8F 40 -; ---- data $FF90-$FFFF (112 bytes) ---- -; referenced by `isc $FFFF,x` at $FF0B (operand $FFFF falls inside this region) +; ---- data $FF90-$FFF9 (106 bytes) ---- +; $FFFA-$FFFF are the three CPU vectors, emitted as .word below. +; referenced by the flat tracer's `isc $FFFF,x` pseudo-op at $FF0B, whose +; operand $FFFF serves double duty as the IRQ vector operand below. +; 106 bytes of $FF filler between the end of the code and the CPU vectors at $FFFA. +PaddingFf: .byte $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF ; CPU:$FF90 PRG:3F90 FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF .byte $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF ; CPU:$FFA0 PRG:3FA0 FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF .byte $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF ; CPU:$FFB0 PRG:3FB0 FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF .byte $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF ; CPU:$FFC0 PRG:3FC0 FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF .byte $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF ; CPU:$FFD0 PRG:3FD0 FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF .byte $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF ; CPU:$FFE0 PRG:3FE0 FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF - .byte $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $65, $FF, $0C, $E8, $64, $FF ; CPU:$FFF0 PRG:3FF0 FF FF FF FF FF FF FF FF FF FF 65 FF 0C E8 64 FF + .byte $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF ; CPU:$FFF0 PRG:3FF0 FF FF FF FF FF FF FF FF FF FF +; ---- vectors $FFFA-$FFFF ---- + .word NmiHandler ; CPU:$FFFA PRG:3FFA 65 FF + .word Reset ; CPU:$FFFC PRG:3FFC 0C E8 + .word IrqHandler ; CPU:$FFFE PRG:3FFE 64 FF diff --git a/Lunar Pool (U)/copilot/reconstructed.lbl b/Lunar Pool (U)/copilot/reconstructed.lbl new file mode 100644 index 0000000..737b0d0 --- /dev/null +++ b/Lunar Pool (U)/copilot/reconstructed.lbl @@ -0,0 +1,705 @@ +al 00FF90 .PaddingFf +al 00FF65 .NmiHandler +al 00FF64 .IrqHandler +al 00FF5B .WaitFrames_Loop +al 00FF56 .WaitFrames +al 00FF50 .RotateCoord270 +al 00FF43 .RotateVector270 +al 00FF3D .RotateCoord180 +al 00FF2B .RotateVector180 +al 00FF25 .RotateCoord90 +al 00FF18 .RotateVector90 +al 00FF11 .GetCosine_Lookup +al 00FF0E .GetCosine +al 00FECE .SineTable +al 00FECD .GetSine_Done +al 00FEBD .GetSine_Lookup +al 00FEC5 .GetSine_Ninety +al 00FEA8 .GetSine +al 00FE95 .SquareRoot16_Next +al 00FE8E .SquareRoot16_Subtract +al 00FE6A .SquareRoot16_Loop +al 00FE5A .SquareRoot16 +al 00FE4A .SignExtendFixed +al 00FE49 .NegatePtr_Done +al 00FE37 .NegatePtr +al 00FE36 .NegatePpuAddr_Done +al 00FE24 .NegatePpuAddr +al 00FE17 .SignedDivide16_Negate +al 00FE1A .SignedDivide16_Return +al 00FE1F .SignedDivide16_CheckDivisor +al 00FE0E .SignedDivide16_Divide +al 00FE06 .SignedDivide16_DivisorDone +al 00FDFE .SignedDivide16 +al 00FDFA .Divide16_Borrow +al 00FDE0 .Divide16_Loop +al 00FDD8 .Divide16 +al 00FDD4 .MultiplyByte16_NextPair +al 00FDBF .MultiplyByte16_NextBit +al 00FDAA .MultiplyByte16_Loop +al 00FDA8 .MultiplyByte16 +al 00FD98 .Multiply16_LowByte +al 00FD8B .Multiply16 +al 00FD85 .ProjectCoordinate_High +al 00FD88 .ProjectCoordinate_Done +al 00FD60 .ProjectCoordinate +al 00FD32 .ProjectObjectPosition_Store +al 00FD2D .ProjectObjectPosition_Skip +al 00FC6C .ProjectObjectPosition +al 00FBD1 .ComputeBallVelocity_Moving +al 00FBC2 .ComputeBallVelocity +al 00FBA5 .ResolveBallCollision_Rotate +al 00FBC1 .ResolveBallCollision_Done +al 00FB99 .ResolveBallCollision +al 00FB90 .CollisionAngleLimitTable +al 00FB87 .ComputeCollisionAngle_Quadrant2 +al 00FB8D .ComputeCollisionAngle_Quadrant3 +al 00FB7A .ComputeCollisionAngle_Quadrant1 +al 00FB69 .ComputeCollisionAngle_ApplySigns +al 00FB4C .ComputeCollisionAngle_Mirror +al 00FB38 .ComputeCollisionAngle_Reject +al 00FB39 .ComputeCollisionAngle_Steep +al 00FB55 .ComputeCollisionAngle_Shallow +al 00FB2C .ComputeCollisionAngle +al 00FAF9 .ComputeFieldCellAddress +al 00FAC9 .PaletteColorTable +al 00FAB1 .MapColorCodeToPalette_Disabled +al 00FAB4 .MapColorCodeToPalette_High +al 00FA99 .MapColorCodeToPalette +al 00FA8D .BuildPaletteFromShadeTable_Loop +al 00FA8B .BuildPaletteFromShadeTable +al 00FA7F .FadeInPalette_Loop +al 00FA7D .FadeInPalette +al 00FA6F .FadeOutPalette_Loop +al 00FA6D .FadeOutPalette +al 00FA5F .CopyScoreToHighScore_Loop +al 00FA56 .CopyScoreToHighScore +al 00FA4A .GetPlayerScoreIndex +al 00FA40 .CompareScoreToHighScore_Next +al 00FA34 .CompareScoreToHighScore_Loop +al 00FA2B .CompareScoreToHighScore +al 00FA1F .AddScoreDigit_Overflow +al 00FA26 .ScoreRoutine_Return +al 00FA07 .AddScoreDigit_Loop +al 00F9F9 .AddScoreDigit +al 00F9E4 .CountUpScore_WaitFrame +al 00F9D9 .CountUpScore_PointLoop +al 00F9D6 .CountUpScore_MultiplierLoop +al 00F9CE .CountUpScore +al 00F9BD .IncrementTurnBallCount_CheckBonus +al 00F9B0 .IncrementTurnBallCount +al 00F9AD .IncrementPlayerBallCount_Redraw +al 00F9A0 .IncrementPlayerBallCount +al 00F998 .SetBallSpriteTile +al 00F990 .SetBallSpriteAttributes +al 00F989 .SetPpuAddr +al 00F988 .StampBallMarker_Abort +al 00F908 .StampBallMarker_BottomRight +al 00F8EE .StampBallMarker_BottomLeft +al 00F8D4 .StampBallMarker_TopRight +al 00F924 .StampBallMarker_IfEmpty +al 00F8AB .StampBallMarker_CheckColumn +al 00F8BB .StampBallMarker_TopLeft +al 00F89B .StampBallMarker_Done +al 00F89C .StampBallMarker_CheckRow +al 00F897 .StampBallMarker +al 00F88A .SaveHighScore_Loop +al 00F87F .SaveHighScore +al 00F872 .LoadHighScore_Loop +al 00F867 .LoadHighScore +al 00F858 .StrPerfect +al 00F84C .ShowPerfectText +al 00F83B .StrHiScore +al 00F826 .StrPlayer3 +al 00F81A .ShowPlayerHiScoreText +al 00F809 .StrGameOver +al 00F7F4 .StrPlayer2 +al 00F7E8 .ShowPlayerGameOverText +al 00F7DD .RestoreVramOverlay_Loop +al 00F7CB .RestoreVramOverlay +al 00F7BC .BeginVramOverlay_Wait +al 00F7A7 .BeginVramOverlay +al 00F79B .StrShot +al 00F786 .StrPlayer1 +al 00F77A .ShowPlayerShotText +al 00F762 .AimPhaseTable0 +al 00F73F .DrawBlinkingBallSprite_Visible +al 00F728 .DrawBlinkingBallSprite +al 00F725 .BuildBallSprites_Done +al 00F71A .BuildBallSprites_Next +al 00F6CF .BuildBallSprites_Draw2x2 +al 00F6C1 .BuildBallSprites_CheckSpecial +al 00F69D .BuildBallSprites_Loop +al 00F683 .BuildBallSprites +al 00F67D .WaitForObjectSlot_Spin +al 00F674 .WaitForObjectSlot +al 00F66B .FillAttributeTable_Loop +al 00F669 .FillAttributeTable +al 00F654 .FillNametable +al 00F5E4 .EndingCommandList +al 00F5D6 .ShowEndingScreen_ClearRow2 +al 00F5C6 .ShowEndingScreen_ClearRow1 +al 00F585 .ShowEndingScreen_RestorePlayer +al 00F574 .ShowEndingScreen_SwapPlayer +al 00F56C .ShowEndingScreen +al 00F557 .ShowGameOverScreen_CheckInput +al 00F54C .ShowGameOverScreen_WaitLoop +al 00F542 .ShowGameOverScreen_QueueSpawn +al 00F540 .ShowGameOverScreen_SpawnAlt +al 00F4B1 .TurnEnd_NextPlayer +al 00F4DF .TurnEnd_StartTurn +al 00F49B .TurnEnd_SaveCounts +al 00F4F6 .ShowGameOverScreen +al 00F487 .TurnEnd_PlayerOut_CheckCountdown +al 00F476 .TurnEnd_PlayerOut +al 00F457 .TurnEnd_TableCleared_Continue +al 00F44D .TurnEnd_TableCleared_DecCount +al 00F435 .TurnEnd_TableCleared +al 00F41B .TurnEnd_CheckTable +al 00F413 .RoundFinish_NoPotPenalty +al 00F410 .StartNextRound_ShowEnding +al 00F406 .StartNextRound_AllStagesDone +al 00F3E4 .StartNextRound_Store +al 00F3D2 .StartNextRound +al 00F3AD .RoundFinish_Wait +al 00F3BB .RoundFinish_Tail +al 00F387 .RoundFinish_Clear +al 00F36E .RoundFinish_Score_Loop +al 00F377 .RoundFinish_Advance +al 00F365 .RoundFinish_Score +al 00F344 .RoundFinish_Collect_Store +al 00F33D .RoundFinish_Collect_Empty +al 00F341 .RoundFinish_Collect_X +al 00F327 .RoundFinish_Collect_Loop +al 00F31F .RoundFinish_Collect +al 00F312 .RoundFinish +al 00F30F .BallUpdateEnd_Next +al 00F302 .BallUpdateEnd_Idle +al 00F2EC .BallUpdateEnd +al 00F2E5 .BallCollisionScan_Repeat +al 00F2DB .BallCollisionScan_NextOuter +al 00F2CB .BallCollisionScan_NextInner +al 00F270 .BallCollisionScan_DY +al 00F25B .BallCollisionScan_DX +al 00F241 .BallCollisionScan_Next +al 00F244 .BallCollisionScan_Test +al 00F238 .BallCollisionScan_Inner +al 00F233 .BallCollisionScan_Pair +al 00F225 .BallCollisionScan_Loop +al 00F221 .BallCollisionScan +al 00F218 .BallFrameEnd +al 00F211 .BallPhysicsNextStep +al 00F206 .BallSlotAdvance +al 00F1F6 .BallDecelerate +al 00F1E2 .BallCommitPosition +al 00F1D3 .BallRememberTile +al 00F1B9 .BallBounceCommit_TestC0 +al 00F1AF .BallBounceCommit_Test80 +al 00F1BC .BallBounceCommit_Store +al 00F19A .BallBounceCommit +al 00F16A .BallReflectVector +al 00F193 .BallBounceExit +al 00F149 .BallFlipXVelocity +al 00F13F .BallReflectX_Do +al 00F148 .BallReflectX_Done +al 00F125 .BallReflectX +al 00F0EF .BallTileHandler8_Exit +al 00F0DF .BallTileHandler8 +al 00F0DC .BallTileHandler5_Reflect +al 00F0CE .BallTileHandler5 +al 00F098 .TileCollisionTable +al 00F07B .BallBounce_TestC0 +al 00F071 .BallBounce_Test80 +al 00F07E .BallBounce_JumpTable +al 00F04D .BallBounce +al 00F031 .SinkRemainingBalls_Next +al 00F019 .SinkRemainingBalls_Loop +al 00F017 .SinkRemainingBalls +al 00F037 .BallPocketed_CueBall +al 00EFF5 .BallPocketed +al 00F045 .BallMove_TestTile +al 00EFD9 .BallMove_SubTile +al 00EFD5 .BallMove_StoreTile +al 00EFB4 .BallMove_OffTable +al 00EFB8 .BallMove_ReadTile +al 00EF84 .BallMove_CheckTile +al 00EF53 .BallMove_Advance +al 00EF50 .BallMove_Stopped +al 00EF3A .BallMove_Step +al 00EF31 .BallMove +al 00EF2A .BallSinkTiles +al 00EF27 .BallSinkAnim_Done +al 00EEF0 .BallSinkAnim +al 00EEE9 .BallAppearTiles +al 00EEE0 .BallAppearAnim_Next +al 00EEE6 .BallAppearAnim_Done +al 00EEB9 .BallAppearAnim +al 00EE80 .BallLaunch +al 00EE76 .BallSlotUpdate_Next +al 00EE79 .BallSlotUpdate_State1 +al 00EE6F .BallSlotUpdate_Case +al 00EE57 .BallSlotUpdate +al 00EE53 .BallPhysicsStep_Skip +al 00EE3E .BallPhysicsStep +al 00EE3A .BallPhysicsPass +al 00EE2C .BallPhysicsBegin_Alt +al 00EE30 .BallPhysicsBegin +al 00EDBA .PlayPhaseLoop +al 00EDB7 .InitBallSlots_BeginPlay +al 00ED8B .InitBallSlots_Next +al 00ED86 .InitBallSlots_MarkActive +al 00ED5D .InitBallSlots_Loop +al 00ED3F .SpritePaletteTable +al 00ED4F .InitBallSlots +al 00ED16 .LoadStageScene_StartPlay +al 00ECF2 .LoadStageScene_LoadLayout_Next +al 00ECE7 .LoadStageScene_LoadLayout_Loop +al 00ECD5 .LoadStageScene_LoadLayout_Clear +al 00ECD3 .LoadStageScene_LoadLayout +al 00ECA2 .LoadStageScene_VaryTiles_Write +al 00ECAE .LoadStageScene_VaryTiles_Next +al 00EC87 .LoadStageScene_VaryTiles +al 00EC63 .LoadStageScene_PlaceBalls +al 00EC3C .LoadStageScene_CopyAttrs +al 00EC3A .LoadStageScene +al 00EC2A .StageAttributeTable +al 00EBB0 .DrawStageBanner +al 00EB7A .ClearRoundState +al 00EB60 .SetupRound +al 00EB06 .AimLoop_UpdatePower +al 00EAFF .AimLoop_DecreasePower +al 00EAEF .AimLoop_StoreStage +al 00EAE9 .AimLoop_ClampStage +al 00EAF5 .AimLoop_IncreasePower +al 00EADE .AimLoop_AdjustStage +al 00EB0D .AimLoop_FireCheck +al 00EA9F .AimLoop_UpdatePlayers +al 00EAB1 .AimLoop_Update +al 00EA86 .AimLoop_CyclePlayers +al 00EA7B .AimLoop_CheckSelect +al 00EA75 .AimLoop_NoStart +al 00EA51 .AimLoop +al 00EA00 .TitleCommandList +al 00E9CC .StartGame_CopyAttrs +al 00E9CA .StartGame +al 00E9B9 .StartGameAttributeRow +al 00E9A3 .TitleColorCycleTable +al 00E980 .UpdateTitleColors_Store +al 00E974 .UpdateTitleColors +al 00E971 .TitleScreenLoop_Next +al 00E95D .TitleScreenLoop_SetPalette +al 00E947 .TitleScreenLoop_Animate +al 00E928 .TitleScreenLoop_WaitFrame +al 00E923 .TitleScreenLoop +al 00E8FF .EnterTitleScreen_CopyAttrs +al 00E8B3 .EnterTitleScreen +al 00E88F .Reset_InitPlayerRecords +al 00E882 .Reset_CopySignature +al 00E862 .BootSignatureText +al 00E880 .Reset_ColdInit +al 00E852 .Reset_CheckSignature +al 00E848 .Reset_LoadSpritePalettes +al 00E830 .Reset_ClearShadowTables +al 00E81E .Reset_WaitVblank2 +al 00E817 .Reset_WaitVblank +al 00E80C .Reset +al 00E802 .CheckTileCollision_Next +al 00E7C0 .CheckTileCollision_Probe +al 00E7B5 .CheckTileCollision_Loop +al 00E7B1 .CheckTileCollision +al 00E78B .FindPocketInPath_DiffAbs +al 00E7A6 .FindPocketInPath_Next +al 00E771 .FindPocketInPath_Loop +al 00E76D .FindPocketInPath +al 00E748 .FindBlockingBall_DiffAbs +al 00E763 .FindBlockingBall_Next +al 00E721 .FindBlockingBall_Loop +al 00E71D .FindBlockingBall +al 00E71B .ComputeAngleFromDelta_Quad1 +al 00E71C .ComputeAngleFromDelta_Done +al 00E706 .ComputeAngleFromDelta_Quad2 +al 00E70F .ComputeAngleFromDelta_PosX +al 00E6F7 .ComputeAngleFromDelta_Adjust +al 00E6F8 .ComputeAngleFromDelta_Quadrant +al 00E6E4 .ComputeAngleFromDelta_TableUp +al 00E6ED .ComputeAngleFromDelta_Found +al 00E6D9 .ComputeAngleFromDelta_TableLoop +al 00E6D0 .ComputeAngleFromDelta_Divide +al 00E696 .ComputeAngleFromDelta_RatioSetup +al 00E68C .ComputeAngleFromDelta_Ratio +al 00E683 .ComputeAngleFromDelta_ZeroY +al 00E67A .ComputeAngleFromDelta +al 00E63E .ComputePotAimPoint_Scale +al 00E60B .ComputePotAimPoint +al 00E60A .ScoreShotLineup_Done +al 00E5F2 .ScoreShotLineup_Record +al 00E5DF .ScoreShotLineup_Tolerance +al 00E5E7 .ScoreShotLineup_Accept +al 00E5FE .ScoreShotLineup_Next +al 00E598 .ScoreShotLineup_AfterAbs +al 00E586 .ScoreShotLineup_Loop +al 00E582 .ScoreShotLineup +al 00E572 .PlanBestShot_VaryAngle +al 00E570 .PlanBestShot_VaryFar +al 00E564 .PlanBestShot_VaryLoop +al 00E57B .PlanBestShot_SetShot +al 00E550 .PlanBestShot_StorePower +al 00E54A .PlanBestShot_ClampPowerLow +al 00E53E .PlanBestShot_PowerBucket +al 00E517 .PlanBestShot_AimAtPoint +al 00E50B .PlanBestShot_TargetPointX +al 00E4F9 .PlanBestShot_TargetPointY +al 00E4DC .PlanBestShot_FallbackAccept +al 00E4E6 .PlanBestShot_FallbackNext +al 00E4C1 .PlanBestShot_FallbackLoop +al 00E4B9 .PlanBestShot_Fallback +al 00E4AA .PlanBestShot_Next +al 00E48D .PlanBestShot_Evaluate +al 00E473 .PlanBestShot_StoreBall +al 00E43B .PlanBestShot_Measure +al 00E47B .PlanBestShot_AdvanceBall +al 00E429 .PlanBestShot_BallPoint +al 00E417 .PlanBestShot_ScanLoop +al 00E415 .PlanBestShot_ScanStart +al 00E40E .PlanBestShot +al 00E405 .ComputeDeltaVector_StoreHigh +al 00E3FB .ComputeDeltaVector_Square +al 00E3E7 .ComputeDeltaVector_AbsY +al 00E3CE .ComputeDeltaVector_AbsX +al 00E3BF .ComputeDeltaVector +al 00E3BE .UpdateCpuAim_Steer_Done +al 00E3B1 .UpdateCpuAim_Steer_SetButtons +al 00E3AB .UpdateCpuAim_Steer_TurnLeft +al 00E3AF .UpdateCpuAim_Steer_AngleMatch +al 00E39C .UpdateCpuAim_Steer_LengthKey +al 00E392 .UpdateCpuAim_Steer_LengthDown +al 00E39A .UpdateCpuAim_Steer_LengthMatch +al 00E381 .UpdateCpuAim_Steer +al 00E37C .UpdateCpuAim_Check +al 00E370 .UpdateCpuAim +al 00E367 .TestShootButton_Ready +al 00E364 .TestShootButton_Fail +al 00E34A .TestShootButton +al 00E349 .ReadPlayerButtons_Done +al 00E341 .ReadPlayerButtons_ReturnToCaller +al 00E333 .ReadPlayerButtons_CheckPlayer +al 00E322 .ReadPlayerButtons +al 00E31D .ResetAimPhase +al 00E318 .ByteToDecimal3_Units +al 00E30F .ByteToDecimal3_Tens +al 00E30D .ByteToDecimal3_AfterHundreds +al 00E304 .ByteToDecimal3_Hundreds +al 00E2FE .ByteToDecimal3 +al 00E2DB .DrawTurnMarker_Store +al 00E2D7 .DrawTurnMarker_Alt +al 00E2C8 .DrawTurnMarker +al 00E2BB .DrawShotIcons_Store +al 00E2B2 .DrawShotIcons_Loop +al 00E2A2 .DrawShotIcons +al 00E286 .PrintMenuPower +al 00E275 .PrintBallCount_Blank +al 00E270 .PrintBallCount_Value +al 00E25C .PrintBallCount +al 00E24F .PrintRate +al 00E240 .PrintTwoDigitValue_Units +al 00E22F .PrintTwoDigitValue +al 00E22D .PrintTwoDigitValue_Stage +al 00E225 .PrintStageNumberTop +al 00E21A .PrintStageNumber +al 00E215 .PrintHiScore_Source +al 00E20D .PrintHiScoreHud +al 00E202 .PrintHiScoreMenu +al 00E1F2 .PrintMenuPlayerScore +al 00E1ED .PrintPlayer2Score_Source +al 00E1BB .PrintScoreDigits_Loop +al 00E1AE .PrintScoreDigits +al 00E1AC .PrintPlayer1Score_Source +al 00E1E5 .PrintPlayer2Score +al 00E1A4 .PrintPlayer1Score +al 00E19D .PrintCurrentPlayerScore +al 00E194 .UpdateAimInput_PowerBar_Next +al 00E17C .UpdateAimInput_PowerBar_Fill +al 00E171 .UpdateAimInput_PowerBar_Loop +al 00E162 .UpdateAimInput_PowerBar +al 00E15D .UpdateAimInput_ClampTop +al 00E147 .UpdateAimInput_RescaleY +al 00E145 .UpdateAimInput_ClampBottom +al 00E14E .UpdateAimInput_NegY +al 00E118 .UpdateAimInput_TraceY +al 00E113 .UpdateAimInput_ClampLeft +al 00E0E7 .UpdateAimInput_Rescale +al 00E0E3 .UpdateAimInput_RescaleX +al 00E0FE .UpdateAimInput_StoreEndX +al 00E0E1 .UpdateAimInput_ClampRight +al 00E104 .UpdateAimInput_NegX +al 00E0BA .UpdateAimInput_Trace +al 00E0B1 .UpdateAimInput_StoreLength +al 00E0A4 .UpdateAimInput_LengthDown +al 00E089 .UpdateAimInput_PowerMeterBounce +al 00E094 .UpdateAimInput_LengthUp +al 00E079 .UpdateAimInput_PowerMeterDown +al 00E055 .UpdateAimInput_AimRight +al 00E062 .UpdateAimInput_PowerMeter +al 00E048 .UpdateAimInput_AimLeft +al 00E040 .UpdateAimInput_RepeatDelay +al 00E02F .UpdateAimInput_RepeatStart +al 00E01E .UpdateAimInput +al 00D559 .LayoutData +al 00D536 .ComputeStageLayoutAddress +al 00D4FA .LayoutScriptTable +al 00D4ED .SelectLayoutScript_Index +al 00D4E4 .SelectLayoutScript +al 00D4CC .ReadStageLayoutId +al 00D4C4 .ClassifyLayoutTile_Bits +al 00D4BD .ClassifyLayoutTile_Mid +al 00D4B6 .ClassifyLayoutTile_High +al 00D4AF .ClassifyLayoutTile +al 00D4AD .GetConnectionIndex_Result +al 00D48F .GetConnectionIndex +al 00D488 .PlaceLayoutTile_Neighbour_Clear +al 00D487 .PlaceLayoutTile_Neighbour_Skip +al 00D45E .PlaceLayoutTile_Neighbour_Compose +al 00D444 .PlaceLayoutTile_Neighbour_Pick +al 00D449 .PlaceLayoutTile_Neighbour_Blend +al 00D45D .PlaceLayoutTile_Neighbour_Return +al 00D41F .PlaceLayoutTile_Neighbour +al 00D405 .PlaceLayoutTile_Cell +al 00D400 .PlaceLayoutTile_Row +al 00D3E5 .PlaceLayoutTile_Simple +al 00D41E .PlaceLayoutTile_Done +al 00D3D3 .PlaceLayoutTile +al 00D3CB .DrawPocketCorner_RemapC7 +al 00D3BF .DrawPocketCorner_RemapC6 +al 00D3B3 .DrawPocketCorner_RemapC5 +al 00D3A0 .DrawPocketCorner_Remap +al 00D39F .DrawPocketCorner_Return +al 00D392 .DrawPocketCorner +al 00D384 .DefinePockets_Next +al 00D325 .DefinePockets +al 00D31B .DrawCellGrid_NextColumn +al 00D317 .DrawCellGrid_TileNext +al 00D30D .DrawCellGrid_TileCell +al 00D2DF .DrawCellGrid_AttrLoop +al 00D300 .DrawCellGrid_TileRow +al 00D2D4 .DrawCellGrid +al 00D2A0 .RunCellCommandList +al 00D29C .RemapTileIndex_Found +al 00D291 .RemapTileIndex_Loop +al 00D28F .RemapTileIndex +al 00D22C .FixIsolatedCells_Fix +al 00D222 .FixIsolatedCells_Next +al 00D212 .FixIsolatedCells_Loop +al 00D20A .FixIsolatedCells +al 00D1FB .UploadFieldMap_Store +al 00D1F5 .UploadFieldMap_Found +al 00D1EB .UploadFieldMap_HighNibbleSearch +al 00D1E8 .UploadFieldMap_HighNibble +al 00D1DA .UploadFieldMap_LowNibble +al 00D1CC .UploadFieldMap_Loop +al 00D1BB .UploadFieldMap +al 00D1BA .PlaceFieldTile_Done +al 00D197 .PlaceFieldTile_NorthEdge +al 00D174 .PlaceFieldTile_WestEdge +al 00D151 .PlaceFieldTile_SouthEdge +al 00D129 .PlaceFieldTile_KeepTile +al 00D12C .PlaceFieldTile_Store +al 00D0F3 .PlaceFieldTile +al 00D0E4 .DrawCellRun_Vertical +al 00D0D5 .DrawCellRun_Horizontal +al 00D073 .DrawCellRun_Block2x2 +al 00D088 .DrawCellRun_Corner2x2 +al 00D057 .DrawCellRun_TileTable +al 00D0C3 .DrawCellRun_DiagonalAlt +al 00D0B1 .DrawCellRun_Diagonal +al 00D047 .DrawCellRun_SetTile +al 00D03D .DrawCellRun_PickTile +al 00D05B .DrawCellRun_TileFromBit +al 00D02D .DrawCellRun_Kind40 +al 00D026 .DrawCellRun_Kind20 +al 00D017 .DrawCellRun +al 00D00D .RunSceneScript_Advance +al 00D004 .RunSceneScript_Next +al 00CFE5 .RunSceneScript +al 00CFDE .RunCommandList_Done +al 00CFA6 .RunCommandList_Loop +al 00CF9B .RunCommandList +al 00CF87 .LoadScene_Done +al 00CF70 .LoadScene_CheckVsMode +al 00CF40 .VsCommandList +al 00CF15 .DrawLayoutRows_Cell +al 00CF10 .DrawLayoutRows +al 00CEEE .ClearFieldMap +al 00CE9E .UploadFieldRows +al 00CE55 .FillFieldEmpty +al 00CE35 .LoadScene +al 00CE25 .WritePpuDataAtTemp +al 00CE14 .ReadPpuDataAtSrc +al 00CDF4 .PrintTextToNametable_Char +al 00CDE4 .PrintTextToNametable_RowStart +al 00CE09 .PrintTextToNametable_NextRow +al 00CDDA .PrintTextToNametable_Row +al 00CDD3 .PrintTextToNametable +al 00CDB9 .MixChecksum +al 00CDAE .UploadAttributeShadow_Loop +al 00CD9D .UploadAttributeShadow +al 00CD73 .SetAttributeCell_Align +al 00CD7E .SetAttributeCell_Store +al 00CD65 .SetAttributeCell +al 00CD5F .GetAttributeCell_Read +al 00CD58 .GetAttributeCell_Column +al 00CD3C .GetAttributeCell +al 00CD1C .ReadControllers_Loop +al 00CD0E .ReadControllers +al 00CCF3 .FlushPaletteToPpu_Loop +al 00CCD9 .DrainVramQueue_ReadLoop +al 00CCE5 .FlushPaletteToPpu +al 00CCA9 .DrainVramQueue_CopyLoop +al 00CCBA .DrainVramQueue_NextSlot +al 00CC91 .DrainVramQueue_Slot +al 00CC8F .DrainVramQueue +al 00CC7D .ResetVramQueue_Loop +al 00CC7B .ResetVramQueue +al 00CC49 .QueueVramByte_Store +al 00CC5E .QueueVramByte_NewSlot +al 00CC2E .QueueVramByte_WaitSpace +al 00CC29 .QueueVramByte +al 00CC12 .BeginVramWrite_Alloc +al 00CC05 .BeginVramWrite_FindSlot +al 00CBFD .BeginVramWrite_WaitSpace +al 00CBFB .BeginVramWrite +al 00CBF4 .PrintInlineString_Done +al 00CBE5 .PrintInlineString_Loop +al 00CBDC .PrintInlineString +al 00CBC9 .PrintInlineStringToVram +al 00CBC8 .WriteStringToPpuData_Done +al 00CBB9 .WriteStringToPpuData +al 00CBB2 .FillOamOffscreen_Loop +al 00CBAE .FillOamOffscreen +al 00CBA9 .SetPpuAddrFromXY +al 00CB92 .SwapPpuAddrAndPtr +al 00CB82 .CopyFromVram_Loop +al 00CB7F .CopyFromVram +al 00CB6F .CopyToVram_Loop +al 00CB69 .CopyToVram +al 00CB66 .IncCount16_Hi +al 00CB61 .IncCount16 +al 00CB5F .IncPpuAddr +al 00CB5A .IncPtr +al 00CB4F .DecCount16_Return +al 00CB50 .DecCount16_Borrow +al 00CB45 .DecCount16 +al 00CB39 .DecPpuSrcCount +al 00CB30 .FillVramByte_Loop +al 00CB2B .FillVramByte +al 00CB25 .TriggerOamDma +al 00CB1D .SetPpuCtrlAndMask +al 00CAF7 .ComputeTileAddress +al 00CABD .WritePpuData +al 00CAB9 .ReadPpuData +al 00CAAE .ReadVramByte +al 00CAA3 .WritePpuAddr +al 00CA8F .SetNtBaseFromA +al 00CA86 .UpdateNtBaseFromPpuCtrl_Base0 +al 00CA77 .UpdateNtBaseFromPpuCtrl +al 00CA6F .SetNtSelectBit +al 00CA60 .SetNtBase2000 +al 00CA52 .WritePpuCtrlAndResetScroll +al 00CA48 .EnableNmi +al 00CA42 .EnableNmiAndRendering +al 00CA3C .WritePpuCtrl +al 00CA38 .DisableNmi +al 00CA2E .EnableRendering +al 00CA21 .DisableRendering +al 00C559 .SpriteAnimationTable +al 00C552 .AnimationPointerTable +al 00C543 .StateTimerTable +al 00C522 .SpawnObjectTable +al 00C47A .ObjectStatePointerTable +al 00C475 .SpawnObject_NextSlot +al 00C445 .SpawnObject_CopyField +al 00C471 .SpawnObject_EndRecord +al 00C429 .SpawnObject_SlotLoop +al 00C415 .SpawnObject_Return +al 00C416 .SpawnObject_Create +al 00C409 .SpawnObject_JumpTable +al 00C404 .SpawnObject +al 00C401 .AdvanceScriptPtr_HiCarry +al 00C3FC .AdvanceScriptPtr +al 00C3F5 .ResetGameState +al 00C3F0 .QueueSpawnRequest_Done +al 00C3EB .QueueSpawnRequest_NextSlot +al 00C3E0 .QueueSpawnRequest_FindSlot +al 00C3DA .QueueSpawnRequest +al 00C3C7 .ClearGameState_LoopArrays +al 00C3BE .ClearGameState_LoopByte +al 00C3BC .ClearGameState +al 00C3B4 .SoundChannelMask +al 00C3AE .UpdateObjectSound_CheckVolume +al 00C392 .UpdateObjectSound_EnableChannel +al 00C38A .UpdateObjectSound_UseVolume +al 00C39F .UpdateObjectSound_Sustain +al 00C331 .UpdateObjectSound_Return +al 00C332 .UpdateObjectSound_Emit +al 00C321 .UpdateObjectSound_Silence +al 00C32A .UpdateObjectSound_Check +al 00C314 .UpdateObjectSound +al 00C304 .AdvanceAnimFrame_ReadCount +al 00C2FE .AdvanceAnimFrame_Restart +al 00C2EC .AdvanceAnimFrame_Relative +al 00C306 .AdvanceAnimFrame_Commit +al 00C2CB .AdvanceAnimFrame_Next +al 00C2CA .AdvanceAnimFrame_Return +al 00C2BB .AdvanceAnimFrame +al 00C2B8 .DecodeAnimOffset_Literal +al 00C2AD .DecodeAnimOffset_Restart +al 00C29E .DecodeAnimOffset_Relative +al 00C294 .DecodeAnimOffset_Back +al 00C28D .DecodeAnimOffset +al 00C275 .BuildObjectSprite_ClampY +al 00C286 .BuildObjectSprite_NoAnim +al 00C22F .BuildObjectSprite +al 00C21C .SetObjPtr_FromStateTable +al 00C20C .SetObjPtr_NonZero +al 00C205 .SetObjPtr +al 00C200 .AdvanceScriptPtrKeepA +al 00C1DA .EnterObjectState +al 00C1D5 .SetObjectState_Store +al 00C1D1 .SetObjectState_Table +al 00C1C0 .SetObjectState_Resolve +al 00C1A2 .ObjOp_LowOpcode +al 00C18D .SetStateFromOpcode +al 00C18B .ObjOp8F_StateFromScriptPtr +al 00C185 .ObjOp8A_SpawnFromScript +al 00C175 .ObjOp8E_SkipTwoBytes +al 00C16F .ObjOp86_SetFlags +al 00C166 .ObjOp89_StoreNibble +al 00C15E .ObjOp89_ClampNibble +al 00C14A .ObjOp89_SetFlagsNibble +al 00C13D .ComputeRecordIndex +al 00C12B .ObjOp8C_SetRecordByte +al 00C125 .ObjOp84_StoreSpeed +al 00C11F .ObjOp_AddSpeed +al 00C119 .ObjOp87_SetAnimSelector +al 00C113 .ObjOp83_SetSoundParam +al 00C109 .ObjOp82_StopScript +al 00C0F2 .ObjOp81_Loop +al 00C0E6 .ObjOp80_SetScriptPtr +al 00C0C0 .ObjectOpcodeHandlerTable +al 00C0A9 .DispatchObjectScript_Table +al 00C0A1 .DispatchObjectScript_High +al 00C092 .DispatchObjectScript +al 00C08F .NextScriptOpcode +al 00C082 .ResumeObjectScript +al 00C07C .FlushSoundRegisters_Next +al 00C072 .FlushSoundRegisters_Loop +al 00C06A .FlushSoundRegisters +al 00C05C .UpdateObjects_Render_Sound +al 00C054 .UpdateObjects_Render +al 00C05F .UpdateObjects_Next +al 00C02E .UpdateObjects +al 00C024 .ClearObjectWork_Loop +al 00C01B .DrainSpawnQueue_Next +al 00C00C .DrainSpawnQueue_Loop +al 00C00A .DrainSpawnQueue +al 00C003 .RunObjectFrame +al 00C000 .ResetStub diff --git a/_wip/Lunar Pool (U)/copilot/reconstructed.map b/Lunar Pool (U)/copilot/reconstructed.map similarity index 61% rename from _wip/Lunar Pool (U)/copilot/reconstructed.map rename to Lunar Pool (U)/copilot/reconstructed.map index aaf7f17..1ad1cc6 100644 --- a/_wip/Lunar Pool (U)/copilot/reconstructed.map +++ b/Lunar Pool (U)/copilot/reconstructed.map @@ -1,13 +1,19 @@ Modules list: ------------- +header.o: + HEADER Offs=000000 Size=000010 Align=00001 Fill=0000 prg.o: PRG Offs=000000 Size=004000 Align=00001 Fill=0000 +chr.o: + CHR Offs=000000 Size=002000 Align=00001 Fill=0000 Segment list: ------------- Name Start End Size Align ---------------------------------------------------- +CHR 000000 001FFF 002000 00001 +HEADER 000000 00000F 000010 00001 PRG 00C000 00FFFF 004000 00001 diff --git a/_wip/Lunar Pool (U)/copilot/reconstructed_prg.bin b/Lunar Pool (U)/copilot/reconstructed.nes similarity index 65% rename from _wip/Lunar Pool (U)/copilot/reconstructed_prg.bin rename to Lunar Pool (U)/copilot/reconstructed.nes index e4b8e4cecf2fbe770fc2731a5554ea5e0f25425e..f45f9a829969ccaab1300ef7a2e0f9fdb59d0364 100644 GIT binary patch delta 8268 zcmeHMe|%F_mcOs5Neh9LVOOhyt>`Q``-5N^Nl7)Sw2}_kMko@O-Q_VIYTW5aKERA` zoY?nb1AR!e&w~2!SD!o1OctxnNX1Om?b9-8z(6CPU6;@PF%7~F=qS{wI|L1Rd(KT> z+6v=1e*ElTdz$9nbI&>7bIv{IzP!8$0wbwRS!4a`s~CnMIw?+GpAy2DES8E2ov*N1 zOnJr1@{(d$R+Fi*bViqF(&;gkGP)g%Gb<`|y9&$9yuCV>PG`Ul?0uYHxASv0w9orz ziU0}$=2kF81`2!44D&<)Vx2Pw5Pe-BUroB@(DN@U zf(QU;#@x9%_k_%uyaQrT&@)g4m;%*s2!J#x0Q1~Ag&nw50M_)>0CfL^rcHNXPEk>A zim_pcZR@9>X8jX*1^L9JkUuU>H0FfD zq?w@VjG#}Zj(X*$uIij1q$Z~NY^r~gzI>@j1VJ6s<$4e3JRKQBh0Yr;0uaDFRX9B< z01!}lvVVp#IdlNiq*F@Q&|V$O>hdvFN6=RY!x$_DIE!H_05wmgHC;QM$^jG%bitP# zg+HNpQT}=Tyq)08^E}C~o8hl9&NAsE(LhRZ1_embqo;S{Cxd2ZB?V~*3W2f%@O2@EQjf0FA3 z+<*N%=G6ah-@j`8zpg0%-~ZROlV1(zqWw2)Y1y=SqrIAv)o%ZZU!Rk?pAf@`_NjE@ z zqAk9N;l1N$J~;lnkL(|PaD40|Fob{LafxWeQ~n{HrLnLZ{_c@-?pqFFCf!b zHY}@eT#bUe$YqTUpwn2_WN*67UVD4}s)l8?c}49Dc8QSEHSU_arnQasRZVLe>j*Kf ztiP?fW>v#-SF`;#KxuAhYJ@ONFYns5i--RS+DA;?fxseP+lC)++#Cqpz2OHN0}@>e zOrhM`jXAw7e@gF1TLLYce&CzH`{knr;&ZbI#8Zm#6lfnQd3k#vuzAxD@BJS2-3coY z++>nqrFHW?EnDx|bZ>4QRwjWXc7$lm{ug!X$xrn0Dad~xVR{$A=M$w~sO8-o1)+C~ zchlAf9(VveN+7>cciX#p!`6)ftF_m+=|0?|=eAM#PyG3Y?fveCwl_E4u#| zpUKbkk$>?q46*q1$xG7vgp@36YFxgmwt3CUS}fengiO1uX^q`gduP49uBow}Os`$J z(!RR6c6t5krNrFqs%>0h2MuVnQunH+x;4vaJK1X+8b~Q^$Vt6e!Y_x;ve(tGZdl%! zYdbPyS<~(AhL!b%6n}91lJq;Gbv*sd^UwDF>|c9+@nZPrFYJBL+RwhC?w4L&9QFR{ z&4KRMY_D&4YI?2jBc_)a{2@bF0D z@X?XPJ4cTm{Pm$^;^3hpiNi;ZCJ!Gy`p%))+are$@oyhJd}QPZD8!R*562Tn-cB4n zGLjrQdKB)6uey59;&0y+iYG);veIRy6Z1+lfyqizLU5J{AcGfe|>$;w7Tmwl-_E`Knk)aZJmd~3!QS1y{%9!rbd-?K^Q_?W`ee}~h83?OM+D&cDGTD~6heYm z@XFpu#2xWQgo^-~cTYkrhP>3tp?&$$ESq&c}w`QD0ILrMMK8jtR05R%9jYv3jkXRkX_1 zur+E^U7Xe9i}+w4Wm#6kf-1SW2&alFFp;n-DWPLhTva_zQH}=LAl!e4oGj}RSS8A; zLR1Ne_Ie^7&Z~Gs zoX6{t1()m+qH+|xdIbTuGAgq^R`Lmi2vJ|$2N?@4pT}ooc^A~!>jlk-9C6}paYzU) z@FuyWn3R*@WHc$sqSqs;T-X)0`J&*MRiVaeScWV)iFHd6B@$6oNflHOhuv{D?u#r? z7AVIe$Kpy{k^~PV!rH(Rf`)rgn}9{Od3~(tRp9dB7(w(Y#i$q zI3*NU6jgvqC|F?X3Z_wK1dFCdB4LFPS>k*iD2?h0Td}ll2fVT`%tghpEQ=yI6gZ9( zJrU8Wy2FZ;bh|trx7WkDMUU*}!=9)|^7ur^MwDcqEXa}sHG&$8dW}_=SK-1UR3NNC z=3GejsNT3Qs;ZHAI2!tQEJ@TBbw?p}7Cy;BL66hp_OL1_s1P742sYSin;Z|r9uVRY zI2PIzc8|mS2?5t|CNWBxlOf_i3*nLgxcH^$qWiBeW%czbeI@^uNTiaCB59+V+wGO2J$(EKsu9A7F+I;zi~=&E3luQA5_$Pb;b?$GAc zv?UT*GdVG|tE!3_*RpEHh;oK^7|x@DKc;44)WBh=20j}zms_n?!c>o+8W|Y@c?@3w zSdA~_+l^)p`M~+{&RhcdT_fe?G@Z}A=?@?1ms!9rBY@AF&E^tfHp5rba`4EKo{>}F zu}7`>Xdd$Byx1CK$PF>sI(q!)ycF~b&!n96sHTPgqj z*6BGpIHYoL$OQ$inA)>O1KQJoEAs)DV?yYk!;BCzw*VPX7BdL;_xER9z^_=b!f+Er z%vrev252-Jt6GRC`Vf+|VyU258QQcNVlZMQ4McBJy$|%BnZ)~fY$~1fuGD#(%~nQi z(DlQ^XSLyBY%=-)3Jwf|r^eP6i)CXmGQ6w0nyIeVGO-xG2y`&MpoicR+*$)YdDQxZ!Y8#|T&{i^wv`Bl{#U;||dgagEAu`_)3 zT?#mhxd8!Vzx~5+j>O&~)mN5YyQunRJZ3=j*nzkMGmJrmm|-Jl2ZwO1{YGl<=s1t|aPEMJ0nRiY>lo}mbpZB25HV7l4Ku8+-Zc#TyYFVt)B%6P z4a}_9AY#AGe+Dv|)iK;Lt6FPqZLPuD@7c3w2)01W&YWYz3la12iDA4D9Zn=NiNs-Y zV^x)*s_I59g&UCgkW}CXRL$0SQqv9uHF{(7=KI^<7$U@6jP)N1;6wkw5XnEw9qxc1 z4myUh>{CeZ6@8Jvg^)5_WE}J7JC-p+0hkAFz5e>Yf1_P%zxisa&lD9?{pF@N8Z zD==aNzyNTfXS{gn&9@W)AOH#g0q8q4f9wu zI}AM9^XDJ{%oqVM!$JT6Km*VLV23C`zJ_C6QRt(_sLJ2O(8f!W^5D z5;P_1Mgu4lRcdJJ96m9Ao*p&uof2pO!vfKG-jUD1V!Ce8 zf_7&1d<=l$o7VFffDk{4fs>x0oIM1P{sinXfT11+?JE}20GgIB`!Vb^Q#*ah2=AD8 z=e8NMms=cl|NPv`$IgtyT?+nEGM34VrIL!`a%RTQ#JdCYiXHG6o`F7bjNEti?c460 zN2>*ISA8S*hqYUiFCxlZp4=bKr;tYW=1NUW(+FQ$M1^H#vtUfQOJw+hkRz9jx0nzP zAx;%Won~KIHVuDW0QnW)BBezF$|u?Da$WxmM;@eqEQ2pJ1mU~~x0@`EkqUjh|Nhs0 z^dNJ@6xa09Ja2jDCDd!#Q z*4%MNVbpK*K~x|s+=nBX&HN?r` is gone from the file — and Pass 3 named 33 tables plus the zero-page aliases (38 semantic, 66 neutral, ten former phantom aliases deleted). Residue, recorded rather than guessed: 73 bytes of *reachable* code are still `.byte` (`$EA9A`, `$EADC`, `$EAE5`, `$EAED`, `$EB04`, `$EB16-$EB4F` — the CDL capture never fetched them), another 75 bytes of ending-screen code sit at `$F5F9-$F643`, and ~206 bytes of unreached-but-clearly-code stubs stay data. The full 24,592-byte ROM (header + PRG + CHR) rebuilds byte-identically. See `Lunar Pool (U)/OVERVIEW.md`. - **Ice Climber (JE) vs (U)**: byte-identical PRG *and* header — only the CHR differs (~regional title graphic). - **Popeye (JU) PRG 0 vs PRG 1**: different PRG binaries (and mirroring); same vectors. - **Raid on Bungeling Bay (U) vs [a2]**: `[a2]` differs in mirroring only per header, but PRGs differ — separate builds. @@ -356,9 +359,32 @@ opcodes. It is **default off** so that projects whose `prg.s` is already regen-stable keep reproducing byte-for-byte under `make regen`. `_tools/verify_pass1.py` now checks all 36 projects. All are faithful; none is -truncated. It also reports that **no project follows the canonical -`; CPU:$xxxx PRG:xxxx AA BB` audit-comment convention** — five other spellings are -in use, and Excitebike and Pac-Man carry no byte comments at all. +truncated. Its comment-spelling report used to claim that **no project follows the +canonical `; CPU:$xxxx PRG:xxxx AA BB` audit-comment convention**. That was a bug in +the checker, not a fact about the sources: the `canonical` pattern ends with `$` but +was compiled without `re.MULTILINE`, so it could only ever match once — at end of +file — and every project fell through to whichever laxer spelling matched most +lines. Fixed. With `re.M` the true split across the 17 top-level projects is +**8 canonical** (CIRCUS, Excitebike, Joypad Test Cartridge, Lunar Pool, MUSCLE, +NES PowerPad Test Card, Pac-Man (USA) (Namco), Wild Gunman), 3 `pipe`, 2 `short`, +and one each of `rom`, `bytes`, `colon` and `slash` — so the checker sees seven +distinct spellings across the repo, six of them non-canonical, with canonical +dominant. + +The old claim that "Excitebike and Pac-Man carry no byte comments at all" is stale +too. Pac-Man (USA) (Namco) is complete (4,695/4,695 instructions commented); the two +`_wip/Pac-Man` folders are 12-line `.incbin` Pass-0 skeletons with no disassembly to +comment. The one real gap is **Excitebike: 1,013 of its 5,376 instruction lines carry +no audit comment**, and that is now the whole of item 3 below. + +Separately, `verify_pass1.py`'s re-trace half crashes on `MUSCLE (U)` and +`Donkey Kong Jr. (JU)` with `ValueError: invalid literal for int() with base 16: +':$0010'` (and `':$0002'`). `nesdis.trace()` parses an emitted operand with +`int(text[1:], 16)`, but the `a:` prefix that the emitter adds to ABS/ABSY/ABSX/IND +operands with a `$00` high byte makes the text `a:$0010` — so the slice starts on the +colon. Any project containing `jmp ($00xx)` / `jsr`/`jmp $00xx` hits it. Not fixed +here because `nesdis.py` feeds `make regen`, and MUSCLE's regen output must stay +byte-stable. ### TODO — audit comments for Excitebike and Pac-Man diff --git a/TODO.md b/TODO.md index 1c681b4..f5c23e5 100644 --- a/TODO.md +++ b/TODO.md @@ -17,18 +17,26 @@ A build that assembles but does not print that message is a failure. Requires Two tiers exist, and the difference is real: -- **Top level (16 projects)** — `make` compares the whole ROM against `copilot/rom.nes`. -- **`_wip/` (20 projects)** — `make` only runs `cmp reconstructed_prg.bin prg.bin`. +- **Top level (17 projects)** — `make` compares the whole ROM against `copilot/rom.nes`. +- **`_wip/` (19 projects)** — `make` only runs `cmp reconstructed_prg.bin prg.bin`. Header and CHR are **not** proven for those. Promotion means adding `copilot/rom.nes`, switching to a whole-ROM compare, and changing - `../../../_tools/` to `../../_tools/` in the Makefile. + `../../../_tools/` to `../../_tools/` in the Makefile. A promoted project also + needs `header.s`, `chr.s` and a HEADER/PRG/CHR `linker.cfg`, which a Pass-0 + skeleton does not carry — `Lunar Pool (U)` (2026-10-18) is the worked example. ## Current state -- 16 top-level projects, all byte-identical. -- 20 `_wip/` projects, all PRG-identical. `Pyramid (U)` is the only one with Pass 1. +- 17 top-level projects, all byte-identical. +- 19 `_wip/` projects, all PRG-identical. `Pyramid (U)` is the only one with Pass 1. - 9 commits ahead of `origin/master`, nothing pushed. -- `_tools/verify_pass1.py` rebuilds and re-traces everything: **all 36 faithful, none truncated.** +- `_tools/verify_pass1.py` rebuilds and re-traces everything: **all 36 faithful, none + truncated** — but its *re-trace* half now crashes on `MUSCLE (U)` and + `Donkey Kong Jr. (JU)` (`ValueError: ... int() with base 16: ':$0010'` / `':$0002'`) + because `nesdis.trace()` parses operands with `int(text[1:], 16)` while the emitter + writes the `a:` prefix for ABS/ABSY/ABSX/IND operands with a `$00` high byte. The + `make` half still runs. Fixing it needs `nesdis.py`, which feeds `make regen`, so + MUSCLE regen must be re-checked afterwards. ```bash python3 _tools/verify_pass1.py # all projects @@ -88,29 +96,125 @@ Resolving the pushed table addresses is the key to the remaining 28%. phase dispatcher. Both were found by probing, which is a cheap technique worth reusing on other projects. -### 2b. Lunar Pool (U) — Pass 1 complete, Pass 2/3 outstanding +### 2b. Lunar Pool (U) — Pass 2 and Pass 3 complete, promoted to the top level -`_wip/Lunar Pool (U)/`. Pass 1 complete: **57.8% code** (4,586 instructions, -9,475 bytes), byte accounting exact, BYTE-IDENTICAL. +`Lunar Pool (U)/` (promoted out of `_wip/` 2026-10-18 by `git mv`, so the relative +`copilot/rom.nes` symlink is live and tool paths are `../../_tools/`). Pass 1 +complete: **67.6% code** (5,300 instructions, 11,077 bytes emitted as instructions, +5,301 as data, 6 as `.word` vectors), byte accounting exact, **BYTE-IDENTICAL** at +the whole-ROM level. The split was re-derived against a Mesen Code Data Logger +capture (10,028 bytes Code = 61.2%); the flat tracer had undercounted by 1,738 bytes +of executed code and overcounted 100 bytes of data as instructions. + +**Promotion detail worth reusing:** a Pass-0 skeleton has no `header.s`, `chr.s` or +HEADER/PRG/CHR `linker.cfg`, so promotion is not just a symlink and a `cmp` edit — +copy the shape from `Burger Time (U)/copilot/` (`header.s`/`chr.s` are one-line +`.incbin`s; the linker needs `HEADER: start = $0000, size = $0010` before PRG). +Result here: `reconstructed.nes` 24,592 bytes, SHA-256 `6da37fd3…c8a1`, equal to the +original `Lunar Pool (U).nes`. - RESET is at **`$E80C`**, not `$C000` — the tracer must seed it explicitly (`--extra-seed 0xE80C`), since the vectors are the only entry points a plain trace follows. -- Code is gated behind two dispatch mechanisms, both of the Mario Bros shape: - `jmp ($7961)` at three sites (`$F788`/`$F7F6`/`$F828`, RAM-pointer dispatch — - the data blocks after them hold the screen text "game over" and "hi`score__"), - and stack-based dispatch at `$CBDC` (pointer arrives via `pla`). -- 6,909 bytes (42.2%) still data. ~585 `Label_Cxxxx` to name in Pass 2. +- **Correction to an earlier claim in this file and in the two `OVERVIEW.md`s:** + there is no `jmp ($7961)` RAM-pointer dispatch at `$F788`/`$F7F6`/`$F828`. Those + were flat-tracer phantoms. `$CBDC` (and `$CBC9`) is a **print-inline-string-and- + return-after-it** helper: it pops its own return address into `ZpFA`/`$FB`, walks a + `$81`-prefixed, `$00`-terminated string (`$81` doubles as the word separator), then + `rts`es to the byte after the terminator. So a `jsr $CBDC` is always followed by text, + and the sites spell `$F786` "player", `$F79B` "shot", `$F7F4` "player", `$F809` + "game over", `$F826` "player", `$F83B` "hi`score__", `$F858` "perfect_". + Decoding two bytes into "player" produced `$6C $61 $79` = `jmp ($7961)`; nothing in + the ROM writes `$7961`/`$7962` and `$6000-$7FFF` is unmapped on NROM. Same trap to + watch for in other titles. +- **Also corrected: the old Pass 2 claim.** No `SubC` label exists in this + `prg.s` and `git log -S SubC` finds no commit that added one; the file used to be + all address-derived `Label_` with only `Reset`/`NmiHandler`/`IrqHandler` + semantic. Do not copy the old "218 renamed / 374 internal" line into other docs. + **Pass 2 then finished for real: 705 labels, zero `Label_` left.** Naming + rule that was applied: `jsr`/`jmp` targets and logical block heads get PascalCase + semantic names, internal branch targets get `_` (`_Loop`, `_Next`, + `_Done`, `_Store`, `_Return`, …), and `jsr`/`jmp` operands stay raw numeric + (this file's convention, as in `Joypad Test Cartridge (U)`) while branch operands + are symbolic. +- Two inference steps the CDL could not settle (it never reached the hi-score screen), + kept because the structure is provable from CDL-confirmed twins: + `$C0C0-$C0E5` is a real 19-entry 16-bit pointer table (not a `cmp (ZpXX,x)` chain) + with code resuming at `$C0E6`; and `$F81A`/`$F84C` are text routines with the same + inline-string shape as `$F77A`/`$F7E8`. +- Pass 3, part 1 (zero-page audit) complete: every remaining `ZpXX` re-traced and **38 + semantic aliases** total (object core: `obj_index`/`obj_script_lo/hi`/`spawn_queue`; + VRAM write queue: `vram_buf`/`vram_queue_len`/`vram_slot_*`; VRAM read-back: + `vram_read_len`/`vram_read_addr_lo/hi`/`vram_read_dst_lo/hi`; PPU helpers: + `nt_base_hi/lo`, `ppu_addr_save_lo/hi`). 66 stay neutral with recorded reasons. + Ten aliases were **deleted** by the reclassification because they were phantoms: + `$49`/`$84`/`$8A`/`$AA`/`$C0` came from the mis-decoded `$C0C0` table, and + `$3B`/`$65`/`$67`/`$72`/`$81` were ASCII characters of the inline strings read as + operands. Full evidence + residue in `locals.inc`. +- Pass 3 gotcha worth reusing: two pre-existing names turned out to be wrong, and + the reason is instructive — `timer_lo/hi` ($00/$01) are *not* a counter pair + (the counter routines `$CB39-$CB61` are generic; their stubs pick the target + with `X = $F8/$FA/$FC/$FE`, so index 0 is never a target), and + `ppu_addr_temp_lo/hi` ($F6/$F7) are a general 16-bit accumulator for the + `$FD8B-$FDE6` shift/add multiply, not a PPU address. Not renamed again (churn), + recorded in `locals.inc` instead. +- **Pass 3, part 2 (tables) complete: 33 data structures named.** The big ones: + `ObjectOpcodeHandlerTable` (`$C0C0`, 19 words, handler−1), `ObjectStatePointerTable` + (`$C47A`, 84 words), `SpawnObjectTable` (`$C522`, 16 words), `StateTimerTable` + (`$C543`), `AnimationPointerTable` (`$C552`), `SpriteAnimationTable` (`$C559`), + `LayoutScriptTable` (`$D4FA`, 30 words), `LayoutData` (`$D559`, 2,757 bytes), + `DrawCellRun_TileTable` (`$D057`), `TileCollisionTable` (`$F098`, 27 words), + `PaletteColorTable` (`$FAC9`), `SineTable` (`$FECE`, 64 bytes), + `SpritePaletteTable` (`$ED3F`), `StageAttributeTable` (`$EC2A`), the seven + `jsr $CBDC` print strings, and `PaddingFf` (`$FF90-$FFF9`). Five `.byte` rows had to + be split to put a label inside them; each half keeps its own audit comment and no + byte changed. The `$FFFA-$FFFF` vectors are `.word NmiHandler, Reset, IrqHandler`. + Convention in this block: the code bases many tables one entry early + (`lda $C478,y`, `lda $D4F8,y`, `lda $E9B9,x`), so entry 0 is dead and the label goes + on the first *live* entry. +- **Residue the CDL could not settle — recorded, not guessed.** Everything below is + still `.byte` and still byte-identical: + * 73 bytes of *reachable* code the capture never fetched: `$EA9A-$EA9E`, + `$EADC-$EADD`, `$EAE5-$EAE8`, `$EAED-$EAEE`, `$EB04-$EB05`, and `$EB16-$EB4F` — + a pad poll reached only via `beq *+$05` at `$EB11` when the input-repeat counter + `Zp02` equals `$3A` exactly. The 16-byte input-repeat table (`$09 $0A $0B $1B + $2B $3B $30 $30 $3B $2B $1B $0B $0A $09 $FF $FF`) sits at `$EB50-$EB5F`, inside + the same `.byte` run. + * 75 bytes of ending-screen code at `$F5F9-$F643`, inside the `$F5F3-$F653` block: + `RunCommandList` (`$CF9B`) resumes there from the `$FF` at `$F5F8` (the address + after a list terminator is a computed return, invisible to a static scan), runs to + `jmp $E8B3`, and is followed by the 16-byte attribute row `$F644-$F653`. Needs a + completed game, so natural play never reached it. + * ~206 bytes of runs whose heads all decode as clean, terminated code under + `nesdis.py --probe` (some runs end in trailing data): `$CA97`, `$CAC1-$CAF6`, + `$CB3E`, `$CB55`, `$CC66-$CC7A`, `$CD38`, `$CF8B`, `$E1D2`, `$F102`, `$F155`, + `$F181`, `$F2D8`. + * Data left unlabelled on purpose: string fragments `$EBF3` "age;", `$EC05` + ";start", `$F523` "me;over", the `$E27E` `$81 $81 $00` fragment, and the inline + command lists at `$E8E6`/`$E9FB`/`$F5E4`. Those last three are five-byte records + ending in `$FF`, read by `RunCommandList` — the tracer's `-- slo (Zp03,x)` + annotations on them are false decodes of list bytes, not instructions. + * `$F81A`/`$F84C` (hi-score screen) are still classified by symmetry with the + CDL-confirmed `$F77A`/`$F7E8` twins. Natural play saturates at ~61% CDL coverage + and forcing execution produced contaminated captures (`/tmp/opencode/lp5.cdl`, + `lp6.cdl` — **do not use**). Beating `HI. 0005000` or sinking a "perfect" shot + would settle them. +- `_tools/cdl_reclass.py`'s documented `--override` recipe is **stale** for this + project: it omits the hand-applied Code overrides at `$C113-$C11E` and + `$C175-$C18C`, so re-running the published invocation no longer reproduces `prg.s`. - Three undocumented opcodes this project forced into `nesdis.py`: `$72` (RRA abs), `$42` (NOP #imm), `$FA` (NOP abs,X). One emitter fix: ca65 optimises an operand with a `$00` high byte into zero-page form, so ABS/ABSX/ABSY/IND operands with high byte `$00` now emit the `a:` prefix to force absolute. -### 3. Audit comments for Excitebike and Pac-Man +### 3. Audit comments for Excitebike -Both are hand-written sources with semantic labels but **no byte-identity audit -comment**, so a source line cannot be mapped back to ROM bytes without -re-assembling. Every other project has one. +Excitebike (JU) is a hand-written source with semantic labels, and **1,013 of its +5,376 instruction lines carry no byte-identity audit comment**, so those lines cannot +be mapped back to ROM bytes without re-assembling. (An earlier revision of this item +named Pac-Man as well. That was wrong on both counts: Pac-Man (USA) (Namco) is fully +commented, 4,695/4,695, and the two `_wip/Pac-Man` folders are 12-line `.incbin` +Pass-0 skeletons with no disassembly at all. Corrected 2026-10-18.) - `ca65 -l` gives offset + bytes, and the offset indexes `prg.bin` directly. Byte *values* must come from `prg.bin`, not the listing — ca65 prints `rr rr` @@ -192,6 +296,29 @@ These cost real time this session. All are recorded so they don't cost it twice. - **Input goes on joy1 = `$4016`** with a real latch/shift register. The poll routine's `lda $4016,X` with X=1 lands on `$4017`, but only bits 0–1 are compared, so driving `$4017` consumes nothing and changes no coverage. +- **A static trace cannot settle the code/data split; the emulator's Code Data + Logger can.** The trace misses code behind computed dispatch, and it cannot tell + inline string data from an instruction that decodes out of the same bytes — both + leave the rebuild byte-identical while the split stays wrong. Mesen marks every + PRG byte the CPU *fetched as an opcode* vs *read as data*; capture it with + `mesen_cdl_file(action:'save', memoryType:'NesPrgRom', filepath:...)` (cumulative — + it does not reset) and feed it to `_tools/cdl_reclass.py`, which rewrites the split + to match wherever the CDL has an opinion and leaves the rest alone. Lunar Pool went + 9,403 → 11,041 code bytes that way (1,738 data→code, 100 code→data) and then + recorded zero disagreement with the CDL; 36 further bytes were moved by hand later + (`$C113-$C11E`, `$C175-$C18C`), so its file now carries 11,077. Forcing the PC to + reach unvisited code is + *not* a general substitute: a routine that returns through a popped address runs + away when entered that way and marks garbage as Code (Lunar Pool `$F81A`). +- **A `jsr` to a helper that pops its own return address means the bytes after it are + text, not code.** Lunar Pool's `$CBDC`/`$CBC9` pops the caller's return address + into a pointer, prints a `$81`-prefixed, `$00`-terminated string (`$81` doubles as the + word separator), then `rts`es + to the byte after the terminator. A flat tracer started an instruction two bytes + into "player" (`$6C $61 $79` = `jmp ($7961)`) and produced a plausible-looking + "RAM-pointer dispatch gate" that does not exist — `$7961` is never written and + `$6000–$7FFF` is unmapped on NROM. Suspect this shape whenever a `jmp ($xxxx)` + operand spells ASCII. - **Odd vector targets are not bugs.** Burger Time's `$FF7F` NMI and CIRCUS's `$4CB7` IRQ point into unused space. That is common in this set — verify before assuming a handler is broken. @@ -238,4 +365,7 @@ These cost real time this session. All are recorded so they don't cost it twice. - `_tools/nesdis.py` — Pass 1 tracer (`--undocumented`, `--auto-seed`, `--extra-seed`, `--table`, `--data`, `--probe`). - `_tools/verify_pass1.py` — faithfulness + completeness check across all projects. +- `_tools/cdl_reclass.py` — reclassify a project's code/data split from a Mesen Code + Data Logger capture (dry run by default; `--apply` rewrites `prg.s`, then `make` + must still print BYTE-IDENTICAL). Its docstring covers capture and the safety rules. - `_tools/bytecode_dis.py`, `pass2.py`, `trace_stage_payload.py` — per-pass helpers. diff --git a/_tools/cdl_reclass.py b/_tools/cdl_reclass.py new file mode 100644 index 0000000..d4cfc77 --- /dev/null +++ b/_tools/cdl_reclass.py @@ -0,0 +1,498 @@ +#!/usr/bin/env python3 +"""Reclassify a NES disassembly's code/data split using a Mesen Code Data Logger file. + +Why this exists +--------------- +A static trace cannot see code reached through computed dispatch, and it cannot tell +inline string data from an instruction that happens to decode from the same bytes. Both +failure modes are common (see TODO.md "Gotchas that will bite you"), and both leave the +`.byte`/instruction split wrong even though the rebuild is still byte-identical. + +Mesen's Code Data Logger is the oracle: it marks every PRG byte the CPU *fetched as an +opcode* (bit 0 = Code) and every byte it *read as data* (bit 1 = Data), plus bit 2 +JumpTarget and bit 3 SubEntryPoint. This tool rewrites prg.s so its split matches the CDL +wherever the CDL has an opinion, and leaves bytes the CDL never observed exactly as they +were. Only the *representation* changes (instructions <-> .byte/.word); every ROM byte is +preserved, so `make` must still print BYTE-IDENTICAL afterwards -- run it. + +Capture a CDL from the Mesen MCP: + mesen_cdl_file(action='save', memoryType='NesPrgRom', filepath='game.cdl') + +You can also drive the routines the CDL never reached by setting the PC in the debugger -- +but note that a routine that returns through a popped address (a `jsr` + `pla`/`rts` +dispatcher, very common) will run away when entered that way, marking garbage as Code. +Check the newly-marked ranges before trusting such a run; treat a PC-forced capture as +unverified and discard it if the CPU ends up somewhere nonsensical. + +Inputs and defaults +------------------- + --dir DIR project copilot directory (default: cwd) + --cdl FILE the CDL file (required) + --prg FILE PRG image, default /prg.bin (byte-identity oracle, read only) + --src FILE assembly, default /prg.s (or main.s where used) + --locals FILE zero-page alias file, default /locals.inc; optional + --base 0xC000 CPU address the PRG is mapped at + --label-template 'Label_{addr:04X}' + name given to a *new* label the tool has to define. Labels already + defined in the source keep their exact spelling, whatever it is + (`SubCxxxx`, semantic names, ...). + --override LO-HI:C|D + force a range's classification. Use for structure the CDL is silent + about but that is provable another way; record the justification in + the project's OVERVIEW.md. Repeatable. + --apply write the result; without it the tool only reports + +What it needs from the source format +------------------------------------ + * per-emission audit comments `; CPU:$AAAA PRG:AAAA BB BB ...` (the addressing key) + * data emitted as `.byte` / `.word` (`.incbin` blocks are left untouched, since they + carry no per-byte provenance) + * the data-block header `; ---- data $AAAA-$BBBB (N bytes) ----` -- if absent, block + expansion is quietly skipped + * optionally the routine header `; Routine: