Commodore 1541-II User Manual page 52

Hide thumbs Also See for 1541-II:
Table of Contents

Advertisement

"channel #" is a secondary address, giving further instructions to the selected
device about how further commands are to be obeyed. In disk files, the channel number
selects a particular channel along which communications for this file can take place. The
possible range of disk channel numbers is 0-15, but 0 is reserved for program Loads, 1 for
program Saves, and 15 for the disk command channel. Also be sure that no two disk files
have the same channel number unless they will never be open at the same time. (One way
to do this is to make the channel number for each file the same as its file number.)
"drive #" is the drive number, always 0 on the 1541. Do not omit it, or you will
only be able to use two channels at the same time instead of the normal maximum of three.
If any pre-existing file of the same name is to be replaced, precede the drive number with
the "at" sign (@) to request Open-with-replace.
"file name" is the file name, maximum length 16 characters. Pattern matching
characters are allowed in the name when accessing existing files, but not when creating
new ones.
"file type" is the file type desired: S = sequential, P=program, U = user, and
L=length of a relative file.
"direction" is the type of access desired. There are three possibilities: R=read,
W = write, and M = modify. When creating a file, use "W" to write the data to diskette.
When viewing a completed file, use "R" to read the data from diskette. Only use the
"M" (modify) option as a last ditch way of reading back data from an improperly-closed
(Splat) file. (If you try this, check every byte as it is read to be sure the data is still valid,
as such files always include some erroneous data, and have no proper end.)
"file type" and "direction" don't have to be abbreviated. They can be spelled out
in full for clarity in printed listings.
"file #", "device #" and "channel #" must be valid numeric constants, variables
or expressions. The rest of the command must be a valid string literal, variable or
expression.
The maximum number of files that may be open simultaneously is 10, including all
files to all devices. The maximum number of sequential disk files that can be open at once
is 3 (or 2 if you neglect to include the drive number in your Open statement), plus the
command channel.
EXAMPLES OF OPENING SEQUENTIAL FILES:
To create a sequential file of phone numbers, you could use:
OPEN2,8,2,"0:PHONES,SEQUENTIAL,WRITE"
or save yourself some typing with:
OPEN 2,8,2,"0:PHONES,S,W"
On the off-chance we've already got a "PHONES" file on our diskette, we can avoid a
"FILE EXISTS" error message by doing an ©OPEN
OPEN 2,8,2,"@0:PHONES,S,W"
44

Advertisement

Table of Contents
loading

Table of Contents