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

[BASIC] Replace ldy #0 + (zp),y addressing with (zp) addressing #350

Merged
merged 6 commits into from
Aug 11, 2024

Conversation

Fulgen301
Copy link
Collaborator

As the original NMOS 6502 didn't have (zp) addressing, it used (zp),y addressing with a constant .Y = 0 for ZP indirect loads. Not only is this not necessary anymore, as both our target CPUs support (zp) addressing, it leads to behavior differences when POKE is used on addresses in the IO page: In the extra CPU cycle needed to calculate the target address during sta (zp),y, the 65C816 performs a read of an invalid address, while the 65C02 performs a read of what is presumed to be the last fetched instruction byte, causing an extra read from the IO page on the 65C816.

This PR replaces all unnecessary (zp),y usages in code17.s, where the implementation for PEEK and POKE lives.

Copy link
Collaborator

@mooinglemur mooinglemur left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@mooinglemur mooinglemur merged commit a2c09dc into X16Community:master Aug 11, 2024
1 check passed
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.

2 participants