Tandy 1000 Basic Reference Manual page 112

Hide thumbs Also See for 1000:
Table of Contents

Advertisement

Chapter 10 I BASIC Keywords
Sample Program 2
Enter NEW and this program:
1 0 REM T H I S PROGRAM DEMONSTRATES C H A I N I N G U S I N G
2 0 A $ = " M A I N P R O G . B A S "
3 0 C H A I N MERGE " o v e r l a y l " ,
1 0 0 0 , ALL
4 0 E N D
T H E MERGE AND ALL O P T I O N S .
Save this program as mainprog.bas, using the A option. Enter
NEW, and then type:
1 0 0 0 P R I N T
A $ ; "
H A S C H A I N E D TO O V E R L A Y 1 . B A S . "
1 0 1 0
A $
=
" o v e r l a y l . b a s "
1 0 2 0
B $
=
" o v e r l a y 2 . b a 5 "
1 0 3 0 C H A I N MERGE " o v e r l a y 2 . b a 5 " ,
1 0 0 0 , A L L ,
1 0 4 0 E N D
D E L E T E 1 0 2 0
-
1 0 4 0
Save this program as overlayl.bas, using the A option. Enter
NEW, and then these lines:
1 0 0 0 P R I N T
A $ ;
"
H A S C H A I N E D TO
";E$;"."
1 0 1 0 E N D
Save this program as overlay2.bas, using the A option. Load
mainprog.bas and run it. Your screen should display:
M A I N P R O G . B A S H A S C H A I N E D TO O V E R L A Y 1 . B A S .
O V E R L A Y 1 . B A S H A S C H A I N E D TO O V E R L A Y 2 . B A S .
Hints:
The CHAIN statement with the MERGE option leaves the
files open and preserves the current OPTION BASE setting.
0
The CHAIN statement without the MERGE option does not
preserve variable types or user-defined functions for use by the
chained program. That is, any DEFINT, DEFSNG, DEFDBL,
DEFSTR, or DEF FN statements containing shared variables
must be restated in the chained program.
0
When using the MERGE option, place user-defined functions
before any CHAIN MERGE statements in the program. Oth-
erwise, the user-defined functions will be undefined after the
merge is complete.
0
CHAIN automatically executes a RESTORE before running
the chained program. The next READ statement starts a t the
first item of the first DATA statement.
110

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents