Program Chain (Chain) - Sharp MZ-700 Basic Manual

Disk basic interpreter
Hide thumbs Also See for MZ-700:
Table of Contents

Advertisement

26
1.6 Program Chain (CHAIN)
Next, following the data file control commands, will be an explanation of program file
controls. The commands explained here are CHAIN (page 44) and SWAP (page 45).
When these commands are used, the program is registered on the floppy disk in job
units and, while the program is being run, a separate program can be read-out and
control moved to it, i.e., a program can be connected (CHAIN) to a program
registered on the floppy disk, and can be read-out (SWAP) in the form of a sub
routine. The CHAIN command, which connects and links the programs, will be
explained first.
The form of a CHAIN command can be, for example, as follows:
700
CHAI N
"F01: TeXT
2"
This statement means that the program currently within the text area is made NEW
(although the variable will be retained), the "TEXT 2" file registered on the floppy
disk in drive number 1 is to be overlaid (that is, to overlay text areas and be read out),
and control is moved to the heading of that text.
When this statement is executed, control will move away from the BASIC text now
running, newly read out the "TEXT 2" text, and control will move to that heading.
When the program CHAIN is executed, the variable, and the function defined by
DEF FN, will be transferred to the CHAIN destination program.
The CHAIN command function can be taken as <goto "filename"> .
. file "ABC"
~
file "DEF"
-
10 PRINT "SUNDAY"
10 INPUT A,S
,
2i PRINT A, B
:
100 CHAIN "DEF"
r-
300 CHAIN "GHI"
When the CHAIN command is used, a large program (even a huge program which
exceeds the BASIC text area) can be divided and, as shown in the figure above, can be
connected. When one program is finished, the data are left as is, and the following
programs are chained one after another.
The CHAIN command can be considered indispensable if complicated and diversified
data must be processed.

Hide quick links:

Advertisement

Table of Contents
loading

This manual is also suitable for:

Mz-2z009

Table of Contents