nesdev.com
http://forums.nesdev.com/

nestest log with bus cycles
http://forums.nesdev.com/viewtopic.php?f=3&t=13283
Page 2 of 2

Author:  blashyrk [ Fri Jan 20, 2017 4:19 pm ]
Post subject:  Re: nestest log with bus cycles

lidnariq wrote:
No, because the instruction pointer already points to $D000 by the time the offset is going to be added. (Hence why relative branches have an effective displacement of -126 to +129 bytes)


Thank you!

Author:  Zepper [ Fri Jan 20, 2017 6:21 pm ]
Post subject:  Re: nestest log with bus cycles

lidnariq wrote:
No, because the instruction pointer already points to $D000 by the time the offset is going to be added. (Hence why relative branches have an effective displacement of -126 to +129 bytes)

Yes. Cycle 3 is the answer.
Code:
CFFE  F0 05     BEQ $D005
    #   address  R/W description
       --- --------- --- ---------------------------------------------
        1     PC      R  fetch opcode, increment PC
        2     PC      R  fetch operand, increment PC
        3     PC      R  Fetch opcode of next instruction,
                         If branch is taken, add operand to PCL.
                         Otherwise increment PC.
        4+    PC*     R  Fetch opcode of next instruction.
                         Fix PCH. If it did not change, increment PC.
        5!    PC      R  Fetch opcode of next instruction,
                         increment PC.

So, right, PC is at $D000 when adding the operand byte.

Author:  lidnariq [ Fri Jan 20, 2017 6:35 pm ]
Post subject:  Re: nestest log with bus cycles

You know how I was talking about a language barrier before?

Here's his question, emphasis mine:
blashyrk wrote:
Shouldn't an extra cycle be added at this point because we're branching from CFFE -> D005?


Please reread his question and my answer until you understand that I answered the question correctly.

Author:  Zepper [ Fri Jan 20, 2017 7:16 pm ]
Post subject:  Re: nestest log with bus cycles

lidnariq wrote:
Please reread his question and my answer until you understand that I answered the question correctly.

Did I answer incorrectly? I edited slightly my post to be crystal clear.

Author:  tepples [ Fri Jan 20, 2017 10:44 pm ]
Post subject:  Re: nestest log with bus cycles

Think of it this way: Look at the address of the opcode that would be executed if the branch were not taken. If the taken and not-taken opcode are in the same page, there is no page crossing penalty cycle.

In the present case of a branch at $CFFE, this not-taken instruction is at $D000. The taken instruction is $D005, which is in the same page as $D000.

Author:  Rational [ Sun Oct 15, 2017 3:31 pm ]
Post subject:  Re: nestest log with bus cycles

I am also sorry but I must resurrect this thread. There is something that I simply don't get.

I have been using this log to run my CPU through some tests and I actually don't understand at all what is happening to the "log registers" whenever it calls PHP followed by PHA.

If you look at line 73, the accumulator is set with the value 0x7F. Two lines before, it uses PHP when the Status Register is set at 0x6F, and just after it calls immediately PLA, which is supposed to pull back the same value (0x6F) and store it into the Accumulator...no ?
Unless PHP or PLA are supposed to modify the value in question, is there someone who can explain to me why the log is specifying the value 0x7F for the accumulator in this very specific line ?

EDIT : Same pattern for lines 82/83/84. Stores 0x64, retrieve 0x74. Each time the original value is met again by the use of AND instruction.

Author:  lidnariq [ Sun Oct 15, 2017 3:33 pm ]
Post subject:  Re: nestest log with bus cycles

nesdevwiki:CPU status flag behavior

Author:  Rational [ Sun Oct 15, 2017 3:37 pm ]
Post subject:  Re: nestest log with bus cycles

lidnariq wrote:


Thank you so much dude. I never saw it specified elsewhere before.

Author:  lidnariq [ Sun Oct 15, 2017 3:38 pm ]
Post subject:  Re: nestest log with bus cycles

Is there another place we could put that information that would have helped you find it on your own?

Author:  Rational [ Sun Oct 15, 2017 3:48 pm ]
Post subject:  Re: nestest log with bus cycles

lidnariq wrote:
Is there another place we could put that information that would have helped you find it on your own?


No it is put in the right place. The thing is I already read this page before but it was for another reason. I completely forgot about these lines talking about PHP and BRK.

Usually I use this http://www.obelisk.me.uk/6502/reference.html or the Levanthal's 6502 book.

Once again thank you for your quick help :D

Page 2 of 2 All times are UTC - 7 hours
Powered by phpBB® Forum Software © phpBB Group
http://www.phpbb.com/