Atari ST series Technical Reference Manual page 124

Hide thumbs Also See for ST series:
Table of Contents

Advertisement

tended), GEMDOS searches the FAT for free clusters and as­
signs as many of them to the file as necessary.
The physical location of the various disk data structures
may be determined by values found in the BIOS Parameter
Block. The boot sector(s) occupy logical sectors 0 through (fa-
tr e c -fs iz -1 ). The first FAT starts at (fatree — fsiz). The sec­
ond FAT starts at fa tree. The root directory starts at (fa-
trec + fsiz). For a nonbootable floppy, the first two tracks are
used for these data structures. Sector 1 of track 0 holds the
boot block. The first FAT occupies sectors 2-6 of track 0,
while the second FAT is split between sectors 7-9 of track 0,
and sector 1 and 2 of track 1. The root directory takes up sec­
tors 3-9 of track 1. The rest of the disk, starting with track 2,
is made up of data clusters, with two sectors per cluster.
File I/O Functions
The most fundamental of the file system functions are those
used to create a file, write data to it, and read data back from
the file. The GEMDOS functions used for these purposes are
modeled after Unix-style file commands. In fact, if you pro­
gram in C you'll probably notice that the macro names for
the GEMDOS file functions differ only in capitalization from
those of the C compiler's own library functions. Thus, the
GEMDOS function Fread() is roughly equivalent to, but not
exactly the same as, the C compiler's own fread() function.
The GEMDOS file functions identify the file upon which
they operate by a number known as a file handle. There are
three types of file handles (see table below). The first type
(handles - 3 through - 1 ) belongs to the character devices.
The console device (consisting of the screen and keyboard),
the serial device, and the parallel printer device may all be
treated like disk files for I/O purposes. This makes it possible
to redirect file output to a device like the printer (see the sec­
tion of Fdup() and Fforce(), below). The next type of handle
(0-5) is reserved for standard system files. These are
modeled after devices that MS-DOS makes available to any
program. MS-DOS initializes handles 0-4 to point to stan­
dard devices that can be used for input, output, error re­
ports, and listings. While GEMDOS reserves the same range
of handles for its own standard devices, it doesn't automati­
cally initialize them. This is usually performed by the C com­
piler, which at least assigns a standard input and output file
116
CHAPTER 6

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents