# Handoff, end of 2026-09-24 State of play at commit `2df119c`, pushed, working tree clean, `main` level with `origin/main`. Both suites green: **104 passed, 1 deselected** on PyPy 7.3.23 and CPython 3.14.4; `ruff format` and `ruff check` clean. Read [start-here.md](start-here.md) first for the project's shape and [handoff-brief.md](handoff-brief.md) for the milestones and the working agreement. This file is only what a fresh session needs to pick up from here. ## Where the board is Milestones 1-8 are done and certified ([validation.md](validation.md)). Milestone 8 was a measuring milestone, and four of the changes below came out of triaging what it measured rather than from the milestone itself. | commit | what | | --- | --- | | `04ea242` | milestone 8: the sweep, both triage passes, their write-ups | | `9a86b5c` | an oversize image is marked unsupported instead of silently truncated | | `3ddd770` | `load_image` takes the cartridge, not a zip's first member | | `f9828db` | the renderer keeps two buffers; the `$A130F0` conflict settled | | `4e98af3` | Krikzz's Extended SSF mapper | | `cd3200e` | BlastEm's event log read; what it says about Earthion | | `2df119c` | that reader's 32-bit counter fixed | The sweep's current figures: **2,072 of 2,673 present cartridges (77.5%)** draw a picture identical to MAME's or identical a frame or two either side; 1,610 `same`, 462 `phase`, 261 `differs`, 243 `mame-board`, 75 `unsupported`, 16 `size`, 5 `lockup`, 1 `error:`, 841 `missing` (broken symlinks in the romset). **Do not quote a single headline without its basis.** Against the boards the emulator models the figure is 79.8%, and it *fell* from 80.3% when the Extended SSF mapper landed, because nineteen cartridges left `unsupported` and seventeen of those are games the board now runs and MAME cannot score. Both bases and the reason are in [validation.md](validation.md). ## What is open 1. **Overdrive 2's four wrong frames** (7,200, 8,400, 9,000, 10,800). All four are **confirmed still broken by eye** on the double-buffered renderer, so they are a real rendering fault and not the capture bug. Everything needed to chase them is in place and validated; the diff itself is not started. See "How to chase Overdrive 2" below. *(Corrected later on 2026-09-24, docs/worklog.md "Session 9": "broken by eye" had no reference behind it. BlastEm's own picture, taken through its libretro core, shows that **8,400, 9,000 and 10,800 are not broken** -- their "plaid" is the B-masked debug-register effect the demo means, and the board draws it as BlastEm does. **7,200 was broken**: it is inside a fractal zoom (frames 7,066-7,598) that sets the vertical scroll every line, and the board drew each line from VSRAM as it stood instead of from the once-a-line latch. That is fixed and measured on Nuked-MD (docs/undocumented-behavior.md, VDP item 23).)* 2. **`docs/polish.md` has one row left**: an odd initial PC raises out of `System.__init__` where a real 68000 would take an address error during reset processing, double-fault and halt. It is a decision about how a class of bad dump is reported, which is why it was left for the user. 3. **Item 21** is *resolved*, not open: the board's DMA rate is the Manual's to a ratio of 1.00. *(Corrected later on 2026-09-24: "BlastEm is the outlier" is withdrawn. The factor of two was the reader's clock unit, below; read right, BlastEm agrees within 5 %.)* Do not reopen it as a board bug. 4. Milestone 9 (the desktop frontend) is unblocked -- the renderer's two buffers were its prerequisite -- and milestone 10 is optional. ## The instruments, and the traps in them Three instruments produced wrong readings before they were checked. Every one of those readings was reported as a finding first and withdrawn afterwards. **Validate the instrument before drawing a conclusion from it.** - **`scripts/blastem_events.py`** reads BlastEm's event log (`blastem -b N -e FILE`). `Event.cycle` is absolute time; `Reader.raw` is the 32-bit counter BlastEm holds, which wraps and which `EVENT_ADJUST` deducts from. `EVENT_FLUSH` is **not** a frame marker (it is an output-buffer flush whose count merely lands near the frame count); use `Reader.frame_of`. A cycle is **one master clock** *(corrected later on 2026-09-24: this line said half a master clock, which doubled every frame number)*, and **`-b N` runs N/2 frames**: ask for twice what you want. The reader consuming the body exactly is what says the decode is right. - **A distinct-row count does not find a corrupted frame, and is inverted.** The four Overdrive 2 frames confirmed broken score 0.226-0.620 on periodicity while a *correct* grey cube on black scores 0.892: a mostly-black scene is hugely self-similar and a dense plaid has every row distinct. Pixel statistics do not separate these. Do not revive this; use a reference. - **Comparing instantaneous VDP registers says nothing** for a game with raster effects. Earthion's registers 0, 10, 12 and 13 differ between the board and BlastEm after 600 frames purely by sampling phase. Compare streams, not snapshots. - **Frame number is not a common clock.** The board and BlastEm are at different points in a game at the same frame count. Align on write-stream position. ## How to chase Overdrive 2 Everything below is done and checked; the diff is the next step. - The demo is **PAL only** (`MACHINES["megadrive"]`), 12,000 frames = 240 s, and runs in about 420 s with `board.fm.enabled = False`. - **BlastEm's reference log exists and reads correctly**: 20,545,852 events over **12,002 frames**, decoding to byte 76,821,806 of 76,821,806. *(Corrected later on 2026-09-24: that log holds **6,001** frames and ends before frame 7,200, so it never contained a broken frame. `-b 24000` gives the whole demo: 65,160,157 events over 12,001 frames, 211,063,218 bytes. See docs/worklog.md, "The BlastEm clock".)* Regenerate with `blastem -b 12000 -e FILE "Overdrive 2 ... .md"` from a directory holding *only* that image -- a `*.md` glob in a directory with two images picked the wrong one once already. - **A VRAM replay of that log is faithful, and this was validated rather than assumed.** The risk was that BlastEm logs the register writes that trigger a DMA but not the bytes it moves. Earthion settles it: the board's **380,340 VRAM byte writes are identical to BlastEm's, address and value, in order**, with no address transform. So replaying the log's VRAM events reconstructs VRAM faithfully, and `_vram_write_byte`'s address is the convention the log uses. - The diff to build: rebuild BlastEm's VRAM/CRAM/VSRAM at a chosen point, compare against the board's, and walk back from frame 7,200 to the first point where the **data** diverges -- not the picture. No heuristic anywhere in that chain. - **Align on write-stream position, not frame number** (item 21), and show the alignment holds before diffing anything. ## Things that are settled, so they are not re-litigated - **`$A130F0` on Extended SSF carts is the Sega mapper's SRAM control**, as MAME has it and against krikzz's own document, because the games were observed ([undocumented-behavior.md](undocumented-behavior.md) item 20). krikzz's document describes his Everdrive flashcart; a pressed cartridge is not that. - **The board's DMA rate is the Manual's**, ratio 1.00 (item 21). - **BlastEm is a detector**, never a judge, however good it is. The tier rule is not negotiable ([validation.md](validation.md)). - **Its framebuffer backend does not build** at the pinned revision and was deliberately not patched: a patched oracle stops being an independent one. Its debugger is unusable headless (it spawns a terminal emulator). The event log is the way in. ## Working agreement, the parts easiest to forget - Commits use `git -c user.name=alewman -c user.email=alewman@gmail.com`. - Never commit ROMs, BIOS images, saves, traces, recordings, fetched material or referee builds. `reference/` and `tests/compat/` are gitignored; keep it that way. - Never copy GPL/AGPL/LGPL/non-commercial code. Read it, cite it by file and line, write our own. - `/data/emu/source` is master and regeneration is deterministic: never hand-fix a generated romset. That is rom-farmer's job, a different project. - Shared machine: `nice`, at most 16 parallel processes, delete large intermediates. Never use `until ! pgrep -f X` wait loops -- they match their own shell and hang. - Verify before pushing, on **both** interpreters. Piping `pytest` through `tail` means no output appears until the pipeline exits, so an empty output file is not a signal.