
Originally Posted by
helloo
Hey @ all,
I wonder what happens within the µC when I write code that jumps out of a subroutine with the goto command?
Example:
Code:
main:
GOSUB label
goto main
label:
GOTO somwhereelse
RETURN
somwhereelse:
DOSOMETHING HERE
GOTO main
I know from other BASIC dialects that one should'nt do this, because it messes up the pointers. But what happens in PBP eg. the PIC itself?
Is there a better solution for this problem?
Greetings, helloo
Try:
Code:
main:
GOSUB label
IF bit1 = 1 then
GOTO somwhereelse
Endif
goto main
label:
'GOTO somwhereelse
F x > 3 then
bit1 = 1 'set a flag
Endif
RETURN
...
RETURN
somwhereelse:
DOSOMETHING HERE
GOTO main
Norm
Bookmarks