Chapter 6 (a3) - MS-DOS Command Referance ; EMM386 - Expand 
 
Emm386

Enables or disables EMM386 expanded-memory support on a computer with an 80386 or higher 
processor. The emm386 command also enables or disables Weitek coprocessor support.
 
Do not use this command when you are running Windows.
 
The EMM386 device driver, EMM386.EXE, provides expanded-memory support and also provides 
access to the upper memory area. For information about EMM386.EXE, see EMM386.EXE. 

Syntax

emm386 [on|off|auto] [w=on|w=off] 

To display the current status of EMM386 expanded-memory support, use the following syntax: 

emm386
 
Parameters

on|off|auto
Activates the EMM386 device driver (if set to on), or suspends the EMM386 device driver (if set to off), 
or places the EMM386 device driver in auto mode (if set to auto). Auto mode enables expanded-memory 
support only when a program calls for it. The default value is on. 

w=on|w=off
Enables (if set to w=on) or disables (if set to w=off) Weitek coprocessor support. 
The default value is w=off. 

Notes

Installing the EMM386.EXE device driver

To use the emm386 command, you must have an 80386 or higher processor, and you must also install 
the EMM386.EXE device driver by using the device command in your CONFIG.SYS file. If you try to use 
the emm386 command on a computer that does not have an 80386 or higher processor, MS-DOS 
displays the following message: 
  
EMM386 driver not installed 
  
Reactivating EMM386 expanded-memory support. If EMM386 was loaded when MS-DOS started but is 
not currently in use, the on parameter reactivates expanded-memory support. 

Suspending EMM386 expanded-memory support

If EMM386 expanded-memory support is currently active, handle 0 is the only handle allocated, and 
EMM386 is not providing access to the upper memory area. The off parameter suspends EMM386 
expanded-memory support. When EMM386 expanded-memory support is off, the EMM386.EXE 
device-driver header is changed so that programs cannot use expanded memory. This enables you to
run non-VCPI-compliant programs such as Windows 3.0 in Standard mode. 

Enabling and disabling Weitek coprocessor support

If the w=on parameter is specified and the off parameter (different from the w=off parameter) is not, 
EMM386 enables Weitek coprocessor support. The high memory area (HMA) must be available to 
enable Weitek coprocessor support. If you load MS-DOS into the HMA by specifying dos=high, you 
may not be able to enable Weitek coprocessor support. 

If you specify the w=on or w=off parameter and no Weitek coprocessor is installed in your computer 
system, MS-DOS displays the following error message: 
  
Weitek Coprocessor not installed 
  
EMM386.EXE

Provides access to the upper memory area and uses extended memory to simulate expanded memory. 
This device driver must be loaded by a device command in your CONFIG.SYS file and can be used only 
on computers with an 80386 or higher processor. 

EMM386 uses extended memory to simulate expanded memory for programs that can use expanded 
memory. EMM386 also makes it possible to load programs and device drivers into upper memory 
blocks (UMBs). 

Syntax

device=[drive:][path]emm386.exe [on|off|auto] [memory] [min=size] [w=on|w=off] 
[mx|frame=address|/pmmmm] [pn=address] [x=mmmm-nnnn] [i=mmmm-nnnn] [b=address] 
[L=minXMS] [a=altregs] [h=handles] [d=nnn] [ram=mmmm-nnnn] [noems] [novcpi] [highscan]
[verbose] [win=mmmm-nnnn] [nohi] [rom=mmmm-nnnn] [nomovexbda] [altboot] 

Parameters

[drive:path]

Specifies the location of the EMM386.EXE file. 

on|off|auto
Activates the EMM386 device driver (if set to on), or suspends the EMM386 device driver (if set to off), 
or places the EMM386 device driver in auto mode (if set to auto). Auto mode enables expanded-memory
support and upper memory block support only when a program calls for it. The default value is on. 
Use the emm386 command to change this value after EMM386 has started. 

memory
Specifies the maximum amount of extended memory (in kilobytes) that you want EMM386 to provide as 
expanded/Virtual Control Program Interface (EMS/VCPI) memory. This amount is in addition to the 
memory used for UMBs and EMM386 itself. Values for memory are in the range 64 through the lesser 
of either 32768 or the amount of extended memory available when EMM386 is loaded. The default value 
is the amount of free extended memory. If you specify the noems switch, the default value is 0. 
EMM386 rounds the value down to the nearest multiple of 16. 

Switches

min=size
Specifies the minimum amount of EMS/VCPI memory (in kilobytes) that EMM386 will provide, if that 
amount of memory is available. EMM386 reserves this amount of extended memory for use as 
EMS/VCPI memory when EMM386 is loaded by the device=emm386.exe command in your 
CONFIG.SYS file. EMM386 may be able to provide additional EMS/VCPI memory (up to the amount 
specified by the memory parameter) if sufficient XMS memory is available when a program requests 
EMS/VCPI memory. Values are in the range 0 through the value specified by the memory parameter. 
The default value is 256. If you specify the noems switch, the default value is 0. If the value of min is 
greater than the value of memory, EMM386 uses the value specified by min. 

w=on|w=off
Enables or disables support for the Weitek coprocessor. The default setting is w=off. 

mx
Specifies the address of the page frame. Valid values for x are in the range 1 through 14. 
The following list shows each value and its associated base address in hexadecimal format:
 
1 => C000h    8 => DC00h
2 => C400h    9 => E000h
3 => C800h    10 => 8000h
4 => CC00h    11 => 8400h
5 => D000h    12 => 8800h
6 => D400h    13 => 8C00h
7 => D800h    14 => 9000h

Values in the range 10 through 14 should be used only on computers that have 512K of memory. 

frame=address
Specifies the page-frame segment base directly. To specify a specific segment-base address for the 
page frame, use the frame switch and specify the address you want. Valid values for address are in the 
ranges 8000h through 9000h and C000h through E000h, in increments of 400h. To provide expanded 
memory and disable the page frame, you can specify frame=none; however, this may cause some 
programs that require expanded memory to work improperly. 

/pmmmm
Specifies the address of the page frame. Valid values for mmmm are in the ranges 8000h through 9000h 
and C000h through E000h, in increments of 400h. 

pn=address
Specifies the segment address of a specific page, where n is the number of the page you are specifying 
and address is the segment address you want. Valid values for n are in the range 0 through 255. Valid 
values for address are in the ranges 8000h through 9C00h and C000h through EC00h, in increments of 
400h. The addresses for pages 0 through 3 must be contiguous in order to maintain compatibility with 
version 3.2 of the Lotus/Intel/Microsoft Expanded Memory Specification (LIM EMS). If you use the mx 
switch, the frame switch, or the /pmmmm switch, you cannot specify the addresses for pages 0 through
 3 for the /pmmmm switch. 

x=mmmm-nnnn
Prevents EMM386 from using a particular range of segment addresses for an EMS page or for UMBs. 
Valid values for mmmm and nnnn are in the range A000h through FFFFh and are rounded down to the 
nearest 4-kilobyte boundary. The x switch takes precedence over the i switch if the two ranges overlap. 

i=mmmm-nnnn
Specifies a range of segment addresses to be used (included) for an EMS page or for UMBs. Valid 
values for mmmm and nnnn are in the range A000h through FFFFh and are rounded down to the nearest 
4-kilobyte boundary. The x switch takes precedence over the i switch if the two ranges overlap. 

b=address
Specifies the lowest segment address available for EMS banking (swapping of 16-kilobyte pages). 
Valid values are in the range 1000h through 4000h. The default value is 4000h. 

L=minXMS
Ensures that the specified amount (in kilobytes) of extended memory will still be available after 
EMM386 is loaded. The default value is 0. 

a=altregs
Specifies how many fast alternate register sets (used for multitasking) you want to allocate to EMM386. 
Valid values are in the range 0 through 254. The default value is 7. Every alternate register set adds 
about 200 bytes to the size in memory of EMM386. 

h=handles
Specifies how many handles EMM386 can use. Valid values are in the range 2 through 255. 
The default value is 64. 

d=nnn
Specifies how many kilobytes of memory should be reserved for buffered direct memory access (DMA). 
Discounting floppy-disk DMA, this value should reflect the largest DMA transfer that will occur while 
EMM386 is active. Valid values for nnn are in the range 16 through 256. The default value is 16. 

ram=mmmm-nnnn
Specifies a range of segment addresses to be used for UMBs and also enables EMS support. If you do 
not specify a range, EMM386 uses all available adapter space to create UMBs and a page frame for 
EMS. 

noems
Provides access to the upper memory area but prevents access to expanded memory. 

novcpi
Disables support for VCPI applications. This switch must be used with the noems switch. If you specify 
the novcpi switch without specifying the noems switch, EMM386 does not disable VCPI support. If you 
specify both switches, EMM386 disregards the memory parameter and the min switch. Disabling s
upport for VCPI applications reduces the amount of extended memory allocated. 

highscan
Specifies that EMM386 use an additional check to determine the availablity of upper memory for use as 
UMBs or EMS windows. On some computers, specifying this switch may have no effect or cause 
EMM386 to identify upper memory areas as available when they are not. As a  result, your computer 
might stop responding. 

verbose
Directs EMM386 to display status and error messages while loading. By default, EMM386 displays 
messages only if it encounters an error condition. You can abbreviate verbose as V. (To display status 
messages without adding the verbose switch, press and hold the ALT key while EMM386 starts and 
loads.) 

win=mmmm-nnnn
Reserves a specified range of segment addresses for Windows instead of for EMM386. Valid values for 
mmmm and nnnn are in the range A000h through FFFFh and are rounded down to the nearest 4-kilobyte
 boundary. The x switch takes precedence over the win switch if the two ranges overlap. The win switch 
takes precedence over the ram, rom, and i switches if their ranges overlap. 

nohi
Prevents EMM386 from loading into the upper memory area. Normally, a portion of EMM386 is loaded 
into upper memory. Specifying this switch decreases available conventional memory and increases the 
upper memory area available for UMBs. 

rom=mmmm-nnnn
Specifies a range of segment addresses that EMM386 uses for shadow RAM  random-access 
memory used for read-only memory (ROM). Valid values for mmmm and nnnn are in the range A000h 
through FFFFh and are rounded down to the nearest 4-kilobyte boundary. Specifying this switch may 
speed up your system if it does not already have shadow RAM. 

nomovexbda
Prevents EMM386 from moving the extended BIOS data from conventional memory to upper memory. 

altboot
Specifies that EMM386 use an alternate handler to restart your computer when you press 
CTRL+ALT+DEL. Use this switch only if your computer stops responding or exhibits other unusual 
behavior when EMM386 is loaded and you press CTRL+ALT+DEL. 

Notes

Sharing XMS and EMS memory

EMM386 provides EMS/VCPI memory for programs that require it by converting XMS memory to 
EMS/VCPI memory. When it is loaded, EMM386 reserves the amount of memory specified by the min 
switch for use as EMS/VCPI memory (the default value is 256K). Once this amount of XMS memory is 
reserved, it is always available as EMS/VCPI memory and no longer available as XMS memory.
 
EMM386 may be able to convert additional amounts of XMS memory to EMS/VCPI memory, up to the 
amount specified by the memory parameter. EMM386 returns the additional amount back to XMS 
memory when it is no longer needed as EMS/VCPI memory. 

If you specify min=0, EMM386 does not reserve any XMS memory for use as EMS/VCPI memory. 
Instead, it converts XMS memory to EMS/VCPI memory only when a program requests it. This frees 
XMS memory when EMS/VCPI memory is not needed. However, EMM386 will not be able to supply the 
requested amount of EMS/VCPI memory if programs have allocated all the XMS memory at the time of 
the request. 

Must install HIMEM.SYS before EMM386.EXE 

You must include a device command for the HIMEM.SYS device driver in your CONFIG.SYS file before 
the device command for EMM386.EXE. 

Using EMM386 memory switches 

Unless you want to use EMM386 to provide access to the upper memory area, you need not specify 
memory switches on the device command line. EMM386 usually runs properly with the default values. 
In some cases, however, you might want to control how EMM386 uses memory. For example, you can 
control where EMM386 puts the EMS page frame or which segments it uses for EMS pages. You can 
use as many of these memory switches as you want, in any order you want. 
  

Caution   Use EMM386.EXE parameters carefully. You can make your computer inoperable if you use 
them incorrectly. 

  
Using EMM386 to provide access to the upper memory area

In addition to providing access to expanded memory, EMM386 provides access to the upper memory 
area, which you can use to load certain programs and device drivers. You must use either the ram or 
noems switch to provide access to the upper memory area. 

To give MS-DOS access to the upper memory area but not to expanded memory, use the noems switch.
To give MS-DOS access to both the upper memory area and expanded memory, use the ram switch. 
The ram switch provides access to less of the upper memory area for running device drivers and 
programs than does the noems switch. In either case, you must include the dos=umb command in your 
CONFIG.SYS file. The device command for EMM386.EXE must precede any devicehigh commands. 

Using EMM386 with Windows 3.1

When EMM386 is used with Windows 3.1, the i, x, noems, mx, pnnnn, and frame switches have 
precedence over the emminclude, emmexclude, and emmpageframe settings in the Windows 
SYSTEM.INI file. Changes to these settings in the SYSTEM.INI file have no effect when EMM386 is 
loaded. 

SMARTDRV double buffering may be required to use EMM386

If you have a small computer system interface (SCSI) or enhanced system device interface (ESDI) hard 
disk or other device, you may have to add the following line to your CONFIG.SYS file: 
  
device=smartdrv.exe /double_buffer 
  
Add the line before any devicehigh statements and before any statements that load installable device 
drivers that use expanded memory. The statement enables an SCSI or EDSI controller to transfer 
information to programs that use the upper memory area or expanded memory. 

Examples

To start EMM386 as an expanded-memory emulator, using the default values, add the following lines to 
your CONFIG.SYS file: 
  
device=himem.sys
device=emm386.exe
  
Since no location is specified, MS-DOS searches for the EMM386.EXE file in the root directory of your 
startup drive. 

To specify that EMM386 allocate a maximum of 4096K of memory and a guaranteed 256K of memory 
(the default value), and to specify that the EMM386.EXE file is located in the DOS directory on drive C, 
add the following line to your CONFIG.SYS file: 
  
device=c:\dos\emm386.exe 4096 
  
To emulate expanded memory, specify the segment-base address D000h for the EMS page frame, 
and allocate 512K of memory to EMM386, use one of the following commands: 
  
device=emm386.exe 512 frame=d000
device=emm386.exe 512 p0=d000 p1=d400 p2=d800 p3=dc00
  
Suppose that, in addition to specifying the conditions set in the preceding commands, you want to 
prevent EMM386 from using the segment addresses E000h through EC00h. To do this and to specify 
that EMM386 can use 127 handles, add the following line to your CONFIG.SYS file: 
  
device=emm386.exe 512 frame=d000 x=e000-ec00 h=127 
  
To provide access to the upper memory area but not provide EMS/VCPI memory, add the following line 
to your CONFIG.SYS file: 
  
device=emm386.exe noems novcpi 
  
To provide access to the upper memory area and provide EMS/VCPI memory, add the following line to 
your CONFIG.SYS file: 
  
device=emm386.exe ram 
  
Exit

Quits the MS-DOS command interpreter (COMMAND.COM) and returns to the program that started the 
command interpreter, if one exists. 

Syntax

exit 

Notes

Using exit with the command interpreter

When you use the MS-DOS COMMAND command to start a new instance of the command interpreter, 
you can use the exit command to return to the old command interpreter. Also, while running some 
programs, you can run the MS-DOS command interpreter and then use the exit command to return to 
your program. For more information about command interpreters, see the COMMAND command. 

If you are not using the /p (permanent) switch with the inital copy of COMMAND.COM, the exit 
command quits the command interpreter. You must then specify at the command prompt the location of the COMMAND.COM file to start the command interpreter again. 

Using exit when the command program is loaded as permanent

If you start the COMMAND.COM program with the /p (permanent) switch, the exit command has no 
effect. 

Expand

Expands a compressed file. You can use this command to retrieve one or more files from the Setup 
disks that accompany MS-DOS 6. These files are not usable unless you expand them.
 
Syntax

expand [drive:][path]filename [[drive:][path]filename[ ...]] destination 

If you type the following, expand will prompt you for the location and/or name you want to give the 
expanded file: 

expand [drive:][path]filename 

If you type the following, expand will prompt you for the location and name of the compressed file you 
want to expand, then prompt you for the location and/or name you want to give the expanded file: 

expand
 
Parameters

[drive:][path]filename
Specifies the location and name of a compressed file or files to be expanded. You cannot use wildcards 
(* and ?). 

destination
Specifies the location and/or name of the expanded file or files. Destination can consist of a drive letter 
and colon, a directory name, a filename, or a combination. However, you cannot specify a filename for 
destination unless you also specify a single compressed file for filename.
 
Notes

Retrieving files from the Setup disks

Most of the files on the Setup disks provided with MS-DOS 6 are compressed. Each of these 
compressed files has a file extension that ends with an underscore character (_). When you installed 
MS-DOS, you ran the Setup program, which expanded these files before copying them to your system. 
However, if you need to retrieve just one or a few files from the original disks, you can use the expand 
command. 

Letting expand prompt you

If you dont include the destination, or dont include the compressed file and the destination, expand 
prompts you for the information and provides examples. 

Examples

Suppose you accidentally delete the SORT.EXE file from your DOS directory on drive C. You can copy 
and expand the compressed file SORT.EX_ from the MS-DOS 6 Setup disks to your hard disk. First, 
find out which disk contains SORT.EX_ by opening the PACKING.LST file on Setup Disk 1. Then insert 
the appropriate disk into drive A and use the following command to copy and expand the file: 
  
expand a:\sort.ex_ c:\dos\sort.exe 
  
To copy and expand the SORT.EX_ file to the hard disk by letting expand prompt you, type the 
following at the command prompt: 
  
expand 
  
Expand prompts you with the following: 
  
Type the location and name of the compressed file you want to expand.
(Example: A:\\EGA.SY_)

Compressed file:
  
To expand and copy the SORT.EX_ file from the Setup disk in drive A, type the following: 
  
a:\sort.ex_ 
  
Expand prompts you with the following: 
  
Type the location and/or name you want to give the expanded file.

(Example: C:\\DOS\\EGA.SYS)

Expanded file:
  
If your MS-DOS files are in the C:\DOS directory, type the following: 
  
c:\dos\sort.exe 
  


 