                         UIDE -- DOS Device Driver
          ===========================================================

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

   UIDE is an Open Source DOS disk caching driver for a PC system with an
   80386+ CPU and using FreeDOS.    It traps BIOS "Int 13h" I-O and caches
   data for up to 22 BIOS disks of any size on up to 9 "Legacy" and Native
   PCI SATA/IDE controllers.   It calls the BIOS to run A: or B: diskettes
   and caches data for other Int 13h drivers which load first.   UIDE also
   runs up to 4 CD/DVD drives, including old PIO-mode types (no UltraDMA),
   and caches their data files and directories for FAR faster speed (audio
   or trackwriting is uncached).   UIDE's cache is in XMS memory and holds
   up to 4 Gigabytes of data.   Its /B switch also sets a "basic" UltraDMA
   disk driver (no cache) which can use 128K of XMS to buffer I-O unsuited
   to UltraDMA.   The basic UIDE is for tests and other non-cached work.

   The small CC.COM "Clear Cache" program can help verify files written by
   UIDE/UHDD.   Entering  CC  at a command prompt makes the caching driver
   "flush" its cache.     Disk data (NOT data still in cache!) can then be
   compared v.s. the original output.    Note that some CompactFlash cards
   cause CC to execute very slowly.


2. NO Warranties
   -------------

   UIDE is offered at no cost, as-is, "Use at your own risk", and with
   NO warranties, not even an implied warranty of FITNESS for any
   purposes, nor an implied warranty of MERCHANTABILITY!


3. Revision Summary
   ----------------

    7-Jul-20   UIDE now updated with all UHDD updates and "bug fixes" from
                 15-Feb-2019 onward.    It now offers 10-MB and all 20-MB+
                 cache sizes for old small-memory systems.   UHDD fixed to
                 run 9 controllers and "LBA48" disks (> 128-GB) correctly.
                 It now does Read-Ahead with all 10-MB+ caches.    See the
                 driver .ASM source files for full notes on these changes.

    4-Jul-2020   New UIDE updates are:
                 * Cache sizes are now 5-MB, 10-MB, 15-MB, and all sizes from 20- to
                   4093-MB (4 Gigabytes) for better small-memory PC support.   The
                   default cache size is now 20-MB, when /S is omitted or invalid.
                 * The 5-MB cache now has 16K cache blocks, the 10- and 15-MB caches
                   now have 32K blocks, and the 20-MB+ caches now have 64K blocks,
                   to improve speed for the smaller caches (fewer blocks per I-O).
                 * XMS moves are done in 8K-byte blocks for a 486+ CPU and 4K blocks
                   for slower 386 CPUs, to help prevent LOSING any 386 interrupts!
                 * The 386 errata commands used by Ninho on his 386/SX are included.
                 * SSDs and CompactFlash cards that show an "ATAPI" (CD/DVD) flag on
                   an "Identify ATA" command can now run as UltraDMA disks, not as
                   slower "Call the BIOS" drives like in older UIDE releases.
                 * Disks over 128-GB now get only LBA48 commands, to avoid ERRORS if
                   an LBA28 command "crosses OVER" the 128-GB limit!    Disks with
                   128-GB of data or less will get only LBA28 read/write commands.

    5-Mar-2015   UIDE now handles 9 controllers, 22 BIOS disks or diskettes,
                 4 CD/DVD drives. UHDD binary-search buffer is again 512
                 bytes. UIDE "CD/DVD" cache deleted.

   24-Nov-2014   UIDE "User" caches and user-cache logic deleted, due to
                 non-use. UIDE now runs 26 disks/diskettes and 6 CD/DVD
                 drives (same as UHDD + UDVD2) which saves memory.

   26-Jan-2014   UIDE error handling CD/DVD media-changes for "stand alone"
                 mode is fixed.

   12-Jan-2014   UIDE /UD switch deleted (many problems!).

   12-Dec-2013   UIDE /N2 dismisses CD/DVD logic. UIDE /C switch added, user
                 caching improved.

    9-Sep-2013   UIDE now uses all 32 CD/DVD LBA bits in caching calls.

   15-Oct-2012   UIDE again detects A: and B: diskettes from BIOS data,
                 NOT from "Int 13h" calls that FAIL with an LS-120 drive!

    2-Aug-2012   New /UD switch in UIDE, for CD/DVD directory caching.

    9-Jul-2012   UIDE/UIDEJR device select error, for master + slave CD/DVD
                 units on one IDE channel, is corrected.   Many Thanks to
                 Doug Beneway for finding this error!

   25-Jun-2012   UIDE2 deleted:  Not-enough added speed, complex to use.

   17-Jun-2012   UIDE/UIDE2/UIDEJR /A switch, init of 2 "Old IDE" channels,
                 and CD-audio "Q"/status data corrected.   Many Thanks to
                 Japheth for his research and audio-test program!

   29-May-2012   UIDE and UIDE2 check for diskettes via Int 13h, avoid DPTE
                 tests if no PCI BIOS, let the BIOS do I-O for disks with
                 bad DPTE data, all re: VirtualBox BUGS!

   16-Oct-2011   UIDE /M switch deleted, search-buffer is always 512 bytes.
                 UIDE.SYS back to 7.5K, UIDE-S dropped, UIDE2 improved.

    7-Oct-2011   All UIDE drivers updated to avoid BIOS "DPTE" ERRORS:  Bad
                 DPTE data for USB sticks!   Many Thanks to Daniel Nice!

    9-Sep-2011   UIDE2 re-added.   UIDE-S and UIDE2 handle 6 CD/DVD drives.

   22-Jul-2011   UIDE /E switch added for DOS emulators (VirtualBox, etc.).

   20-May-2011   UIDE-S ("short" UIDE) added, for systems with limited HMA.

   25-Apr-2011   BAD "code mods" init error corrected!

    5-Dec-2010   UIDE/UIDEJR /R15 and /R63 switches added to handle old DOS
                 "games" (Thanks, Guillermo Grana Gomez!).

   28-Nov-2010   Minor updates:  UIDEJR audio track-number error corrected.
                 Added /Z.

   15-Aug-2010   UIDE audio track-number error corrected (Thanks, Nagatoshi
                 Uehara!).

   10-Aug-2010   UIDE/UIDEJR use of $ in CD/DVD names is fixed (Many Thanks
                 to Japheth!).

    4-Jul-2010   README file update -- UIDE can use "Native IDE" mode, same
                 as "Legacy"/"Compatibility", for AHCI mainboards.

   10-Jun-2010   UIDE now ignores "removable HARD disks", size reduced.

   16-Nov-2009   UIDE now caches 4 GIGABYTES of data!

    6-Oct-2009   UIDE and UIDEJR /H requests HMA use "at the user's risk"!

   23-Jun-2009   Corrected UIDE CD/DVD handling of VDS errors.

    9-Jun-2009   UIDE/UIDEJR /N3 switch added for no XMS memory.   Override
                 of /D: name by UIDE$/UIDEJR$ added for no CD/DVD drives.

   25-Apr-2009   UIDE license and FreeDOS prohibition deleted, drivers and
                 sources are again available to all.


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

   UIDE usually needs only a /H switch to use HMA space and a /S switch to
   specify its cache size.   All UIDE switches are as follows:

      /A     Requests "alternate" addressing for "legacy" IDE controllers,
                01E8h/0168h for the first one, 01F0h/0170h for the second.
                /A is rarely needed.   Without /A, the first "legacy" con-
                troller will use 01F0h/0170h and a second uses 01E8h/0168h
                as is usual for PC mainboards.

      /B     Requests a "basic" UltraDMA driver for disks and CDs/DVDs, no
                caching nor diskette handling.   The /B driver can request
                128K of XMS for an UltraDMA I-O buffer, and it can load in
                the HMA.

      /D:    Specifies the "device name" used by the CD/DVD Redirector to
                access CD/DVD drives, e.g.   /D:CDROM1   /D:SANYO1   etc.
                If /D: is omitted, or the name following a /D: is missing
                or invalid,  UDVD1  is set by default.

      /E     Makes the driver call the BIOS for any hard disk I-O request.
                /E avoids setup trouble on some DOS emulators (VirtualBox,
                etc.) that do not emulate all PC hardware logic!   /E also
                allows using hard disks on 1994 or older PCs which have no
                UltraDMA or no PCI/EDD BIOS.    /E still caches disk data,
                unlike /N1 that removes ALL disk logic!    If /B is given,
                /E is ignored.

                ***** NOTE *****

                Using /E on protected-mode systems (JEMM386 etc.) may LOSE
                much speed, as a newer BIOS may omit "Virtual DMA" support
                and force disks to run in PIO mode!   If /E is required, a
                DOS system should run in real-mode (UMBPCI, etc.) whenever
                possible.

      /H     Puts most of the driver in "free HMA" space.   To use /H, the
                driver must load from FDAUTO.BAT (not FDCONFIG.SYS), since
                FreeDOS provides no "free HMA" until FDAUTO is run.

      /N1    Requests NO hard-disk handling by the driver.

      /N2    Requests NO CD/DVD handling by the driver.

      /N3    Requests no XMS memory.    /N3 sets UIDE's /B "basic" driver.
                /N3 requires loading in LOW memory, or UIDE aborts!    /N3
                can LOSE much speed, as misaligned or other I-O unsuitable
                for UltraDMA requires calling the BIOS for a disk or using
                PIO-mode for CD/DVD drives!

      /N4    See /Z below.

      /Q     Awaits "data request" before starting UltraDMA I-O transfers.
                /Q is rarely needed, only for old systems where the driver
                loads O.K. but seems unable to transfer data.    /Q is NOT
                for use with Sabrent or other SATA-to-IDE adapters that do
                not emulate "data request"!

      /R15   "Reserves" 15-MB or 63-MB of XMS, for old DOS "game" programs
      /R63      which require XMS memory below 16- or 64-MB.   The drivers
                must be able to reserve this memory, reserve their own XMS
                memory beyond that, and then "free" the 15/63-MB XMS.   If
                not, the drivers display "XMS init error" and abort!    /R
                for UDVD2 is ignored if it loads after UHDD, as UDVD2 will
                then "share" UHDD's XMS memory.

      /Snn   Specifies the desired cache size, in megabytes of XMS memory.
                Values for /S can be 5, 10, 15  or any number from 20 thru
                4093 (4 Gigabytes).    When /S is omitted/invalid, a 20-MB
                cache is set.   UIDE displays "XMS init error" and aborts,
                if not-enough XMS memory is free!   If so, a smaller cache
                must be requested.

      /UX    Disables all CD/DVD UltraDMA, even for units that can do it.
                All CD/DVD data input then uses PIO-mode.   /UX is rarely
                needed, only for odd drives that do not obey ATAPI rules.
                /UX does not affect hard disks.

      /Z     Moves protected-mode XMS data in 8K blocks (not 64K) for 486+
                CPUs and 4K blocks for slower 386 CPUs.   With JEMM386, /Z
                is unneeded.    When other EMM/VCPI/DPMI drivers are used,
                PCs must be tested to find if /Z is needed.   BAD schemes,
                that allow not-enough interrupts during an XMS move, could
                still be in use!

             --------------------

   For all switches, a dash may replace the slash and lower
   case letters may be used if desired.


