Search Algorithm of MS-DOS 5.0 EMM386.EXE (74212)



The information in this article applies to:
    Microsoft MS-DOS operating system 5.0
    Microsoft MS-DOS operating system 5.0a

This article was previously published under Q74212

SUMMARY

When EMM386.EXE is installed, it searches through the upper memory area (UMA) (the area between 640K and 1024K) for "holes" (unused space) that it can use to load TSRs (terminate-and-stay-resident programs) and/or device drivers, and/or create a page frame to emulate expanded memory.

MORE INFORMATION

The search algorithm follows these steps, starting at C000 through DFFF (on most machines), checking every 2K. C000 - C7FF is searched on EISA and ISA machines only. The E000 range will be checked on Compaq machines only.

    To check for RAM, EMM386.EXE will first write to the address and then read the same address. If it reads what was written, the space is RAM, and is excluded.
    To check for ROM, EMM386.EXE looks at the first two bytes of the address. If the bytes are "55AA", then the space is occupied by ROM. The next two bytes (after 55AA) indicate the size of the ROM, and this space is excluded. Because some video ROMs incorrectly report their size, the search algorithm starts at C000 instead of A000. B000-B7FF is free on most VGA monitors. If so, it can be included with the I= switch.
Note: The I= switch on EMM386.EXE has a higher order of precedence than the search algorithm, and it is possible to force the inclusion of address spaces that are being used by other hardware, which will cause the machine to hang or behave in an erratic fashion.

Modification Type: Major Last Reviewed: 9/30/2003
Keywords: KB74212