DOS memory management on a 286

Last Updated on April 18, 2023 by Dave Farquhar

This month, YouTuber Casual Retro Gamer rebuilt a 286 clone from the late 1980s. After his restoration work was done, he did what any of us would have done. He started upgrading it, because a handsomely restored retro PC is less fun than a souped up handsomely restored retro PC. And that’s where he ran into the oddities of 286 memory optimization. When he was done, he had 585 kilobytes of conventional memory available, and he speculated that might not be quite enough. Here’s how to get more.

286 memory management challenges vs later PCs

286 memory management
286 memory management is harder than on later systems but it’s still possible to get 620K of available conventional memory on a 286, like this IBM 5170.

Memory is trickier in a 286 than it was in later computers. And I’m not just talking about need to use big ISA cards with delightfully outrageous quantities of discrete memory and logic chips. You also have to set memory types.

It’s also a bit different from a software point of view. You will probably never have as much available memory on a 286 as you would on a similarly loaded 386 or 486. But you can get pretty close.

My 286 has 620k of available conventional memory. On a 386 or 486 I can typically get between 619 and 623K free with the tools DOS provides.

What version of DOS to run

If you want to have more than 600K of available conventional memory, you probably want to run DOS 5 or newer. DOS 5 included memory management features that were not included with earlier versions. If you’re worried about authenticity, I’d say more 286s ended up running version 5 or even version 6 than staying at version 3.3. There were benefits to upgrading at least to version 5.

But for maximum flexibility, I recommend IBM PC DOS version 7 or 2000. Microsoft stopped at version 6.22, but IBM kept going for a couple of years. They did sell both of these versions at retail, and they run fine on clones, not just on IBMs. They had the same code base as Microsoft, so their DOS is essentially 100% compatible. As cool as DR DOS was, PC DOS had better compatibility.

One of the major selling points of these last versions was that IBM tried to reduce the memory footprint, which had been steadily increasing over the last two major versions. Between optimizing the code and finding ways to more aggressively use high memory, IBM was able to get the memory usage back below what version 5 needed. It uses more memory than the fabled version 3.31, but for the slight increase in memory usage, you get a lot more functionality.

My configuration files

Here are the configuration files I used to get 620k of free conventional memory on my 286. Some of these settings are pretty aggressive, so you may need to adjust some of them, but you should still end up with well above 610k of free memory, especially if you use one of the later versions of PC DOS.

autoexec.bat

@echo off
SET TEMP=C:\DOS
C:\DOS\DOSKEY.COM
path=c:\dos
rem configured for an old Logitech mouse
rem this is the ctmouse driver from FreeDOS
ctmouse /M /R11

config.sys

device=c:\dos\himem.sys
dos=high
lastdrive=c
fcbs=1,0
buffers=10
files=25

Configuring your memory

286 DOS memory optimization
Using the two configuration files above, my 286 has 620K of conventional memory free.

When you buy a 286 memory expansion board, such as an AST Advantage, it will give you the option to configure the memory as expanded memory or extended memory. Extended is the type that you want. The utilities that came with the card may assume that you’re going to configure it as expanded memory. That’s because in 1987, when these cards were new, expanded memory had better software support. That may or may not be true today, but extended memory can emulate expanded memory. The reverse is not true.

And DOS and Windows make much better use of extended memory than they do expanded memory.

And don’t worry about the tools that came with the card. They’re great to have as a historical curiosity, but DOS 5 and later came with tools that made them obsolete.

Other memory types on a 286

A 286 can have extended or expanded memory. It can also have high memory, which you enable with the himem.sys driver in DOS version 5 and later. That’s one of the big reasons I recommend using at least version 5.

A 286 may or may not have upper memory. If your 286 has one megabyte of memory on the motherboard, it’s possible that it maps that last 384k into that upper memory area. But it is much more common for 286 systems to map that 384K into extended memory. To verify, just run MSD.exe from Microsoft Windows or DOS version 6 on your unexpanded 286. If it tells you that you have 384k of extended memory, believe it. If you prefer another diagnostic utility such as Checkit, you can use that instead.

And then when you go to configure your expansion board, instead of starting it at 1024 k, start it at 1408k. That way you get all of your available memory available to use.

Emulating EMS or expanded memory

On 386 and newer systems, you manage upper memory blocks and emulate expanded memory with a driver called EMM386.exe.

A similar driver does exist for 286 systems, called EMM286.exe. It lacks upper memory capability, but it will emulate expanded memory with extended memory if you know or think you may run software that uses that memory type. All you need to do is transfer that file to your 286, and then reference it in your config.sys file like this:

DEVICE=[d:\][path\]EMM286.EXE 256 /H=64 /S=7

RAM disks

