Web Control Panel – Building the Web Page – Raspberry Pi Pico, ESP32, Arduino
21st May 2023ESP32 Camera With LCD Panel Image Processing Overview and Setup and Motion Detection
5th June 2023Turn your old PC into a DOS gaming machine using DOSBox-X and Linux
We all have old PCs and laptops lying around gathering dust. But most of these scrap machines can have a new life as a DOS gaming computer.
In this video I’ll be showing you my best solution for getting an older PC to run reliably as a DOS computer with full graphics, sound, mouse and USB functionality.
The Problem with Native DOS
In a couple of my previous tutorials I’ve tried to build a DOS computer using DOS. Whilst this sounds like the most straightforward approach it introduces a whole range of problems. Most of these centre around the lack of driver software which interfaces DOS with the post DOS hardware inside even older PCs.
Up until around 2000 DOS formed the basis of all PC operating systems including the earlier versions of Windows. These machines use different hardware configurations for a number of peripherals, especially when it came to sound generation.
When DOS was incorporated into the Windows operating system the need for new DOS drivers vanished so newer hardware is no longer supported by DOS.
In my previous FreeDOS tutorial I tried the new SBEmu package which tried to add Sound Blaster capability to post DOS PCs. It worked to an extent but is still not fully compatible with all PCs and all software titles.
To get a reliable DOS killing machine will need to use a different route.
Emulation
Although we are using a PC the best way to get a fully compatible DOS PC is to use emulation. This removes the need to have specific driver software as the emulator package will create a virtual PC with all the correct sound and graphics hardware installed but then interface that with the more modern hardware inside the real machine. The upshot of this is that everything just works.
My preferred PC emulator is DOSBox and in this tutorial we’ll be using the slightly modified version DOSBox-X as it provides a nice menu-driven system to configure the application and hot swap floppy and CD images that can be attached to the virtual PC.
Base Operating System
To run DOSBox-X we need a base operating system for our PC hardware. Full versions of Windows and Linux run slowly on older hardware, especially when you go back to something like an Intel Core 2 Duo as I am with my old Hewlett-Packard PC.
Instead, I’m going to use a light version of Linux specifically designed for lower powered machines. This will give us access to all the modern software and hardware whilst allowing the machine to run at a very usable pace.
Putting It All Together
The first stage in building our DOS gaming PC is to install Linux. For this project I’m using my favourite light distribution, Lubuntu.
Visiting the website and going to the download page you’ll see a number of options. The recommended option will be for the latest stable release, but these versions will only be suitable for 64-bit computers. If your old PC has a 64-bit processor these will be fine, otherwise you’ll need to scroll down the page and click on the previous releases link to get to the older, 32 bit versions. The last 32 bit version was version 18.
The file you download is an image for a bootable USB stick, so you’ll need to use something like Etcher or the Raspberry Pi Imager to burn this onto a USB memory stick.
Once you’ve got your bootable USB stick you simply need to plug it into your old PC and get it to boot from the USB port.
Once you do this Lubuntu will boot directly from the USB stick. We now need to transfer the operating system onto the hard drive of the PC.
We will need Internet access to complete the installation process to make sure you’ve either got an ethernet cable plugged in or a Wi-Fi adapter attached to your PC.
You’ll find an Install Lubuntu icon on the desktop. Clicking that will start the installation process.
Once Lubuntu is installed we are ready to set up DOSBox-X
Installing DOSBox-X
The DOSBox-X website is at https://dosbox-x.com/.
If you scroll down to the Linux version section you’ll see a link to the FlatPak package page.
FlatPak is a Linux package manager that allows you to easily download and install a range of software. Our first task therefore is to install FlatPak.
If you browse to https://flatpak.org/setup/ you’ll see a number of icons for the various Linux distributions. Lubuntu is based on Ubuntu so select the orange circle in the top left corner. This will take you to the installation instructions. As will be using our Linux terminal we only need to follow step one and step three.
On your DOS gaming PC boot into Lubuntu and press CTRL + ALT + T to open up a terminal window. You then simply need to type in the two commands. If you use the built-in browser in Lubuntu you will be able to simply copy and paste these commands.
sudo apt install flatpack
sudo apt install gnome-software-plugin-flatpak
Once FlatPak is installed we can download and install the DOSBox-X package.
flatpak install flathub com.dosbox_x.DOSBox-X
Once DOSBox-X is installed you’ll find it listed in the start menu inside the game section, or you can simply run the following command from the terminal to start the application.
flatpak run com.dosbox_x.DOSBox-X
Setting up DOSBox-X
When you first run DOSBox-X it will appear as a small window on your desktop. The menu bar across the top of this window lets you access all the features of the software. To begin with we need to adjust some settings to get the emulator running the way we want it.
Click on the main menu and select the Configuration Tool. In the SDL section we can set up the graphics display. If you want DOSBox-X to run in fullscreen mode when it starts take the fullscreen checkbox. If there are any sizing issues in fullscreen mode you’ll need to adjust the fullresolution setting. Just tell it what your monitor pixel dimensions are (1920×1080) and that should fix the problem.
The output setting let you specify an output driver for the emulator. There are a range of options that will control the way your DOS computer screen looks. My preferred option is opengl which will use the OpenGL driver and display the DOS computer screen as it would have looked on a real DOS computer. The openglpp option uses pixel perfect output using square pixels rather than the original rectangular pixels. Ttf replaces the original DOS font with a modern, smooth text output. In the end is up to you which look you prefer.
Clicking OK takes you back to the main setting screen. The only other setting which I always change is in the render menu section where I set the aspect ratio to true.
Once you’ve made all the adjustments to your settings just click the save option and that will automatically rewrite your configuration file so that when you next start-up DOSBox-X it will look as you want it.
Don’t forget that if you set DOSBox-X to run in fullscreen mode you would need to use the F12 + F key combination to get back to windowed mode so that you can access the menus.
We now need to attach a hard drive to the emulator. This is simply going to be a folder on your real hard drive. I tend to create a dosbox folder in my main home directory and inside that create a c folder that will act as my hard drive.
Once you create your folder simply go back into the configuration tool and select the AUTOEXEC.BAT option. This lets us specify a number of commands that will run once the emulator has booted up. We now need to mount our Linux folder as a hard drive.
mount c /home/bob/dosbox/c
This command basically says to mount a drive, as drive C, where the files are stored at the specified path.
I usually add a second line to simply change drive onto my new hard drive so that everything is set once the emulator boots up.
c:
That’s DOSBox-X all set up and ready to go.
Running Games
Many games simply need you to download the files into your C drive folder and then run the executable.
But some games require you to insert either a floppy disk or CD to get the game to run. DOSBox-X allows you to attach and change disc images without the need to update your configuration file or reboot the virtual PC. Just go to the drives menu, select the drive letter you want to attach your image to and then find and select your CD or floppy image file. Once you’ve done that it’s as if you’ve plugged the media directly into your PC. You can change drive to your floppy or CD and run the files as if the disc was there.
Running DOS Box Automatically
The last stage in getting this computer set up is to have DOSBox-X automatically start when Linux boots up.
If you go to the Lubuntu start menu, preferences, LXQt Settings, LXQt Configuration Centre, Session Settings, Autostart, you’ll get to a list of applications that run as soon Linux boots up. We need to add an application by giving it a name (DOSBox-X) and then specifying a command to run. This command needs to be the terminal flatpak command from earlier.
flatpak run com.dosbox_x.DOSBox-X
Once you’ve saved that DOSBox-X will start automatically on the next boot.
Conclusion
So that’s it for my best solution to getting a fully working DOS gaming machine.
Yes, it’s not a true DOS computer and it does go through a Linux boot before dropping you into DOS, but you do have full sound, graphics, Internet and USB capabilities so on my books it’s an overall win for the emulator route.
All that’s left now is to install some games and get playing!