
             QCACHE, QDMA, and QDBOOT -- DOS Disk Drivers, V4.0
            =====================================================

1. Description
   -----------

   QCACHE, QDMA, and QDBOOT are a "package" of DOS hard-disk drivers.

   QCACHE is a general-purpose Sector Caching program.    It handles up to
   8 hard-disks, and it "intercepts" DOS Int 13h I-O requests to the BIOS.
   Single sector requests are cached in XMS memory.   Up to 254 individual
   sectors can be stored.   DOS handles its directories with single sector
   I-O.   Caching only the directories gives most users a huge performance
   improvement!   QCACHE does Sector Caching before calling the BIOS to do
   any disk reads or writes.   In this way, QCACHE supports ALL hard-disks
   on a DOS system!   Serial-ATA or non-UltraDMA IDE disks need only their
   BIOS I-O logic, no drivers!   IDE UltraDMA disks can be run by the BIOS
   or QDMA can load before QCACHE for better UltraDMA handling.    To help
   verify files after they are written, the FLUSH.COM program is provided.
   Entering  FLUSH  at the DOS command-prompt issues a BIOS "reset" to all
   disks.   This makes QCACHE discard all cache data.   Data from the disk
   (NOT data still in cache!) can then be compared to the original output.
   QCACHE takes 3568 bytes of memory with a local-stack or 3040 bytes with
   /X and no stack.    128K of XMS memory are also required for its cache.

   QDMA is a DOS driver for IDE UltraDMA hard-disks.   It runs on standard
   PC mainboards using UltraDMA controller chips from Intel, VIA, SiS, ALi
   and others.    QDMA runs up to 4 UltraDMA disks of all sizes, including
   new types over 128 gigabytes of storage.   It "intercepts" DOS disk I-O
   calls and does reads or writes using UltraDMA.    Seeks and other calls
   are "passed" to the BIOS for processing.   QDMA accepts both 48-bit LBA
   mode and 24-bit CHS mode DOS I-O requests, so it can be run with new or
   old DOS systems.    As CHS I-O uses 24-bit addressing, data accessed by
   CHS I-O must be in the first 8 gigabytes of a disk.    More data can be
   in other partitions and can be accessed by non-CHS systems.   QDMA uses
   1328 bytes stand-alone or 816 bytes if run below QCACHE with /X.   128K
   of XMS memory is also recommended, to provide buffering for QDMA/QCDROM
   I-O not suitable for UltraDMA.   This will improve performance.

   QDBOOT is a DOS "boot" driver for one or two diskettes and up to 8 hard
   disk drives.   Many users prefer the UMBPCI upper-memory driver written
   by Uwe Sieber.   It takes much less low memory than EMM386.    To avoid
   DMA trouble in UMBPCI "Shadow RAM" upper-memory, QDBOOT can load first.
   QDBOOT "catches" diskette and hard disk I-O for memory above 640K.   It
   does such I-O one sector at a time using a "safe" low memory buffer and
   using BIOS I-O calls.   Normal drivers like QDMA can then load in upper
   memory and "take over" I-O for their units.    SATA disks and diskettes
   may continue using BIOS I-O, and QDBOOT will go on "catching" their I-O
   for upper-memory.   Thus, UMBPCI can be run safely on systems with SATA
   or other type hard disks!   The QDBOOT /W switch can request use of the
   DOS "workspace" buffer, and its /R switch cah "relocate" its logic into
   temporary memory.   After UMBPCI loads, the QDREL driver can be used to
   put the logic in permanent upper-memory.   With its /W and /R switches,
   QDBOOT requires only 32 bytes of low memory!

   V4.0+ QCACHE now issues no "A20 line" requests.   V4.0+ QDMA now issues
   an "A20 local-enable" and "A20 local-disable" for any I-O request which
   uses its XMS buffer.   The author is DISGUSTED at having to make such a
   change, but current DOS kernels are written so that a single "A20 local
   enable" cannot be given when device-drivers load.   V4.0+ QDBOOT, QDREL
   and FLUSH are unchanged.    V3.7+ QCDROM has been similarly updated and
   can be run with V4.0+ QDMA.    Other "old" versions should NOT be mixed
   with the newer drivers!


2. NO Warranty
   -----------

   QCACHE, QDMA, and QDBOOT are offered as free software, "as is" and "use
   at your own risk", and WITHOUT any warranty,  not even the implied war-
   ranties of MERCHANTABILITY nor of FITNESS for ANY particular purpose!

   Driver questions may be addressed to Johnson Lam at <johnson@tmfc.net>.
   The author of these drivers in the U.S.A. shall try to answer and shall
   try to upgrade the drivers as needed.


3. Revisions
   ---------

   V4.0  12-Nov-06  QCACHE and QDMA "A20 line" handling corrected.

   V3.9   9-Nov-06  QCACHE /X switch added, QCACHE/QDMA stack increased.
   V3.8  24-Oct-06  QDMA updated for QXHIMEM.   V3.7 changes DELETED!
   V3.7  15-Oct-06  QDMA no-longer requires XMS memory with UMBPCI.
   V3.6   8-Oct-06  QDBOOT made general-purpose to support UMBPCI.
   V3.5   1-Oct-06  Added QDMA/QDBOOT /A switch for alternate addresses.
   V3.4  28-Sep-06  Added the QCACHE driver, "separated out" from QDMA,
   V3.3  21-Sep-06  QDMA and QDBOOT now handle an Intel 82801EB chipset.

   V3.2   8-Sep-06  Output-overlap, dual-buffers deleted for simplicity.
   V3.1  16-Aug-06  Added QDBOOT "diskette catcher" /I switch.
   V3.0  14-Aug-06  Added QDMA Sector Caching with NO overlap.
   V2.9   7-Aug-06  QDMA updated to support V3.0 QHIMEM and QHIMEM2.
   V2.8  19-Jul-06  QDMA caching and overlap driver sizes reduced.
   V2.7  11-Jul-06  QDMA upgraded for fast V2.8+ QHIMEM XMS moves.
   V2.6   8-Jul-06  QDMA now caches 254 sectors and enables overlap with
                      caching.   /D re-added for 2 XMS buffers.

   V2.5   2-Jul-06  QDMA Sector Caching size minimized.   /D deleted.
   V2.4  30-Jun-06  "Int 13h" QDMA-to-QCDROM logic added.   /D changed.
   V2.3  23-Jun-06  Added QDMA Sector Caching, QDBOOT /M switch.
   V2.2  16-May-06  Fixed ERROR in QDMA's XMS-move logic.
   V2.1  12-May-06  QDBOOT now has /N to omit the "diskette catcher".
   V2.0  30-Apr-06  QDMA/QCDROM "linkage" revised to support EMM386 etc.

   V1.6  22-Mar-06  QDMA now loads in UMBPCI upper-memory with QDBOOT.
   V1.5  16-Mar-06  QDMA now loads and runs in UMBPCI upper-memory.
   V1.4   8-Mar-06  QDMA shares XMS buffers with QCDROM.   Added /B, /D.
   V1.3  24-Feb-06  Logic improved.  Non-overlap QDMA reduced 64 bytes.
   V1.2  22-Feb-06  Fixed ERROR saving segment registers.
   V1.1  21-Feb-06  Added /F switch to enable "Fast DMA".
   V1.0  20-Feb-06  Original release.


4. Switch Options
   --------------

   QDREL and FLUSH have no switch options.

   QCACHE has one switch option:

      /X    Causes QCACHE to omit its local-stack.   If /X is not given, a
              local-stack of 512 bytes shall be set.

            --- NOTE ---
              /X should ONLY be given with QCACHE when a "STACKS=9,512" is
              present in the CONFIG.SYS file!   For older DOS systems that
              have no "STACKS=" logic, /X must be omitted!   DOS stacks of
              under 512 bytes should NOT be used, due to the risk of other
              BAD drivers or BIOS logic!    FAILURE to provide QCACHE with
              a stack (using /X without "STACKS=9,512") can cause a CRASH!

   QDMA switch options are as follows:

      /A    Requests use of the old "alternate" EIDE controller addresses.
              See section 7 below for details.   /A is rarely needed.

      /F    Enables "Fast DMA".   I-O requests that cross an UltraDMA "64K
              boundary" are done in 2 parts, below and above the boundary.
              This improves speed.   Misaligned I-O (not at an even 4-byte
              address) uses UltraDMA thru the driver XMS buffer or will be
              passed to the BIOS if /B is given.

            --- NOTE ---
              NOT ALL chipsets and mainboards do multi-part DMA correctly!
              /F must be TESTED on every system and used with CARE!

      /L    Limits DMA to memory below 640K.    /L is REQUIRED with UMBPCI
              or other drivers whose upper-memory cannot do DMA.   If QDMA
              itself loads with /L in upper-memory, XMS memory is required
              to issue DMA command-lists, or QDMA will ABORT!   Without /L
              or if QDMA is in low memory, XMS is optional.   /L makes the
              driver use its XMS buffer for I-O of data above 640K.   Such
              I-O is "passed" to the BIOS if /B is also given.

      /X    Causes QDMA to omit its local-stack.    This saves memory when
              the QCACHE driver is present, as QDMA will run on the QCACHE
              stack.   /X should NOT be given if QCACHE is not used!

      /B    Disables XMS memory.   This makes QDMA and QCDROM use PIO-mode
              for I-O unsuited to DMA.   QDMA passes such I-O to the BIOS.
              /B may lose much speed!   It is a LAST-chance, if absolutely
              needed, or for diagnostics.

   QDBOOT switch options are as follows:

      /Mn   Specifies a "temporary" memory area when needed for QDBOOT and
              its I-O buffer, as follows:

                  /M1 = 00010000h (64K).      /M5 = 00050000h (320K).
                  /M2 = 00020000h (128K).     /M6 = 00060000h (384K).
                  /M3 = 00030000h (192K).     /M7 = 00070000h (448K).
                  /M4 = 00040000h (256K).     /M8 = 00080000h (512K).

              With no /M, QDBOOT defaults to /M5 and uses the 320K area as
              needed for temporary memory.   DOS systems may NOT load from
              address 0 up and may leave their own temporary data anywhere
              in memory!   If needed, /M can be used to change its address
              and find a safe area for QDBOOT to use.

      /R    Requests "relocation" of QDBOOT's logic to upper-memory.   The
              logic first goes in "temporary" memory.   After upper-memory
              is enabled by UMBPCI, the QDREL driver copies QDBOOT's logic
              to its final upper-memory.   336 low memory bytes are saved!

      /W    Requests use of the DOS "workspace" I-O buffer.   MS-DOS V5.0+
              or similar is required.    If /W is omitted, an "old" DOS is
              in use, or the "workspace" area cannot be found, QDBOOT will
              set its own buffer.   Using the "workspace" buffer saves 512
              low memory bytes!   For more details, see section 7 below.

   Most QDMA users will want /F for "Fast DMA", /L if UMBPCI is also used,
   and /X if QCACHE loads after QDMA.   Most QDBOOT users will want /R and
   /W to save low memory.   Other switches may be used as necessary.   For
   all switches, a dash may replace the slash, and a lower-case letter may
   be used if desired.


