
                     XMGR and UIDE -- DOS Device Drivers
                   =======================================

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

   XMGR and UIDE are DOS device drivers.    They can be used with a system
   having an 80386+ CPU and running MS-DOS V5.0+ or equivalent.

   XMGR is a DOS driver that works as an XMS memory manager.   It supports
   V3.70+ UMBPCI by Uwe Sieber.    After UMBPCI enables upper-memory, XMGR
   can load there directly and provide both upper and XMS memory for a DOS
   system.   XMGR uses an "I-O catcher" with UMBPCI, to intercept diskette
   or hard disk I-O above 640K.   Such I-O is done thru a low memory area,
   to avoid DMA trouble in UMBPCI "Shadow RAM".   XMGR also supports V4.49
   and V4.95 EMM386 (MS-DOS V6.22 or V7.10).   With EMM386, XMGR using its
   /B switch can first "boot" into temporary space.   After EMM386 enables
   upper-memory, XMGR loads there with no /B switch, copies all its "boot"
   data, and takes-over XMS work.    Only its XMS "Handles" table stays in
   low memory, so EMM386 can always find them at fixed addresses.    For a
   small XMS-only system, XMGR can also load entirely in low memory.

   UIDE is a DOS "Universal IDE" caching driver.   It intercepts "Int 13h"
   BIOS I-O requests and can cache data for up to 32 BIOS units, including
   standard A: and B: diskettes if present, and including newer hard disks
   with over 128-GB of data.    UIDE accepts 48-bit LBA and 24-bit CHS I-O
   calls from new or old DOS systems.   It uses its own IDE logic for SATA
   or UltraDMA hard-disks, and it handles up to 8 "Legacy" or "Native PCI"
   IDE controllers.   All possible IDE I-O is done thru its cache buffers,
   for faster speed.   UIDE "calls the BIOS" for diskettes, SCSI, or other
   type disks, so it caches ALL disks on a DOS system!   "Int 13h" drivers
   can load before UIDE, and it will intercept and cache I-O for the other
   drivers, too.   (Drivers using "ASPI" or I-O schemes other than Int 13h
   are unsupported).

   UIDE also supports up to 4 CD/DVD drives, including SATA, UltraDMA, and
   old "PIO mode" drives.   It checks up to 8 "Legacy" or "Native PCI" IDE
   controllers when it loads, and it runs the first 4 CD/DVD drives found.
   UIDE handles file input for SHCDX33C or other "CD-ROM Redirectors" like
   MSCDEX, and it caches all file data and directories for improved speed!
   It also supports DOS "audio" requests and will "play back" an audio CD.
   Using multiple CD/DVD drives, UIDE can handle data, audio playback, and
   "trackwriter" programs on one system (audio/trackwriting is uncached).

   UIDE uses XMS memory and caches from 5-MB to 1-Gigabyte of data!    Its
   cache logic and binary-search table can load in HMA space not needed by
   DOS, and it uses only 1.75K bytes of upper-memory for a cache up to 200
   Megabytes and only 3.5K bytes for caches of 201 to 255-MB.   For larger
   caches or if HMA space is limited, UIDE loads entirely in upper-memory,
   using 4.5K bytes for logic plus 32 data bytes for each 1-MB of cache.

   For "boot" diskettes or other limited DOS systems, the UIDES driver can
   be used in place of UIDE.   UIDES omits the /L switch and loads only in
   1.75K small-size, so it "compresses" into a 6K object file.   UIDES has
   all other UIDE features.    Except as noted below, all comments in this
   README regarding UIDE apply equally to the UIDES driver as well.

   The small CC.COM "Clear Cache" program can help verify files written by
   UIDE.   Entering  CC  at the DOS command-prompt sends a BIOS "reset" to
   all disks, making UIDE discard its cache.    Data on the disk (NOT data
   still in the cache!) can then be compared with the original output.


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

   XMGR and UIDE are offered as free software, as-is, and "use at your own
   risk", and with NO warranties, not even the implied warranty of FITNESS
   for ANY particular purpose nor of MERCHANTABILITY!

   Driver questions or comments may be addressed to the website of Johnson
   Lam, <johnson@tmfc.net>.


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

   15-Jan-08   UIDE corrected to "see" CD/DVD changes and re-read the new
                 disc directory if CD/DVD is loaded by CLOSETRAY in 4DOS.

   24-Nov-07   UIDE and UIDES disk-entry logic updated to avoid unhandled
                 units, CD/DVD "A20 error" logic corrected.

    1-Nov-07   UIDES (1.75K driver) replaces UIDEL, for "boot" diskettes.
   29-Oct-07   UIDE /N switch added.   6K-byte UIDEL included.
   18-Oct-07   UIDE 200-MB cache uses 1.75K of upper-memory.   /L added.

   13-Oct-07   UIDE can read CD/DVD data directly to cache and runs 8 IDE
                 controllers, 32 BIOS drives.   Multi-chip problem fixed.
   11-Oct-07   UIDE corrected to run CD/DVD "PIO mode" drives properly.

   10-Oct-07   UIDE now runs in 3424 bytes!   UIDE issued to the public.
    6-Oct-07   UIDE logic improved, HMA cache limit up to 255 Megabytes.
    3-Oct-07   UIDE "Universal IDE" driver supersedes both UDMA and UDVD.


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

   XMGR usually needs only its /B switch if "booting" with EMM386.    XMGR
      switch options are as follows:

      /B     Specifies "boot" mode.   XMGR loads in temporary memory until
                upper-memory is enabled by EMM386.   Without /B, XMGR will
                load stand-alone in low memory or directly in upper-memory
                with UMBPCI.   See the CONFIG.SYS examples in section 5.

      /Mn    Specifies the temporary area used to load XMGR in "boot" mode
                and used for UMBPCI upper memory I-O before DOS can post a
                "workspace" buffer.   Values are:

                    /M1 = 64K.    /M3 = 192K.   /M5 = 320K.   /M7 = 448K.
                    /M2 = 128K.   /M4 = 256K.   /M6 = 512K.   /M8 = 512K.

                Without /M, /M5 is assumed and the 320K area will be used.
                NOTE:  A DOS system often may NOT load at address 0 up and
                may leave temporary data anywhere in memory!   /Mn changes
                the temporary area to find a "safe" place for XMGR to use.
                /M is ignored if XMGR loads stand-alone.

      /Nnn   Specifies how many XMS "Handles" can be used by DOS programs.
                The value nn may be 48, 80, or 128.   If /N is omitted, 48
                "Handles" are used.   A big system doing much XMS work may
                need 80 or 128 "Handles".

      /Tn    Specifies the BIOS requests to use in getting extended memory
                as follows:

                   /T0   Neither "E820h" nor "E801h" requests.
                   /T1   Memory-list requests only (Int 15h, AX=E820h).
                   /T2   A dual-area request only  (Int 15h, AX=E801h).
                   /T3   "E820h" requests first, then an "E801h" request.

                /T can usually be omitted, which causes /T3 to be assumed.
                In addition, XMGR always uses an old 64-MB request, to get
                extended memory for /T0, or if the requests specified with
                /T1 through /T3 are unsuccessful.   Users may need to test
                /T1 and /T2 separately, to see if their BIOS accepts them.
                A pre-1994 BIOS may not "ignore" /T1 thru /T3 properly and
                may require /T0 to be used.   For compatibility with older
                QHIMEM drivers, /T4 thru /T7 may be used and work the same
                as /T0 thru /T3.

      /W     Specifies use of the DOS "workspace" buffer, for upper-memory
                I-O if loading with UMBPCI.    If /W is omitted, or if the
                DOS system does not have proper workspace logic, XMGR will
                set its own buffer in low memory.   An EDR-DOS system must
                OMIT this switch!   Without UMBPCI, /W will be ignored.

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

   UIDE usually needs only its /Sn size switch and /D: to specify a device
      name for the SHCDX33C CD-ROM Redirector.   UIDE switch options are:

      /A     Specifies use of ALTERNATE "legacy IDE" I-O addresses.    The
                first legacy controller will use alternate 01E8h/03EEh and
                0168h/036Eh addresses, and a second legacy controller will
                use normal 01F0h/03F6h and 0170h/0376h I-O addresses.   If
                /A is omitted, the first legacy controller uses normal and
                the second legacy controller uses alternate addresses, the
                usual case with most mainboards and BIOS programs.   /A is
                for "odd" cases where "legacy IDE" addresses are REVERSED.
                /A does not affect "native PCI" controllers.

      /B     Requests the "basic" stand-alone UltraDMA driver for disks or
                CD/DVD drives only (no caching or diskettes), which may be
                of help in running a diagnostic program.

      /D:    Specifies the desired device name, used by SHCDX33C to access
                the CD/DVD drives.   Example:  /D:CDROM1  /D:MYCDROM  etc.
                Device names must be from 1 to 8 bytes O.K. for use in DOS
                filenames.   If /D: is omitted, or the device name after a
                /D: is missing or invalid, UDVD1 is used as a default, for
                compatibility with CONFIG.SYS files run with the old UDVD.

      /L     Requests the "large" 3.5K upper-memory driver, even for cache
                sizes under 200-MB.    If /L is omitted, the "small" 1.75K
                upper-memory driver will be used by default for HMA caches
                less than 200-MB.   /L saves 2K of HMA space, for a system
                with limited "free HMA".    /L is ignored when /R is given
                or when the UIDES driver is used.

      /N1    Requests NO handling of any hard-disk drives.

      /N2    Requests NO handling of any CD or DVD drives.

      /Q     Enables awaiting "data request" before starting UltraDMA disk
                transfers.   /Q is only for "old" systems and must be used
                only if UIDE loads O.K. but seems unable to transfer data.
                /Q must be OMITTED with SATA-to-IDE adapters by Sabrent or
                others, as such cards do not emulate "data request" from a
                SATA disk!   /Q does not affect CD/DVD drives.

      /R     Restricts UIDE to "normal" memory and avoids using HMA space.
                /R is REQUIRED to run with ROM-DOS!   It is not needed for
                V7.10 and V6.22 MS-DOS, V7.1 PC-DOS, PTS-DOS, and EDR-DOS.
                Other DOS systems must be tested first.    /R can be given
                to force use of "normal" memory if not-enough HMA is free.

      /Sn    Specifies a cache size in Megabytes of XMS memory as follows:

                /S5         5-MB cache,  1280-byte table size,  8K blocks.

                /S10       10-MB cache,  2560-byte table size,  8K blocks.
                /S20       20-MB cache,  2560-byte table size, 16K blocks.
                /S40       40-MB cache,  2560-byte table size, 32K blocks.

                /S80       80-MB cache,  2560-byte table size, 64K blocks.
                  .        .              .
                  .  thru  .              . (32 bytes per MB)
                  .        .              .
                /S1023   1023-MB cache, 32736-byte table size, 64K blocks.

                Values for /S may be 5, 10, 20, 40, or a large-cache value
                from 80 thru 1023 (1023 = 1-Gigabyte!).   If /S is omitted
                or invalid, an 80-MB large cache is assumed.    Except for
                old systems with less memory, /S127 or more should be used
                with today's BIG files!   Some memory must remain free for
                other applications, thus with current system memory sizes,
                suggested UIDE /S values are:

                     256-MB memory:  /S127      1-GB memory:   /S511
                     512-MB memory:  /S255      2-GB or more:  /S1023

                For more about UIDE and cache sizes, see section 7 below.

      /UX    Disables ALL UltraDMA for CD/DVD drives, even for those which
                can do it.   PIO-mode is then used on all CD/DVD requests.
                Excepting some "unusual" drives by Sony, etc. which do not
                follow all ATAPI "rules", /UX is rarely needed.   /UX does
                not affect hard-disks.

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

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


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

   XMGR and UIDE are loaded through the CONFIG.SYS file.   Your CONFIG.SYS
   file should have command lines similar to:

       DEVICE [HIGH] = [path] XMGR.SYS [/B] [/Mn] [/Nnn] [/Tn] [/W]

       DEVICE [HIGH] = [path] UIDE.SYS [/A] [/B] [/D:DeviceNm] [/L] [/N1]
                                       [/N2] [/Q] [/R] [/Snnnn] [/UX]

   Examples:   DEVICE=C:\BIN\XMGR.SYS /N128 /B

               DEVICEHIGH=C:\DRIVERS\UIDE.SYS /S125 /D:MYDVD

   With V3.70+ UMBPCI and XMGR, a "boot" procedure is not needed!   UMBPCI
   loads first to enable upper-memory, then XMGR loads to offer it and XMS
   to DOS, then other drivers may load.   An example CONFIG.SYS file using
   V3.70+ UMBPCI and XMGR is as follows:

      SHELL=C:\DOS\COMMAND.COM C:\DOS /E:512 /P
      DEVICE=C:\BIN\UMBPCI.SYS
      DEVICE=C:\BIN\XMGR.SYS /W
      DOS=HIGH,UMB
      DEVICEHIGH=C:\BIN\UIDE.SYS /S200 /D:CDROM1        [Or UIDES]
          ..
          ..  Etc.
          ..

   XMGR can be used stand-alone, for a small XMS-only system.   It must be
   the first DOS system driver to load, and it must load in LOW memory, as
   in the following example:

      SHELL=C:\DOS\COMMAND.COM C:\DOS /E:512 /P
      DEVICE=C:\BIN\XMGR.SYS
      DOS=HIGH
      DEVICE=C:\BIN\UIDE.SYS /S40 /D:MYCDROM            [Or UIDES]
          ..
          ..  Etc.
          ..

   With EMM386 and XMGR, XMGR must load first in "boot" mode, then EMM386,
   and then XMGR can finally load in upper-memory.   An example CONFIG.SYS
   file using the XMGR "boot" procedure is as follows:

      SHELL=C:\DOS\COMMAND.COM C:\DOS /E:512 /P
      DEVICE=C:\BIN\XMGR.SYS /B                         [/B for "boot"]
      DOS=HIGH,UMB
      DEVICE=C:\DOS\EMM386.EXE I=B000-B7FF NOEMS ...
      DEVICEHIGH=C:\BIN\XMGR.SYS                        [No /B used here!]
      DEVICEHIGH=C:\BIN\UIDE.SYS /S255 /D:MYDVD         [Or UIDES]
          ..
          ..  Etc.
          ..

   When other Int 13h DOS drivers will be used, UIDE must load after them,
   so it can cache disk I-O for the other drivers.   When XMGR, other disk
   drivers, and UIDE are loaded, all other CONFIG.SYS drivers (SETVER.EXE,
   ANSI.SYS, etc.) can then load in any desired order.

   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
   drive running in "mode 3" ATA-44 (44 MB/sec) or higher.    When cabling
   a single drive 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!

   Be sure to enable all CD/DVD drive(s) through the BIOS set-up routines!
   A drive that is "disabled" may cause the BIOS to clear all its UltraDMA
   flags and force the drive into "PIO mode" zero, which is terribly SLOW!


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

   XMGR and UIDE return normal XMS or CD/DVD driver error codes if needed.
   These are shown in the V3.0 XMS Specification and the Microsoft "MS-DOS
   CD-ROM Extensions 2.1" documentation, available from Microsoft or other
   Internet sources.

   UIDE works as a "BIOS driver" and returns whatever codes the BIOS posts
   for its diskettes or hard-disks.   For SATA or UltraDMA disks, UIDE can
   return 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!


7. Technical Notes
   ---------------

   UIDE handles only "Legacy" or "Native PCI" IDE controllers.   Old "RAID
   only" chipsets (Via VT6420, etc.), port-multiplier chips, and ADMA/AHCI
   chipsets are not currently supported.   To use UIDE, the mainboard BIOS
   must set SATA controllers in "IDE" mode, not RAID/ADMA/AHCI!   UIDE can
   then handle SATA drives properly, at full speed.    Where no "IDE" BIOS
   setting for SATA is offered, a Sabrent converter card (or similar) will
   allow UIDE to run SATA hard-disks and CD/DVD drives from the "standard"
   UltraDMA controller channels, at full UltraDMA speeds.

   *** NOTE ***   It is now UNRECOMMENDED for UIDE to run UltraDMA or SATA
   hard-disks with BIOS I-O logic!   Many "cheap" BIOS programs still have
   no DOS "Virtual DMA" support.   If EMM386 puts a system into "protected
   mode", a BIOS with no Virtual DMA can do only PIO-mode transfers, which
   LOSES much speed!   If needed, use a Sabrent card (as above), and avoid
   running DOS hard-disks with "cheap" BIOS logic!

   UIDE uses 4528 bytes for driver logic and stack, plus the binary-search
   table sizes shown above for its /S switch.   For a cache size of 200-MB
   or less, it places its search table and 2736 bytes of logic in the HMA,
   unless /R is given or the HMA has under 5296 bytes free (4016 bytes for
   /S5) in which case normal memory will be used.   For caches over 200-MB
   or when /L is given, UIDE loads its search table and 976 bytes of logic
   in the HMA, unless /R is given or the HMA has less than 3536 bytes free
   (2256 bytes for /S5), in which case normal memory will be used.

   UIDES does not offer a 3.5K size option and ignores a /L "large driver"
   switch.   For caches over 200-MB, or if /R is given, UIDES always loads
   in normal memory.

   Both drivers set the largest of their 5-MB, 10-MB, 20-MB, 40-MB or user
   entered "large cache" size which will fit in available HMA or in normal
   memory.   /S sizes below 80 are "rounded down" to the nearest of 5, 10,
   20, or 40 Megabytes, which becomes the largest cache to be set.    UIDE
   and UIDES load from "packed" 6K .SYS files, thus a 5-MB cache in normal
   memory can always be set.   To avoid "bugs" in V7.10 MS-DOS, a cache of
   over 255-MB always loads in normal memory.    When not enough XMS cache
   memory is free, the drivers display "XMS init error" and abort!   If so
   a smaller /S value is needed.   With a V2.0 XMS manager (ROM-DOS etc.),
   the largest cache that may be used is 40-MB.

   The CD/DVD logic in UIDE is meant to run with SHCDX33C and does not set
   its own stack for most CD/DVD requests (cached CD/DVD input does run on
   UIDE's stack).   Users of other "CD-ROM Redirectors" (MSCDEX etc.) must
   verify that they offer adequate stack space for CD/DVD driver functions
   before running UIDE with them!

   XMGR loads in UMBPCI upper-memory BEFORE that memory is declared to the
   DOS system!   Memory displays using UMBPCI may not list XMGR, since its
   memory is not part of the DOS memory lists.   Such memory displays will
   begin with a block having a 00A7h offset, or greater if using 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!   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, users should follow these two RULES
   for running UMBPCI together with XMGR and UIDE:

     A) The loading "order" for V3.70+ UMBPCI and XMGR, shown in section 5
        above, MUST be used!    This lets the XMGR "I-O Catcher" intercept
        and process upper memory disk I-O, until the UIDE driver loads and
        takes-over disk UltraDMA.   Older UMBPCI versions, or other UMBPCI
        loading schemes, are NOT recommended!

     B) When CHS I-O is done (MS-DOS V6.22 or older), every disk MUST have
        valid CHS parameters!   If not, UIDE and the "I-O Catcher" let the
        BIOS handle CHS I-O.   If BIOS UltraDMA is not disabled, a similar
        "Shadow RAM" CRASH will occur!

   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,
   UIDE may display "EDD BIOS error!  Unit ignored.", then go on searching
   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 SATA/UltraDMA disks were found, may IGNORE this message!
   It is caused by an ERROR in the "CD-ROM boot" program, NOT by a problem
   with UIDE or its SATA/UltraDMA disks!

   Some BIOS programs do not "configure" a mainboard controller if no user
   drives are found!   If the driver finds no SATA or UltraDMA units, UIDE
   runs all disks using the BIOS or uses "PIO mode" for all CD/DVD drives.
   But it tests for controllers first.   An unconfigured controller causes
   "BAD controller" to display, and the driver continues looking for other
   chips to use.   If this message displays, users should verify that each
   SATA or UltraDMA drive was made "active" thru the BIOS set-up routines.
   If so, "BAD controller" says a chip is not set to both "Bus Master" and
   "I-O Space" modes, and the BIOS needs to be UPDATED!

