# Documents Read in this order. | Document | What it holds | | --- | --- | | [start-here.md](start-here.md) | The 65C816 vs the 5A22; registers; emulation vs native mode and how emulation mode differs from an NMOS 6502; the instruction set; 24-bit addressing; the bus as the 5A22 sees it (VDA/VPA/VPB/MLB, 6/8/12 master clocks); interrupts, WAI, STP, MVN/MVP, decimal mode; what the core does not own | | [timing.md](timing.md) | The datasheet's Table 5-7 measured against every SingleStepTests case; every addressing mode's cycles with address and kind; the extra-cycle notes; interrupt sampling; MVN/MVP, WAI/STP in the corpus | | [undocumented-behavior.md](undocumented-behavior.md) | Items U1-U14 (emulation-mode wrapping, the `(d,x)` quirk, widths, MVN, decimal, interrupts, WAI/STP, reset, WDM, IO addresses), contradictions C1-C8 between sources, open items | | [validation.md](validation.md) | Every oracle by tier with pins; what was run here and what it showed; the rung plan; the minimal harness | | [mame-oracle.md](mame-oracle.md) | The verified MAME 0.285 recipe with a free substitute S-SMP boot ROM, its trace format, how MAME scores on the CPU tests | | [handoff-brief.md](handoff-brief.md) | The task for the session that builds the core: the user's decision to build on 6502-python's frame, the bus contract, what the frame provides, the NMOS behaviours not to carry over, rungs, tooling, open decisions | ## Findings made while gathering (2026-10-21) These came from running things, not from any single document: 1. **WDC's Table 5-7 and SingleStepTests 65816 agree on the cycle count of all 5,080,400 corpus cases**, every opcode in both modes, read literally from the datasheet with no emulator knowledge, and on the VDA/VPA/VPB/RWB/MLB kind of every cycle except in three opcodes (`JMP (a,x)`, `JSR (a,x)`: datasheet VPA, corpus VDA; `WDM`). Every address disagreement (1,095 cases) is an emulation-mode wrapping rule the table does not show. So the bus schedule has a manufacturer source checked at volume, unlike the SM83's. 2. **The corpus's emulation-mode initial S is not normalised**: SH is often not $01, and the generator forces it at execution. A harness must set it. 3. **SingleStepTests lacks the emulation-mode `(d,x)` quirk** (high pointer byte wrapped within the page when D.l ≠ 0) that gilyon's cputest tests and bsnes, ares, Mesen2 and MAME implement; and it has no case at all of `(d)`/`(d),y`/`[d]` at the page end with D.l = 0 in emulation mode. 4. **MAME 0.285 passes every CPU test ROM tried**: krom's 23 (all rows PASS) and gilyon's cputest-full (1,610 tests) and -basic (1,107). It does not model DRAM refresh, so its cycle totals drift 40 master clocks per scanline from hardware. 5. **No Nintendo boot ROM is needed.** MAME's `snes` driver runs with a wrong-checksum `spc700.rom`; a 54-byte clean-room S-SMP IPL written here from the documented protocol boots Super Mario World to its title and attract demo, and a 5-second trace of it is 4.18 million instructions. 6. **bsnes and the datasheet disagree on the emulation-mode RMW modify cycle** (bsnes: no write; datasheet note 17 and the corpus: a write with VDA = 0), which matters on the SNES only for RMW on I/O registers in emulation mode; and bsnes turns an implied instruction's IO cycle into a read before an interrupt, a timing rule no test here shows. 7. **No transistor-level or die-traced 65C816 exists** to settle C1-C5; srg320's P65C816 VHDL (hand-written, FPGA-proven) analyses cleanly in GHDL 7 and exposes VDA/VPA/VPB/MLB, so it can become a third opinion.