Hey all.

I have some routines that I want to use in multiple programs (setting up
and starting up a serial port, sending out initialization codes, and then
having files open, etc)

I thought of doing something like this:

--- A,ba
10 $prg = "a.ba"
20 IF aok THEN GOTO 100
30 RUN  "setup.ba",R
40 END
100 PRINT "Setup has run!"
110 PRINT "do other stuff now."

-- B.ba
10 IF aok then GOTO 100
20 OPEN "COM:xxxx" FOR OUTPUT AS #1
30 OPEN "COM:xxxx" FOR INPUT AS #1
40 ON COM GOSUB 200
50 COM ON
60 aok = 1
100 RUN $prg,R
110 END

---- (example code from memory, some syntax errors may be typoed in)

So the idea is that I can just use the code seen in A.ba, lines 10-30 to
call the setup routines in the b.ba program if it's not already set up

And b.ba will set 'aok' and then return to A.ba, which will go through the
beginning bit again. but continue on line 100.

But it doesn't seem to work.  RUN "file",R only preserves open files, not
variables...

Is there a way to do this, is my 2018 software engineering brain
over-solving this, or is there another way to have "library functions"
available to multiple programs without burning a rom. ;)

-s


-- 
Scott Lawrence
yor...@gmail.com

Reply via email to