Gosubs across Code segments in SX
Archiver
Posts: 46,084
Do GOSUB's remain persistant when you run another program on the SX? I have a gosub/return pair in code space 0. I call code space 1 and then run·code space 0. Upon hitting the return my program starts over. Is the gosub/return stack cleared when the "RUN" command is executed?·If so are there any workarounds?···
MH
MH
Comments
is lost when you run another program. About the only workaround is
to assign each return location a number and store that number in a
variable that will be preserved when other program(s) run. Use a
Branch instruction at the beginning of the main program to sort out
the returns. Cumbersome, but workable.
--- In basicstamps@egroups.com, "Michael Hendricks" <mjh80@b...>
wrote:
> Do GOSUB's remain persistant when you run another program on the
SX? I have a gosub/return pair in code space 0. I call code space 1
and then run code space 0. Upon hitting the return my program starts
over. Is the gosub/return stack cleared when the "RUN" command is
executed? If so are there any workarounds?
>
> MH
and borderline unmanagable.. thanks for clearing that up...
MH
Original Message
From: <stamps@s...>
To: <basicstamps@egroups.com>
Sent: Friday, October 06, 2000 11:32 PM
Subject: [noparse][[/noparse]basicstamps] Re: Gosubs across Code segments in SX
> As you have discovered, the pointer required to return from a Gosub
> is lost when you run another program. About the only workaround is
> to assign each return location a number and store that number in a
> variable that will be preserved when other program(s) run. Use a
> Branch instruction at the beginning of the main program to sort out
> the returns. Cumbersome, but workable.
>
>
> --- In basicstamps@egroups.com, "Michael Hendricks" <mjh80@b...>
> wrote:
> > Do GOSUB's remain persistant when you run another program on the
> SX? I have a gosub/return pair in code space 0. I call code space 1
> and then run code space 0. Upon hitting the return my program starts
> over. Is the gosub/return stack cleared when the "RUN" command is
> executed? If so are there any workarounds?
> >
> > MH
>
>
>
>
>