Hello,
I have a bug in my CPU where JMP Indirect reads the wrong address. I used the Nintendulator debugger to find out what it's supposed to be, and I think that the Indirect JMP instruction needs to wrap around at the end of a page.
The instruction is JMP($02FF) which is supposed to end up jumping to address 0300. I looked at the NES CPU memory in Nintendulator, and indeed the memory location 02FF has 00, and 0200 has 03 in it, which would result in 0300. This leads me to think the Indirect mode requires page wrap around.
However, I am unable to find anything about this in the MOS6502 documentation or the 6502 reference site.
So does anyone know if Indirect mode requires page wrap around or not?
Thanks!
Yes, that's how JMP indirect works. I won't go through the trouble of looking for references now, but this is not a secret or an obscure behaviour by any means, it's mentioned fairly frequently in documents about the 6502. Maybe it's not mentioned along with the JMP instruction itself, but there's usually a section of observations somewhere that mentions this behavior.
tokumaru wrote:
Yes, that's how JMP indirect works. I won't go through the trouble of looking for references now, but this is not a secret or an obscure behaviour by any means, it's mentioned fairly frequently in documents about the 6502. Maybe it's not mentioned along with the JMP instruction itself, but there's usually a section of observations somewhere that mentions this behavior.
Okay thanks!
I did look for it in here:
http://archive.6502.org/datasheets/mos_ ... g_1975.pdfand here:
http://www.obelisk.me.uk/6502/reference.htmland here:
http://www.obelisk.me.uk/6502/addressing.htmlBut couldn't find it anywhere.
timl132 wrote:
http://www.obelisk.me.uk/6502/reference.html
This one mentions it very clearly in the section about the JMP instruction:
Quote:
NB:
An original 6502 has does not correctly fetch the target address if the indirect vector falls on a page boundary (e.g. $xxFF where xx is any value from $00 to $FF). In this case fetches the LSB from $xxFF as expected but takes the MSB from $xx00. This is fixed in some later chips like the 65SC02 so for compatibility always ensure the indirect vector is not at the end of the page.
tokumaru wrote:
timl132 wrote:
http://www.obelisk.me.uk/6502/reference.html
This one mentions it very clearly in the section about the JMP instruction:
Quote:
NB:
An original 6502 has does not correctly fetch the target address if the indirect vector falls on a page boundary (e.g. $xxFF where xx is any value from $00 to $FF). In this case fetches the LSB from $xxFF as expected but takes the MSB from $xx00. This is fixed in some later chips like the 65SC02 so for compatibility always ensure the indirect vector is not at the end of the page.
Oh sorry, wow. I even remember reading that, but completely forgot about it.
Thanks for pointing out.