Sequential Files - Commodore 1541 User Manual

Hide thumbs Also See for 1541:
Table of Contents

Advertisement

5.
SEQUENTIAL FILES
OPEN
SEQuential files are limited by their sequential nature, which means they must be
read from beginning to end. Data is transferred byte by byte, through a buffer, onto
the magnetic media. To the disk drive all files are created equal. That is, SEQuential
files, program files, and user files aJl work (he same on the disk. Only program Tiles can
be LOADed, but that's really the only difference. Even the directory works like this,
except that It is read-only. The onJy difference is with relative files.
FORMAT FOR OPENING A SEQUENTIAL FILE:
OPEN fileff, device*, channel, "0:name,type,directionIN
The file number is the same as in all your other applications of the OPEN state
ment, and it is used throughout the program to refer to this particular file. The devicetf
is usually 8. The channel^ is a data channel, number 2 through 14. It is convenient to
use the same number for both the channel and filetf, to keep th.m straight. The name
is the file name (no wild cards or pattern matching if you're creating a write file). The
type can be any of the ones from the chart below, at least the first letter of each lypc.
The direction must be READ or WRITE, or at least the first letter of each.
FILE TYPE
PRG
SEQ
USR
REL
MEANING
Program
Sequential
User
Relative
EXAMPLES OF OPENING SEQUENTIAL FILES:
OPEN 2t 8, 2. "0:DATA. S, W"
OPEN 8, 8. 8. "0:Program, PN R"
OPEN A, B, C, "0;" + AS + "Ut W"
tf the file already exists, you can use the replace option in the OPEN statement,
similar to the SAVE-and-replace described in chapter 3, Simply add the @0: before the
file's name in the OPEN statement.
EXAMPLE OF SEQUENTIAL FILE WITH REPLACE OPTION:
OPEN 2, 8, 2, "@0:DATA,S,W"
The 0: should always precede the name of the file or the drive will only allow you
to use 2 of the available buffers.
20

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents