Disk Commands - Commodore 1541 User Manual

Hide thumbs Also See for 1541:
Table of Contents

Advertisement

4*
DISK COMMANDS
OPEtV AND PRINT #
Up 'til now, you have explored the simple ways of dealing with the disk drive. In
order to communicate with the disk drive more fully, you have to touch on the OPEN
and PRINTS statements in BASIC (more details of these commands arc available in
yaur VIC 20 or Commodore 64 User's Guide or Programmer's Reference Guide). You
may be familiar with their use with data files on cassette tape, where the OPEN state-
ment creates the file and the PRINTS* statement Fills the file with data. They can be
used the same way with the disk, as you will see in the next chapter. But ihey can also
be used to set up a command channel. The command channel lets you exchange infor
mation between the computer and the disk drive.
FORMAT FOR THE OPEN STATEMENT:
OPEN filc#r device*, channel*, (cxtS
The filetf can be any number from 1 to 255. This numbe: is used throughout the
program to identify which Tile is being accessed. Bui numbers greater than 127 should
be avoided, because they cause the PRINT# statement to generaie a linefeed after the
return character. These numbers are rcaJiy meant to be used with non-standard
printers.
The device*/ of the disk is usually 8.
The channel* can be any number from 2 to 15. These refer to a channel used to
communicate with the disk, and channels numbered 0 and 1 are reserved for the
operating system to use for LOADing and SAVEing. Channels 2 through 14 can be
used for data to files, and 15 is the command channel.
The textS is a string that is PRINTed to the file, as if with a PRINTS statement.
This is handy for sending a single command to the channel,
EXAMPLES OF OPEN STATEMENTS:
OPEN 15, 8, 15
COMMAND CHANNEI
^
--_-^
^—^—^-
s
COMMANDJ(texlS)
OPEN 2, 8.2
OPEN A, B, C, Z$

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents