
				    SHSUCDX

			   Copyright 2006 Jason Hood

			    Freeware.  Version 3.04

			Derived from v1.4b by John McCoy


    ===========
    Description
    ===========

    SHSUCDX is an unloadable CD-ROM redirector	substitute  for  MSCDEX.  It
    supports  up to 10 drives.	Each drive is single-sector buffered and the
    last 10 directory entries are cached.  Each unit from each driver can be
    assigned a specific drive letter.


    =====
    Usage
    =====

    Run SHSUCDX with the name of one or more CD-ROM device drivers.  If  the
    drivers  are valid, SHSUCDX will install a drive letter for each unit on
    each driver.

    -------
    Options
    -------

	/D	driver and drive manipulation
	/L	drive letter
	/C	memory usage
	/V	memory statistics or option information
	/~	tilde usage
	/R	read-only attribute usage
	/I	install
	/U	unload
	/Q	quiet

    /D - Driver

    This option is used to specify the name of the  device  driver.  It  can
    also  indicate which unit(s) should be assigned and to what letter.  The
    complete syntax is:

	/D[:][?|*]driver[,[letter][,[unit][,[max]]]]

    DRIVER is the name of the device driver installed to control the  CD-ROM
    drive.  Prefixing the driver with '?' will silently ignore it if it does
    not exist (or is not actually a CD-ROM); prefixing with  '*'  will  also
    ignore it, but a drive will be reserved (see below).

    LETTER is the first drive letter to assign to the units on this  driver.
    The  default  is  the  first  available letter.  Note: the drive letters
    assigned to subsequent units will always be higher than  those  assigned
    to previous units.

    UNIT is the first unit on this driver to be assigned a drive.  Unit 0 is
    the default.

    MAX is the maximum number of units on this driver to be assigned drives.
    The default is all units (or all remaining units, if UNIT is given).

    Once installed, /D by itself will display the assigned drives and return
    the number of drives assigned.

    /D - Drive manipulation

    At install time, /D can also be used to  reserve  space  for  additional
    drives.  Use  a  single  digit  to	indicate  how  many drives should be
    reserved (eg: /D1).  (If you should happen to have a device driver	name
    with  a single digit, use the '?' prefix.)  After installation, the same
    option will remove the drive(s) that were last assigned.  It is possible
    to	specify both forms of /D, in which case the current drive(s) will be
    removed, then the new drive(s) added.

    /L - Letter

    This option is an alternative to the LETTER component of  /D,  which  it
    must  follow  (ie:	/D:driver /L:letter).  It can also be used to return
    the number of drives installed (/L:0, will return 255 if not  installed)
    and the letter of each assigned drive (/L:1, /L:2, etc., with A: = 1 and
    255 if the drive is not assigned).

    /C - Memory usage

    By default, SHSUCDX will load itself into high memory, if available,  or
    into  low  memory if it is already high.  This option will prevent that.
    To be exact:

	SHSUCDX 	relocate high
	SHSUCDX /C	stay low
	LH SHSUCDX	relocate low
	LH SHSUCDX /C	stay high

    /V - Memory statistics

    When this option is used at installation, a summary of memory usage will
    be displayed.  This summary includes:

	Static		code and variables
	Dynamic 	data for each drive and paragraph rounding
	Total		overall memory usage

    /V - Information

    When used with /?, or  after  installation,  this  option  displays  the
    compile- and run-time options of SHSUCDX.  This information includes:

	8086/386	the minimum processor required
	CD root form	TRUENAME will return \\D.\A.\ instead of D:\
	High Sierra	the original format for the CD file system
	Joliet		the Windows format for long names
	image on CD	enables access to an image which is itself on a CD

    /~ - Tilde usage

    The ISO standard allows for CDs to have names up to  31  characters  and
    Joliet  can have names up to 64 characters.  When this is reduced to 8.3
    for DOS it may lead to duplicated entries.	This option will remove  the
    duplication by appending a tilded number after the name (similar to what
    Windows does).  By default, tildes are off.  This option is also  avail-
    able  after  installation.	By itself it will toggle the status (ie.  if
    tildes are currently on, /~ will turn them off and vice versa).   Tildes
    can  be explicitly turned on or off by adding a '+' or '-' sign (ie: /~+
    will turn tildes on, irrespective of the current state).

    /R - Read-only attribute usage

    By default, files on the CD are given the  read-only  attribute.  Should
    you  wish to remove this attribute, this option will do so.  As with /~,
    it can be used after installation and it accepts '+' and '-'.

    /I - Install

    Normally SHSUCDX will refuse to install if it detects another redirector
    (such as MSCDEX).  This option will cause SHSUCDX to install anyway.

    /U - Unload

    Unhook the interrupt, free the memory and mark the drive(s) as invalid.

    /Q - Quiet

    Prevent display of the sign-on banner (the copyright notice).  /Q+	will
    only display the drive assignments (when used after install '-' will in-
    dicate a removed drive and '+' an added drive).  /QQ will display  noth-
    ing at all.


    ==========
    SMARTDrive
    ==========

    SMARTDrive caches MSCDEX by modifying  MSCDEX'  memory,  so  it  is  not
    directly  capable  of  caching  SHSUCDX.   However, the supplied SMARTER
    program (see README.TXT) can patch SMARTDrive,  enabling  it  to  modify
    SHSUCDX  in  the same way.	Due to the method employed, if /D is used to
    remove a drive, then later to install it again, it	will  no  longer  be
    cached.   If a drive is created from an image file, SMARTDrive should be
    instructed not to cache it,  since	the  image  itself  will  be  cached
    (unless, of course, the image is located on a network).  Note: upgrading
    from SHSUCDX v2 will require re-running SMARTER.


    ======
    DOSLFN
    ======

    This version of SHSUCDX will only work with DOSLFN 0.40a or later.	Att-
    empting  to use an earlier version of DOSLFN may render the entire CD or
    some files inaccessible.


    ===============
    Critical Errors
    ===============

    A critical error is only generated on the initial access to the CD.   If
    a read error occurs, the calling function will fail with error 15 (drive
    not ready).  If an image is located on a CD, and that CD is removed,  do
    NOT  abort,  but fail and then abort (the first error is for the CD, the
    second is for the image).


    ===========================
    Additional CD-ROM Functions
    ===========================

    SHSUCDX has an additional installation check:

	Int 2F
	AX = 1100
	BX = BABE
	Return:
	  BX = BABE if SHSUCDX v3 not installed, otherwise:
	  BL = compile-time flags
	  BH = release number
	  ES:DI -> drive table
	  CX = number of drives
	  DX = size of each entry

	Compile-time flags:
	Bit 0 = 0 if 386, 1 if 8086
	    1 = 1 if CD root form (\\D.\A.\)
	    2 = 1 if High Sierra is supported
	    3 = 1 if Joliet is supported
	    4 = 1 if image on CD is supported

    There are also functions to control the tilde and read-only state:

	Int 2F
	AX = 150F
	CL = -1
	  CH = 0: Get current tilde state in AX (0 off, -1 on)
	       1: Set current tilde state from BX (0 off, anything else on)
	       2: Get read-only attribute in AX (0 = off, 1 = on)
	       3: Set read-only attribute from BX (0 off, anything else on)

	Carry will be cleared (MSCDEX will set carry).

    Finally, there is a function to convert a CD directory name to an FCB:

	Int 2F
	AX = 150F
	CL = -2
	  ES:SI -> pointer to directory entry
	  ES:DI -> 11-byte buffer for FCB name
	     DX = alias number (0 for none)

    The alias number is the number of the directory entry within the sector,
    plus  64  times  the  sector number (both zero based).  For example, the
    third entry in the third sector of a directory would have an alias	num-
    ber of 130 (2 + 2 * 64).


    =========
    Exit Code
    =========

	0	Uninstalled, help, option set
	1-32	Drive number of first installed drive (A=1)
	246	Invalid or unknown option
	247	Unable to uninstall
	248	Not enough memory
	249	No drives assigned (ie. not installed)
	250	No drive letters available
	251	Unit on driver does not exist
	252	Invalid or non-existant driver
	253	Already installed
	254	Unsupported version of DOS
	255	386 required


    ========
    Examples
    ========

    SHSUCDX /D:SHSU-CDH

    SHSUCDX finds the first available drive letter and assigns it to  device
    unit  0  of  the  driver SHSU-CDH.	If there is a second and/or third CD
    drive they are assigned to	the  next  available  letters  in  sequence.
    Drive letters in use are skipped.  The first CD supported by a driver is
    device unit 0 regardless of its SCSI address.

    SHSUCDX /D:IDE-CD,F /D:?USB-CD,U /D:*SHSU-CDH,W /L:0

    Assign drive F to the IDE-CD driver, or abort if it is  not  loaded.  If
    the  USB-CD driver is loaded, assign it to drive U; else do nothing.  If
    the SHSU-CDH driver is loaded, assign it to drive W; else reserve  space
    for  it,  so  it can be loaded later.  SHSUCDX will return the number of
    drives assigned (or 252 if aborted).

    SHSUCDX /L:0

    If SHSUCDX is not installed, it will return 255; otherwise the number of
    assigned drives (which can be 0).  In either case, nothing is displayed.

    SHSUCDX /D:CD001,,1,1 /D:CD001,,4,1

    SHSUCDX assigns the first available drive letter to device unit 1 of the
    driver  CD001 and the next letter to unit 4.  This allows access to non-
    contiguous drive units without having to support un-needed units.


    =======
    History
    =======

    Legend: + added, - bug-fixed, * changed.

    v3.04 - 1 October, 2006:
    - 8086 version trashed memory when the disc was missing
    * align sector buffers on a DWORD boundary

    v3.03 - 20 December, 2005:
    - incorrectly restored UMB state
    + /I will install even if a redirector is already present
    + /D by itself will display drive assignments and return number assigned

    v3.02 - 5 May, 2005:
    + set drive number in device driver's header (needed by I_Cache)
    + Int2F/AX=1500 will return AL=FF (needed by XCD in DESQview/X)
    + SMARTDrive install check will return a release number in BH
    + /Q+ to only display drive assignments
    * if loaded high, relocate low (/C will then keep high)
    - /? wouldn't work if a different version was installed
    * removed default driver (/D:drives by itself can now install)
    * modified the installer, binary is now a lot smaller
    * more NASM macros

    v3.01 - 5 March, 2005:
    - Joliet support for non-English users (use ISO if no DOSLFN 0.40a)
    * removed DR-DOS INSTALL support, use INSTALLLAST (or define DOSMOVES)
    + ignore unsupported MSCDEX options (/E/K/S/M)
    + /L enhanced to return drives assigned, drive numbers
    - 386 check was using near conditional jumps
    - preserve AH in redirector install check
    * display error if /C used after install

    v3.00 - 30 November, 2004:
    * clean slate.


    ============================
    Jason Hood, 1 October, 2006.
