O'Reilly logo

Gaming Hacks by Simon Carless

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Play Old Games Through DOSBox

Run glorious old DOS classics on modern operating systems.

Every now and then the urge may strike to play the game that kindled your interest in computer gaming, perhaps X-Com, Master of Orion, or something from the Ultima series. Unfortunately, today’s modern operating systems rarely play well with the relatively ancient games of the early to mid ’90s. If you’re lucky, you can convince some games to run without sound in Windows XP, but they may run far too fast to be playable. That’s where DOSBox comes in.

DOSBox (http://dosbox.sourceforge.net/) is a four-person open source project that emulates an x86-based PC running DOS. The version used for this hack is 0.61 for Windows. Don’t let the version number scare you; it features excellent support for many classic games and can provide Sound Blaster, General MIDI, or Gravis Ultrasound sound support. The DOSBox homepage has a freely downloadable installer as well as the source code and ports to various other platforms.

Getting Started

After you’ve downloaded DOSBox, run the EXE and pick a location to install to. There’s no special setup required to kick off the program at this point. If you run it, you’ll end up at a Z:\> prompt. DOSBox, by emulating a DOS PC, hands you a DOS environment just like the one you remember.

If this is your first time in DOS because you’re boning up on your game history (commendable!) or if you just need a refresher, there are some commands you need to know. mount mounts a drive under a particular letter so that you can access it from within DOSBox. On startup, by default, DOSBox will put you on drive Z:, a virtual directory it creates to start itself up. You’ll need to mount the drive in the computer on which your games reside before you can play them.

If your games are on drive D:, use the mount command as follows:

mount C D:\

This maps a C: drive within DOSBox to the contents of the current D: drive in your PC. It’s important to know how this works, but you can simplify things by editing the dosbox.conf file; I’ll explain that later.

Depending on the media you need to use for installation (floppy disks or CDs), you’ll want to mount those drives as well. DOSBox doesn’t automatically know that A: is your floppy drive, so use a similar command to set it up:

mount A A:\
mount E E:\

This makes A: your floppy drive and E: your CD-ROM. If you now type any of those letters you’ve mounted followed by a colon, at the Z:\> prompt, you’ll switch to the specified drive. You’re only an installation away from playing a game now!

Installing Games

To install, you need to know two more important DOS commands. The first is dir, which lists the contents of your current directory. The second is cd, which changes your directory (for example, to the directory containing the file you want to execute). The command dir /W displays directory contents across the screen instead of down, making it easier to find what you’re looking for. dir works on any drive and in any folder. Use cd with the knowledge you’ve gained from the dir listing. For example, to run X-Com, type:

cd MPS\UFO

This changes directories to X-Com’s default installation location. From there, type UFO, and you’re off battling aliens! DOSBox executes .BAT, .EXE, or .COM files. It works just like standard DOS, so while these simple instructions will help you to play games, there’s a bevy of commands available when you’re ready to tinker more.

Once you’ve mounted everything properly, change to the installation disk and directory and start your game’s installation program. This works just like the original, including sound setup.

Warning

If you want sound, it’s crucial that you now choose either a Sound Blaster or Gravis Ultrasound sound device. Beware that not all games have GUS support. If General MIDI is available, use it because it always provides the best sound quality.

After the installation completes, you’ll probably be in the same directory as the game executable. Type the name of the main executable—for example, UFO.EXE—and the game will attempt to start.

This Thing Runs Too Slow!

Inevitably, after mounting drives and installing a game to your hard drive, you’ll find out that performance isn’t quite as you remember. Now’s the time to tweak DOSBox for optimal performance. Before you start, though, check the web site for any known problems with your game. The DOSBox web site has an extensive and searchable list of games (http://dosbox.sourceforge.net/comp_list.php?letter=a) with a scale ranging from runable to playable to completely supported. This will help you determine if you’re better off playing something else.

Provided that you’re running a supported game, your next step is to increase the cycles DOSBox uses to run the games. As noted in the dosbox.conf file (see Start All Programs DOSBox-0.61), cycles refer to the number of instructions DOSBox tries to emulate each millisecond. A very high number can have adverse effects on the program and your PC, so prepare for trouble if you go crazy. On a midrange PC, most games seem comfortable with values between 5,000 and 10,000.

You will have to spend some time tweaking this number to find the ratio of stability to speed. X-Com locked up at 10,000 but played fine at 8,000, for example. The old Amtex pinball table conversion for Eight Ball Deluxe had a nearly transparent ball at 10,000 but played perfectly at around 7,000. Needless to say, you’ll probably spend most of your tweaking time on this setting.

Editing dosbox.conf

To make your life easier, once you’ve done some manual setup and understand how DOSBox works, you can add some lines to the dosbox.conf file to avoid having to repeat the process each time you want to play. In the [sdl] section, set the fullscreen value equal to true, because DOSBox performs best in fullscreen mode. Hit Alt-Enter to switch between the fullscreen and windowed modes.

The [cpu] section holds the cycles setting. Here you can put the value you determined earlier. Related settings are cycleup and cycledown. When DOSBox runs, the keys Ctrl-F8 and Ctrl-F12 can increase or decrease the value of cycles. Set your default at 8,000 or so to start, and change it after you’ve tried some games.

Finally, you probably want to add your mount statements to the [autoexec] portion of dosbox.conf. This allows the program to configure the drives you use for installation and game playing as soon as you come to the initial Z:\> at DOSBox startup.

There are a lot of other flags in the configuration file, but you can leave most of them alone unless you encounter trouble with a game.

It’s Easier than It Sounds

If you’re new to DOS, you’ll need some time to acclimate to its text-only interface. Don’t worry, we’ve all been there. One nice feature of DOSBox is how well it makes the needed amount of memory available to games. Back in the ’90s, when these games were new, you often had to perform voodoo, sit a particular way in your chair, and then pray to whatever deity you worship to convince a game to run. DOSBox makes this straightforward. A little DOS knowledge goes a long way, though, so don’t hesitate to bone up. See Claymania’s DOS Primer (http://www.claymania.com/dos-primer.html) for an introduction and The DOS (command) Environment (http://www.primerpc.com/dos/dos.htm) for detailed help.

You’ll have to track down the original games or pull out your old discs (or disks) to start playing. DOSBox supports most of the big names of the time with varying degrees of success, including Ultima, X-Com, Master of Orion, Master of Magic, and more. It might seem silly once you’ve installed DOSBox, but be sure to try old games under Windows XP first just in case. Sometimes you won’t need emulation, though it seems like it should be your first choice. The old Simtex classic 1830: Railroads and Robber Barons works just fine in Windows XP without emulation.

Above all, have fun exploring or reliving the golden era of PC gaming. Many of PC gaming’s most beloved games come from the DOS era. Besides buying and refurbishing an old 486 DX2/66, this is the best way to enjoy these games. Now excuse me while I stop an alien invasion for the tenth time!

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required