Fix NMI servicing reading the vector twice, and characterize JMP ($xxFF) behavior - #285
Merged
Conversation
|
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
Three small NMOS-baseline correctness items (groundwork for the upcoming CPU model architecture work):
ProcessInterruptsfetched the NMI vector once purely for a debug log line, thenProcessHardwareNMIfetched it again — two real reads of$FFFA/$FFFBper serviced NMI where hardware performs one. The reads go through the current memory mapping, so the duplicate was observable by mapped handlers. The vector is now read exactly once; the log line runs after entry and reusesPC(the vector target).LogDebugcall and itsstring.Joinallocation now only run when debug logging is enabled, matching the existing unknown-opcode guard pattern.JMP ($xxFF). The emulator currently resolves indirectJMPlinearly (CMOS/65C02-style); real NMOS hardware has the page-wrap bug. A new test pins the current behavior and documents it as a known NMOS deviation, so the planned per-model fix lands as a visible, deliberate change instead of a silent one.Tests
NMI_Servicing_Reads_Each_Vector_Byte_Exactly_Once(countingMapReaders on the vector bytes; fails against the previous code).JMP_IND_With_Pointer_At_Page_End_Currently_Reads_Linearly_Known_NMOS_Deviation.