Linux Goodies

In Pursuit Of The Perfect O/S



How To Install Freedos Into Linux DOSEMU

Zazzle Linux Gifts

So You Want To Run the new Freedos In DOSEMU

If you're a MSDOS fan, or have some old favorite programs that you'd like to be able to run again, or have an old desktop or laptop that struggles with modern operating systems, then there is a solution.

While MSDOS isn't supported anymore, there is an open source project with a few miles behind it that's continuing to work on a plan to keep alive (and improve) a MSDOS compatible operating system. It's called the FreeDOS project.

At this point in development, Freedos has achieved very good MSDOS compatibility, and has added some nice enhancements. Large disks can be used, and there are additional shells to use instead of the old If you've forgotten the fun of programming in DOS, maybe the DOS Programming Success in a Day: Beginners guide to fast, easy and efficient learning of DOS programming book will help you rejuvinate those DOS programming juices.

A large number of utilities and programs have been donated to the project by some very capable and clever programmers, and some old commercial programs have been made available by the original manufacturers.

Freedos for the Programmer

If you enjoy programming in DOS, you'll find quite a treat in Freedos. It now includes several languages since the 1.0 distribution, and several more are available on the Freedos website. It's far more complete than in the old days when MSDOS came only with a version of BASIC.

For ease of use, the bwbasic Bywater BASIC interpreter is in the Freedos distro. It implements a large superset of the ANSI Standard BASIC commands.

In the distro is a fast assembler called fasm. There's also nasm, the net-wide portable assembler. The WASM Intel x86 compatible assembler is also included in the Freedos download.

A number of C compilers are available, starting with Pacific-c. This compiler is not open-source, but is now available for free use. Also included is the Watcom C and Fortran compiling system.

My Favorite DOS Language

My greatest enjoyment in FreeDOS programming is Forth. I use mostly a Forth compiler of my own, styled after Forth 79. I used Starting Forth: An Introduction to the Forth Language and Operating System for Beginners and Professionals as my guide, plus a small booklet from the Forth Interest Group to get the machine code definitions of the fundamental words. There are still a number of freely available Forth compilers at the Forth Interest Group Compilers, many for DOS. A rather robust version of forth known as Gforth is available at Gforth Compilers.

Why Forth? For a number of reasons. First, DOS had a clumsy memory management issue with code larger than 64KB in size. Forth happens to work great under that constraint. Second, most DOS languages are no longer being developed, so some higher level abstractions that have been developed in newer languages aren't available in the dead languages. But Forth is extensible, and usually a screen or so of Forth code can deliver a workable version of constantly developing coding concepts, such as record structures, objects, inheritance, etc.

So when I use Forth on DOS, I'm really denied little to nothing. The clever Virtual Memory concept available in Forth makes the 64KB limitation of DOS go away, and the extensible aspect gives me the power to let Forth keep up.

As an example, I wrote a nifty astronomy program in Forth that I run on an Old Laptop. The laptop is a Windows 95 era box, way too old, small, and slow to run most newer operating systems, with the exception of something like Puppy Linux. Puppy Linux is an amazingly small and efficient version of Linux, and multiple versions of Puppy Linux are available on the Puppy Linux Variety Pack - Slacko, Racy, Wary, Lucid, and Macpup on one CD.

But on this old laptop, I use FreeDOS. Even on that old Laptop, FreeDOS boots quickly, and in only seconds I'm running my astronomy program. In addition, other than the code (which is backed up), the old laptop isn't much of an investment. I don't worry too much about taking it out when I observe, even on cold nights.

The program contains about 5 celestial object alamanacs, from which I can select objects I wish to observe. The program will then make the necessary calculations, and present me with pertinent data about the selected object (type of object, magnitude, size, etc) and it's current position in the sky. It presents both alt-azimuth coordinates and stellar coordinates. This allows me to just position the telescope via setting circles and observe. No star hopping for me.

Forth Stars Program
Forth Stars Program Select Screen

The above image shows the object selection screen presented by my Forth program. I can enter 33 m for example, to tell the program that I want to see the date and where-abouts of Messier 33. The program will then calculate the objects current position for my location, and present the following type of information:

