Living without Windows!

by Jos Visser

Part 16: DOS

Go back to the index

Forgive me

For I have sinned! This article in the Living Without Windows series is dedicated to run that sorry excuse of an operating system MS-DOS under Linux. Please do not judge me too harshly without having read my justification, I then submit to your judgements.......

The Reason

There are those that persist in writing DOS/Windows applications, often leaving their customers no other choice but to maintain some sort of DOS capability in order to run this particular software. Particularly well known sinners in this respect are banks, for electronic banking applications. I must say that to my joy the Dutch RaboBank has recently brought electronic banking to the Internet for its customers, allowing me to ditch their DOS EB-application. I pray other banks follow soon (especially ABN AMRO since I am a customer there as well (6 accounts!)).

Another company that insisted in thrusting a DOS application on me is KPN TELECOM, the Dutch telecommunications monopolist (non-mobile, for all practical purposes though the market has theoretically opened up for other competitors as well). When we moved to our new house last year, we bought a KPN Telecom ISDN/2-8+ telephone switch to handle internal and external telephone traffic. The switch can be programmed in two ways: through a DOS application (centrale.exe) or through the main ISDN telephone. This last option is incredibly complex and kind of boils down to reprogramming the switch's microcode by entering the binary values of the processor's machine language on the keypad of the telephone. The DOS application is not particularly brilliant, but a lot easier to handle.

I had initially programmed the switch using the old "Jadzia" laptop when it still ran Windows NT. You connect a serial port to the switch, fire up "centrale.exe" and start interacting with the various configuration screens. The configuration program has features to upload and download configurations to and from the switch through this serial connection, but can store complete configurations locally as well (for backup purposes). Since my complete switch to Unix (Linux), I had not felt it necessary to configure the switch, but, for some reasons I won't delve into, that had changed.

Running DOS under Linux

So I had to reconfigure my home's telephone switch. Using the archaic configuration method (using telephone keys) still did not seem like a viable option, so I decided that I would have to run the DOS configuration program. Obviously I could have made life easy by creating a DOS floppy, boot my portable from floppy and run the "centrale.exe" program from that floppy. Or, even easier, I could have used my wife's laptop, which still runs Windows 95. But, I am always one for a challenge, and running it under the Linux DOS emulator seemed much more fun. I had always known about the "dosemu" package, I had even installed it when installing SuSE Linux on my laptop. Now obviously the time had come to configure it.

When I am teaching, I always define "emulation" as "the worst of both worlds, multiplied". Emulating an entire operating system under another operating system is no mean feat. There are all kinds of things to take care of, and especially emulation of hardware devices such as disks and serial ports require special attention. So, contrary to my general approach to all things IT, I started out by reading the documentation. Amongst others, there is a quite helpful HOWTO document on the DOS emulator that covers most things you need to know and do in order to get the DOS emulator running.

Configuring dosemu

Dosemu is a regular virtual machine for running DOS and DOS applications. The dosemu "kernel" intercepts all calls to the BIOS and to PC hardware, and emulates these using regular Unix system calls and features. The configuration file "/etc/dosemu.conf" contains the configuration of the DOS virtual machine, mapping amongst other things, PC (simulated) hardware to Unix (device) files. Of all PC hardware, the one thing you immediately bump into when configuring dosemu is the simulated hard drive. Dosemu can either run directly of a hard disk partition, or it can set up a simulated hard drive (hdimage) file (containing a FAT file system) which it then uses as drive C:. This last option does not require that you have DOS natively installed on a separate hard disk partition.

For obvious reasons (my laptop does not have a DOS partition) I chose to have a "hdimage" file. This is the default option in dosemu. To support it there is a "setup-hdimage" script to create the hdimage. The default /etc/dosemu.conf contains a reference to this hdimage:

disk { image "/var/lib/dosemu/hdimage.first" }   ## use diskimage file.
Dosemu also "boots" DOS from this hdimage. This means that this simulated hard disk drive must contain the DOS system files. For licensing purposes, dosemu does not come with a copy of DOS. This means that you have to have a bootable DOS disk yourself which the dosemu setup program reads to create the hdimage file. In my case, I created a DOS 7 (the DOS underlying Windows 95) boot floppy from another machine that still runs Windows 95, and used that floppy as input for the "setup-hdimage" install script.

Running dosemu

After running the setup script, I entered the "dos" command to start the emulator, et voila, it immediately fired up DOS and I was back in the stone age before I knew it!

As you can see, you can run DOS in an xterm, but there are other options as well, e.g. running it on the Linux console or running it in its own X window ("xdos" or "dos -X"). Another handy feature is that the DOS emulator allows you to map a Linux directory to a DOS drive using the "LREDIR.EXE" command. The default setting is to equate D: to /. Through such a mapping you are able to access all your Unix files (with name conversion to the infantile 8.3 naming scheme).


Click for a larger image....

Configuring the switch


Click for a larger image....
The reason I had configured dosemu was to run the "centrale.exe" program which can be used to configure the switch's configuration. I had copied this DOS application from a backup CD (I backup using a CD writer, more on this in another article) to somewhere in my home directory. I started "centrale.exe", and ..........

Tada ........ it worked!

At least, until I started to communicate with the switch using the serial port. This hanged the emulator and forced me to kill it. Ok, a minor setback.

 

The solution was of course obvious, the "/etc/dosemu.conf" that contains device mappings should be taught that COM1: of the emulator should be attached to Linux's serial port at "/dev/cua0". As it turned out, the serial port entries were commented out by default. Nothing that "vi" can't handle though :-) :
serial { com 1  device /dev/cua0 }
Another run of dosemu, and I could communicate with the switch using the serial cable:

Click for a larger image....

Finishing notes

Ok, mission accomplished. Some finishing notes:


Last change: 5th June 1999 by Giuseppe Pescatore