Chapter
2
MS-DOS CONTROL BLOCKS
AND WORK AREAS
File Control Block (FCB)
The Program Segment Prefix includes room for two FCBs at
off-
sets 5CH and 6CH. The system call descriptions refer to uno-
pened and opened FCBs. An unopened FCB
is
one that contains
only a drive specifier and filename, which can contain wild card
characters
(*
and
?).
An opened FCB contains all fields filled by
the Open File function call (Function OFH)
or
the Create File
function call (16H).
The user program must set bytes 00H-0FH and 20H-24H. The
operating system sets bytes 10H-1FH; they must not be altered
by the user program.
The fields
of
the FCB are
as
follows:
Offset Function
OOH
Drive number.
1
means Drive
A,
2 means Drive
B, etc. If the FCB is
to
be used to create
or
open
a
file, this field can be set
to
0
to
specify the de-
fault drive; the Open File function call (Function
0FH) sets the field to the number
of
the default
drive.
Filename. Consists
of
eight characters, left-justi-
fied and padded (if necessary) with blanks. If you
specify a reserved device name (such as LST), do
not include the optional colon.
Filename extension. Consists
of
three characters,
left-justified and padded (if necessary) with
blanks. This field can be all blanks (no
extension).
Current block. This
is
the number
of
the block
(group
of
128 records) that contains the current
record. This field and the current record field
(off-
set 20H) are used for sequential reads and
writes. This field is set
to
0 by the Open File
function call.
01H-08H
09H-OBH
0CH-ODH
151