How do you switch between programs inthe BS2p?
JJaime
Posts: 8
do any of you could give me an script of how actually use the RUN command in the BS2p?
does this actually work for the BS2p?
What is the technique to enter a program in SLOT 0, 1, 2, 3 ..? do you have to use the PUT command for this purpose?
This issue has not been clear to me yet and I have not seen an straight example for the BS2p
Appreciate your input to this matter.
does this actually work for the BS2p?
What is the technique to enter a program in SLOT 0, 1, 2, 3 ..? do you have to use the PUT command for this purpose?
This issue has not been clear to me yet and I have not seen an straight example for the BS2p
Appreciate your input to this matter.
Comments
edit: my bad, multi-file not -slot, and don't forget the $Stamp directive
Read the 'run' command in the manual. The problem is that the 'run' command always causes the run-to program to restart at the beginning.
Dr Tracy Allen [www.emesystems.com] has a write-up on this under his notes. I am trying to insert a routine to allow redirecting the receiver program to resume where it left off. Don't know at this time if I'm on the right track.
cheers, David
There are only three things you need to do for this to work right:
1. create two program files, say slot0.bsp and slot1.bsp. Then define all your variables EXACTLY the same in both files. This is crucial.
2. in the Stamp directive of the FIRST slot program (slot0.bsp) add the additional file name(s), separated by commas. In this case you would only have one extra file:
This tells the editor to load the "base" program into slot 0, and the file "slot1.bsp" into slot 1. "slot0.bsp" is the "base" or master program file.
3. at the end of the code in "slot0.bsp" put the following line:
and at the end of the code in slot1.bsp put the following line:
Voila. When the 2k worth of code in slot 0 runs, it will "switch" to the code in slot 1 and carry on, then go back to the beginning.
The reason for defining the variables EXACTLY the same in both programs is so you don't clobber or "lose" the variables when the slot switches. "Exactly" means the same names, the same ORDER of definition, the same sizes (word, byte, nib, etc).
That said, if you all need to do is "skip" some initialization/setup code at the beginning of slot 0, use a bit flag to skip it after it's run once:
I put the initialization and "do once" code in the first slot then just circulate through the other slots with the "RUN" command the last statement in each slot. -Scott
http://www.parallax.com/Portals/0/Do...3/col/nnnnv87.pdf
It took me a bit of time to understand it, but works well once you get the knack. You break your program into tasks and use the scratch pad area to store the destination task and the return task, as well as save variables if you need to.
http://www.parallax.com/Portals/0/Downloads/docs/cols/nv/vol3/col/nv87.pdf
There is no one right way to approach multi-slot programming. I see that my own way of doing it came up in the thread in the context of it being a struggle. I've been working with it so long that it seems completely natural!
Anyway, I'm attaching a little pdf I had made to illustrate how it works. More graphic than what is on the web site.