JSR Returning to wrong place in code
#4
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.
Reply


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

Possibly Related Threads…
Thread Author Replies Views Last Post
  Map graphics error and wrong location name Gestahl 4 5,688 03-04-2020, 05:09 PM
Last Post: Gestahl
  Wake Up animation is wrong doofenH 2 2,363 02-01-2020, 06:20 PM
Last Post: C-Dude
Dark Knight FF6 SNES vs GBA code differences? Royaken 2 2,590 11-01-2019, 07:32 PM
Last Post: Royaken
  Peer Sprite Viewer (what am I doing wrong?) romraptor 7 5,415 08-22-2019, 03:04 PM
Last Post: romraptor
  Sorry if this is the wrong place need help Zinchi 2 2,620 11-12-2017, 10:13 PM
Last Post: Zinchi
  Event Hacking - What am I doing wrong? PowerPanda 7 6,737 05-04-2017, 07:29 PM
Last Post: PowerPanda
  asm hacking: "faking" short jumps from your code (in a new bank) to old code Eggers 2 3,911 04-16-2016, 07:18 PM
Last Post: madsiur
  Magic Control Code sleepydude 16 14,315 09-19-2015, 02:41 PM
Last Post: Tenkarider
  Sprite Armor Code Royaken 2 3,577 05-30-2015, 11:26 AM
Last Post: Catone
  How to Place your Custom Boss Hack and how to hide Ayamatsuno148 1 2,704 02-11-2014, 11:49 AM
Last Post: SSJ Rick

Forum Jump:


Users browsing this thread: 1 Guest(s)