denise: move the DIW comparator anchor to the hardware 2H-196 mapping#107
Merged
Conversation
A DIWSTRT/DIWSTOP hstart value H now opens/closes the display window at framebuffer x = 2H - 196 (previously 2H - 194). Real hardware verdict from the vAmigaTS Agnus/Blitter/sblit/sblit0 A500 photo: the leftmost partial swatch column measures 24 fb px wide (gap-normalized, two independent bands), equal to the right partial column, so the window edge exposes the standard picture's first lo-res sample; Copperline clipped it to 22. DIW_HSTART_FB0 and RENDER_DIW_HSTART_FB0 move 0x61 -> 0x62; sprites and collisions follow automatically (SPRxPOS drives the same Denise counter comparator). The bitplane fetch references move +1 in lockstep so bitmap sample positions stay at their hardware-calibrated beam-anchored framebuffer columns; colour/copper anchors are untouched. Derived values shift with the window: BITPLANE_CONTROL_PIPELINE_FB 34 -> 36, STANDARD_VISIBLE_X0 64 -> 62, TV cutout, presentation recentring 26 -> 24. Combined with the linear early-DDF placement fix, vAmigaTS bucket means move: Agnus/DIW/OLDDIW 47.0% -> 4.3%, Denise/DIW 9.8% -> 0.9%, Denise/Sprites 9.4% -> 5.1%, Agnus/Copper 15.8% -> 9.7%, Denise/Misc/Overscan/overscan2 90.8% -> 0.004%. KS1.3 (hires FMODE=0) and A1200 KS3.1 (hires FMODE=3) boot pictures do not move; Gen-X's end-text pages regain their previously clipped first column (issue #69).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Move the Denise display-window comparator anchor one lores pixel left:
DIWSTRT/DIWSTOP hstart H now maps to framebuffer x = 2H - 196 (was 2H - 194).
Sprites follow (they share Denise's counter); bitplane fetch references move
+1 in lockstep so bitmap pixels keep their hardware-calibrated beam-anchored
positions. Net effect: every display window edge and sprite moves 2
framebuffer px left; bitmaps and colour writes stay.
This is the second half of the 1-lores-px divergence behind issues #68/#69
(the first half, early-DDF picture phase, landed as #10x). A standard lores
screen now shows its first bitmap sample flush at the window edge, as real
hardware does.
Hardware arbitration
vAmigaTS
Agnus/Blitter/sblit/sblit0(lores, DDF $38, standard DIW, imageflush to both window edges; real photo sblit0_A500_ECS.jpeg). In the
emulators, interior content positions agree exactly; the only difference is
the left window clip: vAmiga shows the leftmost partial swatch column 24 fb
px wide (= the right one), Copperline clipped it to 22. The photo (subpixel
edge detection, ~100 rows averaged per band, widths normalized by the
16-fb-px inter-swatch gap) measures the left partial column at 24.2 fb px
(lower band) / 24.5 (upper band) vs 24.9 for the right partial column -
full width, i.e. the window edge sits at 2H - 196 and exposes bitmap
sample 0. Copperline's 2H - 194 predicted 22 (2.8 photo px narrower than
measured, versus about 0.1 px scatter).
The old anchor also explains why the removed early-DDF "-1 sample"
correction existed: with the window edge 2px too far right, a standard DIW
overran the fetched row on early-DDF screens.
What changed
bitplane::DIW_HSTART_FB0andbus::RENDER_DIW_HSTART_FB00x61 -> 0x62(window comparator + sprites/collisions).
DIW_HSTART_FETCH_REFERENCE_LORES/HIRES, and thecapture twins): bitmap sample positions are unchanged in the framebuffer.
STANDARD_VISIBLE_X0 64 -> 62, TV cutout, presentation recentring 26 -> 24.
verified against vAmiga (latch2 0.000%) and hardware.
tests keep their overlap geometry by moving the programmed sprite hstart
with the comparator.
Scores and checks
cargo test --releasegreen (28 tests re-derived for the new anchor withhardware-verdict comments),
cargo clippyandcargo fmt --checkclean.and A1200 KS3.1 boot (hires FMODE=3) differ from the previous stage ONLY
in the 2px border column at the window edge - the hires pictures did not
move. Second Nature (lores composite) and the KS1.3 TV-mode presentation
eyeballed clean; TV recentring follows the window (26 -> 24).
predicted classes - the newly exposed first bitmap column at standard
window edges (Hamazing x 62-63), window-close clip at 702 (Inside the
Machine), border column at x 14-15 (Gen-X, kicka1200, Zool), and sprite
layers moving with the comparator (Zool cracktro text rows shift exactly
-2 with zero residual; Gen-X gears shutter edge columns).
cargo test --release --test image_regression -- --ignored: 7 pass(ocs_bpu7_ham is the documented host-flaky perf test).
combined with the early-DDF PR against the pre-fix baseline:
Agnus/DIW/OLDDIW 47.0% -> 4.3%, Denise/DIW 9.8% -> 0.9%, Denise/Sprites
9.4% -> 5.1% (114 cases - the sprite anchor verified against vAmiga),
Agnus/Copper 15.8% -> 9.7%, Agnus/DDF 9.7% -> 6.9%, Agnus/Blitter
16.5% -> 14.4%. Standouts: Denise/Misc/Overscan/overscan2 90.8% ->
0.004%, diw7/diw9/diw3/jumpbpu2 exactly 0.000%. The only score
increases are CPU-timing buckets and coprace2; spot-checked MOVES8w
(48.339%) and coprace2 (42.383%) regenerate to the same scores on
clean main - pre-existing drift from the floating-bus work (vAmigaTS sweep fixes: 68000 floating bus + CIA-B POUT/CNT wiring #102),
not this change.
now show the previously clipped first lores column at the window edge
(620s screenshot, content at framebuffer x 62-63).