Hello,
you can only use RTS when you've called a subroutine, because RTS pulls the return adress from the stack ang continues execution on that adress..
The only branch that calls a subroutine is BSR. Every other branch is just like a jump. So if you use RTS,without a JSR or BSR, you pull two bytes from the stack and return to that adress. This will make your program go crazy.
Of course you can branch and push a return adress on the stack and then use RTS but this is more a theoretical approach.
Eckhard
Hello,
you can only use RTS when you've called a subroutine, because RTS pulls the return adress from the stack ang continues execution on that adress..
The only branch that calls a subroutine is BSR. Every other branch is just like a jump. So if you use RTS,without a JSR or BSR, you pull two bytes from the stack and return to that adress. This will make your program go crazy.
Of course you can branch and push a return adress on the stack and then use RTS but this is more a theoretical approach.
Eckhard