[Addendum: this is probably out of date, but I am not updating this (no, I
am not lazy, it's just that I decided to _completely_ rewrite this stuff. 
The only significant new thing is the video-mode-changing code.  This code
is very rough, but works for me - it needs you to be root (so that it can
mmap the various things, and to access the IO ports.]

[Further Addendum: I have list.com running quite well now.  I have also
started work on the _complete_ rewrite, so this code is dis-continued
except for use as a reference - it works, but I have gotten to the stage
where a nice,clean,moduar interface would help things.  There is also the
few remaining parts left from dosemu that need rewriting that will be done
in the new version]

[01/05/94:  Hmm, if I need to do this much more, I should just rewrite this
README file,...   Anyway, a very big thankyou to Michael Beck
(beck@informatik.hu-berlin.de), who sent me the patch to make EXE files work
in this version.  Also new is the support for the kernel-mode emulation of
some of the privelidged instructions (CLI/STI/PUSHF/POPF etc..) that is
present in kernels 1.1.8 and above.]


			       'Virtual DOS'
			     (a DOS emulation)

(note: not to be confused with dosemu, which is a IBM emulator that runs
MSDOS. )

This is a very small subset of what is needed to fully emulate MSDOS without
using any of MSDOS itself.  I re-wrote this from version 0.2x of dosemu over
a period of about a week, and then left it to rust for about six months.  I
would very much like to see something come from this idea, as it is a (IMHO)
much nicer method of running DOS programs than dosemu.  As I have now
finished work on this code, I am not expecting to have much development
spring from it.  However, if you want to help write something like this, get
in touch with me as I am probably going to try and develop the 'new,
improved' version much further than this version went.  I would like to know
what happens with this code - so, anyone who reads this and goes on to
use/modify the code, I would apreciate it if you dropped me a line and told
me about it.

About the code:
---------------

The one program that executes (almost) so far is PKUNZJR.COM - and that
program could be made to work quite easialy as is fails on things like
changing attribs... (in fact, you may find that I have altered this code to
make it work :)
File functions are done by passing _DIRECTLY_ the file-handle from Linux
to the DOS program - I _think_ that this is safe, but, still seems a likely
point for problems to me.
There is a define for the debugging file in global.h (yes, I could make it
a command-line option, but that would mean that I would have to learn how to
use getopt, or somesuch, and the current command-line usage is nice, simple
and efficient.

This seems like a good time to put my philosiphy (spell?) forward..

I dont like raw keyboard access, or raw video access - because that
precludes terminals/telnet's etc.. from using the code.  I dont like
clearing the screen or other such sillyness because that means that you cant
use a script and make the dos program look like a _real_ unix program.  I
dont like emulating devices, because I have yet to find a DOS program that
would use those devices that works better than the unix program, so I just
dont use programs that need those devices.  I dont like it, but I have to
accept that I need to emulate some things that an annoyingly large number of
programs expect - ie: the video status reg (inp's are currently set to give
some emulation for reading from the video status ... note: only _some_). I
also dont like needing special priviledges (suid Root, etc).

My ultimate idea was to end up with a program that I could use as a shell
for DOS programs - like you use /bin/sh as a shell for shell-scripts.  It
would be trivial to change the exec function to exec the dosemulator instead
of the program, if it finds the magic-number for a .EXE file (.COM files are
a little trickyer, but the general case magic-number's could be used and
shell-wrappers for others).

[One day later ;-)]
Right,. I got side-tracked into getting this working - It wouldnt work
because between now and the last time I used it, some things changed to make
executable areas to be non-writeable: making the emulator fail with
sigsegv's while initilizing the low-mem area..., and now - PKUNZJR.COM
_seems_ to work, but has _strange_ problems now-and-again (!) - I put some
really not nice date-and-time functions (basically, it does nothing, but
doesnt halt the emulator) and it worked..

Running the program:
--------------------

All that you should need to do to get this working is a make in its
directory.  The one option is the logging option (mentioned above).  To
install you need to be root, then just 'make install' - it uses the library
'dosemu.2d'. To use it run like this:

		dos <dos-executable> <paramaters.....>

and all should be fine.  NOTE: you do NOT need to make the 'dos' stub file
suid or sgid to root, and you dont even need any special priviledges to run
this emulator.  Included are two dos programs - cmdline.com, which just
prints out its command-line, and list.com, which I was using as my 'program
to get running' until I ran into the brick-wall of allocation routines. 
When you run a program, your debugging output will include the number and
description of any DOS calls and Video and Disk BIOS calls.  Also, if the
program running hits some un-implemented things, or it does something that I
thought might need detailed warning about, the emulator will dump the
registers and disassemble the instruction pointed to by CS:IP.  The
dissasembly routines were stolen from the Mach IBM-emulator, and they noted
that they had stolen it from GNU GDB.  It is different from the current gdb
80x86 dis-assembly code, but I like it better than the latest code (it is
more self-contained and only needs the one file), but this could be because
it was modified by the Mach people, i dont know...


Anyway, that is enough waffle...
If you have any questions, dont hesitate to drop me a line.

		Hamish Coleman  (hamish@zot.apana.org.au)
