Nestest log question

This is an archive of a topic from NESdev BBS, taken in mid-October 2019 before a server upgrade.
View original topic
Nestest log question
by on (#48742)
Hey everyone, Im just testing my CPU right now and I got a working nestest log from http://nesdev.com/bbs/viewtopi ... ight=#6651 (nestest.log from Quietust).

My CPU seems to match that test log exactly except for this part:

Code:
DBB5  6C FF 02  JMP ($02FF) = A900              A:60 X:07 Y:00 P:65 SP:F9 CYC:180 SL:63
0300  A9 AA     LDA #$AA                        A:60 X:07 Y:00 P:65 SP:F9 CYC:195 SL:63
0302  60        RTS                             A:AA X:07 Y:00 P:E5 SP:F9


My CPU jumps to A900 after DBB5 instead of 0300 like this one, and for the life of my I cant figure out why it is supposed to jump to 0300. None of the registers look like they are set to make it do that, am I missing something completely obvious here? My CPU will eventually get back on track after 20 or so instructions, but this is really bugging me. Thanks!

by on (#48743)
Indirect jumps don't increment the high byte of the pointer to the destination address while fetching it in case the lower byte wraps around. So, if the low byte of the destination address comes from $02FF, the high one will come from $0200, not $0300.

by on (#48746)
That makes sense, thanks a bunch!

by on (#48747)
Be sure to note this only affects JMP indirect, and only applies to the 6502. (The 65C02 doesn't have this problem). It's one of the few documented 6502 bugs. :)