Forth Stars for Messier 3
Forth Program Data For Messier 3

As you might expect, The 5 available celestial object almanacs take up considerably more space than can fit into 64KB, given that the same 64KB must also hold the Forth Interpreter and my code. But the virtual memory system of Forth allows the data to be stored on special disk files, and referenced as if they were in memory.

Gforth, by the way, doesn't have the 64KB limitation, and I have a gforth version of the program than can hold all of the alamanacs in memory.

I present this just as an example of a use I still have for FreeDOS. You may well have many more.

How about editors?

You may recall that the old MSDOS had but a couple of text editors in the distribution, including the primitive edlin and edit. You'll be happy to know that Freedos has those and a number of other editors, some borrowed from the open-source Linux world.

For example, both the emacs and vim editors are included in the standard distribution. Additional editors are available for download at the Freedos website.

In fact, a number of other utilities borrowed from the Linux world are included in the Freedos distribution. Cal, for example, is a handy utility that puts the current, or any year and or month's calendar at your finger tips. And handy tools like head, tail, and grep for sifting through text files are included.

But can Freedos do networking?

The short answer is: yes.

A large number of packet drivers that work with many popular network cards is included. Also included is lynx, a handy text-based network and html browser, and arachne, a complete graphics capable browser. Both of these utilities also include ftp capability as well.

So as you can see even from this brief introduction, Freedos is MSDOS on steroids. So if you have an application for MSDOS, I recommend that you consider it.

Ok, so how to I get it and install it?

You can get Freedos at

From there you download an iso file that you can use to burn an installation CDROM. Installing from the CDROM to disk is fairly easy if you've an available partition.

I've also installed Freedos in a couple of Virtual Machines (VMs), including qemu and vmware. It installed easily in both of those platforms, giving me handy access to Freedos from my Debian Linux Operating System any time I want. And of course, compared to most modern systems, Freedos boots up very quickly.

I've also managed to install Freedos into DOSEMU, making it even faster to call up on demand.

The DOSEMU challenge.

If you're not familiar with DOSEMU, it's basically a virtual machine specifically designed to run MSDOS on a Linux system. Similar to the way one can call up a DOS window in Windows, using DOSEMU one can call up a DOS window in Linux.

The difference is that with a given version of Windows, only the version of DOS that comes with the Windows distribution will run in the window. With DOSEMU, virtually any DOS can be ran within a DOSEMU window.

Over the years, I've successfully ran MSDOS 6, DRDOS, and Freedos in a DOSEMU window. The MSDOS and DRDOS distributions had to be installed in DOSEMU, the Freedos came with the Linux distribution I was using.

Recently I wanted to upgrade the old and stripped down version of Freedos that was part of my Debian ETCH distro to the newer and fuller Freedos 1.0 distribution.

I was successful, and now with a quickly available window I can bring up a very complete and robust version of DOS.


Installing the new Freedos in DOSEMU was not easy.

After failing miserably for hours, I hunted the web for instructions on how to accomplish this surprisingly difficult task.

I didn't have a great deal of luck.

Having finally accomplishing the task, I decided to make the steps available to those others who might be interested.

Freedos In DOSEMU: The Details

I'll list the steps in installing Freedos first, then comment on them later:

1) Go to and download two files. The Freedos iso and a floppy boot image called fdboot.img, which you can get here.

2) Burn a cdrom with the Freedos iso.

3) Make a directory in your Linux system to hold the to-be-install Freedos.

4) Mount the cdrom containing the Freedos install cdrom.

5) Edit these variables in the dosemu.conf file. In Debian this file is in the /etc/debian directory.

$_hdimage = "freedos_install_directory /cdrom"
$_vbootfloppy = "fdboot.img"
(Note: Use full path names for the install directory and the fdboot.img)

6) Run either the dosemu or the xdosemu command. The fdboot.img will boot, try to find the cdrom, and fail. By listing the cdrom in the hdimage line of the dosemu.conf file, the cdrom will, none-the-less, be available as drive d:.

7) In the dosemu window:

d: (change to the d: drive)
cd \freedos\setup\batch
run the autorun.bat command

8) When the source/destination screen is presented, adjust destination to be c:\fdos.

9) Proceed with the installation, which will go to your newly created Freedos install directory.

Most of the steps I think are fairly self explanatory. The step 6 comment about the boot disk's failure is about this: had the boot disk found the cdrom, it would have gotten stalled in a loop of trying to format the disk, which would keep failing in the dosemu emulator. Thus it's best to boot from the floppy image and be able to get to a prompt than to boot directly from the cdrom and get stuck in the loop.

At the boot floppy dos prompt you can go to the area on the cdrom where autorun.bat exists, and bypass the format issue. I don't know how common the Freedos install procedure is, but on the 1.0 version I downloaded, these instructions worked for me.

Finishing up

Now that (hopefully) you've gotten Freedos installed, there's a bit of setup to do.

First, go back to the dosemu.conf file and make the following changes:

Remove the /cdrom reference from the "_hdimage parameter.

Comment out the $_vbootfloppy parameter.

Now next time you run dosemu or xdosemu, you should be in your new Freedos distro.

You'd probably like to also have access to the dosemu emulator commands while in Freedos. You can do that by doing the following (in Linux) prior to your next running of dosemu:

cd to your new Freedos install directory
Make a subdirectory named dosemu
cd to the dosemu directory
cp /usr/lib/dosemu/commands/* .

You may find that the dosemu commands on your version of Linus aren't at /usr/lib/dosemu/commands. If so, copy them from wherever they are to your new dosemu subdirectory.

You'll want to comment out any mouse loading in the Freedos autoexec.bat file, since dosemu provides its own mouse driver.

You say you'd like Freedos networking in dosemu?

Believe it or not, you can in fact get the Freedos networking up and running in dosemu. It wasn't easy for me, and I didn't always get it to work. But I'll show how I have had some success. Then you can explore the rather incredible capabilities of the arachne graphic web browser.

I would suggest that if you want a networkable version of Freedos within Linux, I'd recommend qemu dos instead.

But to proceed with networking in dosemu, you'll need to do a bit of setup in 3 places: Linux, dosemu, and the Freedos autoexec.bat.

Networking setup on the Linux host

One of the easiest ways to get dosemu connected to a network is to use the tun/tap connection.

First, see if you have the /dev/net/tun installed. It probably already is. If not, depending upon your distribution, you need to find how to install it.

Be sure the /dev/net/tun is accessible by doing a sudo chmod 666 /dev/net/tun command.

You'll also need to have the utility tunctl available. In Debian distributations, this is in package uml-utilities.

Then you need to set up a script to do the following commands. Just as an example, assume that your home lan network address is Then setup the following script:

sudo tunctl -d tap0
sudo tunctl -u user_name
sudo ifconfig tap0
sudo bash -c 'echo 1 > /proc/sys/net/ipv4/ip_forward'
sudo route add -host dev tap0
sudo bash -c 'echo 1 > /proc/sys/net/ipv4/conf/tap0/proxy_arp'
sudo arp -Ds eth0 pub

Adjust the two addresses in the script to be compatible with your home network (remember I used as an example). When setting up your dosemu network connection, use the address set up in the arp line.

A good additional reference for dosemu networking is Networking Using DOSEMU.

Networking setup in the dosemu.conf file

You'll also need to configure a few setup parameters in your dosemu.conf file, as follows:

$_pktdriver = (on)
$_netdrv = "tap0"
$_vnet = "tap"

Networking setup in the Freedos autoexec.bat

Finally, you need to comment out the loading of any packet driver in the Freedos autoexec.bat file. A Freedos packet driver isn't needed since dosemu provides one to the tap0 device.

That's about it. Run the Linux script to setup and configure the tap0 device, then start up dosemu, and configure arachne to use the device address you assigned on the arp line of the Linux script. You'll only need to run the tap0 setup file once after each Linux reboot.

Don't give up if you don't get it to work right off. Just review the instructions, and try setting up arachne again.

One interesting note. When running arachne in the dosemu engine, I found I had to hold down a shift key while a page was downloading or the download would halt. Even holding down a mouse button would work.

I think it's an anomaly with dosemu, as a straight Freedos install and a Freedos install in qemu do not show this peculiarity.