Currently messing with 6502 assembly on a C64, and I don't understand why the JSRJSR
instruction is so weird.
According to the instruction-table table, JSRJSR
is a 3-byte instruction and only operates in absolute mode. However, JSRJSR
only increasesincrements the PC withby 2 bytes before pushing it on the stack. Which means SPthe return address points to the last byte of the JSRJSR
instruction. It seems the RTSRTS
pops the valuesvalue from the stack, adds another byte to and increments it again before setting the PC to the corrected value.
My question is: Why? Why not just let JSR increaseJSR
increment the PC withby 3 bytes instead of 2, and let RTSRTS
just pullpop and jump? This looks like a forfar more logical approach. Any reason for making this so complicated?