Subject: Linux DOSEMU HOWTO
From: [email-masked] (Michael E. Deisher)
Newsgroups: comp.os.linux.announce,comp.os.linux.help

Archive-Name: linux/howto/dosemu
Last-modified: 17 Feb 94

This is the `Frequently Asked Questions' (FAQ) / HOWTO document for dosemu,
(dosemu-HOWTO).

Please read this document *to the very end*, before you post a question to a
newsgroup / Linux-MSDOS channel / the developers.  This will reduce the number
of redundant questions, and releases us all to more constructive work (like
improving dosemu).

This HOWTO is edited and maintained by:  Mike Deisher
Last update: February 17 1994, for dosemu 0.49pl4

Additions or corrections to the HOWTO should be directed to
[email-masked]
========================================================================
CONTENTS

Section 1: The preliminaries
----------------------------
Q1.1	What's the newest version of dosemu and where can I get it?
Q1.2	Where can I follow the development?
Q1.3	What documentation is available for dosemu?

Section 2: Compiling and installing dosemu
------------------------------------------
Q2.1	What does "emu.c:349: parse error before `outfuntype'" mean?
Q2.2	What does "scan.o: Undefined symbol _yywrap" mean?
Q2.3	Can I use dosemu on a multi-user system?

Section 3: Hard disk setup
--------------------------
Q3.1	How do I use my hard disk with dosemu?
Q3.2	Can I use my stacked/double-spaced/super-stored disk?
Q3.3	I get an error message about my config.sys file but it looks fine.

Section 4: Serial ports and mice
--------------------------------
Q4.1	Where are the (microsoft compatible) mouse drivers?
Q4.2	Why doesn't the mouse driver work?
Q4.3	How do I use dosemu over the serial ports?

Section 5: dosemu and X-windows
---------------------------------------
Q5.1	Can I run dosemu in console mode while running X?
Q5.2	Is it possible to run dosemu in an xterm?

Section 6: Video
---------------------------------------
Q6.1	Exiting from dosemu gives me a screen full of garbage.
Q6.2	How do I get dosemu to work with my Trident or Actix video card?

Section 7: Problems and fixes
-----------------------------
Q7.1	Why does dosemu lock up after one keystroke?
Q7.2	Why does my ethernet driver lock-up dosemu?
Q7.3	Why are my keystrokes echoed ttwwiiccee??
Q7.4	Why does give "divide overflow" errors after running for more
        than 24-hours? 
Q7.5	Where did the debugging output go?

Section 8: Contributing to the dosemu project
---------------------------------------------
Q8.1	Who is responsible for dosemu?
Q8.2	I want to help.  Who should I contact?
========================================================================

Section 1:  The preliminaries
=============================

Q1.1	What's the newest version of dosemu and where can I get it?
-------------------------------------------------------------------
The newest version of dosemu is dosemu0.49pl3.3 and can be ftp'ed from the
following sites:

     dspsun.eas.asu.edu:/pub/dosemu/
     tsx-11.mit.edu:/pub/linux/ALPHA/dosemu/

(Be sure to get and apply all patches.)

Q1.2	Where can I follow the development?
-------------------------------------------
If you want to follow the development of dosemu, you should consider
subscribing to the MSDOS channel on Linux-activists.  To subscribe,
send mail to [email-masked].  Your mail HEADER
or FIRST LINE must contain the line:

			X-Mn-Admin: join MSDOS

To post to the list, send mail to [email-masked].
Your mail HEADER or FIRST LINE must contain the line:

			X-Mn-Key: MSDOS

Q1.3	What documentation is available for dosemu?
---------------------------------------------------
The dosemu manual (dosemu.texinfo) written by Robert Sanders has not
been updated in some time but is still a good source of information.
It is distributed with dosemu.

The "dosemu Novice's Altering Guide" or DANG is a road map to the
inner workings of dosemu.  It is designed for the adventurous, those
who wish to modify the source code themselves.  The DANG is maintained
by Alistair MacDonald ([email-masked]) and is posted once in a
while to the MSDOS channel of Linux Activists.

The EMU success list (EMUsuccess.txt) is a list of all programs that
have been reported to work with dosemu.  It is posted once in a while
to the MSDOS channel of Linux Activists.  The most recent version can
be found on dspsun.eas.asu.edu:/pub/dosemu.

And then, of course, there is the dosemu FAQ/HOWTO.  But you already
know about that, don't you.  It is also posted once in a while to the
MSDOS channel of Linux Activists.  The most recent version can be
found on dspsun.eas.asu.edu:/pub/dosemu.

Section 2:  Compiling and installing dosemu
===========================================
Q2.1	What does ``emu.c:349: parse error before `outfuntype'\,'' mean?
------------------------------------------------------------------------
James B. MacLean ([email-masked]) reported (12/1/93) that   

A fix that works is:  Change the 'outfuntype c' parm in line 349 to
'int (*c())(int)', and try again. 

[Note:  "outfuntype" is defined in termcap.h.  You may have a bad or
 incomplete termcap.h (termcap.h is not part of dosemu).]

Q2.2	What does "scan.o: Undefined symbol _yywrap" mean?
----------------------------------------------------------
Alan David Modra ([email-masked]) reported (2/16/94) that

Flex-2.4.6 generates code that requires linking in libfl.a
You need to add -lfl to the linker command line:

  gcc -o par scan.o parse.o -lfl

[Note:  edit parse/Makefile to incorporate this change]

Q2.3	Can I use dosemu on a multi-user system?
------------------------------------------------
Corey Sweeney ([email-masked]) reported (12/8/93) that

If you running dosemu on a system in which more then one
person may want to run dosemu, then you may want to change the
directory of your hard drive image.  Currently in the /etc/dosemu/config
file there exists the line saying that the hard drive image is
"hdimage".  If you change this to "/etc/dosemu/hdimage" then people do
not have to worry about what directory they are in when they run
dosemu, and hdimage does not have to be moved each time you upgrade to
the next patch level.

If you do do this for multi-user dosemu, then you will want to make
the hdimage in /etc/dosemu read-only for everyone but the dosemu
administrator.

Note: you can use the new emufs.sys thing to mount a "public"
      directory and/or a "private" directory (a sub-directory in each
      person's home directory).

Section 3: Hard disk setup
==========================
Q3.1	How do I use my hard disk with dosemu?
----------------------------------------------

First, mount your dos hard disk partition as a Linux subdirectory.
For example, you could create a directory in Linux such as /dos (mkdir
-m 755 /dos) and add a line like

   /dev/hda1       /dos     msdos   umask=022

to your /etc/fstab.  (In this example, the hard disk is mounted
read-only.  You may want to mount it read/write by replacing "022"
with "000" and using the -m 777 option with mkdir) Now "mount /dos".
Now you can add a line like

  lredir d: linux\fs/dos

to the AUTOEXEC.BAT file in your hdimage (see the note on LREDIR
below).  

Tim Bird ([email-masked]) states that LREDIR users should

be careful when they use LREDIR in the autoexec, because COMMAND.COM
will continue parsing the autoexec.bat from the redirected drive as
the same file offset where it left off in the autoexec.bat on the
physical drive.  For this reason, it is safest to have the
autoexec.bat on the redirected drive and the physical drive
(diskimage) be the same.

Q3.2	Can I use my stacked/double-spaced/super-stored disk?
-------------------------------------------------------------

At this time, compressed drives cannot be accessed via the redirector
(lredir).  However, many people have had success by simply
uncommenting the

   disk { wholedisk "/dev/hda" }        # 1st partition on 1st disk

line in their dosemu config file.  A few others have had success using

   disk { partition "/dev/hda1" 1 }

Holger Schemel ([email-masked]) reported (2/10/94) that

Works even fine under DOSEMU with MS-DOS 6.0. If you have problems, then
you have to edit the file 'DBLSPACE.INI' manually and change the disk
letter to the letter your drive gets under DOSEMU.

Q3.3	I get an error message about my config.sys file but it looks fine.
--------------------------------------------------------------------------
Corey Sweeney ([email-masked]) reported (12/8/93) that

Sometimes when loading config.sys you will get a error message
saying something like "error in line 6 of config.sys".  The problem
will go away if you add several carriage returns at the end of your
config.sys.

Section 4:  Serial ports and mice
=================================
Q4.1	Where are the (microsoft compatible) mouse drivers?
-----------------------------------------------------------
Tom Kimball ([email-masked]) reported (11/24/93) that

Several people said to use a different mouse driver and suggested
some.  I found a couple that seem to work fine.

   oak.oakland.edu:/pub/msdos/mouse/mouse701.zip   (mscmouse)
   oak.oakland.edu:/pub/msdos/mouse/gmous102.zip   (gmouse)

Q4.2	Why doesn't the mouse driver work?
------------------------------------------
[email-masked] (Scott D. Heavner) reported (11/27/93) that

If you start the mouse driver and it just hangs (it might actually
take 30-60s), but if you are waiting longer than a minute for the
mouse driver to start, remove any "timer" lines in your config
file.

Q4.3	How do I use dosemu over the serial ports?
--------------------------------------------------
Corey Sweeney ([email-masked]) reported (12/8/93) that

If you plan to be using dosemu over a serial line, telnet
session, or just don't want to use raw console mode, then you will
probably want to get to know the termcap file.  For those who don't
know, the termcap file is usually located in the /etc directory.
It contains the information on what sequences of characters to send
to your terminal, and what sequences of characters from your
terminal represent what keystrokes.  If when you hit F5, and it
does not work, it will usually be the fault of a incorrect termcap
entry.  (To learn more about termcaps look up the termcap man page.)

Now the information in the termcap relates to entries in the dosemu
code.  So after you put k5=\E[[E in your termcap, whenever
your terminal sends \E[[E, dosemu translates that and says
``he hit the k5 key!''.  Then it is up to dosemu to figure out what the
proper scancode for the k5 key is, and push that into the buffer in
some magical way.  To determine the scancode, it looks up in a little
table in termio.c.  In termio.c under the line which (currently) says

   #define FUNKEYS 20

There exist several lines following the form

   {NULL, "termcap code", scancode} /* name of key */

so when it says

   {NULL, "k5", 0x3f00} /* F5 */

it's saying that 0x3f00 is the scancode for F5, and that when the
person activates the k5 sequence (defined in the termcap) to stuff the
F5 scancode into the buffer.  

Now that's all fine and dandy for analyzing how dosemu does this,  but
you probably want to be able to do something with this new
information.  Well you can add functionality for the F11 and F12 keys
(and any other keys that you can find the scancode for).

All you have to do is add a line to the termio.c table that says:

   {NULL, "ka", 0x8500} /* F11 */

Then to actually get it to read the line you just put in, add one to
the FUNKEYS number.

   #define FUNKEYS = 21

Then add a ``ka'' entry to your termcap.  After that, every time you hit
the sequence stored in your termcap for ka, your dos program
recognizes an ``F11''.

! Warning:  Make sure that ka is not in use in your termcap.  If it is
            you are headed for trouble.

Note:  The scancode for F12 is 0x8600.

Section 5:  dosemu and X-windows
================================
Q5.1	Can I run dosemu in console mode while running X?
---------------------------------------------------------
Ronald Schalk ([email-masked]) reported (1/17/94) that

Yes, no problem, just remember to use ctrl-alt-<Fn> to go to a Virtual
Console (VC), and you can run any Linux application (dosemu is a
linux-application).  I've got almost always WP5.1 in a dos session.

[Note:  Use alt-F7 to switch back to X from dosemu.] 
[Note:  Some people have reported problems when dosemu is started before X]

Q5.2	Is it possible to run dosemu in an xterm?
-------------------------------------------------
Evmorfopoulos Dimitris ([email-masked]) reported (12/10/93) that

It is possible to run dosemu under an xterm, but without any
graphics, and with no more than 128 characters.

Section 6:  Video
=================
Q6.1	Exiting from dosemu gives me a screen full of garbage.
--------------------------------------------------------------
Keith A Grider ([email-masked]) reported (12/5/93) that

I have seen many postings concerning this with exit from X as well
as exiting from a graphic dos screen.  it seems to be prevalent
among ATI graphic card users as well as a few others.  The problem
is that the font information for the vga text screen is not being
saved.  The only way I have been able to fix it is to download the
vgalib-090.tar.gz file from sunsite.unc.edu.  It is (I believe) in
the pub/Linux/GCC directory.  You get a lot of stuff that is not
directly used to solve this problem, but in the fonts directory
that is created when you untar the file, there are 2 files of
interest, runx and restorefont.  Read the README file in this
directory.  Copy runx and restorefont to a directory in your path.
when runx is used, for example, it saves the font information in
tmp/fontdata.  I use a file called fix which consists of the line:

   restorefont -r /tmp/fontdata

so that it is easy to 'fix' a vt when I go there from X
(i.e. ctrl-alt-f2).  This should also work for dosemu.  I think the
XFree86 people know about the problem and are working on a solution
as this is a bit of a kluge.

Q6.2	How do I get dosemu to work with my Trident or Actix video card?
------------------------------------------------------------------------
[The screen flickers violently, displays the video BIOS startup
message, and hangs.]

Andrew Tridgell ([email-masked]) reported (1/29/94) that 

I found with early versions it would work if I used:

   ports { 0x42 }

but that sometimes my machine would crash when it was cycling the
video bios in dosemu. This is because you're allowing the VGA bios to
re-program your clock, which severely stuffs with Linux.

This prompted me to write the readonly and masking patches for dosemu,
which I believe are still in the latest version. I now use:

   ports { readonly 0x42 }

and it boots dosemu more slowly, but more reliably.

Tim Shnaider ([email-masked]) also reported (1/18/94) that

One way of fixing this is to use the GETROM program to dump your video
bios to a file and edit the config file in the /etc/dosemu directory
There will be a few video lines.  Here is my video line

   video { vga console graphics chipset trident memsize 1024 vbios_file
   /etc/dosemu/vbios }

where vbios is the file generated by typing 

   getrom > vbios

Section 7:  Problems and fixes
==============================
Q7.1	Why does dosemu lock up after one keystroke?
----------------------------------------------------
(12/17/93)

You need to turn on the keyboard interrupt in the dosemu config file.
Add a line to the config file:

   keybint on

Q7.2	Why does my ethernet driver lock-up dosemu?
---------------------------------------------------
James B. MacLean ([email-masked]) reported (1/16/94) that

If you have Linux networking turned on for your card, it is not
accessible to DOSEMU at this time.  It is also true that the default
dosemu will not get interrupts from the kernel. That said, if you'd
like to give your NIC to dosemu for it to control, maybe for access to
Netware on the network through a NETX client, I do have a driver
(Silly Interrupt Generator) to put in the kernel that any program,
like dosemu can use to get at the interrupt for your NIC.  I use it in
DOSEMU to access a Novell Lite network.  Speed is not it's high point,
but it does seem to work :-).

Any interested parties should E-mail me ([email-masked]) and
I'll pass along some directions.

Q7.3	Why are my keystrokes echoed ttwwiiccee??
-------------------------------------------------
(1/20/94)

You have an old version of dosemu.  Get the latest version and apply
all patches.

Q7.4	Why does give "divide overflow" errors after running for more
        than 24-hours? 
---------------------------------------------------------------------
(1/17/94)

This is a known bug.  It will (hopefully) be fixed in an upcoming
release.  For now, you can simply exit dosemu and start it again.

Q7.5	Where did the debugging output go?
------------------------------------------

As of dosemu0.49pl4, stderr is automatically redirected to /dev/null.
Try "dos -D+a 2>debug" to turn on debugging information and redirect
it to the file "debug".

Section 8:  Contributing to the dosemu project
==============================================
Q8.1	Who is responsible for dosemu?
--------------------------------------
(12/17/93)

Dosemu is built upon the work of Matthias Lautner and Robert Sanders.
James B. MacLean ([email-masked]) is responsible for
organizing the latest releases of dosemu.

                       History of dosemu

          Version    Date                Person           
         -------------------------------------------------
          0.1        September 3, 1992   Matthias Lautner
          0.2        September 13, 1992  Matthias Lautner
          0.3        ???                 Matthias Lautner
          0.4        November 26, 1992   Matthias Lautner
          0.47       January 27, 1993    Robert Sanders
          0.47.7     February 5, 1993    Robert Sanders
          0.48       February 16, 1993   Robert Sanders
          0.48pl1    February 18, 1993   Robert Sanders
          0.49       May 20, 1993        Robert Sanders
          0.49pl2    November 18, 1993   James MacLean
          0.49pl3    November 30, 1993   James MacLean
          0.49pl3.3  December 3, 1993    James MacLean
          0.49pl4    February 10, 1994   James MacLean

Q8.2	I want to help.  Who should I contact?
----------------------------------------------
The dosemu project is a team effort.  If you wish to contribute,
see the DPR (DOSEMU Project Registry).  A current copy may be found in
dspsun.eas.asu.edu:/pub/dosemu.