Closed BigEd closed 12 years ago
On Sunday, November 4, 2012, BigEd wrote:
Hi I notice you push and pull the return value for JSR and RTS. A physical 6502 pushes one less than the return value, and RTS will increment the value pulled from the stack.
Thanks for noticing, I'll fix it.
Note however that there is currently a much bigger bug because all write operations done using the stack are not considered for invalidating the jit cache and self-modifying code living in the stack is not going to work (and it's not something totally absurd... I remember using self-modifying code in the stack against NMI hardware snapshots).
The emulator is also far from complete and for sure there are problems with the status bits (like decimal mode and overflow).
(You might be interested in Klaus Dormann's 6502 testsuite - see https://github.com/redline6561/cl-6502/blob/b0087903428ec2a3794ba4219494005174d1b09f/tests/6502_functional_test.a65or http://forum.6502.org/viewtopic.php?f=2&t=2241
Thanks for the links, I'll check them out
Andrea
Now jsr/rts is fixed (in the sense it has the same bug as the original processor :-) )
Thanks! I think this odd behaviour may save a cycle in the original implementation, in which case it's worth having! (JSR is an odd bird: it reads the first operand byte, as it must, then stacks the PC. While it's decrementing the stack pointer, that operand byte is placed in the stack pointer. If that wasn't done there'd be a need for a temporary register or a re-read of the operand. See http://visual6502.org/JSSim/expert.html?graphics=f&loglevel=5&steps=20&a=0&d=202143 )
Hi I notice you push and pull the return value for JSR and RTS. A physical 6502 pushes one less than the return value, and RTS will increment the value pulled from the stack.
(You might be interested in Klaus Dormann's 6502 testsuite - see https://github.com/redline6561/cl-6502/blob/b0087903428ec2a3794ba4219494005174d1b09f/tests/6502_functional_test.a65 or http://forum.6502.org/viewtopic.php?f=2&t=2241)
Cheers Ed