Debugging 6502, JMP indirect mode confusion about results

Discuss emulation of the Nintendo Entertainment System and Famicom.

Moderator: Moderators

Post Reply
Darek554
Posts: 7
Joined: Tue Apr 13, 2021 11:03 pm

Debugging 6502, JMP indirect mode confusion about results

Post by Darek554 »

Hi.
So i'm still debugging CPU, and i'm on very confusing me part.

Line 3348, $DBB5:
https://github.com/christopherpow/nes-t ... estest.log

Code: Select all

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 CYC:201 SL:63
So on $02FF address i have byte of value 0x00, then on address $0300 i have value 0xA9, so PC is set to $A900.
So how is it possible that next instruction has address = $0300 according to logs?
It's very strange to me, can anyone help? :D
Myself086
Posts: 158
Joined: Sat Nov 10, 2018 2:49 pm

Re: Debugging 6502, JMP indirect mode confusion about results

Post by Myself086 »

There's a bug where the CPU won't cross page boundary when reading the destination address.
First byte is found at $02FF as expected but the second byte will be at $0200 instead of $0300.
Darek554
Posts: 7
Joined: Tue Apr 13, 2021 11:03 pm

Re: Debugging 6502, JMP indirect mode confusion about results

Post by Darek554 »

Thanks a lot!
User avatar
Quietust
Posts: 1920
Joined: Sun Sep 19, 2004 10:59 pm
Contact:

Re: Debugging 6502, JMP indirect mode confusion about results

Post by Quietust »

As I mentioned in your other thread, the version of nestest.log you retrieved from that repository is outdated and contains an error, and you literally just encountered that error - the section you quoted is supposed to begin with "DBB5 6C FF 02 JMP ($02FF) = 0300".
Quietust, QMT Productions
P.S. If you don't get this note, let me know and I'll write you another.
User avatar
Zepper
Formerly Fx3
Posts: 3262
Joined: Fri Nov 12, 2004 4:59 pm
Location: Brazil
Contact:

Re: Debugging 6502, JMP indirect mode confusion about results

Post by Zepper »

Quietust wrote: Sun Apr 18, 2021 6:00 am As I mentioned in your other thread, the version of nestest.log you retrieved from that repository is outdated and contains an error, and you literally just encountered that error - the section you quoted is supposed to begin with "DBB5 6C FF 02 JMP ($02FF) = 0300".
So... it didn't make any sense! ^_^;; Thanks!
Post Reply