So this is the first time I've experienced this. It's sorta wacky.
I have a routine that I'd like to use in a few instances, so I set up a JSR->Routine->RTS scenario. It does not work. I mean, there are no errors returned, however its effect does not work...
Now, if I take the meat of the routine (all except for the RTS) and put it in line rather than JSRing to it, it works exactly as expected.
Also, I tried JMPing to it and then JMPing back to the next line (which would, for all intents and purposes, do the same as a JSR->RTS I would think), and that actually worked as expected.
I could do it in line, except that I'd like to use the routine in a few places and I'd have to change the label names...it just seems gratuitous to have to put the exact same code in multiple places like that; I had intended to just JSR to it from the few places that I needed it.
Can anyone think of a reason why it would work in line, JMPing to it and JMPing back would work, but cutting the exact code out, pasting it somewhere as a routine, and JSR-RTSing from it would not?
In context, I feel like this might be a fundamental thing I don't understand rather than something wrong with the code.
Thanks!
I have a routine that I'd like to use in a few instances, so I set up a JSR->Routine->RTS scenario. It does not work. I mean, there are no errors returned, however its effect does not work...
Now, if I take the meat of the routine (all except for the RTS) and put it in line rather than JSRing to it, it works exactly as expected.
Also, I tried JMPing to it and then JMPing back to the next line (which would, for all intents and purposes, do the same as a JSR->RTS I would think), and that actually worked as expected.
I could do it in line, except that I'd like to use the routine in a few places and I'd have to change the label names...it just seems gratuitous to have to put the exact same code in multiple places like that; I had intended to just JSR to it from the few places that I needed it.
Can anyone think of a reason why it would work in line, JMPing to it and JMPing back would work, but cutting the exact code out, pasting it somewhere as a routine, and JSR-RTSing from it would not?
In context, I feel like this might be a fundamental thing I don't understand rather than something wrong with the code.
Thanks!