Device Request 04H: Input (Read Data from Device)

Blk► Chr► 
 This tells the driver to read data from the device media and transfer it
 to a specified buffer.

DevReq04Rec
  Offset Size Contents
  ▀▀▀▀▀▀ ▀▀▀▀ ▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
   +0      1  bLen         20H or 14H (length of this request packet)
   +1      1  bUnitNo      (not used)
   +2      1  bCmd         04H (command code)
   +3      2  rStatus      OUTPUT: Device Status Word must fill before exit
   +5H     8  res          (reserved)
  +0dH     1  bMediaID     INPUT: Media Descriptor DOS thinks is there
  +0eH     4  pfBuffer     INPUT: buffer address
  +12H     2  wReadSize    INPUT: number of bytes or sectors to read
                           OUTPUT: bytes or sectors actually read
                           ────────────────────────────── Block Devices Only
  +16H     2  wStartSect   INPUT: starting sector (ffffH=use lBigSect)
  +18H     4  pfVolID      OUTPUT: addr of Volume ID for this unit/media
  +1cH     4  lBigSect     INPUT: starting sector (when wStartSect=ffffH)
          32               size of this structure

     rStatus  On exit, the driver must place a DevStatusWord here.  Always
              set the Done bit (bit 8).  On an error, set the Done bit and
              the Error bit (bit 15) and put a Device Error Code in the low
              byte.

    bMediaID  On entry, this contains the Media Descriptor byte of the disk
              that DOS thinks is in the drive.

    pfBuffer  is the address of a buffer in which the driver may place the
              requested data.  You must not store more than wReadSize bytes
              (or sectors of block devices) here.

   wReadSize  on entry, specifies how much data to transfer into pfBuffer:
                Character devices: requested number of bytes
                Block devices: requested number of sectors

              On return, fill this with the actual amount of data you
              transferred (bytes or sectors)
              ─────────────────────────────────────────── Block Devices Only
  wStartSect  Starting logical sector number to read (see INT 25H).  If the
              sector number is larger than 65,535, this will contain ffffH
              and you should use lBigSect as the 32-bit starting sector
              number.  Used by block devices only.

     pfVolID  Block devices which return Device Error Code of 0fH should set
              this to the address of an ASCIIZ volume ID of the disk that
              should be in the drive (so DOS can prompt to insert that
              disk).  Used by block devices only.

    lBigSect  When DOS requests a logical sector number larger than 65,535,
              it sets wStartSect to ffffH and puts the actual desired
              starting sector number in here.  Used by block devices only.

   Notes: ■ It is up to the driver to translate the "logical sector number"
            to head/track/sector values actually used on the device and to
            access sequential sectors using that numbering scheme.  See
            INT 25H for the standard way to do this.

          ■ This is the device driver "catch-point" for DOS read fns such
            as 3fH (read from device or file).

See Also: Device Requests
          DevRequestHdrRec
          Installable Device Drivers
                                    -♦-