Apr 28, 2008

DosBox on Ubuntu

The other day I was remembering the program called DosBox, which is an emulator for DOS. I used to use it back in the day when I still ran Windows to play my old DOS games like Jazz Jackrabbit or Commander Keen. So I decided to look up the website, and realized that it was open-source (back in my Windows days, this sort of thing didn't really catch my attention, if it ran on Windows and didn't cost me anything, good enough) and has been ported to not just Linux but a thousand (give or take) other platforms. So I quickly download the source, do a quick ./configure && make and I have a working DosBox! Afterwards I discovered that they have dosbox in Synaptic, so that makes it even easier. Here's a quick way to get DosBox up and running on your Ubuntu system:
sudo apt-get install dosbox
dosbox
That's pretty easy! You can always go to the DosBox homepage to get a new version of the software, you'll have to compile it yourself though.

Now, you need games. You can run over here to Abandonia to grab a few, make sure you search only the downloadable ones. Some of them won't work in DosBox unless you get Windows 3.x working, a quick tutorial can be found here. However, many of them do work really well.

I had a problem with my USB mouse and the cursor getting messed up, it would just go to the bottom right and get stuck there. No fun for Command and Conquer. To fix this, create a script like this in your dosbox folder:
#!/bin/bash
export SDL_VIDEO_X11_DGAMOUSE=0
dosbox

Save it and then make it executable (either by using chmod, or right-click the file, go to Properties, choose the Permissions tab, and check "Allow executing the file as program). Now, whenever you want to run DosBox, you just run this instead of the normal dosbox executable.

There's one last thing to do. In order to access any files, you have to mount a drive. So you'll need a folder to mount. Create a folder in your home directory called dos:
mkdir ~/dos
Now you have to mount the folder inside Dosbox. You can do this in the DosBox terminal by typing:
Z:\>mount c ~/dos
This is annoying to do all the time though, so here's a way to make it automatically mount the folder:
1) Go into DosBox, type:
Z:\>config -writeconf dosbox.conf
and hit enter.
2) Exit DosBox, and open the dosbox.conf file that is now in the dos folder you just created.
3) Go to the very end and add:
mount c ~/dos
Now you should have a working DosBox install! Enjoy! Some good games to try out are Skyroads, Command & Conquer or Elder Scrolls I: The Arena.

2 comments:

Matthew Gallant said...

Managed to get Command & Conquer running on my old machine, many thanks. One small curious issue: once Dosbox/C&C has control of your mouse, how do you give it back to Linux? I only regained control once I had exited the program.

Rob Britton said...

Oops, I had meant to put how to do this in the original post...

If you press Ctrl+F10 it will release the mouse. You can set it up to never automatically lock the mouse by going into the dosbox.conf file and changing the line that says
autolock=true
to
autolock=false

I haven't tried this because it's not too much trouble to press Ctrl+F10. However, don't mess up and hit Ctrl+F9, which will close DosBox. I did this accidentally and lost a bit of a game that I hadn't saved in a while.