Repository navigation
Conversation
isrPHI2 acts on DMA_S_StartDisable only in a cycle fBusSnoop declines. While /DMA holds the CPU the undriven address bus is taken by KernalCheck as a KERNAL read on every cycle except those with BA low (badlines, sprite fetches). With the screen blanked and no sprites the release never came: CloseDMA and AbortDMAUnless ran out both ceilings and dropped /DMA unsynchronised after ~100 ms, reporting a transfer that had landed as failed. While the release is pending, CloseDMA puts a small FASTRUN wrapper in front of the snoop that declines the cycle; from the cycle after the release it passes every cycle to the original snoop, which is restored once the release is seen. Only when /DMA is known to be held, so a CPU that is running never loses a snoop cycle. isrPHI2 is unchanged. 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.
isrPHI2acts onDMA_S_StartDisableonly in a cycle the bus snoop declines:ISRs.creturns as soon asfBusSnooptakes a cycle, before the PHI2-low state machine. While /DMA holds the CPU, nothing drives the address bus. With Kernal Replace hooked,KernalChecktakes that floating bus as a CPU read of$E000-$FFFFon every cycle except those with BA low (VIC badlines and sprite fetches), where it declines.With the display on, a badline comes within a raster line, so the release gets through and the problem stays hidden. With the screen blanked (
$D011DEN off) and no sprites, BA never goes low. ThenCloseDMA()runs outDMA_HANDSHAKE_CEILING_mS,AbortDMAUnless()runs out its own, and /DMA is dropped from thread mode, unsynchronised to PHI2, after about 100 ms.CloseDMA()then reports a transfer that had in fact landed as failed. The comment aboveAbortDMAUnless()already namesKernalCheckas a snoop that returns true on every cycle; this is a case where that happens on a healthy bus.What changes
CloseDMA()holds the snoop off until the release (DMAControl.conly). While the release is pending, a smallFASTRUNwrapper stands in front offBusSnoopand declines the cycle, so the state machine releases on the next PHI2 low. From the cycle after the release on, it hands every cycle to the snoop it stands in for, so the CPU's first fetch is served as before. The original pointer goes back as soon as the release is seen.HoldC64()or an immediate start (TransferComplete,TransferReady,ActiveReady). ACloseDMA()after a start that never asserted runs as before, so a running CPU never loses a snoop cycle.fBusSnoopitself in the cycles between keeps its change.REU_FF00_W_Checkis one that does.isrPHI2is unchanged.fKernRepl(Fab04_GlobalKernalReplace, off by default) is called before the state machine too, and is not covered here.Verification
npm testpasses (413).ldrb,cmp, then eitherreturn falseor a tail call, with no register saves.isrPHI2's instructions are identical tomain's; only its address moves (+28 bytes), with the branch targets and literals that follow from that.CloseDMA()failed, with the longest DMA at 100,994 µs (both ceilings) and the KERNAL being served throughout.CloseDMA()calls, the loads work and the longest DMA is 2,319 µs. The same wrapper also fixed a DMA border write (HoldC64, transfer,CloseDMA) under that handler.WriteC64Mem/ReadC64Mempath under Kernal Replace with a blank screen (the sameCloseDMA(), so expected to have had the same failure), REU emulation, PAL, a C64, and the plain TR.🤖 Generated with Claude Code