Home >System Tutorial >LINUX >Methods and steps for executing DOS programs on Linux

Methods and steps for executing DOS programs on Linux

王林
王林forward
2024-01-23 13:48:051263browse

There are many reasons to run an old DOS application these days. Maybe it's pulling a report from a legacy business application, or wanting to play a classic DOS game, or just because you're curious about "traditional computers." You don't need to dual-boot your system to run DOS programs. Instead, you can run them properly in Linux with the help of a PC emulator and FreeDOS.

FreeDOS is a complete, free, DOS-compatible operating system that you can use to play classic games, run legacy business software, or develop embedded systems. Any program that works in MS-DOS can also run in FreeDOS.

In those "old days", you installed DOS as a proprietary operating system on a computer. Today, it can be easily installed into a virtual machine running on Linux. QEMU (short for Quick EMUlator) is an open source virtual machine software that can run DOS as a "guest" operating system in Linux. Many popular Linux systems include QEMU by default.

Through the following four steps, it is easy to run an old DOS program under Linux using QEMU and FreeDOS.

Step 1: Set up a virtual disk

You need a place to install FreeDOS in QEMU, and for this you need a virtual C: drive. In DOS, the letters A: and B: were assigned to the first and second floppy drives, while C: was the first hard drive. Other media, including other hard drives and CD-ROM drives, are assigned D:, E:, and so on.

In QEMU, the virtual disk is an image file. To initialize a file to be used as a virtual C: drive, use the qemu-img command. To create an image file of about 200 MB, you can enter:

qemu-img create dos.img 200M

200MB seems very small compared to modern computers, but back in the 1990s, 200MB was very large. It is sufficient to install and run DOS.

Step 2: QEMU Options

Unlike PC emulation systems VMware or VirtualBox, you need to use the QEMU command to add the components of each virtual machine to "build" your virtual system. Although, this may seem laborious, it is not actually difficult. These are the parameters we use in QEMU to boot FreeDOS:

Step 3: Boot and Install FreeDOS

Now that QEMU is set up to run a virtual machine, we need a DOS system to install and boot into that virtual machine. FreeDOS makes this easy. Its latest version is FreeDOS 1.2, released in December 2016.

Download the FreeDOS 1.2 distribution from the FreeDOS website. The FreeDOS 1.2 CD-ROM "standard" installer (FD12CD.iso) runs fine with QEMU, so I recommend using this version.

Installing FreeDOS is easy. First, tell QEMU to use the CD-ROM image and boot from it. Remember, the first hard drive is the C: drive, so the CD-ROM will appear as the D: drive.

qemu-system-i386 -m 16 -k en-us -rtc base=localtime -soundhw sb16,adlib -device cirrus-vga -display gtk -hda dos.img -cdrom FD12CD.iso -boot order=d

As shown below, you will have FreeDOS installed in a few minutes.
如何在 Linux 中运行 DOS 程序!

Starting FreeDOS installation

如何在 Linux 中运行 DOS 程序!

Select your keyboard layout

如何在 Linux 中运行 DOS 程序!

Selecting which packages to install

如何在 Linux 中运行 DOS 程序!

Rebooting after installation

After your installation is complete, close the window and exit QEMU.

Step 4: Install and run your DOS application

Once FreeDOS is installed, you can run various DOS applications in QEMU. You can find old DOS programs online through various archives and other websites.

QEMU provides a simple way to access local files on Linux. For example, I want to use QEMU to share the dosfiles/ folder. By using the -drive option, you simply tell QEMU to use this folder as a virtual FAT drive. QEMU will access this folder like a hard drive.

-drive file=fat:rw:dosfiles/

Now, you can start QEMU with the appropriate options, plus an external virtual FAT drive:

qemu-system-i386 -m 16 -k en-us -rtc base=localtime -soundhw sb16,adlib -device cirrus-vga -display gtk -hda dos.img -drive file=fat:rw:dosfiles/ -boot order=c

一旦你引导进入 FreeDOS,你保存在 D: 驱动器中的任何文件将被保存到 Linux 上的 dosfiles/ 文件夹中。可以从 Linux 上很容易地直接去读取该文件;然而,必须注意的是,启动 QEMU 后,不能从 Linux 中去改变 dosfiles/ 这个文件夹。 当你启动 QEMU 时,QEMU 一次性构建一个虚拟的 FAT 表,如果你在启动 QEMU 之后,在 dosfiles/ 文件夹中增加或删除文件,仿真程序可能会很困惑。

我使用 QEMU 像这样运行一些我收藏的 DOS 程序, 比如 As-Easy-As 电子表格程序。这是一个在上世纪八九十年代非常流行的电子表格程序,它和现在的 Microsoft Excel 和 LibreOffice Calc 或和以前更昂贵的 Lotus 1-2-3 电子表格程序完成的工作是一样的。 As-Easy-As 和 Lotus 1-2-3 都保存数据为 WKS 文件,最新版本的 Microsoft Excel 不能读取它,但是,根据兼容性, LibreOffice Calc 可以支持它。
如何在 Linux 中运行 DOS 程序!

As-Easy-As 电子表格程序

我也喜欢在 QEMU中引导 FreeDOS 去玩一些收藏的 DOS 游戏,比如原版的 Doom。这些老的 DOS 游戏玩起来仍然非常有趣, 并且它们现在在 QEMU 上运行的非常好。

如何在 Linux 中运行 DOS 程序!

Doom

如何在 Linux 中运行 DOS 程序!

Heretic

如何在 Linux 中运行 DOS 程序!

Jill of the Jungle

如何在 Linux 中运行 DOS 程序!

Commander Keen

QEMU 和 FreeDOS 使得在 Linux 上运行老的 DOS 程序变得很容易。你一旦设置好了 QEMU 作为虚拟机仿真程序并安装了 FreeDOS,你将可以在 Linux 上运行你收藏的经典的 DOS 程序。

所有图片要致谢 FreeDOS.org。

作者简介:

Jim Hall 是一位开源软件的开发者和支持者,可能最广为人知的是他是 FreeDOS 的创始人和项目协调者。 Jim 也非常活跃于开源软件适用性领域,作为 GNOME Outreachy 适用性测试的导师,同时也作为一名兼职教授,教授一些开源软件适用性的课程,从 2016 到 2017, Jim 在 GNOME 基金会的董事会担任董事,在工作中, Jim 是本地政府部门的 CIO。

The above is the detailed content of Methods and steps for executing DOS programs on Linux. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:linuxprobe.com. If there is any infringement, please contact admin@php.cn delete