Chapter
5
I
Device Drivers
READ
or
WRITE
Command codes
=
3,4,8,9, and 12
ES:BX (Including IOCTL)
13-BYTE Request Header
BYTE Media descriptor from DPB
I
DWORD Transfer address
I
1
WORD Bytehector count
I
WORD Starting sector number
~
(Ignored on character devices)
In
addition to setting the status word, the driver must set the
sector count to the actual number of sectors (or bytes) trans-
ferred.
No
error check is performed on an IOCTL
I/O
call. The
driver must correctly
set
the return sector (byte) count
to
the ac-
tual number of bytes transferred.
The following applies to Hock device drivers:
Under certain circumstances the BIOS may be asked to perform
a
write operation of
64K
bytes that seems to be a “wrap-around”
of the transfer address in the BIOS I/O packet. This request
arises because of an optimization added to the write code in
MS-
DOS.
It
occurs only on user writes that are within
a
sector size
of
64K
bytes on files “growing” past the current end of file.
It
is
allowable for the BIOS to ignore the balance of the write that
wraps around, if it
so
chooses. For example,
a
write of 1000OH
bytes’ worth of sectors with a transfer address of XXXX:l could
ignore the last two bytes.
A
user program can never request I/O
of more than FFFFH bytes and cannot wrap around (even to 0)
in the transfer segment. Therefore, in this case, the last two
bytes can be ignored.
185