================================================ Edward's Original "MICRONICA HowTo CheetSheet !" "Upper/High Memory Cheatsheet" Copyright E.Jozis (C)1995,96 Rev 1.0, 20/2/95 ================================================ Feel free to use this cheat sheet at your own risk. But please leave the above credits and revision number intact. This document sets out the function and operation of the Upper Memory Block and High Memory Area. It provides information on how to maximise the 640K base memory area using DOS 5 facilities. To maintain backward compatibility with 8088/8086 CPU's, DOS is limited to operating in "Real" mode. This menas the CPU is basically limited to addressing the first 1MB of memory. The first 640K being usable RAM and the remaining 384K for ROM BIOS, Video RAM, expansion card requirements etc. The 384K area is also addressable by the CPU in "Real" mode. DOS can now split up the UMB, or 384K memory range, into smaller UMB's which are allocated unused memory space in the 384K area between 640K and 1 MB. 8088 and 80286 still require this to be done by hardware, either by the motherboard or by using an add in card. But CPU's 80386 upwards can, internally, remap any memory range to appear as another memory range. So the CPU can use any unused areas between 640K and 1MB if required, but only using a controlling driver (memory manager such as EMM386.EXE, QEMM386, 386MAX) and only if there is enough extended memory, above 1 MB, to do so. DOS=UMB statememt in CONFIG.SYS gives DOS control over unused UMB areas and allows DOS to load software into them in two ways: 1) CONFIG.SYS: Use DEVICEHIGH= instead of DEVICE= to load device drivers. Ex. DEVICEHIGH=ANSI.SYS 2) AUTOEXEC.BAT or command line: Use LOADHIGH (or "LH") to load TSR's. Ex. LOADHIGH MSMOUSE.COM The UMB areas are defined in discrete blocks. So when loading into these areas it is important to try and load the larger drivers and TSR's first so as to minimise wastage of unused block space. EMM386 is not only an EMS driver but actually effectively a UMB and EMS manager. It not only allows EMS to be implemented by providing a page area in UMB but also allows programs and DOS to be loaded into the UMB. When loading EMM386 it is important to specify the NOEMS option in order to maximise the UMB space available to load driver programs and DOS. This may seem a contradiction but remember that EMM386 is not just just an EMS manager but a general UMB manager. The NOEMS option simply eliminates the usual 64KB memory window normally reserved for EMS page swapping. So you have an extra 64KB available in the UMB to load DOS and device drivers. If the NOEMS option is not specified you may find the puzzling effect that the DOS=UMB statement has no effect on available base RAM space. This is because insufficient UMB space is available. You can test this using the MEM/C command before and after including the NOEMS option. EMM386 will manage up to 256KB in UMB, usually starting at D000 or C800. The start address and space is reported during bootup. The fact that EMM386 only manages 256KB out of the available 384KB in UMB means that there should be no problem with the standard system BIOS and VGA BIOS space of 128KB in the UMB. Enabling shadow RAM for system and video BIOS should therefore not have any adverse effect. But watch out for cards that need UMB space for their BIOS or RAM buffer range. For example LAN cards with memory buffer or boot ROM and SCSI cards with boot ROM. These are not always automatically recognised by DOS and can result in a memory space clash resulting in intermittent system problems. As a rule it is always best to specifically exclude these areas anyway using the EMM386 "x=xxxx-xxxx" option just to be sure. The high memory area manager HIMEM.SYS must be loaded before you can load EMM386 or DOS=HIGH. As a rule it is therefore best to make HIMEM.sys the very first line in CONFIG.SYS. DOS=UMB must be executed before any LOADHIGH statements have any effect. This moves DOS into the UMB and then allows DOS to manage programs in UMB. DOS=HIGH must still be loaded before DOS=UMB to free up more base RAM even though DOS=UMB is loaded. Seems no obvious reason as to why. Can check the effect with MEM/C if you don't. LOADHIGH (program name) will try to load any executable device driver programs into the UMB if EMM386 is loaded. For example mouse.com, CDROM drivers, soundcard drivers. It should be noted that there is no error message if EMM386 is not loaded and the program consequently fails to load high. The effect is simply that there is no additional increase in available base RAM. SMARTDRV automatically loads high if EMM386 is loaded even if the "loadhigh" statement is not specified. Try the MEM/C command to see the effect on UMB area, what programs are loaded there. Also note the effect on "UMB area + available base RAM area" as "DOS=UMB" and other configuration commands are loaded and programs are loaded high. The MEM/C command is useful to check the effect on system memory when trying various system configurations. It clearly shows how the available memory available, base + upper, decreases as more programs are loaded through AUTOEXEC.BAT and CONFIG.SYS. Even the magnitude of files, buffers and even smartdrv if more than 4MB will show quite noticeable effects. As the UMB is filled with more programs it is interesting to note how the "available" base + UMB decreases (because UMB is being filled) whilst the largest space for programs (in base RAM area) remains virtually the same. Available base RAM nevertheless decreases slightly each time because the links or "stubs" for the drivers and programs in UMB/High memory have to remain in base RAM. But these are only small. It is also important to note that the UMB space is assigned in discrete blocks to individual programs and drivers. It is therefore possible that a large number of small programs in the UMB can prohibit loading of a large one such as DOS. So the UMB can require some prudent managing. It should be noted that even the humble device=ansi.sys driver consumes substantial memory space. Since very few programs ansi.sys you may consider deleting it completely from your configuration if maximising available RAM is of the essence. Using these methods it is possible to get very close to the available maximum 640K base RAM. For example, on a typical system using DOS 5 it is not uncommon to have 627K out of the available 640K available for program execution by merely using the standard facilities provided by DOS without resorting to any third party utilities. Typical CONFIG.SYS: device=c:\dos\himem.sys - Loads high memory manager dos=high - Moves DOS into high memory dos=umb - Moves DOS into UMB to manage programs in UMB files=40 buffers=40 Typical AUTOEXEC.BAT: c:\windows\smartdrv - Loads into UMB automatically if EMM386 loaded loadhigh c:\mouse\msmouse - Load mouse driver into UMB verify on - Read after write verification Typical CONFIG.SYS for Cardinal DSP-16 sound card installation: device=c:\dos\himem.sys device=c:\dos\emm386.exe noems dos=high dos=umb DEVICEhigh=C:\DSP16\DSP16.SYS /FC:\DSP16\dsp001.ld /A0300 /Q10 /M0330 /R5 /I7 /D1 /J0 DEVICEhigh=C:\DSP16\SONY\SLCD.SYS /B:0300 /D:MSCD001 /M:P /V /C rem REM out SETVER.EXE statement to free up more RAM if necessary rem DEVICE=C:\DOS\SETVER.EXE FILES=40 BUFFERS=40 rem REM out ANSI.SYS statement to free up more RAM if necessary DEVICE=C:\DOS\ANSI.SYS rem SHELL=C:\DOS\COMMAND.COM C:\DOS\ /p rem REM out the STACKS statement to free up more RAM if necessary STACKS=9,256 Typical AUTOEXEC.BAT for Cardinal DSP-16 sound card installation: SET BLASTER=A220 I7 D1 loadhigh C:\DOS\MSCDEX.EXE /D:MSCD001 /L:E /M:12 C:\WINDOWS\SMARTDRV.EXE 4000 PATH=C:\WINDOWS;C:\DOS;C:\;C:\BATFILES;C:\UTILITY; SET TEMP=C:\WINDOWS\TEMP prompt $p$g verify on loadhigh C:\MOUSE\MSMOUSE c:\dsp16\dsp16vol 40