Running MS-DOS on the Linux Operating System

Note! This documentation has likely become dated, but hopefully serves as a general guide for building Dosemu up to versions 1.0.x from source.

Page index

1. Introduction

The Linux Operating System right now is the hottest OS in the PC world. Perhaps you've heard of it and wanted to give it a try, but don't care to give up your favorite MS-DOS programs. Since Linux is based around the standards and file formats of the UNIX world, it is not designed to run MS-DOS or MS Windows programs natively. However, efforts have been under way now to provide Linux (and some other Unices) a way to run MS-DOS programs. The Intel x86 series of microprocessors since the 80386 have contained a feature known as Virtual 86 that allows the microprocessor in conjunction with supporting software to mimic the behavior of an 8086 based computer (in fact multiple virtual 86 machines can exist at once). This combination of hardware and software allows an environment to be created that allows MS-DOS programs to run as if they are being run by themselves on an 8086 machine. MS Windows uses this technique to run DOS programs and multi-task them with Windows programs. Such a program written for Linux is known as dosemu, or the DOS EMUlator.

Dosemu isn't so much an emulator of MS-DOS as it is a PC emulator as it creates a virtual 8086 PC in your computer's memory and boots DOS. Once DOS is running many programs written for DOS (including Windows after a fashion!) may now be run. Dosemu provides programs access to real hardware including the serial ports and disk drives. Much of the configuration is done by editing a few text configuration files. Two of these reside in the main Linux directory for configuration files and the rest reside in a special file dosemu creates which DOS accesses as a bootable disk drive.


2. Installing dosemu

If you are lucky, your Linux distribution has already installed dosemu for you, if not, then you'll want to get the latest source (or rpm or deb file if your distribution supports either) from Go to the stable release page and get the latest version (0.98.4 was current as of this writing. Later versions may require subtle changes). After downloading, you need to uncompress the archive. A good place to do this is in ~/src (use the mkdir command to create the directory "src" under your home directory. Copy the archive to ~/src, change directory to ~/src and extract it using the following command:

~/src $ tar xvfz dosemu-0.98.4.tgz

