Installing MS-DOS 6.22 on a 486 without a floppy drive using a CF-to-IDE adapter

A guide for a very specific problem, but hey, I had trouble doing it and pieced out the solution from a bunch of sources and advice, so here’s a distillation of that.

I’m currently building a 486 “retro” PC for fun, out of parts sourced from a combination of my dad having it lying around in the basement, eBay, and generous friends.
My endgoal is to reproduce the PC setup I had as a kid; MS-DOS 6.22, QuickBasic 4.5, a bunch of DOS games and ANSI art demos.

This week I was at point where I had everything to get started : a motherboard and CPU, graphics card, IDE hard drive, power supply, and a Compact Flash to IDE adapter with a 2Gb CF card.
I did not, however, have a floppy disk drive nor a CD-ROM drive. And it turns out installing MS-DOS without a FDD can be a tricky thing!

The options I saw just Googling variations of “install ms-dos to usb” (since on the modern PC, the CF card is connected via USB) were as follows :

  • Use Rufus to make a boot USB device : that only works if you want FreeDOS (and it does work great for that), because Rufus is unable to make a MS-DOS 6 boot disk, as acknowledged by its author.
  • Use UNetBootin or dd or some other image burner to transfer a bootable disk image from AllBootDisks to USB : this probably does work, but not with CF-to-IDE adapters in my experience. Possibly because the disk/MBR layout of a fixed drive and a floppy must differ…? In any case, I was never able to make a bootable partition that way.

At this point I feel like I need to stress : this is not a sensible project. I could install FreeDOS or even Windows 98’s MS-DOS 7.0 relatively easily, but I don’t want to. There is no good reason.

Regardless, here’s the solution I ended up with. The whole thing assumes that the “modern PC” you’re setting all of that from is running Windows.
Here’s the gist : use a virtual machine to mount the CF card as a virtual hard drive, then use the real MS-DOS 6.22 installer diskettes to create a partition and install DOS on it.

In detailed steps :

  1. Grab the install disks for MS-DOS 6.22 (The Legacy PC Project hosts it currently)
  2. Install VirtualBox for Windows hosts
  3. Plug in your Compact Flash card (I have a 2Gb card, I’ve been told bigger than 2Gb can be problematic)
  4. Open a Command Prompt with Administrator rights (required for unmounting)
  5. Type the following to get the list of physical disks in your system.
    This allows you to know what the DeviceID of your Compact Flash card is (should look like \\.\PHYSICALDRIVE1)

    wmic diskdrive list brief
  6. Find the drive letter associated with your CF card (through the Explorer), and unmount it by typing the following. (replace DRIVELETTER by your drive letter)
    This allows VirtualBox to have raw access to the drive.

    mountvol DRIVELETTER: /p
  7. Change directory to the folder where VirtualBox is installed (most likely C:\Program Files\Oracle\VirtualBox)
  8. Type the following to create a raw virtual machine disk (.vmdk) that maps to the whole device of the CF card.
    (replace the N in \\.\PhysicalDriveN with the DeviceID you found earlier)

    vboxmanage internalcommands createrawvmdk -filename CompactFlashCard.vmdk -rawdisk \\.\PhysicalDriveN
  9. Start VirtualBox with Administrator rights (required for raw disk access)
  10. Create a DOS Virtual Machine (it’s under the “Other” type, Version is “DOS”), with default settings, except that when prompted about the hard disk, choose the “Use an existing virtual disk file” option and provide the CompactFlashCard.vmdk file created earlier
  11. Go in Settings for this VM, “Storage” section, click on the “Empty” first floppy drive and click on the diskette icon, and select “Choose Virtual Floppy Disk File…”. Then, browse to the first disk of the MS-DOS 6.22 install set.
  12. Start the VM, boot from floppy, and go through the installer.
  13. When prompted to switch to the next disk, you can choose it from the “Devices”, “Floppy Drive”, “Choose disk image…” menu item.

There should be nothing special in the MS-DOS setup process itself at this point, just make sure you allocated a DOS partition in the hard drive you’ve mounted and set it as active… and you’re done!
You’ll have to use Disk Management to eject the device for your CF card (which is safer than just yanking it), but you don’t really need to assign a letter unless you want to browse its files directly from Windows.