5. Example Configuration Files
   ---------------------------

   A) Small real-mode systems that need only XMS may use this FDCONFIG.SYS
      example file:

          ..
          ..
      DOS=HIGH
      DEVICE=C:\BIN\XMGR.SYS
          ..
          ..  Etc.
          ..

   B) Real-mode systems with V3.70+ UMBPCI and XMGR do not need the LOWDMA
      driver, as XMGR sets an "I-O Catcher" for UMBPCI.   This scheme uses
      NO low memory, if /W is given; XMGR and other drivers go directly to
      UMBPCI "Shadow RAM" upper memory!   An example FDCONFIG.SYS file is:

          ..
          ..
      DOS=HIGH,UMB
      DOSDATA=UMB
      DEVICE=C:\BIN\UMBPCI.SYS
      DEVICE=C:\BIN\XMGR.SYS /W
          ..
          ..  Etc.
          ..

   C) A protected-mode system with XMGR and JEMM386 can use XMGR's "boot",
      taking only 384 low memory bytes as its 32-entry "XMS Handles" table
      (used early by JEMM386).   See Section 6 below for other notes about
      protected-mode!   An example FDCONFIG.SYS file is:

          ..
          ..
      DOS=HIGH,UMB
      DOSDATA-UMB
      DEVICE=C:\BIN\XMGR.SYS /B /N32             ;32 Handle XMGR "boot"
      DEVICE=C:\BIN\JEMM386.EXE I=B000-B7FF ...
      DEVICEHIGH=C:\BIN\XMGR.SYS                 ;Loads the runtime XMGR
          ..
          .. Etc.
          ..

   When all above drivers are loaded, other needed FDCONFIG.SYS files such
   as SETVER, ANSI.SYS, etc. can then load in any desired order.

   For each of the above examples, FDAUTO.BAT can then load UHDD and UDVD2
   (or just UIDE) using the DEVLOAD program.   This permits the drivers to
   use "free HMA" and save low memory.   UDVD2 must load after UHDD, so it
   will find UHDD in memory and "link" to it for CD/DVD data file caching.
   Example FDAUTO command lines are:

          ..
          ..  Int 13h drivers cached thru UHDD/UIDE
          ..  load now and can load in upper memory.
          ..
      DEVlOAD /H C:\BIN\UHDD.SYS /S500 /H /O     ;Or UIDE alone
      DEVLOAD /H C:\BIN\UDVD2.SYS /D:BLURAY1 /H
      LH C:\BIN\RDISK.COM /S250                  ;Optional
          ..
          ..  Etc.
          ..


