Dec 112017
 
How to optimize memory using DOS 5.0 and Upper Memory Blocks.
File DOS5UMB.ZIP from The Programmer’s Corner in
Category Tutorials + Patches
How to optimize memory using DOS 5.0 and Upper Memory Blocks.
File Name File Size Zip Size Zip Type
UMB.TXT 27574 7995 deflated

Download File DOS5UMB.ZIP Here

Contents of the UMB.TXT file


HOW TO OPTIMIZE MEMORY WITH UMBS

*************************************************************
* *
* BEFORE YOU BEGIN *
* *
* * Print this file (UMB.TXT). *
* *
* * You'll need an 80386 or 80486 processor with *
* at least 350K of XMS memory. *
* To determine how much XMS memory is available, *
* type MEM at the command line. If less than 350K, *
* you need to free up XMS memory before continuing *
* (See "Troubleshooting"). *
* *
* * Backup your CONFIG.SYS and AUTOEXEC.BAT files *
* on a startup floppy disk. If you don't have *
* this disk already: *
* 1. Insert a floppy disk into drive A. *
* 2. Type FORMAT/S A: and press ENTER. *
* 3. Type COPY C:\CONFIG.SYS A:\CONFIG.SAV *
* and press ENTER. *
* 4. Type COPY C:\AUTOEXEC.BAT A:\AUTOEXEC.SAV *
* and press ENTER. *
* *
*************************************************************

THE INSTRUCTIONS IN THIS DOCUMENT ARE INTENDED FOR USERS WHO
HAVE A BASIC KNOWLEDGE OF MS-DOS. YOU SHOULD BE ABLE TO OPEN
AND EDIT FILES, UNDERSTAND THE CONTENTS OF CONFIG.SYS AND
AUTOEXEC.BAT FILES, AS WELL AS THE FUNCTION OF DEVICE DRIVERS,
MEMORY MANAGERS, AND TSRS.

NOTE: When you use the commands in the instructions, be sure
to type the correct drives and directories for your
configuration. What you actually use might differ
from what is shown in the instructions. The commands
in the instructions are examples only.


-------------------
Contents of UMB.TXT
-------------------

* Optimizing Memory with UMBs
Setting Up UMB Support
Viewing UMBs
Optimizing UMB Usage
Windows 3.0 and UMBs

* Troubleshooting

* Networks and UMBs

* Alternate Memory Managers



------------------------------------------
Optimizing Memory with Upper Memory Blocks
------------------------------------------

With MS-DOS 5.0 you can increase the amount of conventional memory
that your computer has available for running applications. Conventional
memory is the first 640K of memory automatically used by MS-DOS and
your applications. Above 640K there's additional memory space called
reserved memory that contains Upper Memory Blocks (UMBs). Reserved
memory is set aside for use by your computer, but typically, some is
left unused. With MS-DOS 5.0 you can free up conventional memory by
moving some device drivers and programs (TSRs) into upper memory.

This new feature of MS-DOS 5.0 requires an 80386 or 80486 processor
with at least 350K of XMS memory available.


=================================
Setting Up MS-DOS 5.0 UMB Support

You set up UMB support by including new commands in your CONFIG.SYS and
AUTOEXEC.BAT files. If you don't have a high-memory manager you install
one first. Then you'll revise commands to place your device drivers
and programs (TSRs) into UMBs.

NOTE: If you are using an alternate memory manager, see the "Alternate
Memory Managers" section at the end of this document.

------------------------------------------------------------
| |
| SUMMARY FOR ADVANCED USERS |
| -------------------------- |
| If you find this summary procedure too abbreviated, |
| see the detailed procedure immediately following. |
| |
| To use UMBs: |
| ------------ |
| |
| 1. Edit your CONFIG.SYS to include the following: |
| |
| device=c:\dos\himem.sys |
| dos=umb |
| device=c:\dos\emm386.exe noems |
| |
| (If CONFIG.SYS already contains the EMM386 line, |
| add RAM at the end: device=c:\dos\emm386.exe ram) |
| |
| 2. For device drivers you want in upper memory, replace |
| DEVICE= with DEVICEHIGH=. |
| |
| 3. For programs in your AUTOEXEC.BAT file that you |
| want in upper memory, add LOADHIGH (or LH): |
| |
| LH |
| |
| 4. Restart your computer. |
| |
------------------------------------------------------------

NOTE: Some drivers and programs might be incompatible with MS-DOS 5.0.
A list of the drivers and programs that shipped with MS-DOS follows the
next procedure. If you have trouble installing drivers and programs in
upper memory, see the "Troubleshooting" section later in this document.


To set up UMB support and load drivers and programs:
----------------------------------------------------
1. Use MS-DOS EDITOR to open your CONFIG.SYS file by entering:

edit c:\config.sys

Or you can use any other text editor, but you must save your
CONFIG.SYS file as a text-only file.

2. Make sure your CONFIG.SYS file contains the following lines, in the
following order:

device=c:\dos\himem.sys
dos=umb
device=c:\dos\emm386.exe noems

* The first command gives MS-DOS access to extended memory.
* The second command places MS-DOS into the upper memory area.
* The third command installs the EMM386 memory manager. If the
emm386 line already appears, add RAM to it as follows:

device=c:\dos\emm386.exe ram

3. After the DEVICE= line for EMM386, replace DEVICE= with the
following to place device drivers in UMBs:

devicehigh=

For example, to load ANSI.SYS in upper memory, you would change
DEVICE=C:\DOS\ANSI.SYS to DEVICEHIGH=C:\DOS\ANSI.SYS.

4. Save your CONFIG.SYS file as a text file.

5. Use MS-DOS EDITOR to open your AUTOEXEC.BAT file by entering:

edit c:\autoexec.bat

Or you can use any other text editor, but you must save your
AUTOEXEC.BAT file as a text-only file.

6. Add LOADHIGH to programs you want to place in UMBs.

For example, to load the PRINT command in upper memory, you would change
PRINT to LOADHIGH PRINT. (Or use LH, the abbreviation for loadhigh.)

7. Save your AUTOEXEC.BAT file as a text-only file.

8. Restart your computer.


SAMPLE CONFIG.SYS FILE
----------------------
dos=high
files= 50
buffers=30
device=c:\dos\himem.sys
dos=umb
device=c:\dos\emm386.exe noems
devicehigh=c:\dos\ansi.sys
devicehigh=c:\dos\printer.sys
devicehigh=c:\dos\smartdrv.sys 2048 512


SAMPLE AUTOEXEC.BAT FILE
------------------------
echo on
loadhigh c:\MOUSE1\mouse
cls
break=on
path=c:\dos;C:\WINDOWS;c:\util;
prompt=$p$g
set TEMP=C:\WINDOWS\TEMP
loadhigh doskey
loadhigh mode
loadhigh append
loadhigh dosshell

The following drivers are shipped with MS-DOS 5.0 and are safe to
load in UMBs:

EGA.SYS DISPLAY.SYS ANSI.SYS
RAMDRIVE.SYS SMARTDRV.SYS DRIVER.SYS
PRINTER.SYS

The following MS-DOS 5.0 programs are safe to store in UMBs:

DOSKEY.COM DOSSHELL.COM KEYB.COM
GRAPHICS.COM NLSFUNC.EXE MODE.COM
SHARE.EXE PRINT.EXE APPEND.EXE

You might have OTHER drivers and programs that you'd like to place in
UMBs. Some of these might not be compatible with the MS-DOS 5.0 UMB
feature. If you have trouble, see the "Troubleshooting" section later
in this document.

For more information about running device drivers and programs from
upper memory, see Chapter 12 of the MS-DOS 5.0 USER'S GUIDE.


============
Viewing UMBS

You can determine which programs and are loaded into UMBs by
first typing the EMM386 command to see where UMBs start, and then using
the MEM/DEBUG (or MEM/Program) command to see how UMBs are used.


Using the EMM386.EXE Memory Manager
-----------------------------------
If you type EMM386.EXE at the command line, you'll see something
similar to the following:

MICROSOFT Expanded Memory Manager 386 Version 4.20.06X
(C) Copyright Microsoft Corporation 1986, 1990

Expanded memory services unavailable.

Total upper memory available . . . . . . . . .0 KB
Largest Upper Memory Block available . . . . .0 KB
Upper memory starting address . . . . . . . . C800 H

EMM386 Active.

The information above shows no upper memory available. That's because
all upper memory has been allocated for use by MS-DOS.

NOTE: If you are using Windows, make sure you exit before attempting
this procedure. If you don't exit first, you'll see the following
message: EMM386 driver not installed.


Using MS-DOS Commands
---------------------

To view memory usage:
--------------------
* Type MEM/DEBUG|MORE and press ENTER.


To print memory usage output to a printer:
------------------------------------------
* Type MEM/DEBUG|PRINT and press ENTER.


To print memory usage output to a file:
---------------------------------------
* Type MEM/DEBUG> mem.txt


The "Upper memory starting address" is the first segment in
which UMBs are located. You'll see something like the following:

Address Name Size Type
------- -------- ------ ------
000000 000400 Interrupt Vector
000400 000100 ROM Communication Area
000500 000200 DOS Communication Area

000700 IO 000A80 System Data
CON System Device Driver
AUX System Device Driver
PRN System Device Driver

<.. removed lines here to shorten output ..>

01A990 MSDOS 085650 -- Free --
09FFF0 MSDOS 028010 System Program

0C8010 MSDOS 000130 -- Free --
0C8150 MSDOS 000AE0 -- Free --
0C8C40 XNSBIOS 000120 Environment
0C8D70 XNSBIOS 002610 Program
0CB390 SESSION 000120 Environment
0CB4C0 PRTSC 000120 Environment
0CB5F0 PRTSC 000320 Program
0CB920 DOSKEY 000FE0 Program
0CC910 MIRROR 001990 Program
0CE2B0 MOUSE 003830 Program
0D1AF0 MSDOS 0064E0 -- Free --
0D7FE0 MSDOS 008020 System Program

0E0010 IO 001500 System Data
RAMDRIVE 0004A0 DEVICE=
D: Installed Device Driver
ANSI 001040 DEVICE=
CON Installed Device Driver
0E1520 SESSION 000410 Program
0E1940 REDIR 0093E0 Program
0EAD30 MSDOS 0052C0 -- Free --


656384 bytes total conventional memory
655360 bytes available to MS-DOS
625664 largest executable program size

4194304 bytes total contiguous extended memory
0 bytes available contiguous extended memory
3124224 bytes available XMS memory
MS-DOS resident in High Memory Area

Given the upper memory starting segment of C800 reported by EMM386, you
should examine the MEM/DEBUG output for any address greater than or equal
to C8000. Anything with "-- Free --" in the type column is available
UMB memory. Anything with a name other than MSDOS is a program or device
driver running in a UMB. In the example, XNSBIOS program, XNSBIOS
environment, SESSION, PRTSC, DOSKEY, MIRROR, MOUSE, RAMDRIVE, ANSI,
and REDIR are all running in UMBs.

The size is in hexadecimal. In the example, there are free UMBs at 0C8010
(size:130h), 0C8150 (size:AE0h), 0D1AF0 (size:64E0h), and OEAD30 (size:52C0h).
If you are unfamiliar with the Hex numbering method, you can get a rough
approximation of the UMB size in kilobytes as follows:

(Multiply 10,000 digit by 16) + (Multiply 1,000 digit by 4) + (Divide
100 digit by 400) = K.

Thus, in the example, the UMB at location OEAD30, size 52C0, is
(5*4)+(2/4)=20.5K.


====================
Optimizing UMB Usage

UMB usage with MS-DOS 5.0 requires an in-depth understanding of memory.
The following information is meant for experienced MS-DOS users only.

You can control how UMBs are used in two ways:

* Load order
* Load contents

If you have enough upper memory space to load all your device drivers
and programs high, then optimization is easy: simply load them all in
upper memory. If you don't have enough space, then optimizing is
considerably more difficult. You'll need to use the EMM386 and MEM/DEBUG
commands to see which UMBs are available and then decide what to load high.

Device drivers are loaded into the largest available UMB. That UMB is
reduced in size by the amount of space the device driver requires.
Thus, if a large network file is started in your AUTOEXEC.BAT, you might
not want to load smaller device drivers into upper memory since they
might reduce the size of the UMB so much that there won't be room for the
large network file. It will probably take some trial and error to achieve
the most optimal solution.


EMM386 and the E000 Segment
---------------------------
If you are certain that your system doesn't use the memory segment from
E000 to EFFF after initialization, you can include it by adding
I=E000-EFFF to the EMM386 line in your CONFIG.SYS file.

Check your hardware manual or ask your manufacturer to find out
whether or not this area is available. Or you can experiment by editing
your CONFIG.SYS to include it. Then remove it if you have trouble.


======================================
Windows 3.0 and MS-DOS 5.0 UMB Support

MS-DOS 5.0 UMB support works great with Windows 3.0, but programs must
be loaded high before starting Windows.


---------------
Troubleshooting
---------------

When you restart your computer after editing your CONFIG.SYS and
AUTOEXEC.BAT files, watch the messages carefully. If you see a
message indicating a problem loading a device or starting a program,
edit the appropriate startup file (CONFIG.SYS or AUTOEXEC.BAT). In
the CONFIG.SYS change the DEVICEHIGH= back to DEVICE= for the affected
driver. In your AUTOEXEC.BAT remove LOADHIGH for the affected program.
When you restart your computer, the device or program you changed
will be loaded low and the problem should be corrected.

If your system hangs after you restart it, note the messages you see.
Use this information to identify the driver or program that is causing
the problem. Use the startup disk (system disk) you created during
the UMB setup procedure to restart your computer. Then move drivers back
to conventional memory one at a time until your system starts properly.


==================
Potential Problems

* Not enough XMS memory available.
If MEM reports that less than 350K of XMS memory is available,
you can increase XMS by reducing the size of your RAMDRIVE or
the amount of memory used by EMM386.

* Device drivers that grow during initialization.
DOS ensures that the UMB contains enough room for the device driver
file. However, if the device driver grows larger than its file size
during initialization, loading high might not be possible. If you
suspect this problem, use the SIZE option on the DEVICEHIGH= line
to specify the required size for the device driver. The size must
be specified in . The line should be in the form:

DEVICEHIGH= SIZE=hhhh path

where hhhh is a hexadecimal number. You can determine the final
size of a device driver with the MEM /DEBUG or MEM /PROGRAM command.
However, some device drivers can grow and then shrink before finishing
initialization. There is no easy way to determine the necessary size
for this type of device driver.

* Programs that make assumptions about memory available above them.
Some programs assume that there is always memory above them (up to
a 64K boundary for example). These programs can have trouble when
loaded into a UMB. The solution is to load them low.

* Programs that get confused by addresses >640K.
These programs must be loaded low.

* Programs/hardware that cause RAM to appear after EMM386 finishes
its ROM/RAM scan.
Some hardware/software maps memory into reserved address space when
software is loaded. Since EMM386 has already completed it's ROM/RAM
scan and determined that no memory is there, EMM386 will be mapping
a UMB into the address. When the other program causes other memory
to be mapped to the same address, you'll have problems. To solve,
edit the EMM386 line to include the X= option and exclude specific
regions from consideration for UMBs.
For example:

device=c:\dos\emm386.exe noems x=d800-dfff

This line causes EMM386 to exclude the area from segment D800 to DFFF.


==============
Other Problems

Problem: I think I have set up my system for UMBs, but when I use MEM/D,
nothing seems to be loaded in upper memory.

What to check:
1. That you included DOS=UMB in your CONFIG.SYS.
2. That EMM386 is loaded with UMB support (run EMM386 from the
command line and check the "Starting Upper Memory Address").
Note that MEM will not report memory above 640K if you run it
from Windows 3.0 in 386 enhanced mode. Make sure that you
specified either NOEMS or RAM in the DEVICE=EMM386.EXE line
in your CONFIG.SYS.
3. Ensure that you specified DEVICEHIGH for device drivers and
put LOADHIGH (or LH) in front of the programs and TSRs.
4. Ensure that the EMM386.EXE line appears after the HIMEM.SYS
line in your CONFIG.SYS.
5. For device drivers, ensure that the device driver line
in the CONFIG.SYS file appears after the EMM386 line.


Problem: I have a device driver or TSR whose size appears to be small
enough to fit into an available UMB, yet it is still loaded low.

What to check:
Look at the file size of the device driver. Some device drivers
shrink after initialization. Before attempting to load a device
driver into a UMB, MS-DOS checks the driver file size and makes
sure there's enough space available in the UMB.

To correct the problem, you need more memory space for the
driver. Try putting DEVICEHIGH= for that driver ahead of
other drivers you're loading into upper memory.


Problem: My system hangs intermittently.

Solution:
Edit the DEVICE=EMM386.EXE line in your CONFIG.SYS by inserting
REM before DEVICE=. Restart your computer. If your system works
without problem, then the trouble is related to EMM386 UMBs.

Remove REM from the DEVICE=EMM386 command and insert it in
front of DOS=UMB. Restart your computer.

If the problem persists, you need to exclude some memory.
Consult your hardware manual to see what range you can exclude.
Add X= to the end of the EMM386 line. You might
need to try several ranges before your computer starts properly.

If the problem does not persist when you include REM DOS=UMB,
one of your device drivers or programs is not loading properly.
You can correct the problem by returning the problem drivers
and programs to low memory. One at a time, change the DEVICEHIGH=
line back to DEVICE= and remove LOADHIGH from programs. Restart
your computer after each change. Repeat the procedure until
the problem stops.

If you notice that the size of a program or driver is smaller
when loaded into a UMB than when it is loaded low, the program
tried to grow beyond its allocated UMB when it moved into upper
memory. (You can check for size variations by using the MEM /P
command, first loading the driver or program low, and then
in UMBs.) To correct the problem, you need more memory space
for the program or driver. Try putting the DEVICEHIGH= or
LOADHIGH command ahead of commands for other drivers or
programs you're loading into upper memory.

Problem: I receive the "UNABLE TO CREATE PAGE FRAME" message when using
the RAM option with EMM386.

Solution: Use the NOEMS option instead of RAM. EMM386 is unable to find
the 64K contiguous space in reserved memory that is required
to create a page frame.


-----------------
Networks and UMBs
-----------------

The procedures that follow are somewhat abbreviated. If you are
unfamiliar with modifying your network configuration, please ask
your Network Administrator (or consultant) for assistance.

Network programs tend to require a significant amount of memory. By moving
network programs into UMBs, you can free up substantial space in lower
memory. The following sections describe how to load some of the
major networks into UMBs. If your network isn't covered here, please
contact your network vendor for the proper procedures.

If you're not sure which network you're using, see the NETWORKS.TXT
file in the same directory as UMB.TXT for instructions.

NOTE: Before using the following procedures, complete the "Setting Up
UMB Support" section earlier in this document.


====================
MS-NET-type Networks

Most MS-NET based redirectors are loaded with the NET command. Check
your AUTOEXEC.BAT file (or other file that you use to start the
network) for a command similar to:

NET START

where indicates that the text following START is not important
to this procedure.

Edit the NET START line as follows:

loadhigh net start


Restart your computer and watch the messages that appear to ensure that
the network loads without problem. You can use the MEM command to see
how much memory you now have available.


LANMAN 1.x/2.x Basic
--------------------
The redirectors for the Basic version will often fit into a UMB. To load
them high, add the word LOADHIGH before NET START as follows:

loadhigh net start

Restart your computer and watch the messages that appear to ensure that
the network loads without a problem. You can use the MEM command to see
how much memory you now have available. For information on using MEM,
see the "Viewing UMBs" section earlier in this document.


LANMAN 1.X/2.X Enhanced
-----------------------

With the enhanced version of LANMAN (2.0b and earlier), you can free
the most lower memory by instructing the network to use LIM memory
as follows.

1. Make sure the EMM386 command line in your CONFIG.SYS appears as follows:

device=c:\dos\emm386.exe ram

2. Locate the LANMAN.INI file that is used to start your network.

3. Find the LIM= line and, if necessary, edit it to appear as follows:

LIM=YES

4. Save LANMAN.INI and restart your network.

NOTE: If you receive the UNABLE TO CREATE PAGE FRAME message when you
restart your network, EMM386 is unable to find the 64K of contiguous
space in reserved memory that's required to create a page frame.
You need to remove the RAM option from the EMM386 line (step 1) and
add NOEMS. This prevents EMM386 from attempting to use expanded memory.
Then edit your CONFIG.SYS and AUTOEXEC.BAT (or the batch file you use
to start your network) to load the network drivers low. Next you need
to use the Setup Disk that came with your computer system to reconfigure
your hardware so that a 64K page frame is free, if possible. Then you can
return the RAM option and try loading network drivers into upper memory.
If you are unable to create a 64K block, comment out the LIM=YES line
in LANMAN.INI, replace RAM with NOEMS on the EMM386 line, and load drivers
other than LANMAN in upper memory.


=================================
Loading Novell Networks into UMBs

Insert LOADHIGH (LH) in front of your network startup command whether you
include it in your AUTOEXEC.BAT or type it at the command line.
For example, if you are using NET5.EXE to start Novell, your AUTOEXEC.BAT
(or other batch file) command will appear as follows:

loadhigh net5

Or you could type the same command on the command line.


---------------------------
Alternate Memory Managers
---------------------------

If you are using an alternate memory manager, you can let it handle
loading device drivers and programs into upper memory. Memory managers
from alternate vendors will be recognized by MS-DOS if their drivers
support allocating UMBs from extended XMS memory.

However, if you want to use the MS-DOS 5.0 LOADHIGH and DEVICEHIGH
commands instead, you need to make the following changes:

1. Edit your CONFIG.SYS file to include DOS=UMB.

2. Replace the alternate commands for loading high with the MS-DOS 5.0
DEVICEHIGH and LOADHIGH commands.

You might want to refer to the "Setting Up UMB Support" section for
detailed instructions about editing CONFIG.SYS and using the high memory
commands.



 December 11, 2017  Add comments

Leave a Reply