# Documents Read in this order. | Document | What it holds | | --- | --- | | [start-here.md](start-here.md) | The HG51B169 as a core author needs it: registers and operand codes, the instruction encoding (byuu's and fullsnes names), flags, the cache/page/jump model, the bus port, data RAM and the computable data ROM, the S-CPU's $6000-$7FFF map, the boundary | | [timing.md](timing.md) | The 20 MHz clock and its exact ratio, what costs what in ares and in closed-box Mesen2 runs, what the S-CPU sees while the chip owns the ROM bus, the board's synchronisation, what the program uses, the oracle runs | | [undocumented-behavior.md](undocumented-behavior.md) | U1-U21 (what the sources agree on) and C1-C18 (where they disagree), each with tier, program evidence, closed-box observations and the default | | [validation.md](validation.md) | Every oracle by tier, what does not exist, the game's built-in test and what it can see, the rung plan, what no judge decides, the minimal harness | | [mame-oracle.md](mame-oracle.md) | MAME 0.285 (HLE only: host stream and screens) and Mesen2 2.1.1 (LLE, closed box: screens, per-instruction trace, host stream, probe cartridges): recipes, traps, the replay design | | [claims.md](claims.md) | What the core claims and how strongly | | [provenance.md](provenance.md) | Where every part came from, the wave-1 audit and the Wave 2 rewrite (2026-11-19) | | [handoff-brief.md](handoff-brief.md) | The task for the build session: the boundary, the contract, the layout, the rung ladder, tooling, and **Open decisions for Aubrey** | ## Findings made while gathering (2026-11-06) 1. **No manufacturer document, hardware capture, test corpus or die model exists** for the HG51B169 (searched). The instruction set is research (fullsnes) and emulator tier (byuu's model, cited in ares; Mesen2 as a closed box). 2. **The games test the chip themselves**: controller 2 B held at power-on enters "Cx4 TEST" with eight items (INTERFACE REGISTER ... IMMEDIATE ROM). MAME 0.285 and Mesen2 2.1.1 both show eight "OK." on Mega Man X2 (USA); Mesen2 also on X3 (USA) and Rockman X2 (Japan). It checks results, not mechanism: MAME's HLE passes without running an instruction. 3. **The 3 KiB data ROM is computable**: fullsnes' six formulas with truncation reproduce all 1,024 words of MAME's `cx4.bin` dump (SHA-1 a002f4ef..., MAME's CC0 software list); its byte sum 054336h is what the IMMEDIATE ROM test checks. Nothing needs to be brought or committed. 4. **MAME 0.285 has no HG51B CPU**: its Cx4 is HLE. **Mesen2 can trace the Cx4** headless through its trace-logger API (not Lua), and holds controller 2 through the debugger's input override (Lua `setInput` ignores port 2). 5. **One program, three versions**: X2 and X3 retail differ in two words; the Rockman X2 betas carry an earlier program (1,028 words differ). 6. **The models disagree where the program could reach**: the program has three shifted compares feeding JMP GE, where Mesen2's flags for a wide A<<8 differ (C2, OBSERVED by probe in Wave 2); shift counts 24-31 differ (C1); fullsnes' "insert a nop" after MUL implies a latency the program respects (C6). (The 2026-11-06 text drew these from reading Mesen2's and MiSTer's sources, withdrawn in Wave 2.) 7. **The S-CPU loses the ROM while the chip loads its cache or runs DMA** (ares, fullsnes), and the games set the chip's vector bytes equal to the ROM's (C12). ## Findings made while building (2026-11-07) 1. **The games' built-in test passes in the board-free harness**, all eight items, on Mega Man X2 and X3 in every retail region, with the expected values read out of the cartridges' own test code (X2 USA 13:F8B7-13:FBDA; DB 06 for the tables). X2's LDMAC counts the upper 512 KiB twice against the header checksum, X3's does not. Rockman X3 Beta 1's header checksum is 0000h, so its LDMAC fails by its own rule. 2. **The test cannot see any contested behaviour**: all fifteen C-switch alternatives of the time left every item "OK." (eleven remain after Wave 2: the same). 3. **Mesen2 agrees instruction for instruction** in five windows from power-on (boot, the test, X2's title page 3, X2's intro stage, X3's title pages 2 and 4); the one S-CPU-visible difference is new: C18, Mesen2's $7F51 sets the IRQ flag. 4. Three more contested points turned up in the sources: C16 (operand 00h), C17 (which bits make a jump far), C18; and two Mesen2 trace-logger traps (window edges, repeated rows at stop: mame-oracle.md traps 7-12). 5. In the recorded windows the program never reaches C1's counts (register shifts by 2, 4, 6), C2's wide operands, C6's MUL-then-read, or a stack deeper than 3. ## Wave 2 (2026-11-19) The provenance rewrite (provenance.md): GPL and unlicensed sources are closed boxes only. Every bsnes citation now points at ares (ISC); the switch positions that rested only on reading Mesen2's or MiSTer's source were removed, and nine were re-established by running Mesen2 on homebrew probe cartridges (`scripts/cx4_probe.py`, 20 recordings, replayed by `tests/test_mesen_probes.py`). C2, C3 and C9 have no switch now: the observations are recorded in undocumented-behavior.md. No default changed; rung 3 and rung 4 are unchanged.