Quote Originally Posted by sayzer View Post
As Alain mentioned, there are potential side effects If I start playing directly with the registers.
Instead now, I am using flags being set to zero before going to a subroutine, and set the flags if something inside the subroutine is used.
Then at the end of the subroutine(s), I am using a kind of select case with "GOTO".
This way, I don't have any "return" address to care for.
This is a little code eating though; but a lot safer.
-------------------
How about something like this:
Code:
main:
code....code...code...
addrreturn = 1
goto subroutine

return1:
addrreturn = 2
goto subroutine

return2:
addrreturn = 0
goto main

subroutine:
code....code....code
branch addrreturn , [ return1 , return2, return3.................]
Set your branch return location parameter, jump to the generic subroutine, branch back to wherever it came from. No calls, no gosubs, and so on...