It was very common back in the day to start all subroutines at line 1000, or some other large round number, and then just before that large number have an END statement.
999 END 1000 REM SUBROUTINES FOLLOW 1100 REM ADD ONE TO A 1110 A = A + 1 1199 RETURN 1200 REM MULTIPLE A BY 1 1210 A = A *1 1299 RETURN To ensure that the subroutines were never reached accidentally. > On Dec 10, 2018, at 12:20 PM, John R. Hogerhuis <[email protected]> wrote: > > In other languages you can't call into the middle of a function. There is one > entry point, possibly multiple exit points. There's no chance unbalanced CALL > and RETURN. once you return you're jump to the stacked address and you're no > longer in the subroutine. > > In basic subroutines, because every line is a potential entry point, you can > possibly have multiple entry points into the same subroutine! Or in this case > that follows, a single entry point but in one case I enter the sub at line > 1000 with a gosub and in the other with sequential "fall through" execution. > > 100 gosub 1000 > > 1000 ?"hello" > 1010 return > > That will give you the same error you saw, Peter, because it unbalanced the > return stack on the second entry to line 1000. > > How can I avoid it? > > Add > > 110 goto 100 > > It will run forever. http://www.hoboes.com/Mimsy/ "After midnight, all things are possible."
