Put a freeware DOS onto your computers .
Among the various permutations of Windows, XP offers the best mix of DOS compatibility and system stability. However, you will still run into a lot of problems running your favorite old DOS applications [Hack #70] even under Windows XP. And if you're running Mac OSX, Linux, or an earlier version of Windows, you may run into more trouble.
If so, there are a couple of solutions. DOSBox [Hack #69] will let you run most applications without grief , and it should be your first stop.
But for pure DOS goodness, nothing beats running DOS right on the bare metal. Dig that 386, 486, or Pentium out of your closet, and get ready to boot it, old school style.
If you want a DOS for your computer, and you'd prefer to use libre software, FreeDOS is just what you need. Even if you are in need of a DOS just because you can't find your old DOS boot disks, FreeDOS is probably just what you need. It offers excellent compatibility, is actively supported and developed, and has advanced features such as power management and IDE DMA support. You can read all about FreeDOS and download it at http://www.freedos.org.
If you want to run FreeDOS on a real computer, you're going to need the right equipment and software:
If your FreeDOS computer can boot or read from a CD-ROM, all you need is another PC with a network connection and the ability to burn a CD-ROM. Download the FreeDOS CD-ROM image and burn it to a CD. You may want to burn it at a low speed, since the compatibility between new and old CD drives can be hit and miss .
If your FreeDOS computer has a CD-ROM but can't boot from it, you'll need a way to write a disk image to a floppy. You can use rawrite (Windows, DOS) or dd (Linux and Unix) to write the image. If all your network-connected machines are floppyless, consider booting your FreeDOS computer into whatever operating system it has, transferring your floppy images over, and writing the images to floppies there. Download the FreeDOS CD-ROM image and burn it to a CD, and also grab the 1.44MB floppy image and write it to a floppy.
If your FreeDOS computer has no CD-ROM, you'll need to write a full set of FreeDOS images to floppies (see the disksets subdirectory of the FreeDOS site).
In this hack, I'll choose door number 2, not just because it has elements of both 1 and 3 and thus economizes on the size of my examples, but because my 486, a Compaq luggable (see Figure 7-1), can't boot from its CD-ROM drive.
When I started to consider doing a clean install of DOS, I took a look at the network card that was working so nicely . The external SCSI controller and internal IDE adapter were living in such harmony under Debian GNU/Linux that I couldn't bring myself to blow away the Linux installation I had. So, I decided to steal a little disk space from my swap partition.
First, I logged in as root , turned off the swap, fired up fdisk , and looked at my partitions:
debian:/home/bjepson# swapoff -a debian:/home/bjepson# fdisk /dev/hda Command (m for help): p Disk /dev/hda: 64 heads, 63 sectors, 619 cylinders Units = cylinders of 4032 * 512 bytes Device Boot Start End Blocks Id System /dev/hda1 * 1 16 32224+ 83 Linux /dev/hda2 558 619 124992 82 Linux swap /dev/hda3 17 557 1090656 83 Linux Partition table entries are not in disk order
Next , I deleted the swap partition, recreated it with a smaller size, and used the unused space to create the fourth primary partition as a FAT partition:
Command (m for help): d Partition number (1-4): 2 Command (m for help): n Command action e extended p primary partition (1-4) p Partition number (1-4): 2 First cylinder (558-619, default 558): Using default value 558 Last cylinder or +size or +sizeM or +sizeK (558-619, default 619): 600 Command (m for help): n Command action e extended p primary partition (1-4) p Partition number (1-4): 4 First cylinder (601-619, default 601): Using default value 601 Last cylinder or +size or +sizeM or +sizeK (601-619, default 619): Using default value 619 Command (m for help): t Partition number (1-4): 2 Hex code (type L to list codes): 82 Changed system type of partition 2 to 82 (Linux swap) Command (m for help): t Partition number (1-4): 4 Hex code (type L to list codes): 6 Changed system type of partition 4 to 6 (FAT16)
Then I checked to make sure the partitions looked correct, and wrote the partition table to disk:
Command (m for help): p Disk /dev/hda: 64 heads, 63 sectors, 619 cylinders Units = cylinders of 4032 * 512 bytes Device Boot Start End Blocks Id System /dev/hda1 * 1 16 32224+ 83 Linux /dev/hda2 558 600 86688 82 Linux swap /dev/hda3 17 557 1090656 83 Linux /dev/hda4 601 619 38304 6 FAT16 Partition table entries are not in disk order Command (m for help): w The partition table has been altered! Calling ioctl() to re-read partition table. WARNING: Re-reading the partition table failed with error 16: Device or resource busy. The kernel still uses the old table. The new table will be used at the next reboot. WARNING: If you have created or modified any DOS 6.x partitions, please see the fdisk manual page for additional information. Syncing disks.
Finally, I rebooted, and then fixed up the swap file:
debian:/home/bjepson# swapoff -a swapoff: /dev/hda2: Invalid argument debian:/home/bjepson# mkswap /dev/hda2 Setting up swapspace version 1, size = 88764416 bytes debian:/home/bjepson# swapon -a
Keeping the existing Linux system on the Compaq gave me another advantage: when I need to to copy files over the network, I can boot into Linux, copy the file over, and easily move stuff to my C: drive.
I'll need a CD image and floppy image to install FreeDOS. On one of my modern PCs, I downloaded the FreeDOS CD image ( fdbootcd.iso ), burned it to a CD-ROM, and inserted it into my Compaq's CD-ROM drive.
I went back to my soon-to-be a dual boot FreeDOS/Linux box and downloaded the FreeDOS floppy image ( fdos1440.img ), wrote it to a floppy disk with dd if=fdos1440.img of=/dev/fd0 , and rebooted with that floppy in the drive.
As it turned out, the FreeDOS installer got as far as formatting my C: drive, but could not recognize my CD-ROM drive. Here's another advantage to having Linux on the other partition. Since the FreeDOS installer can work directly off the ISO image, I solved the problem by booting into Linux and copying the ISO image over to my C: drive:
debian:/home/bjepson# mount /dev/hda4 /mnt/ debian:/home/bjepson# cp fdbootcd.iso /mnt/ debian:/home/bjepson# umount /mnt/ debian:/home/bjepson# reboot
Then, I went through the FreeDOS installation again, and it found the ISO image I had copied over and ran through the installation.
You might be done now. But if like me, you're adding FreeDOS to a machine currently running Linux, you'll need to configure your bootloader to be able to boot DOS. On my system, I needed to add the following to /etc/lilo.conf (you may also want to check that the prompt option is enabled so you don't have to press the Shift key to get the menu):
other=/dev/hda4 label=FreeDOS table=/dev/hda
Next, I had to run the lilo command as root for this change to take effect):
debian:/home/bjepson# lilo Added Linux * Skipping /vmlinuz.old Added FreeDOS
Once this was done, I rebooted, selected FreeDOSat bootup , and enjoyed DOS in all its glory !
One problem remained: my CD-ROM drive still didn't work.
I know from having run MS-DOS on this machine that I need two drivers to use my CD-ROM drive: ASPI2DOS.SYS and ASPICD.SYS . The trick is finding them; you may need to use Google to find the right DOS drivers for your hardware (FreeDOS is compatible with regular DOS drivers). The good news is that these files are available on any Windows 95 or 98 boot floppy. Even better, you can boot from that floppy, watch as the drivers load (it loads a mess of SCSI drivers) and figure out which one you need.
The next step was to copy the files to my C: drive (I put them in C:\BJ , using my initials for the location of drivers I've installed; you will come up with something more clever), and edit my CONFIG.SYS file to load them. FreeDOS uses a funny syntax with its menu system. A ? followed by a number indicates that the item should only be loaded when the user has selected the corresponding menu option. So ?12DEVICE=FOO indicates that FOO will only be loaded if the user chose 1 or 2. I added these two lines to CONFIG.SYS , right after the line that loads EMM386 :
12?DEVICE=C:\BJ\ASPI2DOS.SYS 12?DEVICE=C:\BJ\ASPICD.SYS /D:FDCD0001
FDCD0001 is one of device names that ShsuCDX (FreeDOS' equivalent of MSCDEX ) looks for when it's run from AUTOEXEC.BAT (FreeDOS should have configured it as such, but there's no harm in double-checking). With these two lines added to my CONFIG.SYS , my CD-ROM drive is successfully configured as the D: drive.