If your web browser formats this page incorrectly, try viewing the
page source. In netscape 4, click the view menu, then click page source.
dosemu, DOS emulator
The redhat 5.0 package of dosemu, dosemu-0.66.7-1.i386.rpm, includes a
nonbootable hdimage, hard drive image. The dosemu docs say dosemu includes a
FreeDOS kernel, but there is no FreeDOS kernel in the package. The dosemu
docs say to use setup-hdimage and mkdexe to make an hdimage, but these are
not included in the package. The dosemu docs say mtools can be used to
manipulate an hdimage, but mtools does not work on the hdimage from the
package (the offset for that hdimage is unknown; I do not know if mtools
would work if the offset was known). The dosemu docs hint that you can
create an hdimage with mtools, but the mtools docs say nothing about that.
If you really want to make an hdimage, throw this package away and get the
source for dosemu.
You can make an fdimage, floppy disk image, by doing
'cat /dev/fd0 > fdimage'. This fdimage can be manipulated with mtools. I
do not know if it can be used with dosemu; perhaps it should be 'bootdisk'
instead of 'disk' in /etc/dosemu.conf. The hdimage included with dosemu
already includes all the dosemu utilities; and it is a 1M hard drive with
150K of files, which uses 265K of linux disk space; the file gets bigger as
more files are copied to the emulated hard drive. Apparently the size of the
file is adjusted automatically, although the size of the emulated hard drive
is constant, so it uses disk space efficiently; and I suspect this may make
it incompatible with mtools. Anyway, I never tried to use an fdimage with
dosemu because I did not want to bother copying the dosemu utilities to the
fdimage, and because I thought it would not use disk space as efficiently as
the hdimage.
To make the hdimage bootable, edit /etc/dosemu.conf so that the hdimage is
c: and a floppy drive is a:. Put a DOS boot floppy disk in the floppy drive,
do not mount it. Run dos -A to start dosemu from the boot floppy; then run
sys c: to make the hdimage bootable.
If you want to mount a directory of your linux filesystem as a DOS drive
in dosemu, then you can use device=emufs in CONFIG.SYS, install=lredir in
CONFIG.SYS, or lredir in AUTOEXEC.BAT. emufs.sys does not let you select the
drive letter; it chooses the next available drive letter; and I found that
sometimes emufs failed to mount the drive with no error message; with
multiple emufs lines, if one failed the following emufs lines would use the
drive letter not used by the failed emufs line; thus one time I might run
dosemu and e: would be one drive, and another time I might run dosemu and e:
would be a different drive. install=lredir in CONFIG.SYS also failed
sometimes with no error message, and I found that sometimes an
install=lredir command would work, sometimes it would fail, and sometimes it
would crash dosemu. I found that using lredir in AUTOEXEC.BAT was much more
reliable than using device=emufs or install=lredir in CONFIG.SYS.
If you want to mount a linux directory as a DOS drive in dosemu, and the
linux directory has a name which is not a legal DOS filename, then I found
that sometimes lredir would work and sometimes it would fail. Also, lredir
changes uppercase letters to lowercase letters before attempting to mount
the directory; thus it usually fails to mount directories which contain any
uppercase characters. If you want to mount a linux directory in dosemu, and
the linux directory has a name which cannot be mounted; then create a link
to the directory, make sure the link has a legal DOS filename, and mount the
link. Maybe device=emufs in CONFIG.SYS would have worked better if I had
been trying to mount links instead of directories with illegal DOS
filenames.
The right alt key does not work in dosemu; the left alt key works fine.
Neither shift key works for the shift-insert or shift-arrow key combinations
in MS Edit.
I cannot format floppy disks in dosemu, but this may be a problem with my
hardware, not a problem with dosemu.
There are three ways to use the mouse in dosemu:
You can put a line in /etc/dosemu.conf like this:
mouse { mousesystems device /dev/mouse internaldriver emulate3buttons }
and then dosemu will provide mouse services. It does not matter if you have
a serial or a bus mouse. Do not load a mouse driver in CONFIG.SYS or
AUTOEXEC.BAT. Do not enable any mouse IO ports or IRQs in /etc/dosemu.conf.
Dosemu will transfer mouse data to and from the device, and the kernel
device drivers will do the rest. DOS programs will be able to use the mouse.
The gpm mouse will work normally in other virtual terminals. But the gpm
mouse will not work in dosemu, and the gpm mouse can not be used to copy
text to or from the dosemu virtual terminal. This is the most common way of
using the mouse in dosemu. But if you misconfigure the mouse in dosemu, then
the mouse will not work in dosemu, and the mouse may become confused and
need to be reset, and no mouse will work in any program, until you kill and
restart gpm; if you are running Xwindows, you may have to exit and restart
Xwindows to reset the mouse.
You can set video { vga } in /etc/dosemu.conf instead of
video { vga console graphics chipset cirrus } or whatever. Do not use any
mouse options in /etc/dosemu.conf, and do not load a DOS mouse driver in
CONFIG.SYS or AUTOEXEC.BAT. Then you will be able to use the gpm mouse
in dosemu just like in any other linux program, and copy and paste text to
and from dosemu and other virtual consoles. However, DOS programs will be
slow when displaying text, and DOS programs will not be able to use the
mouse. If you are running Xwindows, you will probably have the Xwindows
mouse instead of the gpm mouse.
Or you can edit /etc/dosemu.conf, make IO ports and IRQs available to
DOS programs, and load a DOS mouse driver in CONFIG.SYS or AUTOEXEC.BAT.
There are two ways to use serial ports and modems with dosemu. You
can set up /etc/dosemu.conf to emulate serial ports and modems, and then
when you run dosemu and a dos program sends data to the DOS COM port
drivers, dosemu will take the data and pass the data to the linux serial
port drivers. But if a DOS program tries to bybass the DOS COM port drivers
and send data directly to the serial port, then the data will vanish and
never get to the serial port. The other way to use serial ports and modems
in dosemu is to set up /etc/dosemu.conf to allow DOS programs to have direct
access to the serial port IO addresses and IRQs; this will allow DOS
programs to have direct access to the serial port hardware. Remember that
most DOS modem telecommunications programs bypass the DOS COM drivers and
directly access the serial port hardware. If you want to use some
special DOS serial port driver, like a fossil driver, then that driver will
probably need to directly access the serial port hardware.
Dosemu provides memory managment. Thus there is no need to load a DOS memory
manager in CONFIG.SYS or AUTOEXEC.BAT. To provide XMS (extended) memory, use
an xms line in /etc/dosemu.conf. To provide EMS (expanded) memory, use an
ems line in /etc/dosemu.conf, and use device=ems.sys in CONFIG.SYS. To
provide DPMI (DOS protected mode interface) memory, use a dpmi line in
/etc/dosemu.conf. To load DOS high and use upper memory blocks, make sure
dosemu is providing XMS memory; and put the normal DOS=HIGH,UMB line in
CONFIG.SYS. In DRDOS 6, put HIDOS=ON in CONFIG.SYS to load DOS high; you may
need a DOS memory manager to use upper memory blocks.
Dosemu does not provide ansi. If you want ansi, load a DOS ansi driver in
CONFIG.SYS with DEVICE=ANSI.SYS or whatever.
If you run dosemu with the wrong keyboard or display settings, then dosemu
may crash or make the keyboard unuseable. You may be unable to enter
commands to fix the problem and have to reboot. To prevent situations where
you have to reboot, run dosemu from a shell script. Before running dosemu,
the shell script should start a second shell script in the background.
The second shell script should wait ten minutes, then run ps and find the
dosemu process id, and kill dosemu. The main shell script should run the
second shell script in the background, then run dosemu, then run kbd_mode -a
and stty sane. Use these shell scripts for experimenting with dosemu; when
you are sure your configuration works, then skip the shell scripts and run
dosemu directly.
dosemu version 1.0.2 dos emulator
The configuration files use a different format from
previous versions. Also, previous versions assumed you wanted a systemwide
suid version of dosemu, while this version assumes you want single
user nonsuid version of dosemu. So dosemu is very different from
previous versions, and much of the documentation is useless because it
is for older version.
The following documentation files in ./doc are partly up to date:
dosemu-HOWTO.txt README.cpuemu README.txt sound-usage.txt
The documentation files in the main source directory are up to date.
The dosemu source defaults to a private installation, where everything
is installed in your private directory, and nothing is shared with other
users. There is also an option for a
systemwide installation, where everything is shared with other
users. Neither of these options seem logical to me.
I think the default installation should be partly shared and partly
private. The dosemu binary should be shared. There should be a
shared dos drive in lib, var, or share. The shared dos drive should be
read only and should contain dos programs and maybe data files which are
shared by all users. Each user should also have a private dos drive,
with private data and configuration files. There should be a set of
skeleton files, so that when a user uses
dosemu for the first time, the dosemu skeleton files are copied to the
user's home directory. The default configuration should be that the user's
private drive is C:, which is the boot drive. The shared dos drive should
be D:.
Even though dosemu recommends and assumes a single user nonsetuid
installation, I prefer a systemwide nonsetuid installation. So my notes
here assume a systemwide nonsetuid installation.
The main program is /usr/bin/dosemu
to start dosemu, type dosemu
to exit dosemu, type exitemu
with some older versions, you type dos, not dosemu
configuration files for nonsetuid systemwide dosemu:
With nonsetuid dosemu installed in /usr/bin, when we run dosemu, it checks
for /etc/dosemu.users, and if not found, it checks for
/etc/dosemu/dosemu.users
Unless permission is found in dosemu.users, dosemu does not run.
The dosemu lib directory is given in dosemu.users, or on the command line,
setting environment variable DOSEMU_LIB_DIR does not work.
In dosemu lib directory, dosemu reads global.conf
global.conf includes /etc/dosemu.conf and $HOME/.dosemurc,
if those files exist. So /etc/dosemu/dosemu.users and global.conf need
to exist; the other config files are optional.
Probably setuid systemwide dosemu is the same.
Probably a private installation of dosemu starts
by looking for global.conf in $HOME/.dosemu, and global.conf
probably includes /etc/dosemu.conf and
$HOME/.dosemurc; and never reads /etc/dosemu.users.
Since a private installation does not read
/etc/dosemu.users, you cannot set the dosemu lib directory
in /etc/dosemu.users. I think the only way to set the dosemu lib directory
in a private installation is to use command line options. Probably the
default dosemu lib directory for private installations is
$HOME/.dosemu, not /var/lib/dosemu as in systemwide installations.
How do we configure dosemu to run a dos program which
uses a modem connected to a serial port?
There are four ways for dos programs to use a serial port. The dos program
can open the dos COM device and read/write, the dos program can use a fossil
driver, the dos program can use a special driver, or the dos program can
directly use the ioports and irq of the serial port. Most dos modem
programs directly use the ioports and irq of the serial port.
Also, dos maintains a data table with base ioports for the serial ports.
Some dos programs look in this data table to get the base ioport before
directly accessing the ioports. Most dos modem programs get the base
ioport from their own configuration files, and do not look in the dos data
table. I do not know what dosemu puts in the dos data table.
It would be easy and logical for dosemu to associate the dos devices
with unix devices. So if a dos program opens a dos device,
dosemu could open the corresponding unix device, and pass the reads and
writes to the unix device. Probably COM1 should be associated
with /dev/cua0 or /dev/ttyS0, etc. But I am not sure if dosemu does this.
If the dos modem program uses a fossil driver, use dosemu's fossil driver.
Edit dosemu's config.sys and make sure there is a command to load dosemu's
fossil driver.
If the dos modem program uses a special driver, edit dosemu's
config.sys and add the command to load the special driver. Now you have to
figure out how the special drivers uses the serial port. The special
driver probably directly uses the ioports and irq of the serial port.
If the dos modem program directly uses the ioports and irq of the serial
port, we need to configure dosemu to pass the ioports and irq to the dos
program. In /etc/dosemu.conf:
$_ports = "fast range 0x2e8,0x2f7"
$_irqpassing = "3"
That allows a dos modem program to use a modem on COM4, 2e8 irq 3.
However, it will not work if any other program is using those ioports or
irq. Usually those ioports and irq are used by the serial port driver,
so make sure the serial port driver is not loaded before running dosemu.
If your dosemu config files include any lines like
$_com1 = "/dev/ttyS0"
then the serial port driver will load when dosemu starts and your dos modem
program will not work. So you need to set all $_com lines in the
dosemu config files to "", or else comment the lines out. Also, only
user root can directly use ioports and irqs, so you will need to log in as
root, or use sudo, or make dosemu setuid, or else your dos modem program
will not work. If dosemu cannot use the ioports or irq, then there will be
no error messages, and when your dos modem program tries to use the modem,
nothing will happen, your dos modem program will not work, and you will
wonder why.
My favorite dos modem program is rbcomm. I can start
dosemu and start rbcomm, and rbcomm works. But if I exit rbcomm, and
then start rbcomm again, rbcomm does not work. If I exit dosemu, and start
dosemu again, and start rbcomm again, rbcomm works. I do not know if
this is a problem with rbcomm, or a problem with dosemu.
The source includes the source for lredir, but does not compile lredir
with the other utilities. The documentation says that a precompiled lredir
is included, but there is no precompiled lredir.
I made several DOS drives with the $_hdimage command
in /etc/dosemu.conf. All the drives existed in dosemu, but all were read
only. If I to write to any drive, no error messages appeared, DIR showed
that the changes had been made, but after doing something else the changes
disappeared, all writes disappeared after exiting dosemu. I worked
around this by eliminating all but the boot drive in the $_hdimage
command, and then creating the other drives from config.sys using
emufs. The drives created with $_hdimage are readonly, the
drives created with emufs are readwrite.
In the $_hdimage command, names of drives are relative to the dosemu lib
directory unless the name begins with /dev/. Names beginning
with / are not relative to the root directory. So if you want to use a dos
drive image which is not in the dosemu lib directory, you need to use a
name like ../../../foo, or else put a link to the hard drive image
in the dosemu lib directory. Or create the dos drive using emufs
in config.sys; names for emufs are relative to the root directory.
What happens if we have $_hdimag = "foo" and there is foo in the
dosemu lib directory and in $HOME/.dosemu, which foo is used?
In /etc/dosemu.conf, I put
$_hdimage = "${HOME} $home $_home ${home} $HOME"
none of these read environment parameter HOME. I guess there is no way
to read an environment parameter from dosemu.conf
I installed the dosemu 1.0.2.1 precompiled binaries onto my PII running
redhat 7.2 with a custom 2.4.19 kernel. I invented my own installation,
with dosemu.bin shared by all users and a private boot drive for
each user, so I am not using the default installation. I
am using DRDOS 6.0 instead of freedos.
Running as root, not running X, if the last line of /etc/dosemu.conf
is a comment, and if the the newline at the end of the last line is
missing; then dosemu fails to recognize that the last line
of /etc/dosemu.conf is a comment, and displays messages about errors
in /etc/dosemu.conf.
Running as root, not running X, if a DOS drive is defined with $_hdimage
in /etc/dosemu.conf or $HOME/.dosemurc, and if I change a file on that DOS
drive from within dosemu; then dos DIR shows the changes I made
to the file, but when I exit from dosemu, the changes are lost. DOS drives
defined with EMUFS.SYS from dosemu's CONFIG.SYS can be written to, and the
changes are not lost when I exit dosemu.
I have a DOS modem telecommunications program named Rbcomm. I have
configured dosemu to allow Rbcomm to access the ports and irq of the
modem. Running as root, not running X, I can run dosemu,
and run Rbcomm, and type 'at', and the modem responds
with 'OK'. Then if I exit Rbcomm, and restart Rbcomm,
the modem does not respond. Then if I exit dosemu,
and restart dosemu, and restart Rbcomm, the modem responds again.
So Rbcomm fails to restart until I restart dosemu.
Running as root, not running X, if I put '$_graphics = (1)' in
/etc/dosemu.conf, then dosemu crashes when
it starts. The display becomes completely black. Dosemu
does not produce any messages, even with option '-D 9'. There is no
response to the keyboard and it is not possible to exit dosemu or change
virtual terminals. I am using a script to test dosemu like this:
#!/bin/sh
sync
sh -c 'sleep 10;killall dosemu.bin' &
dosemu -D 9 $* 2> $HOME/.dosemu/errors
kbd_mode -a
stty sane
exit
The background process fails to kill dosemu, so dosemu has crashed
so totally that background processes are stopped. It does not matter
what I set $_console or $_videoportaccess to. $_chipset=plainvga and
$_chipset=sis produce the same result. The motherboard
is pcchips m741lmrt; the display controller is
integrated into the motherboard chipset, which
is sis 620/5595. The display controller is similar to sis 6326.
If running as nonroot, if not running X, then line drawing characters
on the borders in ms edit are not displayed correctly.
Line drawing characters are displayed correctly when running as root, or
when running X.
If running as root and not running X, ms edit displays and responds to the
mouse correctly. If running as nonroot and not running X, ms edit does not
display or respond to the mouse. If running as root and running X, ms edit
responds to the mouse erraticly and does not display the
mouse, and mouse grab has no effect. If running as nonroot and running X,
ms edit does not display or respond to the mouse, and mouse grab turns off
the X mouse but ms edit still does not display or respond to the
mouse. I have $_mouse = "ps2" and $_mouse_dev = "/dev/mouse"
in /etc/dosemu.conf, /dev/mouse has read and write permission for all
users, and I kill gpm before running dosemu when not running X.
I think the default configuration for dosemu should be partly shared and
partly private. The dosemu binary and the dosemu utilities should be
shared by all users. There should be a readonly DOS drive which is shared
by all users; this drive should contain DOS programs which are shared
by all users. Each user should have a private, writeable DOS
drive. The private DOS drive should be the boot drive, so each user can
have a private AUTOEXEC.BAT and CONFIG.SYS. Here is a script which creates
the private DOS drive the first time a user run dosemu:
#!/bin/bash
BS=\\
CR='
' # this is a carriage return, control-m
DollarSign='$'
DoubleQuote='"'
if ! test -e $HOME/.dosemu/disclaimer
then mkdir --parents $HOME/.dosemu/bootdrive
ln -s /dos/dosemu/emufs.sys $HOME/.dosemu/bootdrive/emufs.sys
ln -s /dos/ibmbio.com $HOME/.dosemu/bootdrive/ibmbio.com
ln -s /dos/ibmdos.com $HOME/.dosemu/bootdrive/ibmdos.com
ln -s /dos/command.com $HOME/.dosemu/bootdrive/command.com
if ! test -e $HOME/.dosemurc
then echo "${DollarSign}_hdimage = ${DoubleQuote}../../..$HOME/.dosemu/bootdrive${DoubleQuote}" > $HOME/.dosemurc
fi
if ! test -e $HOME/.dosemu/bootdrive/autoexec.bat
then cat << end_of_autoexecbat > $HOME/.dosemu/bootdrive/autoexec.bat
@ECHO OFF${CR}
D:${BS}DOSEMU${BS}EMUMOUSE 3${CR}
SET PATH=D:${BS}DOSEMU;D:${BS}DRDOS60${CR}
SET PROMPT=${DollarSign}P${DollarSign}G${CR}
SET TEMP=E:${BS}T${CR}
end_of_autoexecbat
fi
if ! test -e $HOME/.dosemu/bootdrive/config.sys
then cat << end_of_configsys > $HOME/.dosemu/bootdrive/config.sys
device=C:${BS}EMUFS.SYS /dos${CR}
device=C:${BS}EMUFS.SYS $HOME${CR}
end_of_configsys
fi
fi
exit