Msg: 1216 *Conference*

01-04-92 10:41:06

From: RICHARD HANSON

To : CORY HAWKINS

Subj: REPLY TO MSG #1213 (BASIC CHAINING)

Channing BASIC programs is VERY EASY !!!  And, when associated with TS-DOS with
the DOS-ON function--enabling TPDD access--your BASIC programs can be very
large, and very modular, indeed.
 
The trick is to use RUN"0:filename" instead of GOSUB and RETURN.  Here's an
example: Let's say you have a menu and two sub routines.  The menu is called
MENU.BA and the routines are called SUB1.BA and SUB2.BA.  They would all reside
on the TPDD and might look like this:
 
 10 'MENU.BA
 20 PRINT"(1) Run sub 1"
 30 PRINT"(2) Run sub 2"
 40 PRINT"(3) Quit"
 50 INPUT"Now what";X
 60 IFX="1"THENRUN"0:SUB1.BA"
 70 IFX="2"THENRUN"0:SUB2.BA"
 80 IFX="3"THENMENU
 90 GOTO10
 
 10 'SUB1.BA
 20 ....whatever
 30 ....whatever
 10000 RUN"0:MENU.BA"
 
 10 'SUB2.BA
 20 ....whatever
 30 ....whatever
 20000 RUN"0:MENU.BA"
 
Using the above example, you could develop specialized disks with programs on
them, each altered to come back to a "calling" menu program for the sub
programs on the disk.  You could use a common program name for the menu, like
MENU.BA, and a generic calling program in your machine, like START.BA; which
would also be on each disk.  Your menu program, instead of calling MENU to
exit, would RUN"0:START.BA"  And your START program would have two selections,
i.e., RUN"0:MENU.BA" and MENU.
 
So, you want modular?  There it is!  -Rick-