Minor CPU change: JSR/RTS handling

2008-04-07
2013-05-30
  • In JBit-20080407, I have changed the JSR/RTS handling.

    Previously, JSR put the return address on the stack, pushing the low byte first.
    Starting from  JBit-20080407, JSR puts the return address MINUS ONE on the stack, pushing the HIGH byte first. This change has been made to conform to the real 6502.

    Usually, it does not matter what is put on the stack, as long as JSR and RTS are consistent. But in some cases, it does matter; one way to implement a jump table is to push the address to jump to onto the stack using PHA and then to issue an RTS instruction. The new handling should simplify the porting of code using techniques like this.