This will create a directory dosemu-0.98.4 in ~/src and create a number of other sub-directories and put all the necessary files in the right places. Next change directory to dosemu-0.98.4 (or whatever the name is for the version you're installing) and look for the file called QuickStart (the ls command is your friend and is similar to the DOS dir command). You can use the less command to view this file like this:

~/src/dosemu-0.98.4 $ less QuickStart

less is a program that allows you to page forward and backward while viewing files. A real friend when getting started with Linux is the GNU Midnight Commander. This a Norton Commander clone that makes file management a snap and also has a built-in file viewer. Later versions include a text editor as well.

You should be able to print the QuickStart file with this command:

~/src/dosemu-0.98.4 $ lpr QuickStart

This assumes your /etc/printcap file is configured for your printer. If not, consult the Printing-HOWTO and the Printing-usage-HOWTO. If they weren't installed by your distribution, you can find them at the Linux Documentation Project at along with a number of other HOWTOs. You may also want to print out the README.txt file in the dosemu doc directory as it documents the configuration files.

If you have used Linux for a while, QuickStart will provide most of what you need to know to compile and install dosemu and get it running. Otherwise a good place to start is the dosemu-HOWTO in the doc directory. Keep in mind this program is in rapid development and good documentation is a bit scarce. Following the steps in the QuickStart file should at least get dosemu compiled and installed in such a way so that you can play with it and get DOS programs up and running. Fine tuning can be done later.

If you have X running, there is a TCL/Tk script file that eases configuring and compiling dosemu. I assume you have an XTerm window open. In the dosemu directory type the following command to start the script:

$ ./setup-dosemu

A window should open allowing you to change some default settings in dosemu. You shouldn't need to change anything so just click OK.

Next click the Configure/Make button.

After configure is done a window will open showing configure's output.

Next click OK.
Next click Compile dosemu.

dosemu will now be compiled. When it is finished a window will open showing the output of make and gcc and will allow you to exit the script.

Now you'll need to log in as root or superuser. you can do this from your XTerm by using the su command and entering your root password. Now you may continue with section 2 of QuickStart and perform the tests outlined there.

Next from the dosemu directory type:

/home/yourusername/src/dosemu-0.98.4 # make install

This will install the dosemu files in all the right places (hopefully) so you may now configure dosemu, test your configuration and run dosemu as a normal user in the future.

Following each step closely should result in a working dosemu. If something goes wrong, don't be afraid to back up a step or two and do it again. Sometimes doing it over a time or two makes for a better install! (Remember this program implements DOS ;-) )


3. Configuring dosemu

Even though I have run dosemu 0.66.7 for some time, this document will deal with configuring the later stable release, the 0.98.x series.

Okay, everything has been installed, you can start dosemu with the dos -C command and you are able to boot the hdimage partition. Now you'll have to get things a bit customized. I'm no expert at getting dosemu configured in every situation, but have managed to get my system running. Here is a basic layout of my hard drives which will help explain my files and the choices I made.

Linux Device      mounted as     DOS Drive
/dev/hda1          /DOS/C/           C:
/dev/hda2          /                --
/dev/hda5          /DOS/E/           E:
/dev/hdb1          /DOS/D/           D:
/dev/hdc           /cdrom/           F:

The programs I use are installed in /DOS/D/. I think this made it easier to get dosemu going as I didn't have to have to deal with the hassle of re-mapping drive C: to /DOS/D/ after booting to the hdimage.



Configuring my dosemu installation consisted of editing four files. The first is /etc/dosemu.users and it is touched on briefly in section 3 of QuickStart. Copying dosemu.users.easy from the dosemu etc directory as per QuickStart should get you going.

This file will suffice to start, however, if your machine is on any kind of network, be sure to follow the security advice in the dosemu documentation.



The file you will really need to change is /etc/dosemu.conf Be careful as some of the settings fundamentally change the way dosemu behaves. Here are the lines I changed from the supplied file that seems to work reasonably well.


$_cpu = (80486)         # CPU emulation, valid values:  80[345]86

$_speaker = "emulated"  # or "native" or "emulated"

$_term_char_set = "ibm" # Global code page and character set selection.
                        # "" == automatic, else: ibm, latin, latin1, latin2

$_rawkeyboard = (1)     # bypass normal keyboard input, maybe dangerous

$_com2 = "/dev/cua1"    # e.g. "/dev/modem" or "/dev/cua1"


The cpu setting may or may not make a difference, but it's what is in this box.

Emulated speaker allows PC Speaker sound to be played very well in this version.

Setting the terminal character set to IBM allows programs to display its graphics characters as in DOS/Win.

Raw keyboard seems to work better and I haven't had any problems with this parameter set.

If your program needs to use the serial ports, configure those here. I've configured COM 2 in DOS which translates to /dev/ttyS1 in Linux.

I didn't do any special mouse configuration and found that it does work in DOS EDIT running in XDos (more on that below).



Just like a bootable DOS disk, the hdimage has a CONFIG.SYS and AUTOEXEC.BAT. Here is what my CONFIG.SYS looks like.

device=c:\emufs.sys /DOS/D/
device=c:\emufs.sys /DOS/E/
device=c:\emufs.sys /cdrom/

The emufs.sys driver maps the Linux path you specify to a DOS drive, kind of like the DOS SUBST command. Note I mapped the CD-ROM which allows KaGold (a DOS based packet radio program) access to my QRZ callbook. These mappings present the same drive structure to KaGold as under DOS/Win except that drive C: is only 1 Meg under Linux as opposed to 400+ under DOS/Win.



Here is my simple AUTOEXEC.BAT.

@echo off
set path=c:\;d:\ham\kagold;d:\ct

Not much there. Notice the CT configuration? Just testing for now...

These are the settings in the various files that allow me to run KaGold in X using the xdos program to start DOS and then I simply type kagold at the C:\> prompt to start it.


4. XDos

Dosemu can be run from a virtual terminal on the console and will look just like a full screen DOS application. Alternatively, you can use the XDos program provided by the Dosemu package. If you built Dosemu while still in the X Window environment, you'll want to restart X as two VGA font files are installed and X needs to reread its fonts.

Now that X has been restarted, you can start XDos from an XTerm or add it to your Window Manager's menu. Check to be sure everything starts normally and you should be able to run your DOS programs along side your X programs. Exceptions will likely be those programs that use the graphics hardware.

Since I use IceWm, there is an option you'll need to add to ~/.icewm/winoptions so that functions are passed to the application, so, add the following line:

XDosEmu.fullKeys: 1


5. Nits and errata

Okay, dosemu is evolving and some things may get fixed or broken between releases. Even though 0.98.4 is the "stable" branch it is still beta software as it is prior to version 1.0.0. Mostly I can tell little difference between the first version I tried, 0.66.7 and 0.98.4, but here is a short list of what I've found.

Serial comms speed seems to be improved slightly.

Morse announcements were not audible in 0.66.7 and work fine, better than Windows, in 0.98.4.

The cursor which should appear in the transmit text line at the bottom of the screen is not there in 0.98.4. It remains in the upper left hand corner of the screen. Connect to your mailbox and you'll see it. This problem didn't exist in 0.66.7 so I hope it will be one of those version specific bugs.


Take me back to the Index!

The Linux Webring:
[ Prev | Next | Random | List | Home | Stats ]

Original content Copyright © 1997-2017 Nate Bargmann NØNB
any other content copyright by respective author(s).

This page last modified
February 12, 2005
Valid XHTML 1.0! Valid CSS! Built with WSMake!