[Front] [Prev Chapter]
[Next Chapter]
Memory Map Showing Upper, High and Extended Memory
Displaying the Current Memory Configuration
Before you begin making changes to optimize the way in which your system
uses memory, it is important that you know what types of memory are
available on your computer and how memory is currently being used.MEM /?
MEM /H
DR-DOS Memory Managers
To access extended, expanded, or upper memory, the operating system
includes memory managers. A memory manager is a special device driver
that provides access to different memory types. The memory manager you
use depends on what type of hardware you are using. EMM386
The EMM386 memory manager provides access to the upper memory area. It
also uses extended memory to emulate expanded (EMS) memory for those
applications that need it.DEVICE = C:\DRDOS\EMM386.EXE [[/]?|[/]H] [[/]AUTO]
[[/]COMPAQ[=ON|OFF]] [[/]DPMI[=ON|OFF]]
[[/]EXCLUDE=start-end[,start-end]...]
[[/]FRAME=AUTO|NONE|address] [[/]GATEA20=type]
[[/]INCLUDE=start-end[,start-end]...]
[[/]INT15=kb] [[/]MULTI[=ON|OFF]] [[/]OFF] [[/]ON]
[[/]ROM=start-end[,start-end]...]
[[/]USE=start-end[,start-end]...]
[[/]VIDEO[=[start-]end]] [[/]VXD=path]
[[/]WEITEK=ON|OFF] [[/]WINSTD] [[/]XBDA] [[/]XMSUMB]
HIMEM
The HIMEM memory manager provides access to the upper memory area. The features provided by HIMEM, however, will depend on your hardware. If you are using a 286-based computer with extended memory, the only HIMEM feature you may be able to use is relocation of the DOS software to high memory. If you have a chip set or expanded memory board, you can use other HIMEM features.
HIMEM is loaded and configured by a DEVICE statement in the CONFIG.SYS file. This statement is automatically placed in CONFIG.SYS when you choose to load the 80286 memory manager during SETUP (or INSTALL). The configuration of HIMEM depends on the values you set in SETUP and on changes you make yourself to CONFIG.SYS.
The full syntax of the HIMEM DEVICE statement is as follows:
DEVICE = C:\DRDOS\HIMEM.SYSThe following table describes the HIMEM options. For information about specifying these options, either through SETUP or by editing CONFIG.SYS yourself, see ``Making More Memory Available'' on page 10-10.
[/CHIPSET=AUTO|chipset|NONE]
[/EXCLUDE=start-end[,start-end]...]
[/INCLUDE=start-end[,start-end]...]
[/ROM=start-end[,start-end]...|AUTO|NONE]
[/USE=start-end] [/VIDEO[=[start-]end]] [/XBDA]
EMMXMA
EMMXMA is a memory manager that provides EMS (expanded) memory for applications that can take advantage of it.DEVICE = C:\DRDOS\EMMXMA.SYS
The following table describes the EMMXMA options:
[/FRAME=address] [/KB=nnnn]
Making More Memory Available
Most programs require conventional memory; when a program fails to run, it is often because there is insufficient conventional memory available for it. You can make more conventional memory available for applications by minimizing the amount of conventional memory used by the operating system, device drivers, and other memory-resident programs. You can maximize the amount of available conventional memory in the following ways, all of which are described in detail in this chapter:
Loading and Configuring the Memory Manager
Before you can take advantage of extended, expanded, or upper memory, you must load a memory manager that enables these memory types. To load the memory manager, run SETUP, choose DOS System and Memory Management, choose Memory Manager, and then choose to load either the 386 (and later) memory manager (EMM386) or the 80286 memory manager (HIMEM), depending on your hardware.
Copying Slow ROM into Fast RAM (EMM386 and HIMEM)
The EMM386 and HIMEM memory managers can automatically copy data from read-only memory (ROM), which often executes slowly, to Random Access Memory (RAM), which executes much faster. EMM386 and HIMEM ensure that the RAM to which they copy ROM has the same address. Copying ROM to RAM is particularly useful when you have a video card that calls ROM to output characters, for example; character output will be faster.
Providing LIM 4.0 EMS Support (EMM386 Only)
EMM386 can use extended memory to emulate an expanded memory driver, for applications that use LIM EMS 4.0 (expanded) memory. This means that expanded memory is available without a special add-on memory board.
Supporting MS Windows 3.0 in Standard Mode (EMM386 Only)
If you are using MS Windows 3.0 in Standard (80286) mode, the program will not normally run under EMM386. EMM386 can support MS Windows 3.0 in Standard mode, however, if you choose to enable the WINSTD option, to disable upper memory. Do this by running SETUP, choosing to configure EMM386, and then selecting support for MS Windows 3.0 in Standard mode. Using Spare Video Memory Space for RAM (EMM386 and HIMEM)
The video memory on your computer immediately above 640 KB is used by EGA/VGA video display adapters for displaying high resolution graphics. If high resolution graphics are not required, however, EMM386 and HIMEM can make the spare memory available for applications. This can provide up to 96 KB of additional memory, depending on the kind of video display adapter you have: 64 KB if you have an MDA, Hercules*, or EGA/VGA (monochrome) adapter and 96 KB if you have a CGA or EGA/VGA (color) adapter.
NOTE: If you have an EGA or VGA video display adapter, /VIDEO only reserves video memory. Before it can be made available, you must also run MEMMAX +V to enable the use of video memory. If you want to use graphics, you must return the video memory to the video display adapter by running MEMMAX -V. MEMMAX +V and MEMMAX -V can be run at the system prompt or in AUTOEXEC.BAT. See ``Enabling and Disabling Lower, Upper, and Video Memory'' on page 10-16 for more information about the MEMMAX command.
Loading DPMI (EMM386 Only)
You can load the DOS Protected Mode Interface (DPMI) if you are using programs that require it.DPMI=ON|OFF
Reserving Extended Memory for non-XMS/LIM Applications (EMM386 Only)
EMM386 can reserve a certain amount of extended memory for applications that cannot use XMS or LIM 4.0 EMS (expanded) memory. Advanced Memory Options
If you choose <Advanced Options screen> when configuring EMM386 or HIMEM in SETUP, you see a table which indicates how memory is currently being used. You can set the following options for EMM386 or HIMEM on this screen:
If your computer has extended memory, however, you can make more conventional memory available to your applications by running the DOS software in the High Memory Area (HMA) and in upper memory (when the HMA is not available). DOS=HIGH,UMB is the default for the operating system when extended memory is available. In order for high or upper memory to be enabled, a memory manager (EMM386 or HIMEM) must be loaded first. Refer to ``Loading and Configuring the Memory Manager'' on page 10-10 for information about memory managers.
You can also force the operating system software to use the HMA or upper memory exclusively (DOS=HIGH or DOS=UMB).
Loading DPMS Software
Load the DOS Protected Mode Services (DPMS) driver (DPMS.EXE) when you are using Stacker* disk compression, the NWCACHE program, DELWATCH, or the Personal NetWare server (SERVER.EXE), all of which use DPMS to reduce the amount of space they occupy in conventional memory. DPMS allows these programs to run in protected mode, outside of conventional memory. Load the DPMS software by running SETUP, choosing DOS System and Memory Management, choosing Memory Manager, and then choosing to load DPMS. You must have a memory manager (EMM386 or HIMEM) loaded before DPMS can load. Optimizing Memory at the System Prompt
The following sections describe the commands you can use at the system prompt to optimize memory, assuming that upper memory is made available by a memory manager (EMM386 or HIMEM). Running a Program in Upper Memory
You can load and execute a specified program in upper memory, rather than conventional memory, by using the HILOAD or LOADHIGH command at the system prompt. This command can be abbreviated to LH. The full syntax of the command is as follows:HILOAD|LOADHIGH|LH [/?|/H] filespec
If you specify /? or /H, you see online help about the HILOAD/LOADHIGH command. Enabling and Disabling Lower, Upper, and Video Memory
You can control lower, upper, and video memory at the system prompt, when required, by using the MEMMAX command. MEMMAX allows you to temporarily enable and disable memory areas. Some applications may not work properly when certain memory types are enabled or disabled.MEMMAX [/?|/H] [-|+L] [/L] [-|+U] [/U] [-|+V] [/V]
If you specify /? or /H, you see online help about the MEMMAX command. Switching EMM386 Between Protected Mode and Real Mode
The EMM386 memory manager is enabled automatically when it is required, providing extended memory according to the way in which it is configured in CONFIG.SYS. Some applications require the computer to be running in real mode, rather than protected or virtual 8086 mode, when they load. You can temporarily place the computer into real mode at the system prompt by disabling EMM386. Use EMM386 at the system prompt as follows:EMM386 [[/]AUTO|OFF|ON]
EMM386 Weitek Coprocessor Support
You can enable or disable DOS access to the Weitek coprocessor, if fitted on your machine, at the system prompt. Use EMM386 as follows:EMM386 [/]WEITEK=[ON|OFF]
Optimizing Memory by Editing CONFIG.SYS
The following sections describe ways in which you can edit CONFIG.SYS to optimize memory usage. Advanced Memory Manager Options
There are certain EMM386 and HIMEM options that you can only enable by editing the DEVICE statement in CONFIG.SYS yourself. These options are described in the following sections. Specifying the Chip Set or Memory Type (HIMEM Only)
HIMEM automatically detects the type of chip set on your computer (or EMS or permanent upper RAM). If the chip set or memory type is supported, HIMEM maps Shadow RAM into upper memory accordingly. You can use the CHIPSET option, however, when you experience difficulty mapping Shadow RAM or if you want to prevent mapping. Add the following to the DEVICE statement that loads HIMEM in CONFIG.SYS:[/]CHIPSET=AUTO|chipset|NONE
AUTO (the default) allows HIMEM to determine the chip set or memory type automatically. NONE disables mapping of Shadow RAM.
Controlling Support for COMPAQ Computers (EMM386 Only)
If you are using a COMPAQ 386 (or later) computer with at least
1 MB of memory, EMM386 automatically enables support to provide an additional 256 KB of extended memory. If you experience problems and want to disable this support, however, add the following option to the EMM386 DEVICE statement in CONFIG.SYS:[/]COMPAQ=OFF
Setting the Machine Type for GATEA20 (EMM386 Only)
Normally, EMM386 automatically detects your machine type and controls address line A20 accordingly. If necessary, however, you can specify this information by adding the following option to the EMM386 DEVICE statement in CONFIG.SYS:[/]GATEA20=type
You can specify any of the following as type:
Making an Area of Upper Memory Available (EMM386 and HIMEM)
You can make specific areas of upper memory available even if the memory manager would normally define them as not usable. Do this by adding the following option to the EMM386 or HIMEM DEVICE statement in CONFIG.SYS, where start is the hexadecimal starting segment address of each memory area and end is the hexadecimal ending segment address:[/]USE=start-end[,start-end]...]
NOTE: Because USE can map RAM over any hardware or ROM present in the specified memory area, you should not use it unless you are very experienced in allocating upper memory. Also, use conditional statements when you experiment with USE in CONFIG.SYS or have a bootable diskette available containing copies of your original CONFIG.SYS and AUTOEXEC.BAT files, in case you encounter problems. Specifying Location of the VxD to MS Windows (EMM386 Only)
For MS Windows 3.0 or later in Enhanced mode, you can specify the location of the EMM386 VxD. The default location is the location from which EMM386 is loaded. If you need to specify a different location, add the following option to the EMM386 DEVICE statement in CONFIG.SYS, where path is the VxD location:[/]VXD=path
Preventing Relocation of the Extended BIOS Data Area (EMM386 and HIMEM)
When you enable the use of spare video memory by applications, the memory manager moves the extended BIOS data area to the bottom of conventional memory. This is because its presence at the top of conventional memory would prevent that being contiguous with video memory. Certain applications, however, are sensitive to relocation of the extended BIOS data area. To prevent relocation, add the following option to the EMM386 or HIMEM DEVICE statement in CONFIG.SYS:[/]XBDA
Running a Program in Upper Memory
You can load and execute a specified program in upper memory, rather than conventional memory, by using the HIINSTALL or INSTALLHIGH command in CONFIG.SYS. HIINSTALL or INSTALLHIGH performs the same function as HILOAD or LOADHIGH except that it is processed as part of CONFIG.SYS rather than at the system prompt or in a batch file (such as AUTOEXEC.BAT).HIINSTALL|INSTALLHIGH=filespec [options]
You must specify the full filespec of the program you want to load high. You can also specify any parameters (options) that you want to pass to the program. Loading Device Drivers in Upper Memory
You can load an installable device driver into upper memory by replacing the DEVICE command in CONFIG.SYS with a HIDEVICE or DEVICEHIGH command.HIDEVICE|DEVICEHIGH [SIZE=nnnn] filespec
You must specify the name of the device driver (filespec) that you want to load high. Additional Tips for Managing Memory
Because DR-DOS is designed to work on any IBM-compatible personal computer and with any software application, there is no single memory configuration that is ideal for all situations. You may need to experiment before memory usage is optimized for your particular software and hardware. Disabling Expanded Memory
When you are using applications that do not require expanded memory, make sure that you disable expanded memory emulation when configuring EMM386 so that the page frame in upper memory is not defined. This saves 64 KB of memory. See ``Providing LIM 4.0 EMS Support (EMM386 Only)'' on page 10-11 for information about how to do this. If you are using HIMEM, use the CHIPSET=EMSALL option; see ``Specifying the Chip Set or Memory Type (HIMEM Only)'' on page 10-19 for more information.
Load Order
Load the device drivers and TSRs that occupy the most memory first. The documentation for a device driver or TSR may indicate the amount of RAM it requires. If not, however, you can load the driver or program into conventional memory and then use the MEM command to determine how much memory it uses. Refer to the ``Command Reference'' chapter of DOSBook for a detailed description of the MEM command and its options. Add-on Cards
If your computer has add-on cards that use RAM addresses, configure the cards so that the memory addresses used are close together and near the bottom or the top of upper memory. Address a network board, for example, immediately above the video memory area instead of somewhere in the middle of upper memory. Consult the documentation for the card for more information.