Chapter
5
I
Device Drivers
A pointer to
a
BPB (BIOS Parameter Block) pointer array is also
returned. There is one table
for
each unit defined. These blocks
will be used
to
build an internal DOS data structure
for
each
of
the units. The pointer passed
to
the DOS from the driver points
to
an array ofnword pointers
to
BPBs, where n is the number
of
units defined. In this way, if all units are the same, all
of
the
pointers can point
to
the same BPB, in order
to
save space.
Note that this array must be protected (below the free pointer
set by the return), since an internal DOS structure will be built
starting
at
the byte pointed
to
by the free pointer. The sector
size defined must be less than
or
equal
to
the maximum sector
size defined
at
default BIOS INIT time. If it is not, the install
will fail.
The last thing that INIT
of
a block device must pass back is the
media descriptor byte. This byte means nothing
to
MS-DOS, but
is passed
to
devices
so
that they know what parameters MS-DOS
is currently using
for
a particular drive unit.
Block devices may take several approaches; they may be dumb
or
smart.
A
dumb device defines
a
unit (and therefore an internal
DOS structure) for each possible media drive combination. For
example, unit
0
=
drive
0
single side, unit
1
=
drive
0
double
side. For this approach, media descriptor bytes mean nothing.
A
smart device allows multiple media per unit. In this case, the
BPB table returned at INIT must define space large enough
to
accommodate the largest possible media supported. Smart driv-
ers will use the media descriptor byte
to
pass information about
what media is currently in
a
unit.
Function
Call
Parameters
All strategy routines are called with ES:BX pointing
to
the Re-
quest Header. The interrupt routines get the pointers
to
the Re-
quest Header from the queue in which they are stored by the
strategy routines. The command code in the Request Header
tells the driver which function
to
perform.
All DWORD pointers are stored offset first, then segment.
181