I am a huge fan of RAM disks. But not on these types of systems. If you have no other use for the memory, it’s better than having it sit completely idle, but if you’re like me and use them on an Amiga, it’s not the same in MS-DOS.

It’s especially not ideal on a 286 system, where the memory is sitting on the ISA bus, and the CPU is having to slow down to 8 megahertz to access it. It’s on a slow bus rather than being connected directly to the CPU, and it has to go through a software driver. If you are using a compact flash or SD card for storage, the RAM drive will only be marginally faster than your SD card or compact flash card.

Disk caching

DOS version 5 and newer came with a disk cache called smartdrive. But you may have noticed I didn’t have it enabled on my system either. If you are using some type of solid state device on an IDE adapter for storage, the cache provides a marginal performance improvement, and at the cost of some conventional memory. I still use it on a 386 or 486 system, since its RAM is connected directly to the processor and the processor doesn’t have to slow down to 8 megahertz to access it, but on a 286, I don’t notice much performance improvement. You are welcome to try using it and see how it works for you. And if you do use a spinning hard disk, it will give some improvement.

I never thought I would hear myself suggest running a system without a disk cache, but this is the edge case where it can make sense. It does for me, and it may or may not for you. It’s worth a try.

Upper memory in a 286

If your 286 has 384k of memory but doesn’t address it as extended memory, it may be upper memory. Some later 286 chipsets would do this.

A more likely way to get upper memory is by adding hardware. For example, if you install both a CGA and a monochrome video card, but only use one of them, you can use the memory on the other card as UMB space. PC DOS includes drivers for exactly this, with names like UMBCGA.SYS.

Unfortunately if you have a VGA card, that precludes using a second card for UMBs. At least, I’ve never been able to get it to work.

If you have upper memory in hardware, you can use the driver use UMBs to enable them. At least in theory. Unfortunately, I don’t have a suitable 286 to test on.

But if you are able to get some hardware upper memory working in your 286, you can potentially keep network and CD-ROM drivers loaded all the time on your 286 just as you would on a newer system.

Since I don’t have upper memory, I use a DOS boot menu instead. This allows me to use a fairly minimal configuration that gives me 620k for running most software. And when I need networking, I boot into that configuration. I don’t have a CD-ROM in my 286, but if I did, I could put that in a third configuration.

But I don’t worry too much about trying to overcome every limitation of my 286. The 286 was a compromise even when it was new. The way around the compromises is to use a 386 or 486 system for what they’re good at, and reserve the 286 for what it’s good at, which is generally period correct DOS games from around 1986 or 1987 to about 1990.

If you found this post informative or helpful, please share it!

5 thoughts on “DOS memory management on a 286

  • June 29, 2022 at 8:05 am
    Permalink

    I can’t supply a recipe for doing this but the original 640K limit was a feature of the IBM PC, and not MS-DOS. Other non-IBM products could go higher even on DOS 3.x (maybe even DOS 2.11 which I think was the earlier version), and yes, by implication even on a 80186 or 8086/8, Why the IBM engineers chose to do this do this I don’t know.
    Thank heavens for the 386 and all of its descendants!

    • July 4, 2022 at 12:09 am
      Permalink

      The original IBM PC(& by extension most PC compatibles) used several regions of memory between 640K & 1M(the limit for 8086/8088) for memory mapped I/O. Some systems had some UMBs(Upper Memory Blocks) available for use as regular memory. Of course the 286 & later had high memory(past 1M) as well.

      • July 4, 2022 at 11:51 am
        Permalink

        Yes, one of the links in the entry goes into my earlier blog post about DOS memory types which goes into UMBs, how they work, and Gates’ (in)famous “640K ought to be enough for anybody” quote and how it relates. I didn’t want to go too deep into that here because then I’d end up duplicating much of that other entry.

    • July 22, 2022 at 8:54 am
      Permalink

      Holy crap I have no idea how I got here or how there is a lively discussion on 286 memory management somewhere on the internet. But on your comment about using VGA video memory as expanded (or is it extended?) memory. I distinctly remember installing DR DOS on my 286 and discovering that it gave me nearly the full 640k of conventional memory which was nuts but also part of my video memory was available for use. So it definitely is possible on VGA cards.

  • July 22, 2022 at 10:12 am
    Permalink

    Oh one more thing. You say dos 5.0 was first to have himem.sys but it was dos 4.0!

    https://dosbox-x.com/wiki/Guide:Installing-DOS-4

    DOS 4.0x was a MS black sheep and nobody liked it or ran it. Being my first dos I never had an issue with it and it was certainly an improvement over 2.0 and 3.0 which I used later. But for whatever reason it’s considered the WindowsME/Vista of DOSses.

Comments are closed.