打开APP
userphoto
未登录

开通VIP,畅享免费电子书等14项超值服

开通VIP
Linux DOS Emulator
LINUX CLASSES - DOS

DOSemu (DOS Emulator) is a program that lets you run many of your favorite DOS applications under Linux. The name is a littlebit misleading--it doesn't actually emulate DOS; it boots DOS to a virtual machine using the special hardware features in Intel80386 and higher CPUs.A DOSemu session looks and acts like a real DOS session, with a few limitations on what can be done. Not all video and sound cardsare supported under DOSemu, and some programs that require DPMI (DOS Protected-Mode Interface) will not run. The mostnotable examples are Windows-based programs, although some people do report being able to run some under DOSemu.

Setting Up DOSemu

Setting up DOSemu is not hard, but it does require a few steps to get a fully functioning DOS session up and running.Because the software is being actively developed and improved, I strongly recommend that you get the latest versionavailable from the DOSemu Web site at http://www.dosemu.org.After downloading the RPMfile for DOSemu, issue this command while logged in as root:

rpm -i dosemu-0.98.6-1.i386.rpm

Configuring DOSemu

The package is now installed, but we need to tweak the DOSemu configuration file before using it. Edit the/etc/dosemu.conf file and modify the $_hdimage entry so that it reads as follows:

$_hdimage = "hdimage.test /dev/hda1"

The hdimage.test file resides in your/var/lib/dosemu directory and is a hard disk image--a special Linux filethat contains a complete DOS system. The line you just modifed tells DOSemu to treat thehdimage.test file as the C drivewhen DOSemu is started. This C drive is not your beloved DOS partition; it's a simulatedbootable hard-disk partition containing theFreeDOS operating system?a freeware clone ofMS-DOS. The /dev/hda1 portion of the modified line tells DOSemu to treatyour real DOS partition as the next drive letter, or the D drive. (You can boot DOSemudirectly from your real DOS partition, butwe'll address that later.)

Starting a DOSemu Session

Before starting a DOSemu session, which will be accessing /dev/hda1(your MS-DOS partition), it's very important to unmountthe partition. Otherwise, the DOS virtual machine and your Linux system might be tryingto write to the disk simultaneously, withpotentially disastrous results. To unmount the partition, issue this command:

umount /dev/hda1

Now we're ready to fire up DOSemu. Issue the command shown here fromyour Linux command prompt:

dos

In a few seconds, you should see a DOS session start, and the familiarC:> prompt will appear. Voila--you're running DOS underLinux! Issue the dir command and have a look at the results. Don't panicif the listing of files is unfamiliar. Remember--what youhave here is a special C drive with the FreeDOS files that DOSemu will use to boot up.

FreeDOS in a DOSemu session.

You can switch to your D drive (your DOS partition) by issuing the D:command and then change directories, view files, executeprograms, and so on. Because we booted from the C drive with FreeDOS, the config.sys andautoexec.bat files from your DOSpartition were not executed. This means that your normal DOS PATH variable will not be set,so you may have to use cd to get tothe appropriate directory before running a program.

Exiting from DOSemu

You can exit the DOSemu session by entering the following command at your C: prompt (notethat it won't work if you are at the D:prompt):

exitemu

If that doesn't work, or if your DOSemu session is frozen, log in from another virtual console and then use the ps and killcommands to find and terminate the DOSemu task. (See Chapter 3, "Living in a Shell," for details on killing an active task.)

The command "killall dosemu" will also work without having to do a ps.SmoogeIt's a good idea to copy the exitemu.com filefrom the C drive to the D drive so you can exit from DOSemu cleanly if you later decide to run DOSemu directly from your "real"DOS partition. To do so, enter this command from the C: prompt:

copy C:\exitemu D:\

Starting DOSemu with "Real" DOS

If any of your DOS programs don't run correctly as a result of finding themselves on a D drive instead of a C drive, you can start aDOSemu session by booting your "real" DOS partition. To do so, edit the /etc/dosemu.conf file and modify the$_hdimage entry so that it reads like this:

$_hdimage = "/dev/hda1"

This tells DOSemu to treat your DOS partition as the C drive and to boot the MS-DOS operating system instead of FreeDOS. Uponrestarting DOSemu, MS-DOS will try to start Windows 95/98, if you have it installed. This will surely lock up your machine,because DOSemu does not support Microsoft Windows. To avoid this problem, press the F8 key as soon as the message "StartingMS-DOS" appears and then select option 6, Command Prompt Only, to boot MS-DOS without starting Windows.

Additional DOSemu Configuration

By default, DOSemu starts with text-only video support and no support for serial ports. So if you want to run any graphics programsor use the mouse or modem, exit DOSemu and continue.

To enable support for graphics or the mouse or modem, edit the /etc/dosemu.conf file as described here. I recommend thatyou configure only the features you really need. Take these steps one at a time and test each new feature separately by startingDOSemu. That way, if a problem arises, you'll know which feature caused it, and you can go back to the /etc/dosemu.conffile and disable it or try an alternative.

Setting Up VGA Graphics

Look for the $_graphics and $_videoportaccess entries and change them to read as follows:

$_graphics = (1)
$_videoportaccess = (1)

Start DOSemu and test your graphics program. If it doesn't work, see the copious comments in the /etc/dosemu.conf file orat the DOSemu Web site for other things to try.

Setting Up Mouse Support

Look for the $_com1, $mouse, and $mouse_dev entries and change them as follows:

$_com1 = "/dev/mouse"
$_mouse = "microsoft"
$_mouse_dev = "/dev/mouse"

If your mouse is not on COM1, select the $comX entry corresponding to your mouse port. Set the $_mouse value accordingto the type of mouse you have. Most systems use a Microsoft mouse, but this value can be microsoft, mousesystems, logitech,mmseries, mouseman, hitachi, busmouse, or ps2. Start DOSemu and test your mouse application. Again, if you have problemsgetting the mouse to work, refer to the /etc/dosemu.conf file or the DOSemu Website?http://www.dosemu.org/.

Setting Up Modem Support

Look for the $_com2 entry and change it to read as follows:

$_com2 = "/dev/modem"

If your modem is not on COM2, select the $comX entry corresponding to your modem port. Start DOSemu and test your modemapplication.

Previous Lesson: Accesing DOS Partitions
Next Lesson: Updating Your Linux System

[ RETURN TO INDEX ]
   



Comments - most recent first
(Please feel free to answer questions posted by others!)

dosman     (26 Oct 2012, 04:05)
FYI, there is an easy to install dosemu with a package already built,rpmfusion has these.
Jamie     (25 Feb 2012, 17:48)
Hi there.

I have Linux Mint 11. I put DOS on through Synaptic. Didn't work. Idon't know why. So then I removed that through a terminal. Then I had aCD with DOS and put it on my computer in that fashion. Thought it wasloaded properly. I typed dosemu. Then I pressed enter. Here's the errorcode:

[: 373: -: unexpected operator
In file included from built-in global.conf:828
from built-in global.conf:686
Error in built-in global.conf: (line 825) Disk-device/file/var/lib/dosemu/drives/d doesn't exit.
1 error(s) detected while parsing the configuration-file.

So it doesn't open. Any ideas what I have done incorrectly?

Thanks!
Dan     (23 Feb 2012, 16:33)
I downloaded dosemu to linux mint 9, and i just want to know why does itsay that cant find root path to cdrom? And i also want to ask is thereanother way to make it work? I tried editing alot of files, but didnt work.Please help me!
ravi     (22 Feb 2012, 07:11)
how i run linux command in c lauguage?
harshali     (06 Jan 2012, 07:50)
i want same linux cammand run on Dos using C language PLZ help me in coding
Arthur N. Dunning III     (28 Sep 2011, 20:12)
Mr. Rankin, I am looking for information on how to install DOS programs ona DOS partition on my Linux machine. Can you offer any suggestions on whereI can look on the net for such information?
Akhtarul Kabir     (12 Dec 2010, 01:32)
I am new user of Red hat Linux OS. I require help and support to learn onthis OS.

Thanks.
Online Casino     (27 Sep 2010, 00:02)
excellent points and the details are more specific than elsewhere, thanks.

- Norman
Dimitris     (07 Sep 2010, 12:40)
Could anyone tell about 1.the reduction is speed (compared to native DOS ORunder Win98 and 2. If I can use linux network during Dosemu session ?
Bob Rankin     (11 Aug 2010, 14:51)
@Chem - See the Linux Does DOS section in the navigation bar on the leftside of this page.
chem cosmas     (11 Aug 2010, 13:34)
I want to learn how to work on Dos commands and what are the terms
I am a Cameroonian and I live in Cameroon.
Thanks
vinoth     (08 Mar 2010, 00:31)
This is nice article for the Dosemu beginners.Good

I welcome your comments. However... I am puzzled by many peoplewho say "Please send me the Linux tutorial." This website *is* your Linux Tutorial! Read everything here, learnall you can, ask questions if you like. But don't ask me to send what you already have. :-)
本站仅提供存储服务,所有内容均由用户发布,如发现有害或侵权内容,请点击举报
打开APP,阅读全文并永久保存 查看更多类似文章
猜你喜欢
类似文章
【热】打开小程序,算一算2024你的财运
http://blog.hijiam.com/archives/63
如何恢复LINUX的引导
如何删除 Linux 并安装 Windows XP
Dual-boot Linux/WindowsNT installation
linux 使用fdisk分区扩容
成功率很高的硬盘坏道软修复方法
更多类似文章 >>
生活服务
热点新闻
分享 收藏 导长图 关注 下载文章
绑定账号成功
后续可登录账号畅享VIP特权!
如果VIP功能使用有故障,
可点击这里联系客服!

联系客服