Wednesday, November 18, 2009

Installing DOS in a Virtual Machine

One of my recent home projects has been to decommission some old systems that didn’t really need dedicated boxes any longer. Aiding in this effort is virtualization. Thus, I moved what used to be a dedicated Linux installation to a Virtual Box VM; it’s mostly for development use so it’s fine just sitting on my main Windows desktop.

Installing DOS in a VM proved a bit more problematic.

(Why DOS?!? You cry. Mostly just for fooling around with for old times sake—running some old games and such. Not something I particularly wanted to have an ancient PC taking up space for as I did previously.)

The first step was to find DOS. I had diskettes of various versions hanging around including DR-DOS but no easy way to use them to create a VM as my desktop doesn’t have a floppy drive. As it turns out, the best solution appears to be FreeDOS. I downloaded an ISO image, mounted it as a CD, and fired up Virtual Box.

Things went pretty smoothly except for one thing: I couldn’t get sound to work. Recent versions of Virtual Box do let you set audio to Sound Blaster 16, the de facto standard for sound output in the DOS world for many years. I also put what appeared to be the required incantations in the DOS startup files—a messy mix of DMA and IRQ settings and related arcana with which I was far too familiar from past years. But no sound—not even native PC speaker sounds (which are what I really cared about). And no sound meant not much use for games.

VMware Workstation to the rescue. I downloaded a trial copy, created a FreeDOS VM, and sound worked fine out of the box.

One caveat: After FreeDOS sets up your partitions, the system needs to reboot. However, now that there’s a primary partition, the system will try to boot from hard disk (rather than the CD) and fail. At this point, you need to go to the Boot menu in BIOS and change the boot order so that the CD boots before the hard drive. This is a bit tricky because, when the VM boots, it moves past the point where you can press F2 to enter BIOS very quickly. So you have to be fast. (Alternatively, you can edit the .VMX file to increase the delay.) After the installation completes, you then will need to switch things back.

VMware Workstation is for-charge software. However, I assume that once you have the VM set-up, you can run it using the free VMware Player. You may also be able to use VMware Server, the free version of VMware’s former GSX Server, although I have not tried either.

Finally, to move software on to the VM, I found the easiest thing to do was to create an ISO image of any files I wanted. I can then mount the ISO and copy its contents to the "C:\" drive (i.e. the VM's primary partition). FreeDOS provides packet drivers and various other networking pieces but I didn't feel especially motivated to spend the time to try to get this stuff working.

No comments: