Commodore 2001-8 User Manual page 68

Table of Contents

Advertisement

ADDITIONAL BASIC COMMANDS
By this time, the user
is
probably familiar with the use of the commands INPUT and PRINT. INPUT
permits the output or display of data. These commands are common to all forms of BASIC.
To add flexibility to the PET computer system, several commands have been added to classical BASIC in
the PET, and future Commodore products will take advantage of the resulting extra capability. In general,
enhanced flexibility of data interchange between the PET and peripheral devices
is
possible, thanks to
the use of these extra commands.
To communicate with any device,
a
combination of the additional commands is used:
a)
OPEN/CLOSE
Open or close logical file.
b)
PRINT#
Write data from PET to If0 device.
0)
CMD
Same as PRINT# but leaves IEEE device an active
listener on bus after execution of command.
d)
INPUT#
Read data from 1/0 device to PET.
e)
GET#
PET accepts one character from 1/0 device.
INPUTIOUTPUT COMMAND PARAMETERS
In order
to
use the additional commands referred to in the above, four parameters must be taken into
consideration:
a)
Logical file number (LF)
b)
Device number (D)
c)
Secondary address (SA)
d)
File-name (FN)
These parameters can appear, for example, when using the OPEN# command in the form of the
statement:
OPEN#LF,D,S,FN
LOGICAL FILES
Files are used to store and retrieve data, as for example in the case of a magnetic tape or disc file. A
convenient extension of this idea is to regard any device which can receive and/or generate data as a
logical file. To the PET operating system, data might just as well have come from, or be going to, a
storage system such as magnetic tape.
For example, imagine that an external digital voltmeter is set up so that it can transmit voltage readings
upon request to the PET via the IEEE bus. Sometime during the "voltmeter program" the programmer will
have to open a file and assign a logical file number to referto the voltmeter. Once this has been done, The
PET can use a "read" command (INPUT#) which uses the logical file number to refer to the voltmeter.
When no further data is required from the voltmeter, the logical file can be closed.
More generally, the advantages offered by the use of logical files are:
a)
Every device number secondary address combination
can be associated with its own unique logical file number
within a program.
b)
Multiple files within a single dev ice can be refered to
by means of distinct logical file numbers. This approach is
to be used in the newly developed disc storage system for
the PET.
c)
Once a logical file number has been defined in an OPEN
65

Advertisement

Table of Contents
loading

This manual is also suitable for:

Pet 2001-8

Table of Contents