Promote NES PowerPad Test Card (U) from _wip to top-level project

Moves NES PowerPad Test Card (U) from _wip/ to NES PowerPad Test Card (U)/ with full ROM build:
- Adds header.s, chr.s, linker.cfg (HEADER+PRG+CHR segments)
- Updates Makefile to build and verify reconstructed.nes vs rom.nes
- Adds rom.nes copy + copilot/rom.nes symlink per repo convention
- Verified byte-identical build

Pass 1 complete: full code/data classification (~7.2% code / ~92.8% data)
Pass 2 complete: routine headers for all ~50 labels, semantic naming for key
routines (Reset, NmiHandler, VramWrite, ReadPad, ProcessPads, etc.),
zero-page aliases in locals.inc (Zp00-Zp15)
Pass 3 complete: data tables named (PaletteData at ,
PadBitTableLives at )

Root OVERVIEW.md updated:
- Removes NES PowerPad Test Card from _wip skeleton table (21 → 20 skeletons)
- Adds NES PowerPad Test Card as #15 in numbered inventory (BYTE-IDENTICAL, Pass 2/3)
- Updates summary count from 14 to 15 projects
This commit is contained in:
tmerritt committed 2026-10-16 19:24:12 -04:00
1 parent ae3d71cef2
commit 3ef16a6f99
24 files changed
+2800 -88

No files matched your search

