Home Emulators How To Run MS-DOS Games And Programs In Linux
Run MS-DOS Games And Programs In Linux Using DOSBox

How To Run MS-DOS Games And Programs In Linux

By sk
959 Views

Do you want to try some good-old MS-DOS games and defunct C++ compilers like Turbo C++ in Linux? Good! This tutorial will teach you how to run MS-DOS games and programs in Linux using DOSBox. It is an x86 PC DOS-emulator that can be used to run classic DOS games or programs. DOSBox emulates an Intel x86 PC with sound, graphics, mouse, joystick, and modem etc., that allows you to run many old MS-DOS games and programs that cannot be run on modern operating systems, such as Windows XP and later, Linux and FreeBSD. It is free, written using C++ programming language and distributed under GPL.

Install DOSBox In Linux

DOSBox is available in the default repositories of most Linux distributions.

On Arch Linux and its variants like Manjaro Linux, run:

$ sudo pacman -S dosbox

On Debian, Ubuntu, Linux Mint:

$ sudo apt-get install dosbox

On Fedora:

$ sudo dnf install dosbox

Configure DOSBox

There is no initial configuration required to use DOSBox and it just works out of the box. The default configuration file named dosbox-x.xx.conf exists in your ~/.dosbox folder. In this configuration file, you can edit/modify various settings, such as starting DOSBox in fullscreen mode, use double buffering in fullscreen, set preferred resolution to use for fullscreen, mouse sensitivity, enable or disable sound, speaker, joystick and a lot more. As I mentioned earlier, the default settings will work just fine. You need not to make any changes.

Run MS-DOS Games And Programs In Linux Using DOSBox

To launch DOSBox, run the following command from the Terminal:

$ dosbox

This is how DOSBox interface looks like.

Dosbox prompt

Dosbox interface

As you can see, DOSBox comes with its own DOS-like command prompt with a virtual Z:\ Drive. So if you're familiar with MS-DOS, you wouldn't find any difficulties when working in DOSBox environment.

Here is the output of dircommand (Equivalent of ls command in Linux)  output:

dir command output

dir command output

If you're a new user and it is the first time you use DOSBox, you can view the short introduction about DOSBox by entering the following command in DOSBox prompt:

intro

Press ENTER to go through next page of the introduction section.

To view the list of most often used commands in DOS, use this command:

help

To view list of all supported commands in DOSBox, type:

help /all

Remember, these commands should be used in the DOSBox prompt, not in your Linux Terminal.

DOSBox also supports a good set of keyboard bindings. Here is the default keyboard shortcuts to effectively use DOSBox.

Dosbox keyboard shortcuts

Dosbox keyboard shortcuts

To exit from DOSBox, simply type and hit ENTER:

exit

By default, DOSBox starts with a normal window-sized screen like above. To start dosbox directly in full-screen window, edit your dosbox-x.xx.conf file and set the value of fullscreen variable as enable. Now, DosBox will start in full-screen mode. To go back to normal screen, press ALT+ENTER.

Hope you learned the basic usage of DOSBox.

Let us go ahead and install some DOS programs and games.

First, we need to create directories to save the programs and games in our Linux system. I am going to create two directories named ~/dosprograms and ~/dosgames. The first directory is for storing programs and latter for storing games.

$ mkdir ~/dosprograms ~/dosgames

For the purpose of this guide, let me show you how to install Turbo C++ program and Mario game.

First, we will see how to install Turbo.

Download the latest Turbo C++ compiler, extract it and save the contents file in ~/dosprograms directory. I have save the contents turbo c++ in my ~/dosprograms/TC/ directory.

$ ls dosprograms/tc/
BGI  BIN  CLASSLIB  DOC  EXAMPLES  FILELIST.DOC  INCLUDE  LIB  README  README.COM

Start Dosbox:

$ dosbox

And mount the ~/dosprograms directory as virtual drive C:\ in DOSBox.

Z:\>mount c ~/dosprograms

You will see an output something like below.

Drive C is mounted as local directory /home/sk/dosprograms.
Dosbox prompt 1

Mount C drive in DOSBox

Now, change to the C drive using command:

Z:\>c:

And then, switch to tc/bin directory:

Z:\>cd tc/bin

Finally, run turbo c++ executable file:

Z:\>tc.exe

Note: Just type first few letters and hit ENTER to autocomplete the file name.

Run turbo c++ in dosbox

Run turbo c++ in dosbox

You will now be in Turbo C++ console.

Turbo C++ console in Dosbox

Turbo C++ console in Dosbox

Create new file (ATL+F) and start coding:

Turbo C++ console

Turbo C++ console

Similarly, you can install and run other classic DOS programs.


Troubleshooting:

You might be encountered with following error while running turbo c++ or any other dos programs:

DOSBox switched to max cycles, because of the setting: cycles=auto. If the game runs too fast try a fixed cycles amount in DOSBox's options. Exit to error: DRC64:Unhandled memory reference

To fix this, edit your ~/.dosbox/dosbox-x.xx.conf file:

$ nano ~/.dosbox/dosbox-0.74.conf

Find the following variable and change its value from:

core=auto

to

core=normal

Save and close the file. Now you can be able to run the dos programs without any problems.


Now, let us see how to run a dos-based game, for example Mario Bros VGA.

Download Mario game from here and extract the contents in ~/dosgames directory in your Linux machine.

Start DOSBox:

$ dosbox

We have used virtual drive c: for dos programs. For games, let us use d: as virtual drive.

At the DOSBox prompt, run the following command to mount ~/dosgames directory as virtual drive d.

Z:\>mount d ~/dosgames

Switch to D: drive:

Z:\>d:

And then go to mario game directory and run the mario.exe file to launch the game.

Z:\>cd mario
Z:\>mario.exe
Run mario game in dosbox

Run mario game in dosbox

Start playing the game:

Mario game in dosbox

Mario game running in dosbox

Similarly, you can run any dos-based games as described above. You can view the complete list of supported games that can be run using DOSBox here.


Suggested read:


Conclusion

DOSBOX is not a complete replacement for MS-DOS and it lacks many of the features found in MS-DOS. However, it is just enough to install and run most DOS games and programs.

For more details, refer the official DOSBox manual.

Thanks for stopping by!

Help us to help you:

Have a Good day!!

You May Also Like

1 comment

Giorgos September 5, 2018 - 11:24 pm

DOSEmu is also a must.
It runs games who DOSBox can’t (although without or with poor quality sound).

Reply

Leave a Comment

* By using this form you agree with the storage and handling of your data by this website.

This site uses Akismet to reduce spam. Learn how your comment data is processed.

This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish. Accept Read More