# Results: what was measured, against what, with how many differences Every number here was produced by a command in this repository on 2026-11-12, on CPython 3.14.4 (`.venv`) and PyPy 3.11.13 / 7.3.20 (`.venv-pypy`, `PYPY_GC_NURSERY=1M`), on the shared machine (load average 40+). Tier and judge per rung are in [validation.md](validation.md) and [handoff-brief.md](handoff-brief.md); what the numbers cannot decide is in [claims.md](claims.md). ```sh .venv/bin/python -m pytest -q # rungs 0-3, 5 (and 4's checks) PYPY_GC_NURSERY=1M .venv-pypy/bin/python -m pytest -q python -I validation/mame_replay.py tests/mame_traces/ # rung 2/5 detail python -I validation/synthetic.py record|compare # rung 2 synthetic streams python -I validation/vatt.py fit|check # rung 4 python -I validation/faults.py # rung 6 python -I validation/speed.py # rung 7 ``` ## Rung 0: tables `tests/test_rung0_tables.py`, 30 tests (34 until 2026-11-19, when the four-case openMSX detector test was deleted: it read GPL source): variants, table 3-3 (both columns sum to 342), register masks (figure 2-3), table 2-3 spot rows, the schedule derived from TI's 1978 drawing alone ([schedule.md](schedule.md), `src/tms9918_python/_schedule.py`, provenance wave 2): 19 / 51 / 91 / 107 CPU windows a line in Graphics, Multicolor (one-in-four, aside), Text and refresh mode; TI 2.1.5's "once every 16 memory cycles", "at least once out of every three" (Text) and one in four (Multicolor, active area) hold. The wave-2 derivation equals the earlier table (whose reading had openMSX's tables in view) at every slot of every schedule: 0 differing slots. MacDonald's 4K mux, the 4K roll-over, table 3-2's derivations and TI 3.3's worked example. Passes on both interpreters. ## Rung 1: registers and ports `tests/test_rung1_ports.py`, 45 tests (the status-race switch's included), each citing its sentence (TI 2.1-2.3, Young 2, MacDonald, Guttag 1982). With windows on, table 2-2's totals hold: the worst landing time of a data write over every dot of an active Graphics line is between 6 and 8 us, of a Text line at most 3.1 us, and with BLANK = 0 or in the vertical border at most the 2 us delay plus one window. C1, C2, C11 decided in [claims.md](claims.md). Passes on both. ## Rung 2: pictures on register streams (windows off) ### MAME game logs ([mame-oracle.md](mame-oracle.md)) | Log | Accesses | VRAM bytes differing from `vram.bin` | Snapshot pixels differing (of 49,152) | Data reads equal | Status reads equal | | --- | ---: | ---: | ---: | --- | --- | | coleco Zaxxon 5 s (BIOS title) | 17,785 | 0 | 0 | - | 1 of 1 | | coleco Zaxxon 15 s (menu) | 35,321 | 0 | 0 | - | 3 of 3 | | coleco Zaxxon 20 s (gameplay, sprites over Graphics II) | 93,918 | 0 | 0 | 128 of 128 | 132 of 132 | | sg1000 Flicky 20 s (attract, 5S every frame) | 659,796 | 0 | 0 | 8,355 of 8,355 | 1,107 of 1,108 | All with the core's defaults (C7, C10, C11 as decided, not MAME's), windows off. Time: MAME's beam position at each access, frames unwrapped with `totalcycles`; the core powers on at the start of the frame of MAME's soft reset and its flags are cleared at the reset's moment. The snapshot (MAME's line buffer as it stops, at its first vertical blank after the emulated seconds: MAME line 244, core line 204) is compared with the core's rows at the same moment. Flicky's one differing status read (log line 9458, core line 94, MAME `$9F`, core `$80`): the number bits. MAME keeps the number at 31 internally but its status register shows 0 until the first status read copies 31 in; the core powers on with 0 (U4). With `power_on_status=0x1F` that read agrees and the first read (log line 21) differs instead (MAME `$80`, core `$9F`): the difference is MAME's bookkeeping against U4, not a sprite rule. ### Synthetic streams (validation/synthetic.py) Thirteen SG-1000 images built here (pseudo-random 16K VRAM, sprites placed to hit 5S, EC, the terminator, transparency, bleed-in and line 192) were run through MAME (2 s each) and replayed into the core and into sms-python's TMS9918A row (`../sms-python` `vdp.py`, unchanged since `3f26bc3`, read-only). | Case | Mode | VRAM vs MAME | Pixels vs MAME | Pixels vs sms-python | Attribution | | --- | --- | ---: | ---: | ---: | --- | | g1 | Graphics I, 8 x 8 sprites | 0 | 0 | 0 | | | g1-mag16 | Graphics I, 16 x 16 magnified | 0 | 0 | 0 | | | g2 | Graphics II, full tables | 0 | 0 | 0 | | | g2-r4mask | Graphics II, R4 = 0, R3 = $9F | 0 | 0 | 0 | | | g2-c3 | Graphics II, R3 = $83 | 0 | 0 | 19,517 | C3: sms-python does not mask patterns with R3 | | mc | Multicolor | 0 | 0 | 0 | | | text | Text | 0 | 0 | 0 | | | text-g2 | Text + Graphics II | 0 | 0 | 0 | | | mc-g2 | Multicolor + Graphics II | 0 | 39,786 | 45,443 | MAME: `(charcode + row) << 3` (with it patched in for this mode the core gives 0); sms-python ignores M3 here | | bogus | M1+M2 | 0 | 0 | 23,084 | sms-python draws text from the tables; Young 3.7 and MAME: bars | | bogus-all | M1+M2+M3 | 0 | 0 | 23,311 | as above | | blank | BLANK = 0 | 0 | 0 | 0 | | | g1-4k | Graphics I, never 16K | 16,301 | 43,575 | 43,575 | C11 (with `roll_over_4k=False, mux_4k=False`: 0 and 0) | Every differing pixel is attributed. Passes on both interpreters (the replays run inside `tests/test_rung2_pictures.py`). ## Rung 3: sprite rules `tests/test_rung3_sprites.py`, 18 tests (four a line, 5S and number with the F gate, the number with no fifth sprite, 5S on line 192 (C5), terminator, Y = -1 / bleed-in / $E0, EC, SIZE and MAG, priority and transparency, C on and off screen (C7) with the detectors' rule as a switch, a dropped fifth sprite never colliding, Text and BLANK with no sprites, C during the line (U10), sprite bytes fetched the line before). Flicky's status values: 1,107 of 1,108 equal to MAME's log, the one difference U4 (above). Passes on both. ## Rung 4: access windows against VATT (tier 3) `validation/vatt.py` plays VATT's burst (256 writes from an unrolled loop of period P MSX Z80 clocks, i.e. P x 3 master clocks, after a slow reference fill) into the core with windows on, at 64 start positions spread over the frame, sprites hidden with Y = 208 as VATT does, and averages the percentage that lands. Hardware: VATT's raw sheet, the rows with a Texas Instruments part (TMS9918A/ANL, TMS9928A, TMS9929/9929ANL, TMS9118/9128; T6950 and YM2220 rows excluded): 100 rows = 21 machine-and-owner entries with the display on and 4 with it off, each in four modes. **The fit** (`vatt.py fit`, then 64 phases at 13-17), 60 Hz Graphics II, periods outside the hardware spread out of 16 and the summed distance outside it: | `lost_access` | delay 0 | 8 | 12 | 13 | 14 | 15 | **16** | 17 | 20 | 22 (2.05 us) | 28 | 40 | | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | | newer | 9 / 39.8 | 9 / 27.0 | 9 / 15.9 | 8 / 12.7 | 8 / 11.3 | 6 / 11.0 | **4 / 11.7** | 6 / 13.9 | 11 / 30.3 | 12 / 44.2 | 13 / 89.6 | 16 / 237 | | older | identical to newer at every delay | | | | | | | | | | | | | restart | 9 / 39.8 | 8 / 21.3 | 10 / 38.0 | | | | 8 / 66.5 | | 12 / 111 | 13 / 137 | 15 / 223 | 16 / 471 | (Columns 13-17 with 64 phases, the rest with 16.) "newer" and "older" land the same count in every case: VATT cannot tell them apart (U3). "restart" cannot reach hardware's 12 T figure with any delay that also loses writes at 26 T. Default: `newer`, 16 master clocks (1.49 us). TI's 2 us (21.5) fits worse. **Multicolor (C9).** With colour slots as CPU windows (TI table 2-2's one-in-four reading, `MULTICOLOR_ONE_IN_FOUR`) the emulated VATT lands 91.7 % at 12 T and 99.0 % at 22 T on 60 Hz, against hardware's 65-78 % and 92-95 %: 10 of 16 periods outside, by 86.7 points in sum. With the Graphics schedule it lands the same as Graphics II (4 outside). The core uses the latter. **Sprite slots.** Giving the vertical-check slots after the terminator to the CPU lands 100 % at every period (hardware 64-78 % at 12 T): ruled out. Giving the 24 attribute and pattern slots to the CPU: at best 5 of 16 outside: not better, not ruled out. **The check** (`vatt.py check`, default model, 32 phases; hardware lowest-highest with the number of rows): | Rate, display | Mode | Periods outside / measured | Largest distance | Where | | --- | --- | --- | --- | --- | | 60 Hz on | Text | 0 / 13 | - | 100 % everywhere, as hardware | | 60 Hz on | Graphics I | 5 / 16 | 3.5 | 14 T (75.7 vs 70-73, 3 rows), 18 T (84.9 vs 88-89, 2), 19 T (86.5 vs 90, 1), 20 T (89.5 vs 91, 1), 24 T (94.1 vs 93-94, 15) | | 60 Hz on | Graphics II | 4 / 16 | 4.5 | 14 T (vs 70-73), 18 T (vs 88), 19 T (vs 91), 20 T (vs 91) | | 60 Hz on | Multicolor | 4 / 16 | 3.5 | 14, 18, 19, 20 T | | 60 Hz off | all four | 0 / 13 each | - | 100 % everywhere | | 50 Hz on | Text | 0 / 9 | - | | | 50 Hz on | Graphics I | 7 / 14 | 2.4 | 12 T (74.2 vs 70-74, 3 rows), 14, 17, 18, 19, 20 T (single rows), 22 T (94.4 vs 95-96, 3) | | 50 Hz on | Graphics II | 7 / 14 | 1.8 | the same periods | | 50 Hz on | Multicolor | 7 / 14 | 9.3 | as Graphics II, the 9.3 at 20 T against the one row's 82 % where its Graphics rows read 92 % | | 50 Hz off | all four | 0 / 9 each | - | | At every period measured on 14 or more machines (60 Hz: 12, 22, 23, 25, 26, 27 T) the core lands inside the hardware spread, except 24 T Graphics I by 0.1; the fastest loop that loses nothing is 27 T, as on hardware (98-100 % at 26 T). **The exit test (inside the spread at every period, all modes) is not met**: of the 90 display-on cells in the pattern modes (rate x mode x period), 34 are outside: 33 at periods measured on 1-3 machines, by at most 4.5 points (9.3 against the 50 Hz Multicolor row that disagrees with its own Graphics rows), and one at 24 T (15 machines) by 0.1. Text and display-off cells: 0 of 70 outside. What would move them: the window positions in the horizontal blank (transcribed by eye) and the 2 us delay are fitted together; hardware rows at the sparse periods would show whether the misfit is real. **Detectors** ([schedule.md](schedule.md)): under the old rule (before 2026-11-19) openMSX's tables were read and equalled the schedule at every slot except Multicolor (C9), and Clock Signal's equalled it in Graphics/Multicolor and Text, refresh mode one memory cycle later. From 2026-11-19 openMSX is run, never read, and the schedule is derived from TI's drawing alone. **Flicky's 93 fast writes** (21-clock spacing during the display): with windows on the core loses **7** (log lines 513716-513735, one burst); the final VRAM and the snapshot still equal MAME's. ## Rung 5: whole-frame replays Six ColecoVision logs (Zaxxon gameplay, Donkey Kong, BurgerTime, Cosmic Avenger, Frogger, Gyruss; keypad 1 pressed at 14 s), six SG-1000 logs (Flicky, Champion Pro Wrestling, the one sms-python's sweep still differs on; Sega-Galaga, Zaxxon, Doki Doki Penguin Land, Elevator Action), and one PAL ColecoVision log (`colecop`, Zaxxon, TMS9929A), 20 emulated seconds each, MAME 0.285. `tests/test_rung5_replays.py`, windows off and on (26 cases). | Log | Accesses | VRAM differing | Pixels differing | Data reads | Status reads differing | Lost (windows on) | | --- | ---: | ---: | ---: | --- | ---: | ---: | | coleco Zaxxon (play) | 93,918 | 0 | 0 | 128 equal | 0 of 132 | 0 | | coleco Donkey Kong | 76,882 | 0 | 0 | 624 equal | 0 of 347 | 0 | | coleco BurgerTime | 74,942 | 0 | 0 | - | 121 of 1,180 | 0 | | coleco Cosmic Avenger | 83,985 | 0 | 0 | - | 0 of 399 | 0 | | coleco Frogger | 541,903 | 0 | 0 | - | 1,198 of 1,200 | 0 | | coleco Gyruss | 58,285 | 0 | 0 | 6,080 equal | 2 of 1,168 | 0 | | sg1000 Flicky | 659,796 | 0 | 0 | 8,355 equal | 1 of 1,108 | 7 | | sg1000 Champion Pro Wrestling | 148,174 | 0 | 0 | - | 0 of 1,128 | 0 | | sg1000 Sega-Galaga | 21,566 | 0 | 0 | - | 0 of 1,094 | 0 | | sg1000 Zaxxon | 412,807 | 0 | 0 | 6,914 equal | 1 of 1,086 | 0 | | sg1000 Doki Doki Penguin Land | 220,510 | 0 | **2** | 10,368 equal | 1 of 1,112 | 0 | | sg1000 Elevator Action | 176,788 | 0 | 0 | - | 1 of 1,060 | 0 | | colecop Zaxxon (PAL) | 65,529 | 0 | 0 | 128 equal | 0 of 11 | 0 | Windows on gives the same VRAM, pixels and reads on every log. **Attribution.** Pixels: Doki Doki's two (line 189, x 174-175) are a name written at line 189, dot 26 (to $3AF5, column 21): MAME drew the line at its start, the core fetches column 21 at dot 168, after the write. Status reads, by switching each decision to MAME's side (`mame_replay.attribute`): | Log | Default | C7 visible-only | C10 MAME's F | U4 number 31 | All three | Remaining, by bits | | --- | ---: | ---: | ---: | ---: | ---: | --- | | Frogger | 1,198 | 17 | 1,198 | 1,182 | 1 | 1 number-only (MAME's number before/after its first read) | | BurgerTime | 121 | 121 | 115 | 122 | 116 | 113 number-only, 2 with 5S (sprite evaluation timing, U10), 1 number-only first read | | Gyruss | 2 | 2 | 2 | 1 | 1 | number-only | | sg1000 Zaxxon | 1 | 1 | 1 | 0 | 0 | | | Doki Doki | 1 | 1 | 1 | 0 | 0 | | | Elevator Action | 1 | 1 | 1 | 2 | 2 | number-only | | Flicky | 1 | 1 | 1 | 1 | 1 | number-only | So: C7 (off-screen collisions) explains 1,181 of Frogger's reads, C10 (F's dot) 6 of BurgerTime's. Every remaining difference is in the five number bits except two: MAME's status shows 0 until its first read and its internal 31 after, which no single power-on value of the core matches (U4); and MAME reloads its per-line "last examined" number on every status read where the core keeps the frozen fifth-sprite number ([claims.md](claims.md)). These number-bit classes are named by their bit pattern and moment, not proven by a switch. The two BurgerTime reads with a 5S difference fall where the core's evaluation (during the line before) and MAME's (at the line's start) see a sprite table the game is rewriting. ## Rung 6: seeded faults `validation/faults.py` (PyPy): 28 textual faults, each in a copy of the package, the suite run against the copy until its first failure. The unbroken copy passes; **28 of 28 caught**. | # | Fault | First test to fail | | ---: | --- | --- | | 1 | name table row stride 16 | rung 0 `test_table_3_2_pattern_modes` | | 2 | Graphics I colour byte per 4 names | rung 0 `test_table_3_2_pattern_modes` | | 3 | Text area 8 pixels in | rung 0 `test_text_area_offset` | | 4 | R1 keeps bit 2 | rung 0 `test_register_masks` | | 5 | CPU window every 8 cycles | rung 0 `test_graphics_windows_every_16_cycles_in_the_active_area` | | 6 | 4K mux skipped | rung 0 `test_macdonald_4k_mux` | | 7 | no 4K roll-over | rung 0 `test_address_roll_over` | | 8 | C3 gate ignored | rung 0 `test_c3_colour_mask_reaches_patterns_on_99x8` | | 9 | Graphics II thirds ignored for colours | rung 2 `test_graphics2_thirds` | | 10 | Multicolor low nibble left | rung 2 `test_multicolor_high_nibble_left` | | 11 | flip-flop not cleared by a data write | rung 1 `test_data_access_clears_the_flip_flop` | | 12 | read-ahead not refilled | rung 1 `test_read_setup_fetches_the_first_byte` | | 13 | a data write leaves the read-ahead | rung 1 `test_a_write_replaces_the_read_ahead` | | 14 | register write keeps the address | rung 1 `test_register_write_destroys_the_address` | | 15 | status read leaves C | rung 1 `test_status_read_clears_f_5s_and_c_and_keeps_the_number` | | 16 | /INT ignores IE | rung 1 `test_setting_ie_while_f_is_set_asserts_int_at_once` | | 17 | F one line late | rung 1 `test_f_sets_at_the_end_of_line_191` | | 18 | 5S without the F gate | rung 2 MAME replay, Zaxxon 15 s (status read) | | 19 | five sprites a line | rung 1 `test_int_follows_f_and_ie` (5S/C status from the power-on frame) | | 20 | terminator ignored | rung 2 synthetic g1 | | 21 | sprite Y without the + 1 | rung 2 MAME replay, Zaxxon gameplay | | 22 | early clock 16 pixels | rung 2 synthetic g1 | | 23 | higher sprite number in front | rung 2 MAME replay, Zaxxon gameplay | | 24 | visible columns only for C by default | rung 3 `test_offscreen_coincidence` | | 25 | no VDP delay | rung 1 `test_transfers_are_not_instantaneous` | | 26 | `lost_access="restart"` by default | rung 5 Flicky, windows on (lost-access count) | | 27 | Multicolor colour slots as CPU windows | rung 0 `test_multicolor_uses_the_graphics_schedule` | | 28 | TMS9929A at 262 lines | rung 0 `test_lines_per_frame` | ## Rung 7: speed `validation/speed.py`: the synthetic g2 picture (full Graphics II tables, 13 sprites), one VRAM write every 200 master clocks through the frame. Real time is 59.92 frames a second. On the shared machine (load average 40+), so the numbers move between runs. | Interpreter | Windows on | Windows off | | --- | ---: | ---: | | CPython 3.14.4 (5 frames) | 16.65 frames/s (0.278 x real time) | 15.16 frames/s (0.253 x) | | PyPy 3.11 / 7.3.20 (100 frames, `PYPY_GC_NURSERY=1M`) | 56.92 frames/s (0.950 x) | 104.95 frames/s (1.752 x) | A 20-frame PyPy run gave 22.88 and 54.37 (JIT warm-up). Replaying the four rung-2 game logs (60 emulated seconds) took 59 s on CPython. The full suite, 159 tests with every trace present: **159 passed on CPython in 1,504 s and on PyPy in 127 s** (2026-11-12, the commit that adds this file's rungs 4-7).