Invert the sprite Y-expansion flip-flop a cycle later, as the chip does - #338
Merged
highbyte merged 1 commit intoSep 17, 2026
Merged
Conversation
A Y-expand bit set by a write in cycle 55 is still inverted, one set in cycle 56 is not: the inversion the VIC-II article puts in the first phase of cycle 55 happens a cycle later on the chip. VICE's spritecrunch2 test programs clear and set $D017 on every line with the second write a cycle later every eight lines, and hold the sprite's row for as long as the set lands by cycle 55; their 25 to 29 variants now match. The inversion moves from the sprite event of the first DMA compare to that of the second, and leaves out the sprites the first compare has just started, so a Y-expanded sprite still shows its first row twice.
|
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.



What
The Y-expansion flip-flop of a sprite is inverted while its
$D017bit is set. The VIC-II article puts that inversion in the first phase of cycle 55; on the chip it is a cycle later: a bit set by a write in cycle 55 is still inverted (the row is held, the sprite stretcher case), a bit set in cycle 56 is not. We held the row only for writes up to cycle 54.Established by VICE's
spritecrunch2test programs, which clear and set$D017on every line and move the second write a cycle later every eight lines.How
Vic2: the inversion moves from the sprite event of the first DMA compare (cycle 55) to that of the second (cycle 56), before the compare. Sprites the first compare has just started are left out: their flip-flop was cleared there, and a Y-expanded sprite still shows its first row twice.Verification
spritecrunch/spritecrunch2-25to-29. No other result changed, including the other nineteen sprite suites.The_flip_flop_inversion_sees_a_y_expand_bit_set_in_cycle_55: set in cycle 55 holds the row, in cycle 56 it does not.