6. Technical Notes
   ---------------

   Protected-mode users must pretest "I=nnnn-nnnn" or "X=nnnn-nnnn" values
   for JEMM386, as its "I=TEST" or "X=TEST" options may fail on newer PCs.
   Protected-mode is unrecommended with old DOS games needing reserved XMS
   as JEMM386 takes some XMS memory first.   Newer "cheap BIOS" mainboards
   now OMIT logic used only by DOS and need an UltraDMA disk driver loaded
   before JEMM386 sets V86 protected-mode!   For such boards, FDCONFIG.SYS
   example C above requires drivers cached thru UHDD, then UHDD itself, to
   load only in LOW memory directly after XMGR sets up XMS for the system.
   UIDE is unrecommended in this case as it will take FAR more low memory!
   JEMM386 can then load and set V86 protected-mode, and UDVD2 (if wanted)
   can be loaded later from FDAUTO.   2015 or older PCs with a normal BIOS
   usually do not need this and can use example C as shown above.   Use of
   JEMMEX or other "EMM" drivers but JEMM386 must now be avoided.    Other
   "EMM" drivers got dropped long ago, some with leftover ERRORS!   JEMMEX
   has caused crashes on newer PCs due to OBSOLETE XMS detection code, and
   it cannot work with UIDE/UHDD on a "cheap BIOS" board as neither driver
   can load O.K. if the other is absent!   To run protected-mode on "cheap
   BIOS" boards, use FDCONFIG.SYS example C with UHDD/UDVD2 (not UIDE) and
   the changes noted herein, and be aware that JEMM386 will be REQUIRED!

   XMGR and UIDE/UHDD/UDVD2 will return normal XMS and CD/DVD error codes,
   as needed.   They are listed in the "V3.0 XMS Specification" and in the
   Microsoft "MS-DOS CD-ROM Extensions 2.1" document.   Both are available
   from Microsoft or from other Internet sources.

   UIDE and UHDD work as "BIOS drivers" and return whichever codes are set
   for diskettes and hard-disks handled by the BIOS.    For their SATA and
   IDE hard-disks, UIDE/UHDD can post the following error codes:

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

   Many DOS programs display only "Disk Error" messages with NO code, thus
   disk errors may require running a diagnostic to get better information!

   UIDE/UHDD handle only "Legacy" or "Native PCI" IDE controllers.   RAID-
   only chipsets, port multiplier chips, or ADMA chipsets are unsupported.
   UIDE/UHDD must use "Legacy", "Compatibility", or "Native IDE" mode with
   AHCI controllers.    For mainboards with no such controller settings, a
   Sabrent or similar SATA-to-IDE card can let UIDE/UHDD/UDVD2 handle SATA
   disks/CDs/DVDs from parallel-port IDE controllers (80-pin cable) at DMA
   speeds.   "Add on" PCI-bus adapter cards that can be detected by normal
   PCI-bus routines may also be used for disks/CDs/DVDs.

   XMGR loads in UMBPCI upper memory that is not "provided" to the system.
   With UMBPCI, a "MEM" list may begin with a block having a 00A5h offset,
   or greater with 80 or 128 XMS "Handles".    The upper memory skipped by
   this offset contains XMGR.

   The UMBPCI upper memory manager uses system "Shadow RAM" that cannot do
   DMA.    A newer BIOS may use UltraDMA to load programs in upper memory.
   If this is "Shadow RAM", a HANG can occur!    These two rules apply, if
   using UMBPCI with XMGR and UIDE/UHDD:

     A) V3.70+ UMBPCI must load before XMGR, so XMGR finds UMBPCI and sets
        its "I-O Catcher", to handle diskette "Shadow RAM" DMA forever and
        to do disk "Shadow RAM" UltraDMA until UIDE/UHDD can load.   Older
        UMBPCI drivers, or other UMBPCI load schemes, are not recommended!

     B) When CHS I-O is done, each disk must have valid CHS parameters set
        in the BIOS.   If not, the "I-O Catcher" or UIDE/UHDD let the BIOS
        handle CHS I-O.   If BIOS UltraDMA is left enabled, a "Shadow RAM"
        HANG can occur!

   Old BIOS programs may not configure a mainboard controller when no user
   drives are on it!   The drivers then display "BAD controller" and go on
   looking for others to use.   If this message is given, users must check
   that all SATA/IDE drives are set "active" with the BIOS setup routines.
   If so, "BAD controller" means a chip is not using "Bus Master" and "I-O
   Space" modes, and a BIOS update is needed!
