Shop OBEX P1 Docs P2 Docs Learn Events
BS2p40 program slots — Parallax Forums

BS2p40 program slots

Pressus LimitedPressus Limited Posts: 23
edited 2010-05-27 16:26 in BASIC Stamp
Hi,

I remember seeing somewhere, a routine that allowed you to switch program slots using the RUN command and then automatically jumping to a specific routine and back·to the·correct position in the main program slot, much like using the GOSUB command, can anybody point me in the right direction to find it as I can't for the life of me remember where it was.

Thanks

Jon

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2010-05-27 15:48
    There's no such routine and there's no direct way to RUN a specific routine in another slot or to return after the RUN statement. The best you can do is to put a label after the RUN statement and have a label in the other slot for your "specific routine". Before the RUN statement, you'd set a shared variable to a number unique to the destination label and another shared variable to a number corresponding to the label after the RUN statement. At the beginning of the destination slot program, you'd have a BRANCH statement that would use the 1st shared variable to GOTO the label for your routine and at the beginning of your main slot program, you'd have another BRANCH statement that would use the 2nd shared variable to GOTO the labels after the RUN statements. Study some of the examples of multi-slot programming in the chapter on the RUN statement in the Stamp Manual. There's also a Nuts and Volts Column on the subject (#87).
  • ercoerco Posts: 20,256
    edited 2010-05-27 16:13
    See also N&V #71: http://www.parallax.com/dl/docs/cols/nv/vol2/col/nv71.pdf

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    ·"If you build it, they will come."
  • Pressus LimitedPressus Limited Posts: 23
    edited 2010-05-27 16:26
    As always, a great help

    thank you
Sign In or Register to comment.