How real-mode Windows loaded code from the disk, and how you could use that to minimize disk swapping

Real-mode Windows was originally designed to run on a PC with 192KB of RAM and two 360KB floppy drives. We saw some time ago that code was loaded dynamically off the disk on demand. The same principle also applies to read-only data, like resources.

Now, you might not have enough disk space on two floppies to hold the core operating system files, the program you're trying to run, and your data files. No problem.

When Windows needed to load code from the disk, it searched the path for the module, opened it, read the necessary bytes from disk into memory, and then closed the file handle. This means that when the disk is not in active use, any floppy can be removed and swapped for a different floppy.

You typically organized your floppy disks like this:

  1. Windows system files.
  2. The program you're trying to run.
  3. Your data files.

You started with Windows in drive A: and your data files in drive B:. Then you swapped your program disk into drive A: and ran your program. If Windows needed to access any system files, you swapped the Windows system floppy back in.

If you've been paying close attention, you may have noticed a sneaky optimization opportunity: If you have some extra room on floppy 2, you can put duplicate copies of popular system files on floppy 2, in a directory structure that matches floppy 1. Whenever Windows needs to access a file in order to load code from it, it searches the path. If you put a copy on both floppy 1 and floppy 2, then no matter which one you have in drive A:, Windows will find it and you won't be asked to swap disks. (If you were really crazy, you could add B: to your path and put some program files on your data disk.)

Or you could go and buy a hard drive. A 10 megabyte hard drive held the equivalent of 28 floppies and set you back around $700 (over $1500 in today's dollars).

Comments (18)
  1. Simon Brunning says:

    10 Megabytes? Ridiculous. No one will ever need that much storage.

  2. weibomiaopai says:

    That reminds me of the ‘DiskCopy /y A: B:’ in the old days :)

  3. IanBoyd says:

    Our first hard drive c. 1987 was a Seagate 20MB drive. In 1995, when 500MB drives were just becoming common, i jumped to a 4 GB. You could copy entire CDs onto that thing. I would copy the entire CD of a game and play it right off the hard drive. People were in awe. $2,000 for 4GB SCSI. Totally worth it.

    1. dhiren says:

      In the early 90’s, probably around 1993 or so, we got a 486SX with a 250MB hard drive. The salesman convinced my dad to upgrade the RAM from 4MB to 8MB, which added about $60 to the price. This was around the time of MSDOS 6.x and my brother asked the salesman what he thought about using DoubleSpace/DriveSpace to get more storage space. Salesman shrugged and said, ‘You could, but you have 250MB, why would you even want to do that?’
      Needless to say, we filled that up pretty quick.

      1. MarcK4096 says:

        I bet that 4MB upgrade came in very useful. That was a well spent $60.

    2. Joe says:

      I had two such ‘beasts’ as wide SCSI external drives, which I used in a video editing rig that ran on a 486. At the core was a Targa video editing card which used motion jpeg. After that went obsolete about 1997, it took well over 10 years before I could edit video as fluidly without a hardware acceleration as I could on that setup.

      Also reminded me of burning “coasters” with about 1 out of 3 CDR blanks. If I used Imation, the only failures were usually some external thing, like more than one person looked at the computer. Ah, the days of 2x and 4x burning.

    3. Clockwork-Muse says:

      ….and of course, it’s not like those CDs were full, usually. Not 700Mb monsters.

  4. Simon says:

    That’s a tricky title. Before I read the article, I was thinking “Huh? There’s no swap in real mode, you need virtual memory for that.” And then the memories of juggling floppies came back.

  5. CarlD says:

    Ahh, the good old days. While I never worked on real mode windows, I did work extensively in CP/M and MP/M, where similar tricks were common. My first computer with a hard drive (in 1980) was an Ohio Scientific C3C with a 74Mb hard drive – a 14″ drive in a 4U rack mount cabinet that must’ve weighed 80 pounds. Good times.

  6. DWalker07 says:

    I remember buying a 4GB IDE hard drive for about $450, many years ago. Fun times.

  7. Antonio Rodríguez says:

    AppleWorks, the integrated suite for the Apple II, used a similar approach to run on systems with 128 KB of RAM and a single disk drive, and take advantage of bigger systems. The memory was divided for code and the “desktop” (the open documents), and code was organized in overlays (software-managed segments). When only part of the desktop was in use, the free portion cached recently loaded overlays. That way, you could open both an spreadsheet and a word processor document, copy data from the spreadsheet, switch to the word processor, and paste it. Instantly and without touching disk. That is something we take for granted now, but it was pretty impressive for an 8-bit machine in 1984.

  8. 12BitSlab says:

    In the mid80’s, I worked for a company that was fairly good size — low end of the Fortune 500. We wanted to buy a 1GB drive for an NCR mainframe. It was so expensive that the CEO of the company I worked for didn’t have enough signing authority. The CEO of the parent company didn’t have enough signing authority either. The purchase had to be approved at a special meeting of the board of directors.

    BTW, that 1GB drive was rather large. It stood almost 4′ tall, was about 4′ wide, and it was close to 3′ deep and weighed as much as a fully loaded Nimitz class carrier.

    Now, 1GB USB sticks are throw away items!

  9. The first hard drive I used was 10 Mbytes too, but the unit was approximately the size and shape of a chest freezer (the platter being more than a foot in diameter). Roughly contemporary with 8″ single-density floppies I think.

  10. Joshua says:

    Fascinating. That’s the missing piece in the puzzle of *why* this trick works:

  11. cheong00 says:

    That explains the mystery why I could find some files named similar to Windows files on my first typewriting practice application (not verified whether they are the same)

    But I wonder, how will that work with different version of Windows, will they go GPF?

  12. Neil says:

    This reminds me of those ancient Macs which also ran from floppy disks. Excitingly, the string message for the disk swap dialog itself was loaded dynamically off the system floppy on demand… this meant that when you got a dialog with a blank message it usually meant that you needed to insert the system floppy.

  13. John Styles says:

    My favourite anecdote which I feel is the platonic ideal of dull computer anecdotes…
    at my second job we developed software on DOS and CP/M 68K. The CP/M machines (Sage’s) had 10 or 20 MB hard disks formatted as 5 or 10 2 MB drives, so A: to E: for 10MB or A: to J: for 20MB – with the system stuff and compilers on the A: drive. In order to be consistent and because P: was the highest drive letter allowed, we always set them up so the floppy drive was P:.
    Therefore we had
    CP/M 68K machines – system files A: , floppy P:
    DOS machines – system files C:, floppy A:
    Inevitably people swapping between the two would accidentally do FORMAT A: on the CP/M machines, wiping out the OS.
    How we laughed. (To be even more boring, as I recall for some reason getting the OS back required doing something with the UCSD P system before doing something with CP/M 68K. The good thing about CP/M 68K is that the TPA was 931K, much bigger than DOS’s

    [“Platonic ideal of dull computer anecdotes” made me smile. -Raymond]

  14. Tony Konzel says:

    A number of large RPGs that came on multiple floppies (Ultima, AD&D) on the Commodore 64 used this technique to reduce the frequency of swapping disks. That meant anywhere from 65-85% of the data was unique per side, but the amount of time this saves when you consider how long these games take really adds up.

Comments are closed.

Skip to main content