Follow the VIC-II sprite counters per cycle and draw per-line sprites from them - #325
Merged
highbyte merged 2 commits intoSep 10, 2026
Merged
Conversation
… from them The VIC-II now keeps each sprite's data counter, its base and the expansion flip-flop as the chip does, with the checks in cycles 15, 16, 55, 56 and 58 applied as the raster advances. A change of the Y-expand bit lands before or after the cycle 55 check according to its own cycle, clearing the bit sets the flip-flop at once, and the DMA ends when the counter base reaches 63. That gives the 23-line sprite of VICE's d017 tests and the sprite stretcher of the demos, and the bus stall model anticipates the compare that starts a sprite. With per-line sprites on, the sequencer pixel generator draws each raster line's sprites from the bytes the chip fetched for it instead of a band captured at the sprite's start, so pointer, data, position and expansion changes mid-sprite show on the line they reach. The frame-level path and the legacy generator are unchanged. The sprite events skip all work while no sprite is enabled or fetching and are applied behind one compare per raster advance; the model's per-line constants are cached rather than fetched through abstract properties on every advance. New sample SpriteStretch, and two sprite-only demos in Download & Run with a flag that switches per-line sprites on for them.
…ing per cycle The per-instruction loop derives the raster line and the cycle within it once and counts them along, and looks the screen line up in a table filled from the model at setup, instead of a 64-bit division, a modulo and a virtual call on every cycle. Same output; measured neutral within noise on this machine.
|
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
$D017writes, in a bad-line-free band). Two sprite-only demos in Download & Run, For Your Sprites Only and Unfortunate Coincidence, with arequiresPerLineSpritesflag that switches per-line sprites on for a program.Validation
Vic2SpriteDmaTests(compare and display cycles, 21 and 42 rows, expand bit cleared mid-sprite before and after the cycle 55 check, hold and release of a row, redisplay by a rewritten Y) and a per-line render test of the d017 case.