Repository navigation
Preserve pending timer overflow when rewriting timer control - #31
Merged
Merged
Conversation
caused Electroplankton's Rec-Rec drumbeat to not loop cleanly
abradburne
added a commit
to abradburne/DSperate
that referenced
this pull request
Oct 25, 2026
…), and beebono#26-beebono#30 as merged Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
A timer control write can occur when its overflow is already due but has not yet been dispatched. Replacing the scheduled event at that point loses the overflow’s reload, interrupt, and cascade tick.
Settle the timer’s due event through its existing callback before applying the control write, preserving the original overflow phase.
Found while investigating uneven Electroplankton Rec-Rec playback. Offline measurements changed from variable restart intervals of roughly 3.977–4.061 seconds to approximately 4.01134 seconds, with nine consecutive intervals spanning less than 0.3 ms.
Includes a ROM-free regression test covering control writes before, at, and after overflow on both CPUs, checking reload, IRQ, cascade, and subsequent overflow timing.