5. Setup and Configuration
   -----------------------

   All drivers are loaded by command lines in the CONFIG.SYS file.    Your
   CONFIG.SYS must have lines similar to:

        DEVICE = [path] QDBOOT.SYS [/Mn] [/R] [/W]

        DEVICEHIGH = [path] QDREL.SYS

        DEVICE[HIGH] = [path] QDMA.SYS [/A] [/F] [/L] [/X] [/B]

        DEVICE[HIGH] = [path] QCACHE.SYS

   When the QXHIMEM driver is used with UMBPCI, the "boot" drivers are not
   needed.    In this case, UMBPCI must load first to enable upper-memory,
   then QXHIMEM, and then other drivers.    If extra upper-memory or other
   features are needed, JEMM386 can load after the "DOS=HIGH,UMB" command.
   An example of a CONFIG.SYS file using UMBPCI/QXHIMEM is as follows:

        SHELL=C:\DOS\COMMAND.COM C:\DOS /E:512 /P
        DEVICE=C:\BIN\UMBPCI.SYS
        DEVICE=C:\BIN\QXHIMEM /N48 /W
        DOS=HIGH,UMB
        DEVICEHIGH=C:\BIN\QDMA.SYS /F /X /L
        DEVICEHIGH=C:\BIN\QCDROM.SYS /D:CDROM1 /UF /L
        DEVICEHIGH=C:\BIN\QCACHE.SYS
            ..
            ..  Etc.
            ..

   Note that if QDBOOT is used, it must load in low memory.   QDREL should
   always load in UPPER-memory, as it is a "relocator" for QDBOOT's logic.
   An example of a CONFIG.SYS file using the "boot" drivers is as follows:

        SHELL=C:\DOS\COMMAND.COM C:\DOS /E:512 /P
        DEVICE=C:\BIN\QHMBOOT.SYS                    [Or QHMBOOT2]
        DOS=HIGH,UMB
        DEVICE=C:\BIN\QDBOOT.SYS /R /W
        DEVICE=C:\BIN\UMBPCI.SYS                     [Or JEMM386/EMM386]
        DEVICEHIGH=C:\BIN\QDREL.SYS                  [For QDBOOT /R only]
        DEVICEHIGH=C:\BIN\QHIMEM.SYS /N48            [Or QHIMEM2]
        DEVICEHIGH=C:\BIN\QDMA.SYS /F /X /L
        DEVICEHIGH=C:\BIN\QCDROM.SYS /D:CDROM1 /UF /L
        DEVICEHIGH=C:\BIN\QCACHE.SYS
            ..
            ..  Etc.
            ..

   In this example, QHMBOOT will handle XMS memory temporarily, and QDBOOT
   puts drivers in UMBPCI upper-memory.   UMBPCI must be loaded after both
   "boot" drivers.    After UMBPCI enables upper-memory, QDREL can load to
   put QDBOOT's logic in upper-memory.   QHIMEM can be loaded next.   QDMA
   should load after QHIMEM, as it can then request its XMS memory buffer.
   When the QCDROM driver is used, it must load after QDMA so it may share
   QDMA's XMS buffer.   The QCACHE driver must be loaded after QDMA or any
   other hard-disk drivers.   See the QHIMEM and QCDROM "README" files for
   more details.    All other drivers in CONFIG.SYS (SETVER.EXE, ANSI.SYS,
   etc.) can then load in any desired order.

   If QDMA and QCDROM load in UMBPCI upper-memory, each needs a /L switch.
   When JEMM386 or EMM386 is used, rather than UMBPCI, /L switches and the
   QDBOOT/QDREL drivers are not needed, but they do work O.K. if used.

   Please be sure to set each hard disk's geometry correctly in your BIOS.
   Set it to "Auto", "LBA" or "LBA Assisted", but NOT to "None", "Normal",
   "CHS", "ECHS".   "User Cylinders/Heads/Sectors", "Revised ECHS" or "Bit
   Shift" should run but are NOT preferred.   If a BIOS has a setting like
   "UDMA Capable" for a disk, enable it.   Power-saving features such as a
   "drive spin-down timeout" should be DISABLED or driver I-O requests may
   time out!   Also, be sure to use an 80-connector cable for any UltraDMA
   disk operating in "mode 3" ATA-44 (44 MB/sec) or higher.   When cabling
   a single disk to an IDE channel,  note that you MUST use both "ends" of
   the cable, NOT one "end" and the middle connector!   This avoids ERRORS
   as an unused cable-end can pick up "noise", like a RADIO antenna!


