Chapter
2
I
MS-DOS
Control
Blocks
and
Work
Areas
Each string is terminated by
a
byte of zeroes, and the set
of
strings is terminated by another byte
of
zeroes. The environ-
ment built by the command processor contains at least a
COMSPEC
=
string. (The parameters on COMSPEC define
the path used by MS-DOS
to
locate COMMAND.COM on
disk.) The last PATH and PROMPT commands issued will
also be in the environment, along with any environment
strings defined with the MS-DOS SET command.
The environment that is passed is
a
copy
of
the invoking pro-
cess environment. If your application uses a “keep process”
concept, you should be aware that the copy
of
the environment
passed
to
you is static. It will not change even if subsequent
SET, PATH, or PROMPT commands are issued.
0
Offset 50H in the Program Segment Prefix contains code
to
call the MS-DOS function dispatcher. By placing the desired
function call number in AH,
a
program can issue a far call to
offset
50H
to invoke an
MS-DOS
function, rather than issuing
an Interrupt 21H. Since this is a call and not an interrupt,
MS-DOS may place any code appropriate
to
making a system
call at this position. This makes the process
of
calling the
system portable.
0
The Disk Transfer Address (DTA) is set
to
80H
(the default
DTA in the Program Segment Prefix).
0
File control blocks
at
5CH and 6CH are formatted from the
first
two parameters typed when the command was entered. If
either parameter contained a pathname, then the correspond-
ing FCB contains only
a
valid drive number. The filename
field will not be valid.
An unformatted parameter area
at
81H contains all the char-
acters typed after the command (including leading and
embedded delimiters). The byte at 80H is set
to
the number
of
characters. If the
<,
>,
or parameters are typed on the com-
mand line, they (and the filenames associated with them) do
not appear in this area. Redirection of standard input and
output is transparent to applications.
Offset 6 (one word) contains the number
of
bytes available in
the segment.
155