
                        +=====================+
                        | DPMI Help and Tips. |
                        +=====================+

This file documents the use of RTM.EXE and DPMI16BI.OVL.  Parts were
excerpted from DPMIUSER.DOC included with Borland Pascal With Objects
Note: J.E. Smith Software uses Borland C++ for software development, not
Borland Pascal.


| Running a DOS Protected-Mode Program
+=====================================

When you run a DOS protected-mode application, such as SPEED READ, you
must ensure that DPMI16BI.OVL (the DPMI server), RTM.EXE (the run-time
manager), and any DLLs used by the application are present in the
current directory, the same directory as the application, or on the DOS
path.


Protected Mode and Memory
-------------------------

A DOS protected-mode program uses DPMI (DOS Protected Mode Interface) to
run in protected mode which gives the application access to all your
computer's memory.  With the exceptions outlined below, the DOS
protected-mode technology is completely transparent and no extra steps
are necessary in order to run a protected-mode application.

Some memory managers, device drivers, and memory-resident (TSR) programs
can interfere with Borland's DPMI.  If you can not start the program
from DOS, please try the following:

       - Temporarily disabling or removing all memory managers, device
         drivers, and memory-resident (TSR) programs programs.

       - Make sure HIMEM.SYS is included in your CONFIG.SYS.

| Limiting DPMI's Memory
+=======================

By default, the DPMI interface allocates all available extended memory
for its own use. If you don't want all of the available memory to be
taken by the DPMI kernel, you can set a DOS environment variable to
specify the maximum amount of memory to use. This variable can be
entered directly at the DOS prompt or inserted in your AUTOEXEC.BAT
file, using this syntax:

  SET DPMIMEM=MAXMEM nnnn

where nnnn is the amount of memory in kilobytes.

For example, if you have a system with 4MB and want the DPMI kernel to
use only 2MB of it, leaving the other 2MB alone, the DPMIMEM variable
would be set as follows:

  SET DPMIMEM=MAXMEM 2048

Some memory managers, like QEMM or 386^Max, allow allocating the same
area of memory as either extended or expanded and many older
applications can use only expanded memmory (EMS). By using the DPMIMEM
DOS environment variable to limit the amount of extended memory used by
the DPMI server, your system will still have expanded memory available
for use by older applications.


EXTENDED MEMORY

A protected-mode application interacts with the DPMI server through
Borland's run-time manager (RTM.EXE).  By default, a protected-mode
application uses all the extended memory reserved by the DPMI kernel.


================================================================
Running A DOS Protected-Mode Program from Windows
================================================================

A DOS protected-mode program will run in Windows in 386 enhanced mode.
To check if you are running Windows in Enhanced mode, open the Main
program group then open Control Panel.  If there is a 386 Enhanced icon
then you are running in 386 enhanced mode.

To configure the amount of memory available to the application, create a
Windows PIF file.  To learn more about PIF files, see your Microsoft
Windows User's Guide.


Running from a Windows DOS Prompt
---------------------------------

To run a DOS protected-mode application from a Windows DOS prompt, you
must first modify the DOSPRMPT.PIF file found in your Windows directory
so that the protected-mode program will be able to use extended memory.

Using the Windows PIF editor, open the DOSPRMPT.PIF file, and indicate
the amount of extended memory you want the protected-mode program to
use. If you are unsure how to use the PIF editor, see your Microsoft
Windows User's Guide.


================================================================
Controlling the Amount of Memory the Run-Time Manager Uses
================================================================

The run-time manager attempts to free as much conventional memory as
possible (by moving moveable memory blocks into extended memory, for
example) before starting an application.  No attempt is made to release
extended memory, however.  Therefore, if you are going to run other
protected-mode applications that doesn't use the run-time manager
(Paradox 4.0, for example), use the RTM DOS environment variable to
control the run-time manager's allocation of memory.

Use the DOS command line to add the RTM environment variable to your
system's DOS environment. Here is the syntax:

  SET RTM=[option nnnn]

The following table lists the options you can use. nnnn can be a decimal
number or a hex number in the form of xAB54 or xab54.

   Option          Description
   -------------------------------------------------------------
   EXTLEAVE nnnn   Always leave at least nnnn kilobytes of
                   extended memory available. The default value
                   is 640K.

   EXTMAX nnnn     Don't allocate more than nnnn kilobytes of
                   extended memory. The default value is 4
                   gigabytes. In Windows, the default value is
                   one-half the available memory.

   EXTMIN nnnn     If fewer than nnnn kilobytes are available
                   after applying EXTMAX and EXTLEAVE limits,
                   terminate with an Out of Memory message. The
                   default value is zero.

   REALLEAVE nnnn  Always leave at least nnnn paragraphs of real
                   memory available. The default value is 64K or
                   4096 paragraphs.

   REALMAX nnnn    Don't allocate more than nnnn paragraphs of
                   real memory. The default value is 1 megabyte
                   or 65,535 paragraphs.

   REALMIN nnnn   If fewer than nnnn paragraphs are available
                  after applying REALMAX and REALLEAVE, terminate
                  with an Out of Memory message. The default
                  value is zero.

The following DOS command limits RTM to 2M bytes of extended memory, and
ensures that 128K bytes of real memory are left unallocated:

  SET RTM=EXTMAX 2048 REALLEAVE 8192


======================
Desqview Compatibility
======================

Some people have reported problems multi-tasking SPEED and a downloading
a file under DV.  Here is a solution that Dane Beko found to work on his
system.

1.  Run QSETUP.EXE (comes with QEMM).
2.  Choose the second option "D" to enable DPMI.
3.  Select "Y" to enable DPMI.
4.  Take the default virtual memory buffer (1024k) that QEMM offered.
5.  Save and exit.  You'll have to reboot for the DPMI server to get
    loaded.
6.  In the SPEED directory, rename or delete the DPMI16BI.OVL file.
7.  Either set a DPMIMEM variable in your autoexec.bat file or create a
    batch file for SPEED.  I chose the second option.  Here's my
    SPEED.BAT file that's called from DV.

    @echo off
    set DPMIMEM=MAXMEM 750 (Replace the 750 with whatever you want)
    c:\dv\dvansi
    sr
    set DPMIMEM=
    exit

That should do it.  SPEED's extender stub will use the DPMI that QEMM
offers it instead of loading its own via the DPMI16BI.OVL file.

