Thank you!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)
nestest log with bus cycles
Moderator: Moderators
Re: nestest log with bus cycles
Re: nestest log with bus cycles
Yes. Cycle 3 is the answer.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)
Code: Select all
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.
Last edited by Zepper on Fri Jan 20, 2017 7:17 pm, edited 1 time in total.
Re: nestest log with bus cycles
You know how I was talking about a language barrier before?
Here's his question, emphasis mine:
Here's his question, emphasis mine:
Please reread his question and my answer until you understand that I answered the question correctly.blashyrk wrote:Shouldn't an extra cycle be added at this point because we're branching from CFFE -> D005?
Re: nestest log with bus cycles
Did I answer incorrectly? I edited slightly my post to be crystal clear.lidnariq wrote:Please reread his question and my answer until you understand that I answered the question correctly.
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.
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.
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.
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.
Last edited by Rational on Sun Oct 15, 2017 3:35 pm, edited 1 time in total.
Re: nestest log with bus cycles
Thank you so much dude. I never saw it specified elsewhere before.lidnariq wrote:nesdevwiki:CPU status flag behavior
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?
Re: nestest log with bus cycles
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.lidnariq wrote:Is there another place we could put that information that would have helped you find it on your own?
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