Skip to content

Make the sliding 4-bit window the DHGR colour default - #246

Draft
st3fan wants to merge 1 commit into
mainfrom
dhgr-sliding
Draft

Make the sliding 4-bit window the DHGR colour default#246
st3fan wants to merge 1 commit into
mainfrom
dhgr-sliding

Conversation

@st3fan

@st3fan st3fan commented Jul 11, 2026

Copy link
Copy Markdown
Owner

Make the sliding 4-bit window the DHGR colour default

Field report: Thexder's DHGR title via Total Replay on the //e "looked like it stayed in HGR". The debugging split the question cleanly:

  1. Soft-switch probe at title time: Graphics + HIRES + col80=true + dhires=true — Total Replay detected 128K and engaged DHGR correctly. The emulation core was right.
  2. The renderer was the problem: our aligned-cell DHGR decode (the 6b starting choice, explicitly marked "revisit after a known DHGR image") turns hard edges into 4-px colour blocks — the title's credits render as unreadable pink mottling.

The fix — the parked experiment, promoted

DhgrColorMode { Aligned, Sliding } lands in scr.rs with Sliding as the default: each pixel's colour comes from the trailing 4-bit window, phase-weighted (1 << (pos & 3)), reducing exactly to the aligned value at cell boundaries. Side-by-side Thexder renders were night and day — aligned: mottled noise; sliding: crisp white text with thin composite-style edge fringes, exactly what a real monitor shows. Aligned stays selectable via set_dhgr_color_mode.

New end-to-end gate

two_e_totalreplay.rs: boots Total Replay on the //e (HDD + ProDOS + 128K detection), launches Thexder via the menu's incremental search, and asserts DHGR engages — the full stack in one test. Skips when the untracked .hdv is absent (the protected-WOZ pattern).

Verification

  • fmt / clippy -D warnings / full cargo test green (32 result files).
  • The mono DHGR path and its golden are untouched (mono never used the colour decode).
  • colour_cell_selects_the_palette pins itself to Aligned (it tests the palette mapping); a new test asserts the sliding default keeps white runs white.
  • Visual proof: the two Thexder renders in the conversation — the owner can re-check live with two --model 2e --color --hdd "disks/Total Replay v6.0.1.hdv".

🤖 Generated with Claude Code

Field report: Thexder's DHGR title screen via Total Replay on the //e
"looked like HGR". The soft-switch probe showed Total Replay detected
128K and engaged DHGR correctly -- the problem was our aligned-cell
colour decode, which turns text into unreadable 4-px colour mottling
(the credits read as pink noise).

This promotes the parked sliding-window experiment (branch
iie/experiment-dhgr-color) onto master with the exact validation its
notes asked for -- a known DHGR artwork: side-by-side Thexder renders
show aligned = mottled noise, sliding = crisp white text with thin
composite-style edge fringes. DhgrColorMode { Aligned, Sliding } lands
in scr.rs with Sliding as the default; each pixel's colour comes from
the trailing 4-bit window, phase-weighted (1 << (pos & 3)), which
reduces to the aligned value at cell boundaries. Aligned remains
selectable via set_dhgr_color_mode. The mono DHGR path and its golden
are untouched.

Tests: colour_cell_selects_the_palette pins itself to Aligned (it checks
the palette mapping); a new sliding test asserts the default mode keeps
white runs white past the 3-px lead-in. New end-to-end gate
two_e_totalreplay.rs boots Total Replay on the //e, launches Thexder by
menu search, and asserts DHGR engages (skips without the untracked
image, like the protected WOZ gates).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@st3fan

st3fan commented Jul 11, 2026

Copy link
Copy Markdown
Owner Author

Build metrics — DHGR sliding-window promotion

Model Claude Fable 5
Thinking mode adaptive

Token usage for this PR (delta since PR #244; covers the /RAM and ProDrive explanations, the Thexder debugging session — headless reproduction, ][+ vs //e comparison, side-by-side renders — and the promotion):

Metric Tokens
Input 242
Output 106,135
Cache write 1,969,544
Cache read 71,427,300
Total ~73.5M

Cost: ~$101.36 (Fable 5 @ $10/$50 per M in/out, $12.50/$1.00 per M cache write/read)

@st3fan
st3fan marked this pull request as draft July 18, 2026 21:08
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