SpartaDOS X Reference Manual |
Programming with SpartaDOS X |
Open File |
Purpose | To open a disk file for access
through SpartaDOS X. |
|||||||||||||||||
Syntax | OPEN #IOCB,aux1,aux2,"Dd:[path]fname.ext" |
|||||||||||||||||
Remarks | This command opens a disk file through SpartaDOS X. Aux1 is the mode (output, input, update, directory, etc.) in which the file will be opened. The following is a list of legal values for aux1. Unless otherwise noted, aux2 should be 0.
|
|||||||||||||||||
An Example | This short BASIC program will read the formatted directory of a disk in
drive #1 in long format and print it to the screen:
10 DIM ENTRY$(40) |
|||||||||||||||||
Accessing the Raw Directory | Setting bit 4 of aux1 puts the OPEN in raw or unformatted directory mode. This allows you to read from and/or write to SpartaDOS directories as if they were normal data files. Although this is much faster than reading a formatted directory, there is no easier way to trash a disk and make it unusable than to make a mistake in the raw directory. Unless you feel confident about what you are doing and are using a disk you don't mind losing, stay away from the raw directories! This mode
will work with Atari DOS disks if the ATARIDOS.SYS driver is installed. The driver translates the Atari directory format into SpartaDOS format and back. |
|||||||||||||||||
Scan Mode | Adding 64 to aux1 will place the OPEN in attribute scan mode.
Aux2 is used to determine the attributes desired. If a long directory is wanted in scan mode, then 128 should be added to
aux1 instead of to aux2.
To determine the file attributes to be scanned, the following values should be added to aux2, assuming an initial value of 0:
Only those files that fit the requested description will be referenced. A value of 0 in aux2 will ignore all attributes, even "Hidden". For example, to get a long format directory of only the hidden files in the BASIC example on the previous page, simply substitute the following line: 20 OPEN #1,6+64+128,2,"D1:*.*" For a short directory listing without subdirectories, use 20 OPEN #1,6+64,128,"D1:*.*" and, finally, for a long listing of the unhidden, protected entries that end with a .COM extender, use 20 OPEN #1,6+64+128,1+32,"D1:*.COM" It is possible to select contradictory conditions (such as 1+16, protected and not protected) for each of the attributes. This will not produce an error but, since no directory entry can match both conditions, will always select no files. |
Previous page |