Users browsing this thread: 1 Guest(s)
JSR Returning to wrong place in code

#4
Posts: 763
Threads: 83
Thanks Received: 55
Thanks Given: 7
Joined: Apr 2015
Reputation: 22
Status
Obliviscence
Man, I did a whole stream on this subject. But the I had to stop/start the stream a few times changing resolution cause my internet was dumb... otherwise I'd have it on youtube.

Basically, when you JSR it pushes your current location to the stack so that the RTS knows where to come back to. RTS takes the last 2 bytes on the stack (pushed from your JSR) as a return address then adds 1 to get to the next byte of code. This is why as a general rule, you don't f*** with the stack. however, if you know where you are in the stack its all usable.

Keep an eye out for maybe a push or pull inside a conditional that may be skipped due to a branch. That's the place I most often screw up the stack.
  Find
Quote  



Messages In This Thread
RE: JSR Returning to wrong place in code - by B-Run - 12-01-2016, 08:49 AM

Forum Jump:

Users browsing this thread: 1 Guest(s)


Theme by Madsiur2017Custom Graphics by JamesWhite