Closed macmade closed 1 year ago
No, I think this is correct; cf. #36. When performing a JSR the 6502 performs the following process:
1 PC R fetch opcode, increment PC
2 PC R fetch low address byte, increment PC
3 $0100,S R internal operation (predecrement S?)
4 $0100,S W push PCH on stack, decrement S
5 $0100,S W push PCL on stack, decrement S
6 PC R copy low address byte to PCL, fetch high address
byte to PCH
And in that particular test case step 4 has overwritten part of the opcode such that when PCH is fetched in step 6 it's the same PCH that was just pushed.
Wow...
I haven't even tought about searching a similar issue for what I thought was a no-brainer...
Thank you so much for the fast reply.
And thank you for the absolute mind-blow!
First of all, thank you so much for providing these tests.
I'm currently using them to unit-test my 6502 emulator.
While running your tests, I encountered a failed test in
20.json
, for the20 55 13
test.Instruction translates to:
JSR $#0x1355
JSR
is unconditional, so the expected value forPC
after the instruction is0x1355
or4949
.The test case has a final PC value of
0x155
or341
.Or am I missing something?