                        COMBI-Disk -
                   RAM disk & disk cache


Preface.
--------

        - Why don't You use disk cache?
        - I'd like, but memory constrains prevent me from using it:
          I need more memory for  RAM disk.
-----
        - Why don't You use RAM disk?
        - I'd like, but memory constrains prevent me from using it:
          I need more memory for disk cache.
-----
        - Why don't You use RAM disk or disk cache?
        - I'd like, but some of my applications require free extended
          memory.

If one of these answers is Yours then COMBI-Disk is for You!
You may hit THREE targets with a single shot - installing COMBI-Disk
You get a RAM disk and a Disk-Cache and free XMS memory at the same
time in the SAME area of extended memory!

When You install COMBI-Disk You specify amount of extended memory for
it and You get a RAM disk of the specified size and a Disk-Cache of the
same size. You may also specify amount of memory which should be
released if some program requires it. Then when You work with Your PC,
You enjoy COMBI's disk cache which is not worse than others (I hope it
is better).  Suppose now that You start a program which needs a disk
buffer for temporary storage and tell it to use RAM disk.  Then the
program may use the whole amount of the RAM disk's space (though
contracting the size of cache).  When it terminates and deletes
temporary files You get back your cache buffer!  If a program requests
XMS memory COMBI-disk may lend some of its memory to the program (if it
has the requested amount free of RAM disk data). When the program
releases the memory COMBI-disk reallocates it back.

I've been reported of 25% increase in compilation speed with COMBI
compared to that for other cache programs. Sure, the starting conditions
were different: with COMBI the source files were put on the RAM disk
and the compiler (BCX.EXE) used XMS memory released by COMBI. In fact,
one could, probably, achieve the same performance installing a RAM disk
and setting cache size so that there is enough free XMS not used by either
RAM disk or disk cache. But how would one calculate the optimal size of
RAM disk and free XMS? And that is not very convenient to reconfigure
(and reboot) system depending on what task are You going to deal with.



Applications.
------------

Some programs (e.g. compilers, word-processors etc.) need a buffer for
temporary storage, and if the storage is RAM disk then their performance
may be increased few times compared with the case of usage of hard disk
instead. That's why You may sometimes need a RAM disk. But if You use
standard RAM disk (Microsoft (C) RAMDRIVE.SYS or IBM (C) VDISK.SYS or any
other) it often comes out that it stays empty most of the time though
consuming Your extended (expanded) memory. That's why You may wish to
give up using RAM disk or make it less in order to have more memory
for disk cache which is always useful.

Moreover, some of programs can take advantage of XMS memory if it is
available. That's why You may wish to give up using disk cache (though
some of caches support memory reallocation without reinstallation).

                Don't get disappointed!
     COMBI-Disk
is a universal solution of this problem! It uses a little more memory for
RAM disk than is needed to keep all files written into it while all the
remaining memory is used for cache.  You need not bother to make this
memory larger - just WRITE Your file(s) into RAM disk, all the rest it
does itself! You need not bother as well to contract RAM disk's size
and increase cache size - just DELETE files from RAM disk and all the
released memory will be used for cache!  You need not bother to
reconfigure Your system when You need some free XMS memory - COMBI-disk
takes care of that itself (however, if You forgot to specify amount of
memory COMBI-disk would release, You have to run COMBI control program
to tell COMBI-disk that You need certain amount of free XMS memory).


System requirements.
-------------------

        1. 80x86 based machine with extended memory.
        2. DOS 3.30+.
        3. Extended memory manager which supports XMS 2.0 specifications
	   which supports "reallocate XMS" function (Microsoft (C) HIMEM.SYS
           ver 2.77+ or Quarterdeck (C) QEMM.SYS will do, as well as most
           others).


General features.
----------------

        - COMBI-disk may use up to about 14 Mbytes of extended (XMS) memory.
        - Up to 8 physical hard disks are supported.
        - Starting from version 1.00 background write caching is
          supported.
        - Automatic reallocation of XMS memory.
        - Variable size of cache block (memory allocation unit) -
          from 1 to 8 disk sectors (512 bytes each).
        - IOCtl interface to control program.
        - HMA may be used for COMBI-disk data tables (even when MS-DOS
          5.0+ is loaded into HMA and under DR-DOS 6.0 as well).


Limitations.
------------

	- Maximum buffer size is limited by requirement that all COMBI's
	  data tables must fit into a single segment. This results in 14MB
	  limitation of COMBI's buffer (for such a large buffer COMBI needs
	  about 80K of conventional or upper memory). Probably, this will be
	  changed in future releases.

	- EMS reallocation is not supported, yet.

	- Only DOS versions from 3.30 up to 7.0 (excluding 7.0) are supported.
	  This will change in future releases if COMBI either proves
	  compatibility with higher versions or when it is properly changed
	  to support these versions.

	- Maximum size of hard disk accepted by COMBI is about 2GB. This
	  limitation is accounted for COMBI's internal representation of
	  cache data and may be changed in future releases.


Installation.
------------

WARNING! It is recommended to make backup of hard disk before
installation of COMBI-disk (as well as any other disk cache program).

COMBI-Disk installation process is quite straightforward, although it
requires some tweaking with the contents of your CONFIG.SYS file. You may
follow one of two installation strategies suggested below: safe installation
or quick installation.

	Safe installation.

Safe installation is recommended if You have non-standard software/hardware
configuration (some smart BIOS on HD controller, other specific device drivers
wich may conflict with COMBI's cache program etc.) or You never tried COMBI
and do not want to boot from a diskette if COMBI locks the system on startup.

Copy COMBI.SYS into Your hard-disk and insert the following line into Your
CONFIG.SYS file

        DEVICE=[drive:][path]COMBI.SYS /C O

The proper place in CONFIG.SYS would be after all memory managers,
after disk managers and if possible before disk write-protection
programs (otherwise You should not turn on write caching).

The parameters ("/C O") instruct COMBI not to turn cache on after installation.
This must not cause any problems. Now You can check that COMBI has created
RAM-disk, try to reallocate XMS to/from COMBI, run programs that need XMS
and see that XMS is really available to that programs.

Now run

	COMBI.COM O+

This command tells COMBI to turn cache on. COMBI.COM should report that
"Options changed". You can test the cache with some cache test program or
just with CMBTEST.COM which is included into distribution package. If
everything seems O'K and You are going to use advantages of write caching
then run

	COMBI.COM B+

Write caching is turned on and You may test the cache once more. If it does
not cause any problems then change COMBI's parameters in CONFIG.SYS from
"/C O" to "/C B". You may now reboot and return to editing CONFIG.SYS only
when You need fine-tuning COMBI's operation.

	Quick installation.

If You used prior versions of COMBI or suppose that Your hardware/software
is "compatible with everything" then just add the following line into Your
CONFIG.SYS file

        DEVICE=[drive:][path]COMBI.SYS /C B

If You already had COMBI in CONFIG.SYS with customized parameters then,
probably, You need not to change anything (however, You may be interested to
browse WHATSNEW.120 - this file contains recent changes in parameters and
new features).


Installation parameters.
------------------------

The complete syntax of installation line is the following:

	DEVICE=[drive:][path]COMBI.SYS \
	[<mem_parms>] [/V [<RAMd_parms>]] [/C[<cache_parms>]] [/H] [/Q[Q]] \
	[/P] [/D]

The backslash ("\") means that there should not be newline - it is added only
for convenient reading/printing this file. You may be interested to see
COMBI.FAQ file for explanation of various options/features which are
controlled by installation parameters.

All the parameters are optional and and are divided into three groups:

<mem_parms> -  Memory configuration parameters. These include:

    <buff_size> -  The amount of XMS memory (Kbytes) You want to use for
               COMBI-Disk. Minimum  is 128K, maximum is about 14000K.
               If it is omitted then all available memory is default.
               There is no harm if You specify more memory than really is
               available - then COMBI-disk uses all available memory.

    K:<keep_size> - The amount of XMS memory (Kbytes) COMBI will keep (do not
	       lend to other programs) for its RAM-disk and disk cache. This
	       is a new parameter which replaces former <rls_size>. Default
	       for the <keep_size> is <buff_size>/4.

    W:<win_size>  - The amount of XMS memory (Kbytes) COMBI should release
	       when Windows in enhanced mode isbeing installed. This is a new
	       parameter and the default is 0. As a rule this is not needed,
	       but if Windows reports "Not enough memory" or something like
	       that, then it means that Windows can't get memory from COMBI
	       (probably, Windows does not attempt to use standard means of
	       XMS allocation in that configuration). In this case "W:600"
	       should be enough for Windows kernel, as regards applications
	       even in this case Windows allocates XMS for them from COMBI.


/V          -  means that RAM disk parameters follow and may be omitted if
	       no parameters for RAM-disk are specified.

<RAMd_parms> - RAM disk parameters may be the following:

    F:<disk_size>- specifies formatted size of RAM disk. By default COMBI
               creates RAM disk of the size (<buff_size> - <min_cache>)
	       Kbytes. But You may specify a less size though this will not
	       save much of conventional memory.

    R:<root_num> - number of entries in root directory of RAM disk. Default is
		64 for buffer <= 256K,
		128 - for buffer 256-1024K,
		256 - for buffer > 1024K.
	       If You encounter DOS error "can't create file..."
               when number of file in root directory is 63, 127 or 255
	       depending on You configuration (one directory entry is already
               used by COMBI for volume label) then try specifying a larger
	       number.

    S:<sect_size> - sector size for RAM disk - 256 or 512 bytes, default is
               512 bytes. Using 256 bytes sectors may sometimes save
               some space on RAM disk but this is effective only if
               RAM disk size is less than 1 Mbyte.

    N       -  tells RAM disk not to return 'sector not found' error
               (see also below). This setting may be always changed by
               control program.

/C          -  means that cache parameters follow.


<cache_parms>- cache parameters may be the following:

    M:<min_cache>- specifies minimum cache size (Kbytes). This reduces size
               of RAM disk but guarantees that specified amount of
               memory will be always allocated to cache. Default is 0.

    U:<block_sec>- number of sectors per cache block (from 1 to 8). Using
               smaller blocks may result in more effective usage of
               memory (if You have not much of it) but leads to slower
               operation for large read/write transfers. Default is 8.

    T:<delay_ticks> - specifies how long COMBI should wait after last disk
               access before starting write to disk. The delay is measured
	       in timer ticks (approx. 1/18s), default is 18 (about 1 sec).

    O       -  tells COMBI-disk to turn OFF disk cache after
               installation. Cache may be turned ON at any time by
               control program. This may be useful for testing period
	       if You have some problems.

    B       -  enable background disk writes. By default background
               writes are set off on installation. May be changed at
               any time by control program.

    I       -  forces COMBI's disk cache to start background writing
               immediately. By default background writing starts within
               18 timer ticks (approx. 1 sec.) after last access to hard
               disk. This is in effect only when background writing is
               enabled. I admit that sometimes it may be more safe to
	       start writing immediately rather than wait a second, but
	       as a rule that slows down cache performance, especially
	       for large transfers.

    A       -  Turn OFF read-ahead option. By default read-ahead is ON.

    F	    -  Write in FIFO (First In - First Out) order. Default COMBI's
	       strategy is writing in sorted order. This option has no effect
	       if write caching is OFF. This was the only write strategy
	       for prior versions of COMBI.

    L       -  Write in LRU (Least Recently Used) order. Similar to the above.


/H          -  Tells COMBI-disk to use HMA for data tables. If HMA is not
	       used by DOS there is 64 Kbytes - 16 bytes available which is
	       enough for largest COMBI's buffer. Under MS-DOS 5.0+ there
	       is often about 16K available (this is enough for approximately
	       4MB buffer). Usage of HMA saves some amount of conventional or
	       upper memory but sometimes it may cause incompatibility
	       problems.


/Q          -  Tells COMBI-disk not to display installation parameters.


/QQ	    -  Similar to the above, but warning messages (non-fatal errors)
	       are also suppressed.

/P          -  Tells COMBI to assume that hard disk parameters are O'K (see
	       error messages below).

/D          -  Tells COMBI to accept any DOS version higher than 7.0. If this
	       switch is not specified COMBI won't install under DOS versions
	       7.0 and higher. There is no warranty that COMBI will be
	       compatible with that DOS versions, so use this switch on Your
	       own risk.


In short, recommended installation parameters for best performance are:

DEVICE[HIGH]=<drive>:<path>COMBI.SYS /C B /H

In this case COMBI allocates all available XMS memory but will release
almost all when it is requested, RAM disk is created of maximum size
and write caching is enabled. (You may use explicitly set COMBI's buffer
size and other numbers if You either don't want to spend all XMS for COMBI
or want to ensure that there is always some memory available for RAM disk.)

Note:   Minus ('-') may be used everywhere in command line instead of
        slash ('/'), and equal sign ('=') instead of colon (':'). Case
        of the letters is insignificant. Spaces are required only after
        COMBI.SYS name and between two adjacent numbers.


Installation messages.
---------------------

                COMBI-Disk: RAM disk & disk cache
        Copyright 1991-1994 by Vadim V. Vlasov, Moscow, Russia,
                        Version 1.20

             - This banner always appears and tells You that
               COMBI-disk is being installed.


ERROR: Incorrect DOS version!

             - DOS version must be above or equal to 3.30 and below 7.00.
	       However, if /D installation switch is specified then COMBI
	       assumes that DOS version is 5.00. Whether that may cause
               problems depends on actual differences in future DOS versions
	       compared to DOS 5-6.

ERROR: Invalid parameter!

             - An invalid parameter appears in command line or some
               parameter is specified in improper place.

ERROR: Extended Memory Manager not present!

             - COMBI-Disk needs XMM driver. Check that Your XMM driver
               is installed before COMBI-Disk.

ERROR: Can't allocate extended memory!

             - All extended memory is used by some other programs or less
               than 128K is available or an error encountered when COMBI-Disk
               tried to allocate extended memory.

ERROR: Not enough memory!

             - Not enough memory for COMBI-disk's code and data. This
               is almost impossible.

ERROR: No hard drives on system(?!)

             - COMBI-disk can't determine presence of hard disk(s) and
               its (their) parameter(s).

WARNING: Hard Disk x is too large.

	     - Due to internal limitations COMBI can't deal with very large
	       (somewhat about 4GB depending on cache block size) hard disks.
	       So, only lower cylinders of that disk may be cached. If /P
               switch is not specified cache is turned off on installation
               (allowing You to turn off caching of this disk). If /P switch
               is specified then this message does not appear, but only lower
	       cylinders of the disk will be actually cached.


WARNING: Inconsistent parameters.

             - Some of numeric parameters conflict with each other. As
               a rule this is not fatal - some of the numbers will be
               adjusted.

WARNING: Can't hook XMS driver entry chain.

             - COMBI-disk won't intercept XMS (re)allocation calls and
               hence automatic reallocation of COMBI's memory is
               disabled. However, You may change amount of used XMS
               memory by control program.

WARNING: Hard Disk x parameters look dubious.

	     - COMBI attempted to determine hard disk parameters but got
	       a result that may be interpreted as an error rather than
	       actual parameters (less than 2 heads or less than 13 sectors
               per track or less than 312 cylinders). Operating with
               incorrect parameters may result in hangup or destroy disk
	       data, so COMBI is installed but cache is turned off. Cache
	       may be turned on later by running "COMBI O" (say, from
               AUTOEXEC.BAT). But unless hard disk parameters are actually
	       that "non-standard" You should set the correct parameters
	       by running "COMBI Hx:ccc:hh:ss" before. This message may be
               suppressed by /P switch.

WARNING: Not enough HMA for data tables or HMA not available.

             - COMBI-disk will use more low memory for its data tables.
               (For 3 Mbytes buffer it is about 12K)

If "ERROR:..." message is displayed COMBI-disk aborts installation.

If the installation is successful a box is displayed (if it is not
suppressed by /Q switch) which summarizes installation options and
announces how much memory is used by COMBI-disk.

Note. Some of numeric parameters specified in command line may be
adjusted by COMBI-disk.


Testing.
-------

A simple test program CMBTEST.COM is supplied with the package. It
writes randomly to few files, deletes some of them etc. Its objective
is to convince You that memory allocation strategy used by COMBI-disk
is reliable. It may also be used to test write caching reliability.
See file UTILS.DOC for details.


Control of operation.
--------------------

A control program COMBI.COM is supplied with the package. It allows
You to change cache or RAM disk options or change memory setting
without reconfiguring and rebooting. It also displays some statistic
information which may be helpful: current options, number of read/write
accesses to hard/RAM disk etc. See file UTILS.DOC for details.


Compatibility.
-------------

COMBI-disk is compatible with:

  - MS-DOS versions 3.30 - 6.2 (if it were not it would be useless);

  - DR-DOS version 6.00 (version 5.00 was not tested);

  - Borland's Turbo-debugger TD386 (TD386 uses XMS memory released by
    COMBI-disk);

  - MS-WINDOWS;

  - DJGPP (GNU C++ compiler for DOS and GO32 DOS extender by
    DJDelorie), however LD (DJGPP linker) often runs into "Sector not
    found" error if some of object files are on RAM disk, usage of "N"
    installation option or "COMBI n" solves the problem;

  - Stacker and SuperStor disk compression drivers.

  - many other programs.

COMBI-disk is incompatible with:

  - Maybe some multitasking programs (please report me about any
    incompatibilities).

  - For some configurations You should change COMBI's buffer size manually
    if You want to have more XMS for DesqView.


Possible errors.
---------------

Sector not found - You tried to read a sector which does not contain
        any valid data (You haven't written into it yet or have  already
        deleted the file that occupied this sector). This never happens
        with the majority of programs. However, for some programs this
        occurs regularly. It is recommended to reply 'Ignore' to the
        'Retry, Ignore, Fail?' DOS prompt. If You are sure that this
        causes no errors You may specify option 'N' as one of
        installation parameters (or run "COMBI n"). In this case the
        'not found' sectors are also not read, but error status is not
        returned by COMBI-disk.

Warning! Once a file is deleted from RAM disk, it might not be correctly
unerased by any means. It's data is lost immediately.

Data error writing drive <RAM_disk> - this may happen when some XMS
        memory has been lended to a program and that program also tries
        to write some files to RAM disk which has not enough memory for
        that. Suggested action - specify less amount of memory which
        COMBI-disk should release for other programs or configure the
        program to use other drive for temporary files.

        The same problem may arise if a program which used XMS memory
        terminated (or has been aborted) but not released memory. In
        this case COMBI-disk can't reallocate XMS memory back to the
        full size. It continues working but won't use the full buffer
        size for cache or RAM disk data.

        Other errors indicate that either COMBI-Disk internal data tables
are corrupt (e.g. overwritten by other program) or error in XMM driver
encountered.


Some hints.
----------

"TEMP" environment variable is used by MS-DOS as a directory for
temporary files, in particular when COMMAND.COM creates pipes
(e.g. "dir | sort | more" etc.).

"TMP" environment variable is used by many programs (e.g. Microsoft
compilers) as a directory for temporary files. So, setting TEMP and TMP
in AUTOEXEC.BAT to point to Your RAM disk may improve Your system
performance.

Many other programs also can take advantage of RAM disk - see their
manuals and configure them.

Using write caching is not very dangerous as it might seem. In fact,
when COMBI-disk is configured for background writing it often takes
less time to finish writing to hard disk than without write caching.
Moreover, while data is being written to disk You program continues
running and that saves You a lot of processor time. Enabling delayed
writing as a rule decreases number of hard disk accesses and hard disk
head motions. However, if You start a program that hooks INT 08 (timer)
and does not pass control to former INT 08 handlers (some games often
do that) it would be better if You disable delayed writes ("COMBI i")
before starting such a program and enable it later ("COMBI i-").

Freezing cache ("COMBI z") when it contains certain data may be useful
if COMBI-disk's buffer size is relatively small. E.g. Freezing cache
after "CHKDSK" results in faster search for a file or directory change,
freezing cache after run of some program (whose size is less than cache
size) results in faster loading of that program on future runs (while
other programs operate as without cache).


The name of the game.
--------------------

The name "COMBI" originates from "COMBInation" of such incompatible
(maybe even contradicting) at the first sight programs: RAM disk and
disk cache.


History information.
-------------------

Version 1.20 (????????1994): see WHATSNEW.120 for details.

Version 1.13 (03 May 1993):

Added support of XMS reallocate function. Prior versions did not allow
other programs to reallocate an XMS handle to larger size from COMBI's
resources. Though there are not many programs that need this feature.

Now when COMBI is queried for free XMS memory it includes into consideration
the memory used by dirty cache blocks as well, assuming that if XMS is
requested the blocks might be updated and the memory released.

When asked by COMBI.COM to increase buffer size so that the resulting size
would be greater than that on installation, COMBI attempts to retrieve
as much of its setup buffer as possible. No error is returned in this case
if the resulted buffer becomes larger.

COMBI.COM checks whether its output is not redirected and whether ANSI.SYS
driver is installed before producing colour output.

COMBI.COM displays status/statistics only if no options are given. Otherwise
it reports only whether the options or buffer size were successfully changed.

COMBI 1.13 accepts MS-DOS version 6.00.

Version 1.10 (01 Dec 1992):

Few bugs of version 1.00 were fixed. These include:
  - "Not enough memory" error under DOS other than MS v.5.00;
  - Very poor performance (worse than without cache) if VERIFY is set ON.

Now COMBI may use HMA under DR-DOS as well.
Performance of cache improved.
Write delay time increased from 5 to 18 clock ticks (1 sec).
Added Ctrl-Alt-Del handling to flush cache before reboot.
COMBI control program renamed from "CMBCTL" (which was hardly typeable
and hardly memorizable) to "COMBI", ANSI sequences are used to provide
color output.

Version 1.00 (08 Aug 1992):

A lot of new features added compared to prior versions: write
caching, reallocation of XMS memory, IOCtl interface to control
operation of COMBI-disk etc. Most of the code has been completely
rewritten. However, the main idea of dynamical memory reallocation
between RAM disk and disk cache remained the same.

Versions 0.10 (13 Aug 1991) - 0.31 (15 Feb 1992):

These were mainly trial versions to ensure reliability of the idea of
dynamical reallocation of memory for RAM disk.

The very first beta version of COMBI-Disk was version 0.01 (24 Jun 1991).


Future.
------

Here are some of my ideas about future development of COMBI:

  - Caching of floppy disks;

  - Special version for 80386 processor (probably, usage of 80386
    instructions may increase performance);

  - As regards usage of EMS instead of XMS, I'm not sure that it would be
    an advantage. However, if there is enough interest in that I'll implement
    EMS support;

  - Further improvement of performance.


----------------
If You have any questions, comments or find out any problems with
COMBI-disk usage please contact:

        Vadim V. Vlasov,
        Inst. for Nuclear Research of Russian Acad. Sci.,
        60th October Anniversary prospect, 7a,
        117312, Moscow, Russia.

        phone:    7-095-133-6533

        Internet: vvv@ms3.inr.ac.ru (finger,talk: vvv@vvv.inr.ac.ru)


