Validate the lighting-stripe palette model and decode the cls4 selector #259

Merged
jqueuniet merged 0 commits from refs/pull/259/head into main 2026-07-17 11:32:24 +02:00
jqueuniet commented 2026-07-17 11:16:56 +02:00 (Migrated from codeberg.org)

Closes #214.

Validation (primary goal)

The lighting-stripe hypothesis is confirmed on both axes; the live ADDR_PALSEL trace fallback is unnecessary.

  • Re-running the stripe-aware matcher (from #213) on the session-1 captures already resolved CRAM line 1 in all five (four exact bank-stripe hits, one modulo a two-slot flame overlay).
  • A fresh annotated capture session then confirmed the indexing half: bank = map_graphics_style (three banks observed; the starting cave gives a certain map-0/style-2 → bank-2 correlation) and stripe = light level (stripe 1↔4 series in a single room, line 1 byte-identical across its two bright states). Details in docs/formats/palette-lut.md § "VALIDATED".
  • Side findings: the torch glow is a separate CRAM line-2 palette; the slots-9/10 flame flicker overlay recurs byte-identically; banks 1 and 5 are byte-identical in the archive.

Secondary target: cls4 selector + jump-table rule

  • The FTL BSS jump-table entries are function-entry CODE offsets, and jsr disp(a5) maps as entry = (disp − 0x22)/8 — the 32-byte above-A5 params block precedes the runtime table. Live-proven with two breakpoints; the same rule holds on Sega CD and Amiga with matching entry numbers (no merged-table anomaly). Earlier (disp−2)/8 labels were systematically +4 off; the GDAT resolver is 0x2abc0, not 0x1e78e.
  • The cls4 LUT selector splits into an id-taking boolean gate (entry 496, live-sampled on a keyhole) and the pointer-taking selector cls4 = table[record->byte4 >> 4] (entry 492), plus the simplified-sensor Text path cls4 = (word2 >> 3) & 0xFF. The supposed ABI mismatch was the numbering artifact.

Tooling

  • palette_oracle_match now labels candidates with their cls tuples (banks read directly as cls2), with a regression test pinning the six bank ENT1 indices.
  • tooling/palette-oracle/run_capture.sh is a real capture launcher: interactive mode plus a --fifo mode that bridges the BlastEm debugger through a PTY via socat (its REPL hangs on a non-TTY stdin).

Remaining work is tracked in the decoder-wiring follow-up issue.

Closes #214. ## Validation (primary goal) The lighting-stripe hypothesis is **confirmed** on both axes; the live `ADDR_PALSEL` trace fallback is unnecessary. - Re-running the stripe-aware matcher (from #213) on the session-1 captures already resolved CRAM line 1 in all five (four exact bank-stripe hits, one modulo a two-slot flame overlay). - A fresh annotated capture session then confirmed the indexing half: bank = `map_graphics_style` (three banks observed; the starting cave gives a certain map-0/style-2 → bank-2 correlation) and stripe = light level (stripe 1↔4 series in a single room, line 1 byte-identical across its two bright states). Details in `docs/formats/palette-lut.md` § "VALIDATED". - Side findings: the torch glow is a separate CRAM line-2 palette; the slots-9/10 flame flicker overlay recurs byte-identically; banks 1 and 5 are byte-identical in the archive. ## Secondary target: cls4 selector + jump-table rule - The FTL BSS jump-table entries are function-entry CODE offsets, and `jsr disp(a5)` maps as `entry = (disp − 0x22)/8` — the 32-byte above-A5 params block precedes the runtime table. Live-proven with two breakpoints; the same rule holds on Sega CD and Amiga with matching entry numbers (no merged-table anomaly). Earlier `(disp−2)/8` labels were systematically +4 off; the GDAT resolver is `0x2abc0`, not `0x1e78e`. - The cls4 LUT selector splits into an id-taking boolean gate (entry 496, live-sampled on a keyhole) and the pointer-taking selector `cls4 = table[record->byte4 >> 4]` (entry 492), plus the simplified-sensor Text path `cls4 = (word2 >> 3) & 0xFF`. The supposed ABI mismatch was the numbering artifact. ## Tooling - `palette_oracle_match` now labels candidates with their cls tuples (banks read directly as `cls2`), with a regression test pinning the six bank ENT1 indices. - `tooling/palette-oracle/run_capture.sh` is a real capture launcher: interactive mode plus a `--fifo` mode that bridges the BlastEm debugger through a PTY via socat (its REPL hangs on a non-TTY stdin). Remaining work is tracked in the decoder-wiring follow-up issue.
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
jqueuniet/dm2-tools!259
No description provided.