SV: [basicstamps] RUN within GOSUB
Archiver
Posts: 46,084
Greetings!
The stack is cleared when you use the RUN command.
Please note, you don't 'call' the other program slot with RUN, you stop
executing in the old slot and start executing in the new slot. There's
no way to 'return' to where you left off in the first slot.
Variables and scratchpad RAM, though, is unaffected, so can be used to
pass parameters and program state back and forth. (There are some good
docs about this on the Parallax site)
:-)
Trygve
Opprinnelig melding
Fra: dangerduckula [noparse]/noparse]mailto:[url=http://forums.parallaxinc.com/group/basicstamps/post?postID=fmcIuwfnzD8sHYV1HRgvz71vkPL2Lox-mPqAUtg4s8zCC4WvIjXoylaxo1FwreoBjQVOyAcYeohJ74LtshxHlutU]countduckula@o...[/url
Sendt: 16. januar 2004 12:03
Til: basicstamps@yahoogroups.com
Emne: [noparse][[/noparse]basicstamps] RUN within GOSUB
Calling a subroutine saves the program counter to the stack, if I
call another program slot using the run command will I eventually run
into trouble or is the stack cleared everytime a new program slot is
run.
The stack is cleared when you use the RUN command.
Please note, you don't 'call' the other program slot with RUN, you stop
executing in the old slot and start executing in the new slot. There's
no way to 'return' to where you left off in the first slot.
Variables and scratchpad RAM, though, is unaffected, so can be used to
pass parameters and program state back and forth. (There are some good
docs about this on the Parallax site)
:-)
Trygve
Opprinnelig melding
Fra: dangerduckula [noparse]/noparse]mailto:[url=http://forums.parallaxinc.com/group/basicstamps/post?postID=fmcIuwfnzD8sHYV1HRgvz71vkPL2Lox-mPqAUtg4s8zCC4WvIjXoylaxo1FwreoBjQVOyAcYeohJ74LtshxHlutU]countduckula@o...[/url
Sendt: 16. januar 2004 12:03
Til: basicstamps@yahoogroups.com
Emne: [noparse][[/noparse]basicstamps] RUN within GOSUB
Calling a subroutine saves the program counter to the stack, if I
call another program slot using the run command will I eventually run
into trouble or is the stack cleared everytime a new program slot is
run.