
				  XMSDSK.EXE
				      &
				  EMSDSK.EXE

			   Franck UBERTO - 96/12/09
			  38000 Grenoble - FRANCE
				   Email : uberto@esrf.fr


  These utilities are 2 RAMdisks. For some people they surely will lack of
some "bells and whistles", but I made them efficient and simple to use.
  There are 2 programs because I wanted to optimize size and speed, so one is 
for XMS and the other one is for EMS.
  To get help for running them, just type: XMSDSK (or EMSDSK) /?.

 You can use them on 286 and upper (use EMSDSK86 for 8086 CPU). Once installed
they will take about 500 bytes of memory.

  You can resize the disk (down to zero, or up to 2 Gb if available) at any
time and so regain memory for another usage. This is possible on DOS command 
line but *NOT* under WINDOWS because of virtualization. The transient part of 
EXE will calculate all parameters for the new disk (the same ones used by
MS-DOS for hard disk, so they should be convenient for all cases).

  Take care, if you shell out of a DOS program and modify the size of the disk:
in the case you have set TEMP (or TMP) environment variable on the ramdisk or
you have told this program to use the RAM disk, then some (hidden) files may
have been created and some (not) pleasant things can happen.

  These RAM disks can be installed *ON THE COMMAND LINE* (and hence in
autoexec.bat for example, see below). This way users can even *CHOOSE THE
DRIVE LETTER* to be used.

Although the installation method (on command line) has been successfully tested
on MS-DOS 3.x, 4.0, 5.0, 6.x (adapted years ago from "Undocumented DOS" by 
Andrew Schulman, Addison-Wesley), it can't be certified that other MS-DOS 
versions or 'clones' support it.

By _SPECIFING A DRIVE_ this permits to install the RAM disk between or after
CDROM and network disks (some people want to have them at given 'letter' 
drives; unfortunately MS-DOS assigns drive name as they are loaded). BTW this 
method can improve some disk cache behaviour (if the cache can't be disabled
for a given drive, by loading the RAM disk after the cache software, this 
latter does not see the RAM disk and so does not try to cache it: it is not 
only superfluous to cache a RAM disk but it wastes cache ressources).

NB: for a drive to be successfully used when specified on the command line
    one must take care that this drive is <= LASTDRIVE , default value
    (when not set in config.sys) is E.

NB2: when DBLSPACE/DRVSPACE is loaded there is 2 LASTDRIVE to take into 
     account: the one in CONFIG.SYS and another one in DBLSPACE/DRVSPACE.INI.
     This latter is a read-only, hidden, system file located, in general, on 
     your boot disk, or C:, or the host-disk.
     It seems that the highest of the 2 values takes precedence, but there 
     are exceptions (else it won't be funny  :-) ): if one or more drives are
     installed on "slots" reserved for DBLSPACE/DRVSPACE then LASTDRIVE is 
     incremented accordingly.
     Sorry, I tried to be as clear as possible but I can't be more as it's 
     very far to be clear for my poor person.  :) :)


  You can use and distribute these files: it's freeware.

  So ENJOY ...


  
  * Some hints ...
  -----------------
  
  * About XMS and EMS memory ...
  
  XMS memory is allocated in _contiguous_ block. So you can have the surprise
  of not being able to resize XMSDSK although MEM (or other) reports that you
  have plenty of XMS mem available, strange isn't it ?
  The fact is that other programs may have requested fixed blocks of memory
  and now XMS mem is _fragmented_. Yes just like old DOS memory !
  The solution is to load programs which need fixed mem blocks _before_ XMSDSK
  so as to prevent XMS fragmentation. This way you'll be able to resize XMSDSK
  from 0 to up the last Kbyte of available XMS memory.

  This is another advantage of loading the RAM disk from the command line.
  
  Note that on some systems fragmentation can nevertheless persist: this is
  related to the way these BIOS or hardware configuration deal with upper mem.
  
  This fragmentation is not seen with EMSDSK because EMS mem (true or emulated)
  is, sort of, 'scrambled' to appear to be contiguous.


  * About disks in general ...

  Always try to work in a sub-directory: the root directory is assigned a fixed
  size when the disk is formatted and, in most cases, it is limited to 512 
  entries (files or directories) so the root can be "overflowed" although 
  there's a lot of space left on the disk.
  This is particularly true as XMSDSK and EMSDSK are resizable disks: root size
  depends on the total size of the disk.
  This is even more of a concern if you use long filenames under Win95: long
  filename takes up one entry for the equivalent short name and several other
  entries to store the long name. So this should fill up the root directory
  very rapidly.



  * Examples of use
  ------------------

  device[high]='path'\XMSDSK.EXE [size in Kbytes] (or EMSDSK.EXE)
     Install ramdisk in config.sys.
     If size is not specified then disk has a null size.
     
  If the RAM disk is not loaded, at the first time the EXE will be run it
  will ask to do it. So if you want to do it purposely, in autoexec.bat for
  example, type:

  XMSDSK [size in Kbytes] [drive:] /y (or EMSDSK)
     This will try to load driver in upper mem without being prompted.
     The driver part is relocated in the "best fit" place first in upper 
     memory otherwise, if unsuccessful, in lower memory. This should prevent
     memory fragmentation.
     If a drive is specified then it will be tried otherwise first available
     drive will be used. Drive must be <= LASTDRIVE (in config.sys or 
     dblspace/drvspace.ini, see NB2 above).

  XMSDSK (or EMSDSK)
     On DOS command line, tells you the size and drive used by the ramdisk.

  XMSDSK <size in Kbytes> (or EMSDSK)
     Modify the size of the ramdisk.

  XMSDSK <size in Kbytes> /y (or EMSDSK)
     In a batch file this prevents being prompted when modifying size.
     XMSDSK (and EMSDSK) returns a value which can be used with "errorlevel"
     to tell where it is installed: 0 if not installed or in case of error,
     1 for drive A (huh ?), 2 for B (huh huh ?), 3 for C (hmmm ?), etc ...

  XMSDSK /u (or EMSDSK)
     Remove driver from memory, disk doesn't exist anymore.
     
  XMSDSK /u /y (or EMSDSK)
     Same as above, without prompting.  :-)


  NB: size is in Kbytes (1024 bytes) and rounded to the upper 16 Kbytes.



  * History
  ----------

    v1.0  (May 92)   Initial version.
    v1.1  (Jun 92)   Adds some optimization in resident part.
    v1.2  (Oct 93)   Adds some tests in size redefinition part.
    v1.3  (Apr 94)   Corrects a bug when requested size was around 4000 Kb
                     and another one which limited size to 16 Mb.
                     Adds more accurate error messages instead of "error
                     during installation".
    v1.4  (Feb 96)   Some cosmetic cleaning.
    v1.5  (Mar 96)   Adds possibility of installation on the command line.
    v1.6  (Apr 96)   Drive to be used can be specified on the command line.
                     Corrects a bug which prevent compatibility with SCANDISK
                     (may be other ?) program.
    	             Adds option y.
    v1.7  (Apr 96)   Bug fix.
    v1.8  (Apr 96)   Some cleaning.
    v1.9  (Sep 96)   Supports up to 64 Mbytes.
    	             Adds option u to remove driver from memory.
	             EMSDSK and EMSDSK86 can be used in place of each other
	             safely.  :-)
    v1.9a (Sep 96)   Supports up to 2 Gbytes. This should stop the question
                     about "could it support more than xxxKb?".  :)
    v1.9b (Oct 96)   Corrects a problem with DBLSPACE/DRVSPACE.
    v1.9c (Dec 96)   TSR part is now relocated "dynamically" in upper memory.
                     Fixes a problem with NWDOS 7 XMS manager.
		     Some cosmetic change.



  Thanks, for their help and testing (or suggestion), to:
    Philippe Ahles <>
    Mervyn Baldwin <>
    Frank Decandia <frank.decandia@agoron.com>
    Lee Goldstein <72077.2054@compuserve.com>
    Peter Hayward <peter@cdsl.demon.co.uk>
    Bernard Marone <marone@conline.com>
    Pino Navato <Pino.Navato@p18.f225.n335.z2.fidonet.org>
    Jim Oliver <jim.oliver@welcom.gen.nz>
    Michel Peru <peru@esrf.fr>
    Vladimir Plotto <V.Plotto@frec.bull.fr>
    Mike Ray <mer1@cornell.edu>
    John Stockton <jrs@dclf.npl.co.uk>
    Michel Toussaint <100334.2645@compuserve.com>


PS: as you may have seen this package is FREEWARE. I would be glad if you
    appreciate (more :-) or less :-( ) it to send a little Email message.
    Thanks.
    
PS2: these utilities (at least XMSDSK) have been used with Linux + Dosemu and
     work well.
     
PS3: it has been reported by several users to work equally well under MSDOS 7
     (Win95).



  * Disclaimer
  -------------

 Copyright (C) 1992 - 1996  Franck UBERTO

 This package is offered to you "AS IS" without any warranty. This software has
been thoroughly tested but no guarantee is given that it will work on every
computer. The copyright owner may not be held liable for any damages, direct
or consequential, which may result from the the use of this program.

 This archive is freely distributable. You may use the software and share it
with all your friends (or others) as long as the program is supplied in its
original, unmodified form, which includes this documentation. This program
must not be distributed for profit.