6. Error Reporting
   ---------------

   Error codes detected during I-O by QCACHE and QDBOOT are "passed up" to
   the calling program.   QDMA works as a "BIOS driver" and reports errors
   in the normal BIOS way.    On exit from successful I-O, the AH-register
   is zero, and the carry flag is reset.   For an I-O error, carry is SET,
   and the AH-register has one of the following codes.   A disk diagnostic
   program may be needed to see the cause of errors, as DOS programs often
   display only "Disk Error" with no code!    QDMA error codes are:

          Code 08h - DMA timeout.         CCh - Disk FAULT.
               0Fh - DMA error.           E0h - Hard I-O error.
               20h - Controller busy.     FFh - XMS memory error.
               AAh - Disk not ready.


7. SPECIAL NOTES
   -------------

   V3.6+ QDBOOT has been rewritten to support ALL diskettes and hard-disks
   on a system!   This lets UMBPCI run with SATA or other disks that issue
   only BIOS I-O and do not use a "DOS driver".    The BIOS for such disks
   may do DMA in upper-memory, and QDBOOT prevents any UMBPCI DMA trouble!
   MS-DOS and others may not declare a "workspace" buffer until after they
   run CONFIG.SYS, thus temporary buffer memory MAY be necessary!   QDBOOT
   checks for a "workspace" buffer on each I-O call, and it "picks up" and
   uses the buffer after DOS posts one.   Both /R and /W for QDBOOT can be
   omitted, for an "odd" system or for test.   NOTE:  QDBOOT does all hard
   disk I-O using 48-bit LBA mode.    24-bit CHS mode (V6.22 MS-DOS, etc.)
   can give "random" ERRORS one sector at a time, with some BIOS programs!
   Hard disk LBA mode requires an "EDD BIOS", standard on virtually all PC
   systems or mainboards since 1997.   If the BIOS cannot support LBA mode
   I-O (no "EDD" logic) for a disk, that hard disk is IGNORED by QDBOOT!

   The /A switch permits QDMA to work on systems where the EIDE controller
   uses "alternate" I-O addresses.   Standard systems, and most Serial-ATA
   systems that also have an EIDE controller, assign "normal" addresses of
   01F0h-01F7h (primary) and 0170h-0177h (secondary) to the EIDE channels.
   But a few Serial-ATA BIOS programs assign these addresses to their SATA
   channels, and they use the old "alternate" EIDE 01E8-01EFh (primary) or
   0168h-016Fh (secondary) addresses for the EIDE chip!   In this case, /A
   must be specified in the CONFIG.SYS lines that load the QDMA and QCDROM
   drivers, so EIDE drives can run using these "alternate" EIDE addresses!
   The SATA BIOS should show I-O address assignments for its SATA and EIDE
   chips, so users can see if /A is needed by QDMA and QCDROM.    Usually,
   /A will not be needed.

   QCACHE does Sector Caching of up to 254 individual sectors into 128K of
   XMS memory.    It does a binary-search and least-used deletions for top
   speed.   QCACHE needs only the Int 13h I-O vector and is independent of
   the DOS system in use (MS-DOS, DR-DOS etc.)!   Single-sector caching is
   an idea from the 1986 "CACHE2" program that QCACHE improves through the
   use of XMS (not main- or upper-memory) and fast assembly-language code.
   For simplicity, QCACHE uses "write-through" output, not delayed "write-
   backs".   So, it is not for use with disk sorts, heavy database updates
   or other "disk thrashing" tasks that need more caching power.   Few DOS
   users run such programs.    QCACHE offers most DOS users excellent disk
   performance, with no need for "big" cache programs like Norton NCACHE2,
   SMARTDRV, etc.!   NOTE:  QCACHE intercepts only Int 13h BIOS I-O, so it
   will not work with SCSI or other drivers that do not use Int 13h calls!

   The UMBPCI upper-memory manager uses system "Shadow RAM" that CANNOT do
   DMA!   Newer BIOS programs may use UltraDMA to load programs into upper
   memory.   If this is UMBPCI "Shadow RAM", a CRASH will occur!   To stop
   this, and handle new BIOS programs, the following RULES apply for using
   QDMA and UMBPCI together:

     A) If QDMA loads in low memory, it should load ahead of UMBPCI, so it
          can take over all disk UltraDMA from the BIOS.

     B) If loading in upper-memory, QDMA must load after UMBPCI, so UMBPCI
          enables upper-memory first!    The QDBOOT/QDREL drivers can load
          QDMA into upper-memory safely, as shown in section 5 above.

     C) QDMA must load with its /L switch, so it limits UltraDMA to memory
          below 640K and avoids DMA in "Shadow RAM".

     D) Using /B with /L is UNRECOMMENDED!   This will cause QDMA to ABORT
          if loaded in upper-memory!   QDMA must then have XMS memory (not
          "Shadow RAM") to issue its DMA command-lists.   Also --

     E) If QDMA loads in low memory with /L, XMS is still recommended, and
          where CHS I-O is used, hard-disks should have proper CHS values.
          No XMS or bad CHS values makes QDMA "pass" some I-O to the BIOS.
          If BIOS UltraDMA is not DISABLED, the same CRASH may occur!

   Most of these rules are only "advice", and QDMA has no logic to enforce
   them.   It is the USER'S obligation to observe these rules with UMBPCI.

   The EDD BIOS for old "notebooks" (IBM ThinkPad, etc.) or mainboards may
   be missing or incomplete, and QDMA may not get needed "DPTE" data as it
   scans for UltraDMA disks to use!    If no disks are found using the EDD
   BIOS, a hardware-only scan will be done.   In this case QDBOOT and QDMA
   assume the BIOS assigns the disks DEFAULT "units", as follows:

       A) Primary-master   disk must be BIOS "unit 80h".
       B) Primary-slave    disk (if present) must be BIOS "unit 81h".
       C) Secondary-master disk (if present) must be BIOS "unit 82h".
       D) Secondary-slave  disk (if present) must be BIOS "unit 83h".

   These default "units" are used ONLY if the UltraDMA disks are cabled to
   the system as above.    The first disk MUST be primary-master, a second
   disk must be primary-slave etc.   Other IDE units may use the remaining
   IDE positions, so the BIOS "sees" all UltraDMA disks FIRST!   When SCSI
   disks are used too, their controller BIOS (if any) must be DISABLED, so
   SCSI disks are not given BIOS "units".   An IDE disk must "boot" such a
   system.    After "boot", the controller's DOS driver can be used to run
   SCSI disks.   Note that if a full EDD BIOS is present and hardware-only
   scans are not needed, SCSI or IDE disks may be set up in ANY order, and
   a SCSI controller BIOS may be enabled.

   Some "CD-ROM boot" programs handle the CD/DVD as a "fake" hard disk and
   provide incorrect EDD BIOS data for it!   In scanning for disks to use,
   QDMA may display "EDD BIOS error!  Unit ignored." and go on looking for
   more UltraDMA disks.   Users who did NOT "boot" from CD/DVD need to see
   which disk was passed-over and why.   Users who DID "boot" from CD/DVD,
   where all UltraDMA disks were found correctly, may IGNORE this message!
   It is caused by an ERROR in the "CD-ROM boot" program, NOT by a problem
   with QDMA or its hard-disks!

   Some BIOS programs may NOT "configure" a mainboard controller chip when
   no user devices are found!   When QDMA finds no UltraDMA disks, it will
   normally say "No disk to use", then abort loading.   But, it checks for
   controller chips to use first, and an "unconfigured" chip may give "BAD
   UltraDMA controller", then an abort.    If the latter message displays,
   users must first verify that every hard-disk was set "active" using the
   BIOS set-up logic.    If this WAS done, "BAD controller" means the chip
   did NOT get both "Bus Master" and "I-O Space" command bits and the BIOS
   needs to be UPDATED!   Note also that QDMA will not support "Native PCI
   mode" chips ("servers"), only "Legacy IDE mode" chips.

