How to GOTO or GOSUB across 2Kx8 ROM pages on BS2e
dashuang
Posts: 4
I want to use more than one 2K ROM page with BS2e for a single application.· I've set up the compiler directive and successfully tokenized a second file·with some code in it, including label "P1:".· When I attempt to GOTO P1 from the "file0" page, I get a compiler error - label not found.· Does anyone know how to GOTO or GOSUB etc. across 2K pages on a BS2e?· I've been unable to find an answer in the Parallax docs.·
Comments
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
dtq
·· You cannot GOTO or GOSUB across banks like that.· You must use the RUN command as mentioned above.· Bear in mind though that in each bank you must also declare all of your variables and in the same order and sizes or you will have problems with them between programs.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Tech Support
csavage@parallax.com
com = 1
run 1
Then in P1, at the very beginning of the P1 program, write:
if com = 1 then do something
When do something finishes, and you want to go back to bank 0, enter the following:
com = 1
run 0
At the very beginning of the bank 0 program, enter"
if com = 1 then something new.
It is important that the flags be entered at the very beginning of each program.· Stamp must read those lines before it reads anything else.· If you need more help, just holler.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Sid Weaver
NEW! 4 MB EEPROM
http://hometown.aol.com/newzed/page4.html
·
http://www.parallax.com/dl/docs/cols/nv/vol3/col/nv87.pdf
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Jon Williams
Applications Engineer, Parallax
Dallas, TX· USA
Thanks so much for the RUN # solution -- and use of a flag to facilitate a pseudo return.
Chris @ Parallax: FYI, it would have been helpful for me to see a short note about the RUN # command added to the "Compiler Directives" section of Help under:
{$STAMP BS2e, file2, file3, ..., file8}
There is nothing mentioned there about how to actually RUN the code compiled in the various "program slots" (file#'s).
I did several Help searches -- which did not yield info about RUN # command.
Thanks again. Problem solved!
Your N&V article is super.
Thanks!