Archival of formspring answers

From June 2012 to August 2013, I had a ask me anything kinda page on Formspring, a social network/website that hosted such pages (similar to ask.fm, which I believe came in later). I didn’t realize that it was regarded as a pretty crappy site, so I stuck with it for more than a year… and later in 2013, it was sold and re-branded as Spring.me, started getting flooded with spam, and finally died last week, in September 2015.

Thankfully, I did export the answers I had written in March 2013, since Formspring added a tool to do so when they announced that they would close or rebrand. It’s a shame that I lost everything between March and August, but here’s what I saved anyway :

Edit : Thanks to Reddit /r/fez user utter_bodge, I was able to recover the text of the few Q&A that I was missing! The answering dates are wrong though, so disregard that.

Collected Formspring Answers

Enjoy!

Point Source Energy Decay

When playing with explosions, I was trying to determine how much an explosion’s energy or force is lost as you move away from the source. After Googling a bit, I found out that as per Coulomb’s Law (which relates more to electric forces, but makes sense for pretty much any point energy source), the energy is inversely proportional to the square of the distance. Kudos to Matthew for helping me find that information.

I intuitively knew that this made sense, probably seen it in other places… but I couldn’t explain it. Why 1 / d²?

After thinking a bit more about it, I managed to pull off a simple yet formal proof to this for any point energy source like sound and light… and explosions!

Circles on the water

You have to imagine an infinitely small, even null-sized energy source, like a point light in graphics programming. This point energy source emits energy in all directions equally. So let’s say it emits a single pulse at 0-time.

This source emits a 3D sphere around it, which is very dense and concentrated at first (infinitely dense at t=0) but the same energy spreads and becomes less and less dense. This energy “density” defines how much actually hits a surface or object at any distance.

The energy “particles” (that doesn’t sound right, but it’s conceptual) that form that expanding ring are traveling away from the center at constant speed, we’re assuming no friction or resistance in the surrounding medium. It’s a vacuum.

We know that the area of a sphere’s surface is 4πr², where r is the radius of that sphere. Let’s calculate its area at different times, considering that it grows in radius linearly through time :

t0 : r = 0, a = 0
t1 : r = 1, a = 4π
t2 : r = 2, a = 16π
t3 : r = 3, a = 36π

ti : r = i, a = 4πi

So, now that we know the area, I ask the question : How much “energy density” is contained in one square unit of that sphere’s surface at any given time?

Simply put, that’s the inverse of its area. Since we know that the entire area contains all the initial pulse’s energy, one square unit divided by this entire area corresponds to the amount of energy it contains.

And we want to remove all units here, so let’s calculate the ratio to the size at t=1. That gives… :

t0 : a’ = +∞, ratio = +∞
t1 : a’ = 1/4π, ratio = 1
t2 : a’ = 1/16π, ratio = 1/4
t3 : a’ = 1/36π, ratio = 1/9

ti : a’ = 1/4πi, ratio = 1/i²

There you have it. The amount of energy at time t and an equal distance, is the inverse of the square of that value. That is to say… 1 / d²!

I rest my case. :D

Back up!

After a couple of weeks of downtime, my blog and file server is back up, to my great joy and relief. :D

I have at least two subjects to blog about since I went down :

  • I made a comparison of 5 isotropic specular lighting models to find out which looked best, was most versatile, runs faster, etc. I already relased a PDF with my comparison results, but I’ll make a proper blog article too.
  • And I’ve made a static ambient occlusion sample, which pre-calculates the ambient occlusion values for each vertex of a model, saves it into the vertex colors, and made a simple shader that uses that value to filter out ambient lighting.The intuitive way for that is to use ray casting, but it’s quite slow using TV3D collision. So I’m currently making another implementation that uses GPU-accelerated hemicube rendering at each vertex to get the average luminance at this point, kind of like radiosity. My tests showed that the hemicubes implementation is 10.2 times faster while being more accurate.

I will detail my findings soon!