Skip to content

Fix display window, HBLANK timing, sprite visibility and STRLONG#7

Open
thbreidenbach wants to merge 1 commit intoendofexclusive:masterfrom
thbreidenbach:fix/sprites-visible-outside-diw
Open

Fix display window, HBLANK timing, sprite visibility and STRLONG#7
thbreidenbach wants to merge 1 commit intoendofexclusive:masterfrom
thbreidenbach:fix/sprites-visible-outside-diw

Conversation

@thbreidenbach
Copy link

Summary

  • Fix HBLANK timing: Constants corrected from 3/85 to $013/$061, matching real Denise/Minimig reference. Fixes display being shifted left with right side cut off.
  • Add STRLONG support: Beam counter holds for one extra CLK7 cycle on long lines, fixing interlaced mode timing drift.
  • Improve display window pipeline: Added vertical window tracking (vwin), multi-stage horizontal window (hwin0→hwin1→hwin2) for correct pipeline alignment. HPOS reset changed from $1FE to 2.
  • Allow sprites in border regions: Removed the sprite kill outside DIW and modified stage G to only blank playfield colors (bit 4=0) while preserving sprite colors (bit 4=1). Real Amiga Denise renders sprites independently of the display window — mouse pointer, status bar sprites, and demo effects depend on this behavior.
  • Per-pixel DIW masking in stage E: Bitplane pixels are now correctly masked to zero outside DIW directly in the bplbus generation, separately for lores and hires modes.

Background

Analysis was performed by comparing this implementation against the amiga_replacement_project Verilog Denise implementation, which correctly handles all of the above cases. The key architectural insight is that in real Denise hardware, the display window only gates bitplane output — sprites operate on an independent path and must remain visible in border/overscan areas.

Test plan

  • Verify Kickstart boot screen renders correctly (no shifted/wrapped display)
  • Verify mouse pointer (sprite 0) is visible in border/overscan areas
  • Test demos that use sprites in borders
  • Verify interlaced modes display without jitter
  • Test dual-playfield and HAM mode rendering

🤖 Generated with Claude Code

Correct multiple display issues by comparing against the
amiga_replacement_project Denise implementation:

- Fix HBLANK start/stop constants (was 3/85, now $013/$061) to match
  real Denise/Minimig timing. Fixes display shifted left with right
  side cut off.
- Add STRLONG (long-line) support for interlaced modes. The beam
  counter now holds for one extra CLK7 cycle when STRLONG is received.
- Improve display window (DIW) pipeline: add vertical window tracking
  (vwin, set by BPL1DAT writes, cleared at HPOS $13), multi-stage
  horizontal window (hwin0/hwin1/hwin2) for proper pipeline alignment.
- Reset HPOS to 2 at line start (was $1FE), matching real Denise.
- Mask bitplane pixels to zero outside DIW directly in stage E bplbus
  generation, separately for lores and hires modes.
- Allow sprites to display outside the display window (border region).
  Real Amiga Denise draws sprites independently of DIW — the mouse
  pointer, status bar sprites and demo effects rely on this. The
  previous code killed all sprites outside DIW.
- In stage G priority output, only blank playfield colors (bit 4 = 0)
  outside DIW; preserve sprite colors (bit 4 = 1, registers 16-31).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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