Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clear D Flag on IRQ/NMI #436

Merged
merged 1 commit into from
Oct 24, 2022
Merged

Clear D Flag on IRQ/NMI #436

merged 1 commit into from
Oct 24, 2022

Conversation

LRFLEW
Copy link
Contributor

@LRFLEW LRFLEW commented Oct 15, 2022

This is an attempt to fix #414

The code was already clearing the decimal flag on a BRK instruction, so this changes it to also clear it on IRQ, NMI, and RESET signals. I also improved the handling of other flags during these signals. According to section 3.11 of the manual, the B and I flags are set during a reset, so this PR also sets those flags during a reset. With that change to how the B flag is handled, I also updated the NMI to push the status register with the B flag cleared. I had some difficulty determining how the flag is handled on an NMI, with the only resource I could find being this one for the NES, so I'm not 100% confident about how it's handled on the 65C02.

@LRFLEW
Copy link
Contributor Author

LRFLEW commented Oct 23, 2022

Rebased on top of #434 to resolve the merge conflict

@mist64 mist64 merged commit c61674e into commanderx16:master Oct 24, 2022
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.

Cpu simulator doesn't clear D flag on irq
2 participants