Fixed open bus behavior - #11
Open
100thCoin wants to merge 1 commit into
Open
Conversation
Return the data bus instead of the high byte of the address bus.
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.
Currently, reading from open bus on an Everdrive N8 Pro (from address $4020 through $7FFF) always returns the high byte of the address bus. This can be quite easily fooled by running
LDA $50FF, Xwhere X is non-zero. Let's say X is 1. The LDA instruction will perform a dummy read on address $5000, where the value $50 will be read (from the high byte operand), and then the second read will be on address $5100. With the current logic, this would return $51, which is incorrect, as the data bus should still be unchanged from when the high byte operand was read. Similarly, a DMC DMA would change the data bus value, which wouldn't be visible on an everdrive outside of the $4000 through $401F range.This change that I made simply reads the data bus value back instead of the high byte of the address bus. I've made a test for open bus behavior in my accuracy ROM, AccuracyCoin. Here's the results before and after this change:
Before:

Error code 3 is: "Indexed addressing crossing a page boundary should not update the data bus to the new high byte value."
After:
