|DOS Memory Management
Memory Management in DOS Explained
One of the most confusing things to deal with with vintage PCs, is DOS Memory. And it does not help that every single bloody article on the internet makes it sound like this is rocket science. It's really not that hard at all, once you UNDERSTAND it. See, most people would see the RAM and think "okay, all the data hangs around in those chips while the computer is running" but they are not considering how the OPERATING SYSTEM allocates that RAM, and in an older systme, like CP/M, or DOS, you had to manage it yourself (somewhat).
DOS MEMORY STRUCTURE
DOS Memory is structured accordingly.....
0K-640K - BASE RAM - The lower 640K Base RAM in DOS is the area from 0K to 640K. This was originally the memory ceiling for the PC up until about 1984 when EMS became a thing when the 286 came out. If you are running a PC with a clean boot and no memory managers installed, this likely is how much you had. PC's with smaller amounts of Memory (anywhere from 64K, to 128K, to 256K, or even 512K) only have RAM in this area. This is the area of DOS RAM you want to keep as clear as possible so you can run programs, and is the biggest problem to deal with when it comes to games, especially later, memory hungry DOS games, since a lot of them want 545K base memory free or more to run.
640K-1024K - UMB (Upper Memory Blocks) - This refers to the space between 640K and 1024K (1 Megabyte). Typically this space is for the BIOS Option ROMs on add-in cards like hard disk controllers and graphics cards. It's also used for Shadow RAM (ie storing the code inside the BIOS or the Video Card in RAM) as well as the VGA buffer. Sometimes tiny TSR programs and drivers can be loaded into this space to free up Base RAM.
1024K+ - XMS (Extended Memory) - XMS is basically 1024K and anything above it, and includes the same areas as HMA and EMS. This is the most often used method of accessing memory above 1MB on a 386+ machine running in Protected or 386 Enhanced mode. Access to this area relies on HIMEM.SYS or another XMS driver to allow access from other programs. Earlier versions of HIMEM.SYS were limited to 64 Megabytes of RAM, but later versions allowed for up to 4GB of RAM, particulary the version included with Windows 98 onward.
1024K-1080K - HMA (High Memory Area) - HMA is 64K above 1MB used for HIMEM.SYS and is what we refer to when we load DOS as "High" - parts of the kernel and whatnot get stuck up in this area.
1MB - 64MB - EMS (Expanded Memory) - EMS is an older expanded memory standard that can allow up to 16MB or 32MB of memory. It gets used only when needed these days, as some newer programs are not compatible, and some older programs run better with this loaded.