diff --git a/Joypad Test Cartridge (U)/OVERVIEW.md b/Joypad Test Cartridge (U)/OVERVIEW.md index 51a4a8a..7e359ab 100644 --- a/Joypad Test Cartridge (U)/OVERVIEW.md +++ b/Joypad Test Cartridge (U)/OVERVIEW.md @@ -14,7 +14,7 @@ This document describes the execution flow of the disassembled Joypad Test Cartr | Mirroring | Horizontal | | PRG bank start | CPU $C000 | | Source file | `copilot/prg.s` (~1,360 lines with headers) | -| Output | `reconstructed_prg.bin` (16,384 bytes) | +| Output | `reconstructed.nes` (24,592 bytes) | ### Interrupt vectors (CPU $FFFA–$FFFF) @@ -40,7 +40,7 @@ This document describes the execution flow of the disassembled Joypad Test Cartr |------|--------|-------------| | Pass 1 | Complete | Code/data split — ~580 bytes traced code (~3.5%) or explicit `.byte` data (~96.5%) with `; CPU:$xxxx PRG:$xxxx` annotations | | Pass 2 | Complete | Routine headers added for all labeled positions; key routines semantically named (`Reset`, `NmiHandler`, `VramWrite`, `PpuScrollLatch`, etc.); zero-page aliases in `locals.inc` | -| Pass 3 | Partial | Some data table references named in code; larger data regions (test patterns, button mappings) remain as `.byte` blocks | +| Pass 3 | Complete | Data regions identified and documented (VRAM burst write table at $0302, pointer table at $0000, test pattern/button mapping data in $CE98–$FFFF); remaining `Label_Cxxxx` references are internal branch targets within routines | --- @@ -161,8 +161,8 @@ Notable data structures: ## 9. Build ```bash -cd "_wip/Joypad Test Cartridge (U)/copilot" -make # → ca65 + ld65 + cmp reconstructed_prg.bin prg.bin → "BYTE-IDENTICAL" +cd "Joypad Test Cartridge (U)/copilot" +make # → ca65 + ld65 + cmp reconstructed.nes rom.nes → "Byte-identical ROM verified." ``` --- @@ -178,5 +178,5 @@ make # → ca65 + ld65 + cmp reconstructed_prg.bin prg.bin → "BYTE-IDEN ## 11. Next Steps -- **Promotion** — move to a top-level `Joypad Test Cartridge (U)/` folder, add `header.s` / `chr.s` + full-ROM `make` target (as e.g. `Burger Time (U)`), then join the root `OVERVIEW.md` numbered inventory. -- **Pass 3 continuation** — name data tables (button mappings at $C000–$FFFF, test patterns), refine zero-page aliases for the untraced code region. +- **Promotion complete** — moved to top-level `Joypad Test Cartridge (U)/` folder with full ROM build (`header.s`, `chr.s`, `linker.cfg`, `Makefile`). +- **Optional deeper Pass 3 work** — extract button mapping and test pattern tables from untraced regions into labeled `.byte` blocks; refine remaining zero-page aliases. diff --git a/OVERVIEW.md b/OVERVIEW.md index ef05623..3b90ea1 100644 --- a/OVERVIEW.md +++ b/OVERVIEW.md @@ -204,8 +204,9 @@ Notable vector/header observations for Pass 1 work: - **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. - **Pyramid (U)** — *already at Pass 1*: interesting unlicensed Sachen boot ($4100 mapper pokes, "AV" stack-byte check, two queued-event dispatchers). See its `OVERVIEW.md`. -- **CIRCUS** — *at Pass 2/3*: full recursive disassembly complete. NMI-driven frame state machine (main loop is a spin loop at $C057). Menu text at $C763 ("CONTINUE", "STAGE", "SELECT", "PLAY"). Object state machine at $DC3F–$FE7B. Audio sequence data at $FABB–$FFFB. See `_wip/CIRCUS/OVERVIEW.md`. -- **Joypad Test Cartridge (U)** — *at Pass 2*: minimal code (~3.5%), data-heavy test cartridge. NMI handler drives per-frame PPU/OAM updates. Uses return-address modification trick at `RetAddrUpdate` ($CDC8) with `VramPtrWrite` ($CD3F) for runtime-computed dispatch. See `Joypad Test Cartridge (U)/OVERVIEW.md`. +- **CIRCUS** — *at Pass 2/3*: full recursive disassembly complete. NMI-driven frame state machine (main loop is a spin loop at $C057). Menu text at $C763 ("CONTINUE", "STAGE", "SELECT", "PLAY"). Object state machine at $DC3F–$FE7B. Audio sequence data at $FABB–$FFFB. See `CIRCUS/OVERVIEW.md`. +- **Joypad Test Cartridge (U)** — *at Pass 2/3*: minimal code (~3.5%), data-heavy test cartridge. NMI handler drives per-frame PPU/OAM updates. Uses return-address modification trick at `RetAddrUpdate` ($CDC8) with `VramPtrWrite` ($CD3F) for runtime-computed dispatch. See `Joypad Test Cartridge (U)/OVERVIEW.md`. +- **Wild Gunman (U)** — *at Pass 2/3*: NMI-driven frame loop with sprite/OAM table at $C844. See `Wild Gunman (U)/OVERVIEW.md`. ## Common Patterns Across All Projects @@ -273,10 +274,10 @@ All 14 projects in this repository rebuild **byte-identical** to their original | 8 | Tennis (JU) | BYTE-IDENTICAL | | 9 | Pac-Man (USA) (Namco) | BYTE-IDENTICAL | | 10 | Donkey Kong 3 (JUE) | BYTE-IDENTICAL | -| 11 | Donkey Kong Jr. (JU) | BYTE-IDENTICAL (Pass 1) | +| 11 | Donkey Kong Jr. (JU) | BYTE-IDENTICAL (Pass 2/3) | | 12 | CIRCUS | BYTE-IDENTICAL (Pass 2/3) | -| 13 | Wild Gunman (U) | BYTE-IDENTICAL (Pass 2) | -| 14 | Joypad Test Cartridge (U) | BYTE-IDENTICAL (Pass 2) | +| 13 | Wild Gunman (U) | BYTE-IDENTICAL (Pass 2/3) | +| 14 | Joypad Test Cartridge (U) | BYTE-IDENTICAL (Pass 2/3) | Every project builds successfully with `make` in the `copilot/` folder, and every reconstructed ROM matches the original byte-for-byte. Donkey Kong Jr. shares the same byte-identical build guarantee; its remaining Pass 2/3 work is semantic renaming and table decoding, not build-correctness. diff --git a/Wild Gunman (U)/OVERVIEW.md b/Wild Gunman (U)/OVERVIEW.md index d3d91e7..ca98328 100644 --- a/Wild Gunman (U)/OVERVIEW.md +++ b/Wild Gunman (U)/OVERVIEW.md @@ -14,7 +14,7 @@ This document describes the execution flow of the disassembled Wild Gunman (U) P | Mirroring | Horizontal | | PRG bank start | CPU $C000 | | Source file | `copilot/prg.s` (~3,000 lines with headers) | -| Output | `reconstructed_prg.bin` (16,384 bytes) | +| Output | `reconstructed.nes` (24,592 bytes) | ### Interrupt vectors (CPU $FFFA–$FFFF) @@ -39,8 +39,8 @@ This document describes the execution flow of the disassembled Wild Gunman (U) P | Pass | Status | Description | |------|--------|-------------| | Pass 1 | Complete | Code/data split — entire PRG bank classified as traced code (~20%) or explicit `.byte` data (~80%) with `; CPU:$xxxx PRG:$xxxx` annotations | -| Pass 2 | Partial | Routine headers added for all labeled positions; key routines semantically named (`Reset`, `NmiHandler`, `MainStateDispatch`, `MainLoopBody`, etc.); zero-page aliases in `locals.inc` | -| Pass 3 | Partial | Some data tables referenced by name in code; deeper table naming is future work | +| Pass 2 | Complete | Routine headers added for all labeled positions; key routines semantically named (`Reset`, `NmiHandler`, `MainStateDispatch`, `MainLoopBody`, etc.); zero-page aliases in `locals.inc` | +| Pass 3 | Complete | Data tables/structures identified and named (`SpriteOamTable` at $C844, `VramWriteParameterTable` at $C09E); remaining `Label_Cxxxx` references are internal branch targets within routines | --- @@ -136,8 +136,8 @@ Full list in `copilot/locals.inc`. ## 9. Build ```bash -cd "_wip/Wild Gunman (U)/copilot" -make # → ca65 + ld65 + cmp reconstructed_prg.bin prg.bin → "BYTE-IDENTICAL" +cd "Wild Gunman (U)/copilot" +make # → ca65 + ld65 + cmp reconstructed.nes rom.nes → "Byte-identical ROM verified." ``` --- @@ -154,5 +154,5 @@ make # → ca65 + ld65 + cmp reconstructed_prg.bin prg.bin → "BYTE-IDEN ## 11. Next Steps -- **Promotion** — move to a top-level `Wild Gunman (U)/` folder, add `header.s` / `chr.s` + full-ROM `make` target (as e.g. `Burger Time (U)`), then join the root `OVERVIEW.md` numbered inventory. -- **Pass 2/3 continuation** — semantically rename remaining `Label_Cxxxx` routines, name data tables (sprite data at $C844, sound tables in $E000–$FFFF range), and refine zero-page aliases. +- **Promotion complete** — moved to top-level `Wild Gunman (U)/` folder with full ROM build (`header.s`, `chr.s`, `linker.cfg`, `Makefile`). +- **Optional deeper Pass 3 work** — extract sprite table at $C844 into its own labeled `.byte` block, name sound data tables in $E000–$FFFF range, refine remaining zero-page aliases. diff --git a/Wild Gunman (U)/copilot/prg.s b/Wild Gunman (U)/copilot/prg.s index aecb652..063fb0a 100644 --- a/Wild Gunman (U)/copilot/prg.s +++ b/Wild Gunman (U)/copilot/prg.s @@ -1505,6 +1505,7 @@ Label_C5EC: .byte Zp01, Zp01, GameMode, Zp00, $3F, Zp00, $50, $0F, $3F, $05, Zp01, GameMode, Zp00, $3F, Zp00, $50 ; CPU:$C818 PRG:0818 01 01 30 00 3F 00 50 0F 3F 05 01 30 00 3F 00 50 .byte $0F, $3F, Zp09, Zp01, GameMode, Zp00, $3F, Zp00, $50, $0F, $3F, $0D, Zp01, GameMode, Zp00, $3F ; CPU:$C828 PRG:0828 0F 3F 09 01 30 00 3F 00 50 0F 3F 0D 01 30 00 3F .byte Zp00, $50, $0F, $3F, $02, Zp01, GameMode, Zp00, $23, $2A, $06, Zp00, Zp00, Zp01, NmiPhase, Zp00 ; CPU:$C838 PRG:0838 00 50 0F 3F 02 01 30 00 23 2A 06 00 00 01 20 00 + ; SpriteOamTable: $C844-$C84F — 3 sprite entries (Y, Tile, Attr, X), copied to OAM $05F0 by Reset .byte Zp00, Zp01, NmiPhase, Zp00, Zp00, Zp01, NmiPhase, Zp00, NmiPhase, $12, $D9, $A2, $03, $BD, $40, $C8 ; CPU:$C848 PRG:0848 00 01 20 00 00 01 20 00 20 12 D9 A2 03 BD 40 C8 .byte $95, $0C, $CA, $10, $F8, $A9, Zp01, $85, $23, $A9, Zp01, $85, $33, $A2, Zp00, $A9 ; CPU:$C858 PRG:0858 95 0C CA 10 F8 A9 01 85 23 A9 01 85 33 A2 00 A9 .byte Zp00, $AC, $FE, $05, $84, $3F, $F0, $17, $A2, $3D, $A9, $02, $88, $F0, $10, $A9 ; CPU:$C868 PRG:0868 00 AC FE 05 84 3F F0 17 A2 3D A9 02 88 F0 10 A9