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

Indirect addressing mode needs to return entire page when lo(0xFF) #25

Open
lucascebertin opened this issue Mar 24, 2021 · 1 comment
Open
Labels
enhancement New feature or request good first issue Good for newcomers

Comments

@lucascebertin
Copy link
Collaborator

Following the 6502 spec, there is a bug in architecture when indirect addressing mode is used.
Not sure if this thing affects all the indirect addressing like indirect, x and indirect, y but probably yes.
We need to check if the lo(ADDRESS) is 0xFF and, then, consider a full page return, so:

LDX #$02
STX $3000

LDX #$04
STX $3100

LDX #$03
STX $30FF

JMP ($30FF)

the jump will consider the hi(0x3000) + lo(0x30FF) = 0x0203

NB: WE CAN'T USE EASY6502 TO VALIDATE THIS BECAUSE THEY ARE NOT RESPECTING THIS BEHAVIOUR AS WE CAN SEE IN THE PICTURE:
image

@rafaeldelboni
Copy link
Member

So, if I understood correctly, to simulate this bug we need to do something like this In the indirect function?

If address & 0x00FF = 0xFF

Then:
Address & 0xFF00 = hi
Address = lo

Else:
Address + 1 = hi
Address = lo

@rafaeldelboni rafaeldelboni added enhancement New feature or request good first issue Good for newcomers labels Apr 8, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

2 participants