📄 ch62.htm
字号:
</CENTER>
<P>For mouse support, you can get Microsoft-compatible mouse drivers from <TT>oak.oakland.edu:/pub/msdos/mouse/mouse701.zip</TT>
(mscmouse). Make sure that you have the correct port assigned to the mouse. Even
so, some mice do not get recognized for up to 62 seconds, so be patient.</P>
<P>Another known problem is that DOSemu is not able to use COM4 after DOSemu finishes
execution. This port is at 0x2E8, <TT>/dev/cua3</TT> in Linux, and uses interrupt
5. You can run the following command:</P>
<PRE><FONT COLOR="#0066FF">setserial /dev/cua3 irq 5
</FONT></PRE>
<P>Another cure is to disable the <TT>allowvideoportaccess on</TT> line in the <TT>config</TT>
file.
<CENTER>
<H3><A NAME="Heading33<FONT COLOR="#000077">Optimizing DOSemu</FONT></H3>
</CENTER>
<P>A few changes will help DOS performance under DOSemu, short of buying a faster
PC.
<CENTER>
<H4><A NAME="Heading34<FONT COLOR="#000077">Using Garrot</FONT></H4>
</CENTER>
<P>Garrot is an MS-DOS-based Terminate and Stay Resident (TSR) program, written by
Thomas G. McWilliams, that releases CPU time from a DOSemu process back to Linux.
Some MS-DOS applications poll endlessly on events such as keyboard input.<EM> </EM>Garrot
keeps track of how long a DOS application has been running without giving control
back to Linux. After a threshold of time has expired, control returns to Linux. The
Garrot threshold is best determined by trial and error.<EM> </EM>A good initial value
is half the bogo-mips value. Bogo-mips is the value that the Linux kernel for internal
delay loops, and it is displayed during bootup of the Linux kernel.</P>
<P>For CPU-intensive DOS applications, Garrot causes a minor degradation in CPU speed.
For non-CPU-intensive applications, Garrot shows a dramatic decrease in overall CPU
usage, as measured by the Linux utility called top.
<CENTER>
<H4><A NAME="Heading35<FONT COLOR="#000077">Other Optimization Suggestions</FONT></H4>
</CENTER>
<P>The following parameters in <TT>dosemu.conf</TT> can help speed up various aspects
of DOSemu:
<UL>
<LI><TT>Hogthreshold.</TT> Set this to half the value shown in bootup messages for
BogoMIP message.
<P>
<LI><TT>fastfloppy</TT>.
<P>
<LI>X parameters <TT>"updatefreq"</TT> and <TT>"updatelines"</TT>.
<P>
<LI><TT>-c</TT> option on the DOS command line.
</UL>
<P>Because DOSemu runs as a Linux process, any general Linux optimizations should
also help performance under DOSemu. Typical optimizations include having enough swap
space, optimizing the kernel, and killing unneeded Linux processes.
<CENTER>
<H3><A NAME="Heading36<FONT COLOR="#000077">Sources for More Documentation
About DOSemu</FONT></H3>
</CENTER>
<P>The DOSemu manual (<TT>dosemu.texinfo</TT>), written by Robert Sanders, has not
been updated in some time but is still a good source of information. It is distributed
with DOSemu.</P>
<P>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 people who want
to modify the source code themselves. DANG is maintained by Alistair MacDonald (<TT>am20@unix.york.ac.uk</TT>)
and is posted periodically to the MSDOS channel of Linux Activists.</P>
<P>The EMU success list (<TT>EMUsuccess.txt</TT>) is a list of all programs that
have been reported to work with DOSemu. It is posted periodically to the mailing
list. The most recent version can be found on <TT>dspsun.eas.asu.edu:/pub/dosemu</TT>.</P>
<P>Of course, there is the DOSemu FAQ/HOWTO. But you already know about that, don't
you? It is also posted frequently to the mailing list. The most recent version can
be found on <TT>dspsun.eas.asu.edu:/pub/dosemu</TT>.
<CENTER>
<H4><A NAME="Heading37<FONT COLOR="#000077">Where to Get More Information About
DOSemu</FONT></H4>
</CENTER>
<P>Try subscribing to the <TT>linux-msdos-digest</TT> mailing list. To subscribe,
send e-mail to <TT>Majordomo@vger.rutgers.edu</TT> with the following command in
the body of your message:</P>
<PRE><FONT COLOR="#0066FF">subscribe linux-msdos-digest your_username@your.email.address
</FONT></PRE>
<P>To get rid of these messages, send e-mail to <TT>Majordomo@vger.rutgers.edu</TT>
with the following command in the body of your e-mail message:</P>
<PRE><FONT COLOR="#0066FF">unsubscribe linux-msdos-digest your_username@your.email.address
</FONT></PRE>
<DL>
<DT><FONT COLOR="#0066FF"></FONT></DT>
</DL>
<DL>
<DD>
<HR>
<A NAME="Heading38<FONT COLOR="#000077"><B>TIP:</B> </FONT>The <TT>Netware-HOWTO</TT>
by Lauri Tischler (<TT>ltischler@fipower.pp.fi</TT>) is now a separate document.
It is included with the DOSemu distribution and can also be found at <TT>sunsite.unc.edu</TT>.
<HR>
</DL>
<CENTER>
<H3><A NAME="Heading39<FONT COLOR="#000077">How DOSemu Works</FONT></H3>
</CENTER>
<P>DOSemu works similar to the DOS feature of MS-Windows in that it uses the virtual
86 (vm86) feature of the i386 and above chips. Under vm86, a process runs under a
private 80x86 environment that is isolated by the i386 processor from any other process.</P>
<P>In addition to private access to an 80x86 processor, MS-DOS and MS-DOS applications
need to interact with PC hardware through port accesses and interrupt functions.
In vm86 mode, both port access and interrupts return vm86 back to the DOSemu.</P>
<P>For port access attempts, DOSemu tries to recognize the port and either simulates
its function or passes the request to the real hardware. Ports that DOSemu is allowed
to map are configured by the <TT>Port</TT> parameter in <TT>dosemu.conf</TT>. Direct
access to hardware ports is possible under Linux through <TT>/dev/kmem</TT> support.</P>
<P>DOS interrupt functions are widely understood and well-documented. Interrupts
are caught from virtual 86 mode and are implemented by executing the equivalent functionality
as Linux system calls.
<CENTER>
<H3><A NAME="Heading40<FONT COLOR="#000077">A Brief History of DOSemu and Its
Contributing Authors</FONT></H3>
</CENTER>
<P>The first release of DOSemu was written by Matthias Lautner in September 1992.
Since that time, many other people have contributed major pieces of functionality.
There are too many authors to name, but some of the more significant contributors
include Robert Sanders, James MacLean, Andres Tridgell, Stephen Tweedie, and Andreas
Kies. Other parts of DOSemu functionality were borrowed from Carnegie-Mellon's MACH
DOS emulator.
<CENTER>
<H4><A NAME="Heading41<FONT COLOR="#000077">Portable DOS Emulation with Bochs</FONT></H4>
</CENTER>
<P>The Bochs emulator is a new contender as a DOS emulator for Linux. The emulator
fully emulates the 80286 instruction set. A beta version for the 80386 was under
development when this book went to print. The author of this program is Kevin P.
Lawton. You can send mail to the developers via the address <TT>boac@world.std.com</TT>.
Information that is more up-to-date than any printed matter can be seen on the Web
pages at <TT>http://world.std.com/~boch</TT>.</P>
<P>The Bochs software is shareware and is not entirely free. There is a US $25 charge
for using Bochs in a commercial application and an "optional" fee for personal
use. Maybe the cost of a pizza will do? Send mail to the author for an exact amount.
Also, pronounce Bochs as "box," not as "Boches." Looking at the
source code in some of the C files revealed that the Bochs product is labeled a commercial
product, as opposed to a shareware product.</P>
<P>The main advantage of Bochs over DOSemu or Wine is that Bochs requires no x86
instruction set to run on. All BIOS and the instruction set are emulated in software.
This causes Bochs to run slower than DOSemu, but it also makes Bochs portable to
other UNIX platforms, such as Sun Microsystem Inc.'s Solaris. The Bochs emulator
literally emulates a CPU in software and processes instructions individually.</P>
<P>Bochs runs Windows 3.1 with enhanced mode support and runs DOS up to version 6.22.
Only monochrome monitors are supported. There is neither support for networking nor
support for mice. The maximum hard drive size I worked with was 20MB, although the
documentation mentions that up to 30MB can be supported.
<CENTER>
<H4><A NAME="Heading42<FONT COLOR="#000077">Installing and Running Bochs</FONT></H4>
</CENTER>
<P>Before you install Bochs, you must have a DOS bootable floppy on hand. Bochs does
not provide a way for you to create a DOS bootable floppy. Find or make such a floppy
while you download Bochs. Also, you will need the <TT>FORMAT.COM</TT> and <TT>FDISK.EXE</TT>
programs on the floppy. Be sure to copy these DOS files onto the bootable floppy.
The size of the bootable floppy will depend on what <TT>/dev/fd0</TT> points to in
your Linux machine. In my case, it points to <TT>/dev/fd0H1440</TT>, a 1.44MB floppy
drive.</P>
<P>Now let's go get the distribution files. The latest version of the software was
<TT>962928a.tar.gz</TT> in the ftp site and directory <TT>world.std.com/pub/bochs</TT>.
(You will most likely get a later version.) The format for file archives is</P>
<PRE><FONT COLOR="#0066FF">bochs-YYMMDD.tar.gz
</FONT></PRE>
<P>where YY is the year, MM the month, and DD the day. The way to unzip and install
the program is to use the following commands in the directory where you download
the archive:</P>
<PRE><FONT COLOR="#0066FF">$ gunzip -d bochs-962928a.tar.gz
$ tar -xvf bochs-962928a.tar
</FONT></PRE>
<P>You will find a subdirectory called <TT>bochs-</TT>YYMMDD in the directory where
you untarred the files. Go to this subdirectory and then modify the environment to
set the <TT>CFLAGS</TT> variable to <TT>"-O3 -Wall -m486"</TT> even if
you use a Pentium processor:</P>
<PRE><FONT COLOR="#0066FF">$ CFLAGS="-O3 -Wall -m486"; export CFLAGS
</FONT></PRE>
<P>Then run the configure script like this:</P>
<PRE><FONT COLOR="#0066FF">$ ./configure --enable-80286 --enable-native-floppy
$ make
</FONT></PRE>
<P>The make program might complain about not finding the VGA font. The <TT>INSTALL</TT>
file in the Bochs archive contains information about how to install this software.
Copy the file <TT>vga.pcf</TT> into the <TT>/usr/lib/X11/fonts/misc</TT> directory
as root, and run the make file again. The <TT>vga.pcf</TT> file is in the <TT>fonts</TT>
subdirectory of the Bochs distribution.</P>
<P>Now put the 1.44 boot floppy in drive A, and issue the following command to copy
the image to a file called <TT>1.44</TT>:</P>
<PRE><FONT COLOR="#0066FF">$ dd if=/dev/fd0 of=1.44 ibs=512
</FONT></PRE>
<P>Then create a 20MB hard drive image with a bunch of zeroes in it. Here is the
command to do this:</P>
<PRE><FONT COLOR="#0066FF">$ dd if=/dev/zero of=20M bs=512 count=41820
</FONT></PRE>
<P>Now modify the contents of the <TT>.bochrc</TT> file in the source tree root to
contain the following lines:</P>
<PRE><FONT COLOR="#0066FF">floppya: file=./1.44
floppyb:
diskc: file=./20M
</FONT></PRE>
<P>The <TT>floppyb</TT> line is empty to indicate that there is no drive B. With
the floppy disk still in drive A, start the Bochs emulator with this command:</P>
<PRE><FONT COLOR="#0066FF">$ bochs -bootA
</FONT></PRE>
<P>After a brief flurry of messages, you will see a DOS prompt. The emulator somehow
manages to bypass the DOS standard request for date and time and presents the prompt
directly. If you have an <TT>autoexec.bat</TT> file in the boot floppy whose image
you created, the <TT>autoexec.bat</TT> file will be used instead.</P>
<P>When you first boot up, drive C (your 20MB file) is empty. You have to run the
FDISK program to set up the partitions and format them. Sounds scary, doesn't it?
Don't worry; as long as you have set up the file names correctly in the <TT>.bochrc</TT>
file, you should be working only with diskimages. I did not have the guts to change
the filenames in the <TT>.bochrc</TT> file to a device name just yet.</P>
<P>Within FDISK, choose the Create Primary Partition option. Assign all 20MB to this
primary partition by allowing for the maximum size. After the FDISK program is done,
you must reboot the Bochs emulator. Stopping the emulator is easy; just click once
with the mouse on the screen.</P>
<P>Restart Bochs and then format drive C:</P>
<PRE><FONT COLOR="#0066FF">$ bochs -bootA
A> format /s C:
</FONT></PRE>
<P>After the format is complete, stop the emulator by clicking your mouse on the
window.</P>
<P>Now, let's see whether we can access the floppy on the Linux machine from within
Bochs. Modify the <TT>floppyb</TT> in the <TT>.boschrc</TT> file to this:</P>
<PRE><FONT COLOR="#0066FF">floppyb: file=1_44=/dev/fd0
</FONT></PRE>
<P>Now drive B is the physical floppy <TT>/dev/fd0</TT> on the Linux machine. To
boot via drive C, run the Bochs emulator with this command:</P>
<PRE><FONT COLOR="#0066FF">$ bochs -bootC
</FONT></PRE>
<P>At this point, you can do several things, including installing Windows 3.0 or
3.1. Do not install Windows for Workgroups 3.11 because THE SETUP program for 3.11
locked up the emulator. (I had to dig out my old Windows 3.0 disks for this one.)
Also, the Windows keyboard support is for the <TT>All AT Keyboards</TT> selection
only. Other standard entries for the Windows setup worked as promised.</P>
<P>The DOS print command did not work at all. Also, the printer support did not work
at all in Windows. There is no mention of work toward such a venture in documentation
outlining future work.</P>
<P>Another important point to remember is that, even though you are running Windows,
there is no mouse support. One click of the mouse in the window under Bochs brings
the emulator to a screeching halt. Also, the documentation mentions limited CMOS
and BIOS interrupt emulation, so even some DOS games might not work correctly. This
is still in beta stages.</P>
<P>All in all, the Bochs emulator is a good package even in its beta state. Its future
enhancements such as support for the mouse and for the use of color VGA monitors
will make Bochs a very lucrative, portable DOS emulator. Stay tuned to the Net for
further releases.
<CENTER>
<H3><A NAME="Heading43<FONT COLOR="#000077">Summary</FONT></H3>
</CENTER>
<P>Several DOS emulators are available for UNIX (and Linux). This chapter provides
only a very brief introduction to a few of these emulators. Just keep in mind that
an emula
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -