# Synthetic mapper-235 CIRAM test This is a minimal, original test ROM for the mirroring layer, independent of the Golden Game dumps. It is not a game ROM and is not stored in the repository; the generator is MIT. No emulator source was read. ## What it does 1. Starts with mapper 235, no rendering, interrupts disabled. 2. Optionally writes the game's early latch addresses (`$80E0`, `$8000`) with representative data values. The documented mapper-235 latch uses the address, not the data, so these values must not change mirroring. 3. Writes `$11` to `$2000`, `$22` to `$2400`, `$33` to `$2800`, and `$44` to `$2C00`. 4. Reads back `$2000` twice through `$2007` and paints the screen: | Readback | CIRAM behaviour | Screen | | --- | --- | --- | | `$22` | horizontal: `$2000` aliases `$2400` | green (`$1A`) | | `$33` | vertical: `$2000` aliases `$2800` | red (`$16`) | | `$44` | one-screen: all four alias | blue (`$12`) | | other | unexpected | dark grey (`$0F`) | The acceptance result is **green** for both `--no-latch` and latch variants, at 1 MiB and 3 MiB headers. No data value should turn it red or blue. ## Build ``` python tools/make_mirror_test.py --header-prg 64 --out /m235_1m.nes python tools/make_mirror_test.py --header-prg 64 --no-latch --out /m235_1m_none.nes python tools/make_mirror_test.py --header-prg 192 --out /m235_3m.nes ``` Use `` outside this repository; `*.nes` is ignored and must not be committed. The generator prints the SHA-256 of each image. ## Observed results — 2026-11-17 | ROM variant | Board | Mesen2 | mame_nes | | --- | --- | --- | --- | | 1 MiB, no latch writes | green | green | green | | 1 MiB, latch writes | green | **red** | **red** | | 3 MiB, no latch writes | green | not run | green | | 3 MiB, latch writes | green | not run | **red** | | 1 MiB, header says 3 MiB, body 1 MiB | cannot load | not applicable | **red** | `mame_nes` warns about open bus ranges for the 32 KiB and 6000-7FFF regions; no source was read. Mesen2 was run one process per ROM because a second `InitDll` call in the same process crashes. The board returns `$22` (green) with and without the latch writes: it uses the documented address latch. Both detectors change to vertical on a horizontal-latch address. The address bisection below shows the cause is the M/A13 bit, not the data value; it also explains why a display can be coherent in one write sequence and not another. ### NROM control The same generator with `--mapper 0 --no-latch --mirroring h|v` gives green for horizontal and red for vertical on the board, Mesen2 and mame_nes. The readback/color logic is therefore valid. ### Address bisection One bank-0 latch write, with several data values; the result is the same for `00`, `01`, `80`, `C0`, `8B` and `FF`: | Address | M (A13) | Board | Mesen2 | mame_nes | | --- | --- | --- | --- | --- | | `$8000` | 0 | green | not run | red | | `$80E0` | 0 | green | red | red | | `$C000` | 0 | green | red | red | | `$A000` | 1 | red | green | green | | `$E000` | 1 | red | green | green | | `$8400` | N=1 | blue | blue | blue | Both detectors invert the board's M/A13 sense on this synthetic stimulus; the N/one-screen control is correct in all three. The board matches the documented M=0 horizontal / M=1 vertical ordering. Mesen2's game path is one-screen; its visible frame matches the board, and that is not claimed as a horizontal match. The public NESdev page defines **R=0 = 16 KiB, R=1 = 32 KiB**, but the R/P control (`tools/make_r_test.py`) shows the board, Mesen2 and mame_nes all use the opposite mapping on these dumps: `R=0` gives a 32 KiB pair and `R=1` gives the same 16 KiB bank at both windows. The public note is a different board revision; the current `GoldenGame235` R branch is correct for this dump set. The earlier local branch swap lost the menu because it applied the 150-in-1 revision. ### Direct Mesen2 game PPU memory At frame 600, Mesen2's `nesPpuMemory` returns all four 1 KiB nametable windows identical: **one-screen**. The board is horizontal; its logical `$2000` block is byte-identical to Mesen2's. The menu only uses the shared table, so the visible frames match. mame_nes is vertical and separates the table the menu needs, which is the visible failure. The synthetic M=0/V result is therefore a different Mesen2 mapper path, not the game's one-screen path. The earlier `260-in-1` match is consistent: one-screen aliases the same two nametables that the menu uses, so it can look correct even when the detector's mode is not horizontal. ## Acceptance for a fix A fixed mapper 235 should: - return green for the default M=0 prelude, with and without latch writes; - match the board's address table: `$8000`/`$C000` green, `$A000`/`$E000` red; - return blue for the N=1 `$8400` control; - keep the `R`/`P` bank control matching the board for this dump revision; - do the same at 1 MiB and 3 MiB headers; - ignore latch data values for mirroring; only the address bits (and the header default) select the mode; - keep the game menu/Tetris test passing. This is the regression test to offer upstream. The test ROM/script is MIT; do not send the Golden Game dumps or their screenshots. ## Draft for a friendly detector report > Hi - I made a small synthetic mapper-235 test that writes four nametables and paints green/red/blue for horizontal/vertical/one-screen. The N/one-screen control passes on my board, Mesen2 and mame_nes. For the M bit, the board follows the public table: `$8000`/`$C000` (M=0) green and `$A000`/`$E000` (M=1) red. Mesen2 and mame_nes return the opposite on the same single-write test; the data value does not matter. The same happens at 1 MiB and 3 MiB headers. Is this device intended to invert M, or is the board table correct? The generator and acceptance steps are in `mirror-test.md`; no game assets are needed. Happy to test a build. ## Capture Board: `python tools/run_rom.py --frames 120 --shots 120 --out ` and sample the centre pixel. Mesen2: `famicom_python/scripts/mesen_frames.py --frame 120`, one process per ROM. mame_nes: `mame_frames.mame_frames(, [120])`, one process per ROM. Compare the centre pixel with the table above.