Skip to content

tools: regsweep.py measures a Special IO handler's read margin - #83

Open
kfox wants to merge 2 commits into
SensoriumEmbedded:mainfrom
kfox:bench-regread
Open

kfox wants to merge 2 commits into
SensoriumEmbedded:mainfrom
kfox:bench-regread

Conversation

@kfox

@kfox kfox commented Oct 30, 2026

Copy link
Copy Markdown
Contributor

Adds tools/bench/regsweep.py and its C64 side, tools/bench/regread.a. Together they measure the NTSC/PAL read margin of whichever Special IO handler is chosen in Settings, as docs/Architecture/Constraints.md asks for a new handler. They are the tools behind the margin figures in #81.

How it works

  • regread.a finds the cartridge's layout: plain REU, REU with the TR page at $DE00, or GeoRAM with the TR page at $DF00.
  • It then loops, counting wrong answers at $C000:
    • the REU's address and length registers, read back as written;
    • $DF10-$DF1F reading $FF beside a TR page at $DE00;
    • the TR page's TRM/TRB IDs.
  • regsweep.py DWELL VALUE... builds and launches the program, sets nS_PLAprop with tp### for each value, and prints the errors counted in DWELL seconds. It restores the defaults with td at the end.
  • It needs acme on PATH and an image built with Dbg_SerTimChg, and refuses up front on one built without it.

Verified on a TR+ in an NTSC C128, using a Dbg_SerTimChg build of #81 under REU+USB Mouse/Disk:

Reviewed at medium, plus a low review of that review's fix commit.

  • The medium review found that the error counts wrapped at 16 bits once most reads failed. On the board, $FF page printed +1248 at nS_PLAprop 400.
  • The counters are now 24 bits, and the same run prints +66497.
  • The low review reverted the third counter byte and saw the wrapped value come back, then restored it.

kfox added 2 commits October 29, 2026 20:39
regread.a counted errors in 16 bits, which wrap within a 4-second dwell once
most reads fail: at nS_PLAprop 400 the $FF page row printed +1248 for about
66,800 wrong reads. Error counters are now 24-bit.
@kfox
kfox marked this pull request as ready for review October 30, 2026 01:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant