The Hermit Hermit's Free Library  MS-DOS

Explains conventional, upper, and high memory and memory management software under DOS. Includes descriptions of HMA, extended memory (XMS), and expanded memory (EMS 3.2, EEMS, EMS 4.0).

Types of Primary Memory under DOS

Conventional memory

0K-640K. The type of memory used by most DOS application programs.

Upper Memory

640K-1MB. Used by the system to shadow system ROM and/or video ROM in RAM.

Unused portions of upper memory can be utilized to load device drivers and TSR programs using the combination of HIMEM.SYS and EMM386.SYS.

High Memory

1Mb- . High memory, memory beyond 1Mb can only be accessed directly by a processor operating in protected mode. Protected mode supports multitasking by isolating programs from one another so that when one crashes, the others do not.

The first 64K of high memory is sometimes referred to as the High Memory Area, or HMA. A large part of DOS can be loaded here.

The rest of high memory can be used either as extended memory or expanded memory.

Extended Memory

One way of using high memory is as extended memory, using an extended memory manager such as HIMEM.SYS. Extended memory under the control of HIMEM.SYS is called XMS memory. XMS memory conforms to the Lotus/Intel/Microsoft/AST eXtended Memory Specification, a standard for the way programs use extended memory.

Expanded memory

The other way of increasing available memory beyond the 640K of conventional memory is to use expanded memory. There are two ways to obtain expanded memory:

Expanded memory uses bank switching: its like bringing a card out of a deck. How this is done depends on which standard the expanded memory adheres to:

EMS lim 3.2 (Expanded Memory System) (1985)

Four 16K pages onto a page frame which must be below 1M but above 640K. The "card" can only be placed in upper memory. Limit of 8M.

Data can be put in this EMS memory but not program code.

EEMS (Enhanced Expanded Memory System) (1987)

Limit of 32M. Can map expanded memory to conventional memory.

EMS 4.0 (Expanded Memory System)

Limit of 32M. Can map expanded memory to conventional memory, therefore the "card" can be placed anywhere in memory. That and its ability to control data access and sharing enhance multitasking.

Memory Managers

HIMEM.SYS
Extended memory manager. Loaded in CONFIG.SYS with the command:

DEVICE=C:\DOS\HIMEM.SYS.

Conforms to Lotus/Intel/Microsoft/AST XMS Version 2.0.

  1. Makes extended memory available (as XMS) to programs that use it.

  2. Keeps these programs from having memory conflicts.

  3. In conjunction with EMM386.SYS, enables parts of MS-DOS and buffers to be loaded into high memory (HMA) instead of using limited conventional memory.

    Use the command DOS=HIGH in CONFIG.SYS.

  4. In conjunction with EMM386.SYS allows programs and device drivers to be loaded into upper memory.

    Tells DOS to maintain a link between conventional memory and the upper memory area so that device drivers can be squeezed into unused upper memory.

    Use the command DOS=HIGH,UMB in CONFIG.SYS.

  5. Enables EMM386.SYS to simulate expanded memory using extended memory.

EMM386.EXE

  1. Simulates expanded memory using extended memory provided by HIMEM.SYS.

  2. In conjunction with HIMEM.SYS, enables MS-DOS and buffers to be loaded into extended memory instead of conventional memory.

  3. In conjunction with HIMEM.SYS allows programs and device drivers to be loaded into upper memory.

For a sample CONFIG.SYS illustrating the use of HIMEM.SYS and EMM386.EXE, see Using HIMEM.SYS and EMM386.EXE.