Chapter 8 Peripheral Devices
269
1/0,
and the disk controller. This leaves you with only four buffers for
random access files.
Be
sure not to open more than four buffers at a time.
Opening more than four will result in a system error.
Information
is
written to diskette random access files using the
PRINT# command. The files are specified through parameters in the OPEN
statement. The format for opening a random access file
is
as follows:
OPEN lfn,
dn,
sa,
"#
buf'
where:
lfn
dn
sa
buf
is
the logical file number.
For
performing data transfers, use logical file
numbers between 2 and
14.
To perform any utility command, use logical
file
15.
In general,
it
is
a good idea to open the command channel
(15)
and
a data channel for each operation
is
the device number
is
the secondary address
(it
must have a value between 2 and
14)
is
the buffer number allocated to the specified secondary address. You do
not need to use this specification.
If
you leave it out, DOS will automati-
cally select a buffer.
DISK
UTILITY
INSTRUCTIONS
The VIC 20's disk utility instructions are described in this section. Table
8-3
provides a summary of these commands.
BLOCK-READ
The BLOCK-READ command reads any sector (block) into one ofthe
memory buffers. To read a block, you would first need to open the com-
mand channel (15) as follows:
10
OPE~I
15,8,15
Now a direct access channel must be opened.
20
OPEN
2,8,4,"1"
You can select which block you want to read (by track and sector).
30
INPUT
"TRACK";
A
40
INPUT
"SECTOR";
B