Skip to content

NES: Fixed GetInternalOpenBus returning external bus value by mistake.#82

Open
zdg-kinlon wants to merge 1 commit intoSourMesen:masterfrom
zdg-kinlon:master
Open

NES: Fixed GetInternalOpenBus returning external bus value by mistake.#82
zdg-kinlon wants to merge 1 commit intoSourMesen:masterfrom
zdg-kinlon:master

Conversation

@zdg-kinlon
Copy link
Copy Markdown

Summary

Fix OpenBusHandler::GetInternalOpenBus() returning external bus value

Description

Fixed a bug in OpenBusHandler where GetInternalOpenBus() incorrectly returned _externalOpenBus instead of _internalOpenBus.

Technical Details

  • Root Cause: The method returned _externalOpenBus when it should return _internalOpenBus.
  • Impact: While $ 4015 reads may appear unaffected in simple cases (since GetInternalOpenBus() is called before updating the bus), the bug breaks correctness whenever the internal and external bus values differ — such as after a $ 4015 read or in advanced mappers/debuggers that rely on accurate internal bus state.
  • Hardware Behavior: Reading $ 4015 does not drive the external bus; only the CPU's internal bus is updated. Thus, internal and external open bus values must be tracked separately.

APU#Status_($4015)
Note: The $ 4015 bit 5 uses the internal open bus value from before the read, which is correctly captured in the current call order. The bug primarily affects other consumers of GetInternalOpenBus() or future code relying on bus state separation.

It should return _internalOpenBus to correctly reflect CPU-internal open bus state, especially after reads like $ 4015.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant