video: show early hi-res DDF content inside an early display window#195
Merged
Conversation
The early hi-res DDFSTRT pre-fetch snap (af42e2d) unconditionally skipped the whole early-fetch width, assuming the display window opens at the standard $81 edge. KS 3.2 programs ECS extreme-overscan screens with both an early fetch and an early window (Overscan editor edit display: DDFSTRT=$28, DIWSTRT h=$5D, BPLCON1=$44), where those words are inside the window on real hardware; the snap shifted the whole picture left and left a blank colour-0 band at the right window edge, while sprites stayed beam-anchored (issue #186, PAL and NTSC). The physical origin term (display shift minus DDF shift plus the framebuffer-origin clamp) already clips exactly the part of the fetch that lands left of the window: XSysInfo's DDFSTRT=$38 panel still skips its one pre-fetch word. The snap only ever differed from that term for windows left of the fetch reference - it was compensating for the old $83 hi-res reference and became a no-op for standard windows when the reference was recalibrated to $81. Fixes #186.
Contributor
There was a problem hiding this comment.
Pull request overview
This PR fixes ECS Denise hi-res early-DDF rendering on extreme-overscan screens where the display window opens early, preventing an incorrect left-shift of bitplane content relative to sprites by removing an unconditional “snap” that discarded early-fetched words even when they are inside the window.
Changes:
- Removes the hi-res/SHRES FMODE=0 early-DDF “snap to fetch-word boundary” from
ControlState::fetch_origin_native_shift, relying on the existing origin/window math to clip only what’s truly off-screen. - Updates/extends the bitplane origin unit test to cover the KS 3.2 ECS extreme-overscan case from issue #186 while preserving existing XSysInfo and Kickstart assertions.
- Documents the corrected rule for hi-res early DDF in
docs/internals/video.md.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| src/video/bitplane.rs | Removes the unconditional hi-res early-DDF snap and clarifies why window clipping/origin math is sufficient (fixes overscan window-left cases). |
| src/video/bitplane/tests.rs | Renames/updates the relevant test and adds an ECS extreme-overscan regression case asserting the correct origin (18). |
| docs/internals/video.md | Records the “hi-res early DDF is beam-anchored; window comparator hides pre-window fetch” rule and cites the overscan scenario (issue #186). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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.
Fixes #186 (ECS Denise PAL/NTSC horizontal offset: bitplanes shifted left relative to sprites on overscan screens).
Root cause
The early hi-res DDFSTRT pre-fetch snap (af42e2d) unconditionally skipped the whole early-fetch width at the picture origin, assuming the display window always opens at the standard
$81edge. KS 3.2 programs ECS extreme-overscan screens with both an early fetch and an early window (Overscan editor edit display:DDFSTRT=$28,DIWSTRT h=$5D,DIWSTOP h=$1C7via DIWHIGH,BPLCON1=$44). On real hardware those early-fetched words are inside the window; the snap discarded 80 native px instead of the physical 18, shifting the whole bitmap left with a blank colour-0 band at the right window edge while sprites stayed beam-anchored - exactly the reported symptom, on PAL and NTSC alike.Fix
Remove the snap. The physical origin term (display shift minus DDF shift plus the framebuffer-origin clamp) already clips exactly the part of the fetch that lands left of the window: XSysInfo's
DDFSTRT=$38panel still skips its one pre-fetch word. The snap only ever differed from that term for windows left of the fetch reference - it was compensating for the old$83hi-res fetch reference and became a no-op for standard windows when the reference was recalibrated to$81(PR #106/#107 era).Verification
early_ddf_hires_origin_clips_prefetch_against_the_window_edgekeeps the original XSysInfo/standard/KS-boot assertions unchanged (16/0/24) and gains an ECS 8375 overscan case asserting origin 18.docs/internals/video.md records the rule: hi-res early DDF stays beam-anchored and is hidden by the window comparator alone.