+187
View File
@@ -0,0 +1,187 @@
# NES PowerPad Test Card (U) — Game Flow from Power-On
This document describes the execution flow of the disassembled NES PowerPad Test Card (U) PRG bank (16 KB, mapped at CPU **$C000–$FFFF**), starting from power-on. It is based entirely on `copilot/prg.s` in the repository. The rebuild is verified **byte-identical** to the original `prg.bin`.
---
## 1. ROM and Memory Layout
| Property | Value |
|----------|-------|
| Format | iNES |
| PRG | 1 × 16 KB (mapped at CPU $C000–$FFFF) |
| CHR | 1 × 8 KB |
| Mirroring | Horizontal |
| PRG bank start | CPU $C000 |
| Source file | `copilot/prg.s` (~1,650 lines with headers) |
| Output | `reconstructed_prg.bin` (16,384 bytes) |
### Interrupt vectors (CPU $FFFA–$FFFF)
| Vector | Address | Handler |
|--------|---------|---------|
| NMI | $E06E | `NmiHandler` |
| RESET | $E000 | `Reset` |
| IRQ / BRK | $E000 | Reuses `Reset` |
---
## 2. Build Status
`make` in `copilot/` assembles `prg.s` with `ca65`, links with `ld65`, and verifies against `prg.bin`.
**Verification result: BYTE-IDENTICAL** — `reconstructed_prg.bin` matches `prg.bin` exactly (all 16,384 bytes), and `prg.bin` matches the PRG bank of `NES PowerPad Test Cart (U) [!].nes`.
---
## 3. Pass Status
| Pass | Status | Description |
|------|--------|-------------|
| Pass 1 | Complete | Code/data split — entire PRG bank classified as traced code (~7.2%) or explicit `.byte` data (~92.8%) with `; CPU:$xxxx PRG:$xxxx` annotations |
| Pass 2 | Complete | Routine headers added for all labeled positions; key routines semantically named (`Reset`, `NmiHandler`, `VramWrite`, `ReadPad`, `ProcessPads`, etc.); zero-page aliases in `locals.inc` |
| Pass 3 | Complete | Data tables/structures identified and named (`PaletteData` at $E121, `PadBitTableLives` at $E4B4); remaining `Label_Exxxx` references are internal branch targets within routines |
---
## 4. Reset — CPU $FFFC → $E000
**`Reset`** ($E000)
On power-on or reset:
1. Calls a chain of initialization subroutines in sequence:
- `ResetInit` ($E09B): sei/cld, disable PPU rendering, wait for two vblanks
- `ClearRAM` ($E0C9): clear 8 pages of zero-page RAM
- `ClearVRAM` ($E0EB): clear nametable memory
- `LoadPalette` ($E107): load 32 bytes of palette data into PPU palette RAM
- `ClearVRAM_Fill23` ($E142): fill VRAM with $23 (blank tile attribute)
- `InitAPU` ($E16B): initialize APU pulse/triangle channels
- `ClearVRAM_FillFF` ($E187): fill VRAM with $FF
- Five `LoadPatternTable` routines ($E19A–$E1CB): load pattern tables from $F000 region
- `SetPPUCTRL_NMI` ($E219): enable NMI bit in PPUCTRL
2. **Main loop** (`Label_E058` at $E058): calls `ClearScreen` ($E4FA), `WaitForVBlank` ($E092), checks `$07` (frame counter high nibble), loops back to $E000 if zero, otherwise calls `ResetScroll` ($E22D) and jumps back to $E058.
**Key point:** The main loop is driven by vblank waits and frame counter checks. All per-frame work (controller reading, pad processing, screen drawing) happens inside the NMI handler.
---
## 5. NMI / Frame Heartbeat — `NmiHandler` ($E06E)
The NMI fires once per frame:
1. **Save registers** (`PHA / TXA / PHA / TYA / PHA`).
2. Calls `DisableNMI` ($E1FB) — clears NMI bit in PPUCTRL shadow.
3. Increments `Zp03` (frame counter).
4. Reads `PPUSTATUS` ($2002), stores to `Zp02` (vblank flag).
5. Calls `ReadPad` ($E338) — reads controller pad data.
6. Calls `ShiftPads` ($E362) — shifts pad data into state variables.
7. Calls `ProcessPads` ($E398) — processes pad transitions, updates scores.
8. Calls `DrawScore` ($E3E1) — draws score digits.
9. Calls `DrawLives` ($E407) — draws lives indicators.
10. **Restore registers** (`PLA / TAX / PLA / TAY / PLA / RTI`).
---
## 6. Key Subroutines
| Label | Address | Description |
|-------|---------|-------------|
| `Reset` | $E000 | Cold-start initialization and main loop entry |
| `NmiHandler` | $E06E | Per-frame NMI: pad read, process, score/lives draw |
| `WaitForVBlank` | $E092 | Waits for vblank flag, clears it |
| `ResetInit` | $E09B | Cold-start hardware init (PPU, APU, vblank waits) |
| `ClearRAM` | $E0C9 | Clears 8 pages of zero-page RAM |
| `ClearVRAM` | $E0EB | Clears nametable memory with zeros |
| `LoadPalette` | $E107 | Loads 32-byte palette into PPU palette RAM |
| `ClearVRAM_Fill23` | $E142 | Fills VRAM with blank tile value $23 |
| `InitAPU` | $E16B | Initializes APU pulse/triangle channels |
| `ClearVRAM_FillFF` | $E187 | Fills VRAM with $FF |
| `LoadPatternTable1`–`5` | $E19A–$E1CB | Load pattern tables from $F000 region |
| `VramWrite` | $E1CC | Generic VRAM write via indirect pointer |
| `EnableNMI` | $E1F1 | Enables NMI bit in PPUCTRL shadow |
| `DisableNMI` | $E1FB | Disables NMI bit in PPUCTRL shadow |
| `SetPPUCTRL_NMI` | $E219 | Sets NMI bit ($80) in PPUCTRL shadow |
| `ResetScroll` | $E22D | Resets PPU scroll X/Y to zero |
| `InitRoundParams` | $E236 | Initializes round parameters |
| `DrawPlayer1Pad` | $E270 | Draws player 1 pad indicators |
| `DrawPlayer2Pad` | $E2B0 | Draws player 2 pad indicators |
| `ClearRows` | $E2F0 | Clears screen rows with blank tiles |
| `ClearGameVars` | $E32D | Clears game variables $06–$09 |
| `ReadPad` | $E338 | Reads controller pad via shift register |
| `ShiftPads` | $E362 | Shifts pad data into state variables |
| `ProcessPads` | $E398 | Processes pad transitions, updates scores |
| `DrawScore` | $E3E1 | Draws score digits on screen |
| `DrawLives` | $E407 | Draws lives indicators on screen |
| `ShiftVar1`–`4` | $E433–$E47E | Shift pad bits into score accumulators |
| `UpdatePads` | $E47F | Updates pad state, checks button transitions |
| `LoadPatternTable6`–`7` | $E4A0–$E4B3 | Load additional pattern tables |
| `ProcessPadBits` | $E4FA | Process pad bit data for transitions |
| `SetAPUNoise` | $E52E | Sets APU noise channel |
| `ClearAPUNoise` | $E534 | Clears APU noise channel |
| `ClearScreen` | $E53A | Clears screen with blank tile $5F |
---
## 7. Zero-Page Aliases (`locals.inc`)
| Alias | Address | Role |
|-------|---------|------|
| `Zp00` | $00 | PPUCTRL shadow register |
| `Zp01` | $01 | PPUMASK shadow register |
| `Zp02` | $02 | VBlank flag |
| `Zp03` | $03 | Frame counter / NMI tick |
| `Zp05` | $05 | Score/digit temp |
| `Zp06` | $06 | Pad 1 state byte 1 |
| `Zp07` | $07 | Pad 1 state byte 2 |
| `Zp08` | $08 | Pad 1 state byte 3 |
| `Zp09` | $09 | Pad 1 state byte 4 |
| `Zp0A` | $0A | Pad 2 state byte 1 |
| `Zp0B` | $0B | Pad 2 state byte 2 |
| `Zp0C` | $0C | Pad temp / swap variable |
| `Zp0D` | $0D | Pad mode / draw flag |
| `Zp0E` | $0E | Shift counter / temp |
| `Zp0F` | $0F | Delay counter |
| `Zp10` | $10 | VRAM pointer low byte |
| `Zp11` | $11 | VRAM pointer high byte |
| `Zp12` | $12 | Score digit 1 accumulator |
| `Zp13` | $13 | Score digit 2 accumulator |
| `Zp14` | $14 | Score digit 3 accumulator |
| `Zp15` | $15 | Score digit 4 accumulator |
Full list in `copilot/locals.inc`.
---
## 8. Data Tables
| Table | Address | Description |
|-------|---------|-------------|
| `PaletteData` | $E121 | 32-byte palette data loaded into PPU palette RAM |
| `PadBitTableLives` | $E4B4 | 70-byte pad bit lookup table; `DrawScore` reads from offset $0C ($E4C0) |
| Pattern pointers | $F000–$F013 | Pointer pairs loaded by `LoadPatternTable1`–`5` routines |
---
## 9. Build
```bash
cd "_wip/NES PowerPad Test Card (U)/copilot"
make # → ca65 + ld65 + cmp reconstructed_prg.bin prg.bin → "BYTE-IDENTICAL"
```
---
## 10. Notes
- The PRG is approximately 7% code / 93% data. Most of the PRG bank ($C000–$DFFF, $E54F–$FFFF) is $FF-filled test pattern data.
- The NMI handler drives per-frame updates; the main loop (`Reset` at $E058) spins waiting for vblank and frame counter changes.
- `PadBitTableLives` at $E4B4 is a shared lookup table — `DrawLives` reads from base $E4B4, `DrawScore` reads from offset $0C ($E4C0).
- IRQ vector points to $E000 (Reset) and is effectively unused.
---
## 11. Next Steps
- **Promotion** — move to a top-level `NES PowerPad Test Card (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.
- **Optional deeper Pass 3 work** — extract the pattern pointer data at $F000+ into labeled `.byte` blocks; refine zero-page aliases with more specific roles.
@@ -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
$(CA65) -g -o $@ $<
chr.o: chr.s
$(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
cmp reconstructed.nes rom.nes
@echo "Byte-identical ROM verified."
clean:
rm -f *.o reconstructed.nes reconstructed.map reconstructed.lbl
.PHONY: all verify clean
+2
View File
@@ -0,0 +1,2 @@
.segment "CHR"
.incbin "chr.bin"
@@ -0,0 +1,2 @@
.segment "HEADER"
.incbin "header.bin"
@@ -0,0 +1,10 @@
MEMORY {
HEADER: start = $0000, size = $0010, 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;
}
@@ -0,0 +1,24 @@
; NES PowerPad Test Card (U) zero-page aliases - Pass 2
; Semantic names for addresses with observed usage patterns.
Zp00 = $00 ; PPUCTRL shadow register
Zp01 = $01 ; PPUMASK shadow register
Zp02 = $02 ; VBlank flag (set by NMI, cleared by WaitForVBlank)
Zp03 = $03 ; Frame counter / NMI tick counter
Zp05 = $05 ; Score/digit temp
Zp06 = $06 ; Pad 1 state byte 1 (shifted pad data)
Zp07 = $07 ; Pad 1 state byte 2
Zp08 = $08 ; Pad 1 state byte 3
Zp09 = $09 ; Pad 1 state byte 4
Zp0A = $0A ; Pad 2 state byte 1
Zp0B = $0B ; Pad 2 state byte 2
Zp0C = $0C ; Pad temp / swap variable
Zp0D = $0D ; Pad mode / draw flag
Zp0E = $0E ; Shift counter / temp
Zp0F = $0F ; Delay counter
Zp10 = $10 ; VRAM pointer low byte (indirect)
Zp11 = $11 ; VRAM pointer high byte (indirect)
Zp12 = $12 ; Score digit 1 accumulator
Zp13 = $13 ; Score digit 2 accumulator
Zp14 = $14 ; Score digit 3 accumulator
Zp15 = $15 ; Score digit 4 accumulator
File diff suppressed because it is too large. Load diff
@@ -0,0 +1,94 @@
al 00E548 .Label_E548
al 00E53A .ClearScreen
al 00E534 .ClearAPUNoise
al 00E52E .SetAPUNoise
al 00E522 .Label_E522
al 00E514 .Label_E514
al 00E52D .ProcessPadBitsDone
al 00E509 .Label_E509
al 00E4FA .ProcessPadBits
al 00E4B4 .PadBitTableLives
al 00E4AA .LoadPatternTable7
al 00E4A0 .LoadPatternTable6
al 00E49F .UpdatePadsDone
al 00E48F .Label_E48F
al 00E47F .UpdatePads
al 00E47A .Label_E47A
al 00E471 .Label_E471
al 00E46F .ShiftVar4
al 00E46A .Label_E46A
al 00E45F .Label_E45F
al 00E459 .ShiftVar3
al 00E454 .Label_E454
al 00E44B .Label_E44B
al 00E449 .ShiftVar2
al 00E444 .Label_E444
al 00E439 .Label_E439
al 00E433 .ShiftVar1
al 00E424 .Label_E424
al 00E42F .Label_E42F
al 00E41E .Label_E41E
al 00E407 .DrawLives
al 00E3F8 .Label_E3F8
al 00E403 .Label_E403
al 00E3F5 .Label_E3F5
al 00E3E1 .DrawScore
al 00E3D8 .Label_E3D8
al 00E3D1 .Label_E3D1
al 00E3C3 .Label_E3C3
al 00E3B5 .Label_E3B5
al 00E3AE .Label_E3AE
al 00E3A0 .Label_E3A0
al 00E398 .ProcessPads
al 00E37F .Label_E37F
al 00E362 .ShiftPads
al 00E35B .Label_E35B
al 00E34D .Label_E34D
al 00E361 .ReadPadDone
al 00E338 .ReadPad
al 00E32D .ClearGameVars
al 00E326 .Label_E326
al 00E312 .Label_E312
al 00E2FE .Label_E2FE
al 00E2F0 .ClearRows
al 00E2B0 .DrawPlayer2Pad
al 00E270 .DrawPlayer1Pad
al 00E236 .InitRoundParams
al 00E22D .ResetScroll
al 00E219 .SetPPUCTRL_NMI
al 00E1FB .DisableNMI
al 00E1F1 .EnableNMI
al 00E1E3 .Label_E1E3
al 00E1F0 .VramWriteDone
al 00E1D2 .Label_E1D2
al 00E1CC .VramWrite
al 00E1C2 .LoadPatternTable5
al 00E1B8 .LoadPatternTable4
al 00E1AE .LoadPatternTable3
al 00E1A4 .LoadPatternTable2
al 00E19A .LoadPatternTable1
al 00E187 .ClearVRAM_FillFF
al 00E16B .InitAPU
al 00E164 .Label_E164
al 00E150 .Label_E150
al 00E142 .ClearVRAM_Fill23
al 00E141 .ClearPaletteDone
al 00E121 .PaletteData
al 00E113 .Label_E113
al 00E107 .LoadPalette
al 00E0FB .Label_E0FB
al 00E0EB .ClearVRAM
al 00E0DD .Label_E0DD
al 00E0CF .Label_E0CF
al 00E0C9 .ClearRAM
al 00E0B5 .Label_E0B5
al 00E0B0 .Label_E0B0
al 00E09B .ResetInit
al 00E092 .WaitForVBlank
al 00E06E .NmiHandler
al 00E068 .Label_E068
al 00E058 .Label_E058
al 00E02F .Label_E02F
al 00E02B .Label_E02B
al 00E01E .Label_E01E
al 00E000 .Reset
@@ -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
+1
View File
@@ -0,0 +1 @@
../rom.nes
Binary file not shown.
+5 -5
View File
@@ -168,7 +168,7 @@ This document provides a consolidated overview of all NES disassembly projects i
## Skeleton Projects (under `_wip/`)
21 additional ROMs awaiting full disassembly. Each is set up as a Pass-0 skeleton (`default_project.tar.gz`): `copilot/` contains the split `prg.bin`/`header.bin`/`chr.bin`, a symbolic skeleton `prg.s`, and builds **BYTE-IDENTICAL** at the PRG level. Mapper 0 / 16 KB PRG / 8 KB CHR for all.
20 additional ROMs awaiting full disassembly. Each is set up as a Pass-0 skeleton (`default_project.tar.gz`): `copilot/` contains the split `prg.bin`/`header.bin`/`chr.bin`, a symbolic skeleton `prg.s`, and builds **BYTE-IDENTICAL** at the PRG level. Mapper 0 / 16 KB PRG / 8 KB CHR for all.
| Project | Vectors (NMI/RESET/IRQ) | Mir. | Status |
|---------|--------------------------|------|--------|
@@ -184,7 +184,6 @@ This document provides a consolidated overview of all NES disassembly projects i
| `MUSCLE (U)` | $86CB / $8000 / $8764 | H | BYTE-IDENTICAL |
| `Mario Bros (JU)` | $C07D / $C000 / $C000 | H | BYTE-IDENTICAL |
| `Millipede (U)` | $C7F1 / $C735 / $FFF0 | H | BYTE-IDENTICAL |
| `NES PowerPad Test Card (U)` | $E06E / $E000 / $E000 | H | BYTE-IDENTICAL |
| `Pac-Man (Tengen) (U)` | $C0FA / $C033 / $C16A | V | BYTE-IDENTICAL |
| `Pac-Man (U)` | $C0FA / $FF00 / $C16A | V | BYTE-IDENTICAL |
| `Pinball (JU)` | $C1ED / $C000 / $C1ED | H | BYTE-IDENTICAL |
@@ -199,7 +198,7 @@ Notable vector/header observations for Pass 1 work:
- **Pac-Man (U)** RESET at `$FF00` (vector-page tail), while the Tengen variant RESETs at `$C033` — different builds confirmed (PRG bytes differ).
- **MUSCLE (U)** vectors sit in the `$8000-EFFF` window — inconsistent with the `prg.s` skeleton's expected `$C000-$FFFF` mapping; verify the header/image match before Pass 1.
- **Lunar Pool (U)** NMI `$FF65` / IRQ `$FF64` are adjacent in the vector page; RESET `$E80C`.
- **NES PowerPad Test Card (U)** RESET/IRQ both at `$E000`, far from the usual `$C000`-page entries.
- **NES PowerPad Test Card (U)** — *at Pass 2/3*: minimal code (~7.2%), data-heavy test cartridge. RESET at $E000 (non-$C000 entry). NMI handler reads controllers via shift register, processes pad transitions, draws score/lives. See `NES PowerPad Test Card (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.
@@ -278,7 +277,8 @@ All 14 projects in this repository rebuild **byte-identical** to their original
| 12 | CIRCUS | BYTE-IDENTICAL (Pass 2/3) |
| 13 | Wild Gunman (U) | BYTE-IDENTICAL (Pass 2/3) |
| 14 | Joypad Test Cartridge (U) | BYTE-IDENTICAL (Pass 2/3) |
| 15 | NES PowerPad Test Card (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.
All 15 projects in this repository rebuild **byte-identical** to their original ROMs:
The 21 `_wip/` skeleton projects above also all rebuild byte-identical (PRG level); all Pass 1 work and promotion to this index's numbered inventory is future work.
The 20 `_wip/` skeleton projects above also all rebuild byte-identical (PRG level); all Pass 1 work and promotion to this index's numbered inventory is future work.
@@ -1,53 +0,0 @@
# NES PowerPad Test Card (U) — Skeleton Project
ROM: `_wip/NES PowerPad Test Card (U)/NES PowerPad Test Cart (U) [!].nes` (24,592 bytes, iNES). Status: **SKELETON — not yet disassembled.** The entire 16 KB PRG bank is a single unclassified block; `copilot/prg.s` is the default-project skeleton (`default_project.tar.gz`) that reproduces it as one `.incbin`. The skeleton build is **byte-identical** at the PRG level.
## 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 | Horizontal |
| Battery-backed flag | clear |
| ROM SHA-256 | `4392b68e3bfde3177ebbd717f48e4c12010ce00b70396b552e76ca3746a0f2da` |
| PRG SHA-256 | `e9b8009cb1b218594bfb478111912ee6e2c8db574f8ff8f03a1aaddc064b110c` |
## Interrupt Vectors (taken from PRG $3FFA–$3FFF)
| Vector | Target | Note |
|--------|--------|------|
| NMI | `$E06E` | per-frame heartbeat |
| RESET | `$E000` | non-$C000 entry at $E000 — trace from here in Pass 1 |
| IRQ | `$E000` | redirects to RESET — unused placeholder |
## `copilot/` Contents
| File | Purpose |
|------|---------|
| `NES PowerPad Test Cart (U) [!].nes` | original ROM image (reference) |
| `prg.bin` / `header.bin` / `chr.bin` | split image, produced by `_tools/splitnes.py` |
| `prg.s` | Pass-1 skeleton: `.incbin "prg.bin", $0000, $4000` (whole PRG) |
| `symbols.inc` | shared NES hardware constants (PPU/APU/controller, from the skeleton) |
| `locals.inc` | project-local zero-page aliases — empty for now (filled in Pass 2) |
| `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/NES PowerPad Test Card (U)/copilot"
make # → cmp reconstructed_prg.bin prg.bin → "BYTE-IDENTICAL"
```
## Next Steps (per `PROMPTS.md`)
1. **Pass 1** — replace the blanket `.incbin` with classified code/data: trace reachability from RESET ($E000) and NMI ($E06E), emit per-instruction `; PRG:$xxxx AA BB` annotations, keep unreached bytes as explicit `.byte` blocks.
2. **Pass 2** — replace `Label_`/`Sub_` names with semantic routine names; fill `locals.inc`.
3. **Pass 3** — name data tables/structures; release provisional flags.
4. **Promotion** — move to a top-level `<name>/copilot/` folder, add 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.
@@ -1,10 +0,0 @@
all: reconstructed_prg.bin verify
prg.o: prg.s symbols.inc prg.bin
ca65 -g -o $@ prg.s
reconstructed_prg.bin: prg.o linker.cfg
ld65 -C linker.cfg -m reconstructed.map -Ln reconstructed.lbl -o $@ prg.o
verify: reconstructed_prg.bin prg.bin
cmp reconstructed_prg.bin prg.bin
@echo BYTE-IDENTICAL
clean:
rm -f prg.o reconstructed_prg.bin reconstructed.map reconstructed.lbl
@@ -1,6 +0,0 @@
MEMORY {
PRG: start = $C000, size = $4000, file = %O, fill = yes;
}
SEGMENTS {
PRG: load = PRG, type = ro;
}
@@ -1,2 +0,0 @@
; NES PowerPad Test Card (U) zero-page aliases (declared during Pass 2).
; These intentionally conservative names will be refined in Passes 2 and 3.
@@ -1,12 +0,0 @@
; NES PowerPad Test Card (U) NES disassembly - Pass 1 (skeleton)
; Generated from the supplied 16 KiB PRG image.
; Pass 1 classifies recursively reachable code, inline address tables, vectors,
; and untraced/data regions. All PRG data bytes are emitted explicitly with .byte directives.
.setcpu "6502"
.include "symbols.inc"
.include "locals.inc"
.segment "PRG"
.incbin "prg.bin", $0000, $4000
Whitespace-only changes.