Sunday 5 August 2012

Squirrel's Guide to DOSBox


(last updated: 05/03/12)
Some emulators can be seen as intuitive for all age groups. Others, less so, and only deter users from playing great games. Running old PC games through DOSBox is particularly daunting for newcomers, even though in reality, it may be the simplest emulator of all.

So, struggling to mount a C: drive? Not sure if a "Gravis Ultrasound" beats a "Sound Blaster 16"? Can't tell the difference between CGA, EGA and VGA? Maybe I can help with this guide.

A Brief History

It's 1981 and you want one of those newfangled "home computers" the kids are talking about. Off to the high street you go, but *gasp*, the choice! The Commodore PET, Atari 400, Apple II, TRS-80 - it's a mess! How can you possibly know which is the superior product?! If only we'd taken a hint from VHS and produced a computing "standard"!

Enter the IBM PC. Released in the early 1980s and in many ways still going strong today, the IBM PC is perhaps the single most important computer ever made. Other manufacturers were aiming for niche hobbyist markets and schools, but IBM thought differently. Quite literally in the industry of creating business machines, IBM decided to produce a computer for the working man. Down with the mainframes and paper - it's time for screens and keyboards. The digital age is upon us.

The IBM PC is the most famous line of computers in the world, to the point where nine tenths of you will be reading this blog on one, even if you may not know it. The 1980s was a battleground for home computers and video game consoles alike, but only one system survived the entire decade and fought across the world, and that was this machine. Apple went on an adventure with the Macintosh, Commodore practically destroyed itself along with most of the competition with pricing wars, and nobody felt the need to challenge IBM's tactics until it was too late.

The IBM PC was a computer built to evolve. It was the machine inevitably designed to run Windows, and though IBM no longer lend their name to the product, their efforts are still felt in machines today. That "break" key you have on your keyboard for example, or "scroll lock" - they meant something once. Ever wanted to know why hard drives start at the letter C:? Well you have the IBM PC to ask.

But the IBM PC is old. Even though the family has continued to the present day, much of its earlier hardware and software has been left to be ravaged by the sands of time. You can't run thirty-year-old floppy disks on a modern machine without help, but what is this help? Why, it's a wonderful program called DOSBox.

"Why should I care about DOS(Box)?"

IBM PCs usually ran an expertly named operating system called "disk operating system" or DOS. DOS was largely based on the earlier "CP/M" operating system and is often seen as the precursor to Microsoft Windows. DOS is a command-line based operating system which revolutionised the world, and many video games were built to take advantage of it, but today nobody uses DOS - the command prompt of your Windows PC works similarly to DOS, but is far too fast and far too restrictive in the modern age to run the games of old.

DOSBox is a IBM PC/DOS emulator, the only one of its kind to hold any ground, and one of the most respected emulators in the world. DOSBox emulates roughly fifteen years of computers, from the original IBM PC in 1981, to the last of the breed in the mid-to-late-90s. It is a way of simulating older computers, reopening the doors that newer machines have closed behind them, without needing to invest in an old piece of kit. If you want to run any pre-Windows 95 PC software, chances are you'll need DOSBox.

Like any emulator, playing old games is seen as an odd thing to do by many. But the DOS library, just like any other retro console or computer, has tons of interesting gems that are well worth a look. The IBM PC was the birthplace of many of the video game giants, and towards the end of its life was most powerful system for video games on the market. The first person shooter owes its life to the IBM PC, as do a plethora of strategy and simulation sub-genres which many rival computers simply couldn't handle.

As well as covering pretty much every IBM PC ever made (IBM PC (5150), PC XT, PC AT, PS/2 etc.) DOSBox will also handle the deviations such as the IBM PCJr., Tandy 1000 and with a push, you can even get it to run old versions of Windows. DOSBox is primarily aimed at emulating pre-Windows 95 games, so it's not guaranteed to work well with business software, and you might have a hard time linking this thing up to printers or modems. However, as of 2012 it is the only good method of playing the DOS releases of yesteryear.

The Problem

Fans of emulation are often seen hanging around with the likes of ZSNES or Kega Fusion - pieces of software with mouse-driven menus and options, making it quick and easy to play ROMs.

But DOS wasn't designed to deliver graphical user interfaces, as it actually pre-dates the concept of them, hence DOSBox looks a bit like this:

Oh dear.

This is what turns people off this emulator. They see a screen like this and are instantly perplexed by what lies in front of them. What do you type? What's a "Z:\>"? Where's my game?

There are several hurdles in DOSBox and this is often the trickiest for newcomers to get over. Confusion and frustration is likely to emerge from someone who lacks the ability to think on DOS terms. Maybe they'll venture off to the manual and read comments on idea of "Mounting a C: drive", still being a bit baffled and giving up there.

In my mind there are three solutions - the "normal" way, which involves using the keyboard, the "polished" way which involves seeking out a front-end to do the work for you, or the "quick" way which I like to endorse. For now, let's solve this current problem the normal way - Let's mount a C: drive.

Useful DOSBox Commands

Let me patronise you for a moment just to point out that keyboards are the only things used in DOS prompts. Mice weren't widespread in 1981. You type a "command" and press enter. It's hilariously simple.

DOS, like Windows, works on the idea that data is stored on "drives". You have hard disk drives, you have floppy disk drives, and you have CD drives, all of which are given letters by the OS which are used to differentiate between them. Drives all work the same - they store data. The difference is merely how that data is stored, but for the end user, that doesn't matter as it's all accessed in the same way.

Unlike a normal DOS prompt, DOSBox starts with the line "Z:\>". Z: is a drive, but is what DOSBox terms a "virtual" drive. DOSBox assumes you have no components using the letter Z, and thus invents this drive for itself, but you can never access or do anything with Z: as it isn't real. At the moment, DOSBox is oblivious to your entire system's structure - you need to tell it that other drives exist, hence the concept of mounting.

Z: is used to protect your system. DOSBox starts in a state of purgatory so that it cannot meddle with your files and folders. Remember, DOS is an all powerful deity - Windows was created not just for ease of use, but for protection, disallowing the user to delete important files. With DOS, this was fully possible, and DOSBox is capable of emulating these actions if called upon to do so (though we would hope the host OS would kick in and stop it).

DOSBox has invented a drive, but it also allows you to invent drives too, and that's exactly what we're going to do when we mount C:. Mounting C: is essentially creating a fake hard drive called "C:". All drives in DOSBox should be "fake" - you specify a folder on your system, and that becomes the root directory of your new drive.

So for example, if you had a folder called "Games" located at C:\Games on your real hard drive, you can do this

You have now mounted C: at C:\Games. Any file or folder not stored within this "Games" folder will not be recognised by DOSBox. Doing this causes DOSBox to see the world differently to you - as far as DOSBox goes, C:\Games is the root folder of your fake C: drive. You have effectively turned a folder into a hard drive - well done.

To change drives you type a letter and than a colon. In this case you would type C:, which should lead to the text C:\>. I left in DOSBox's instructions on this screenshot above for good measure. You can mount C: anywhere - any folder on any drive is "mountable".

Now I know what you may be thinking - why not mount "fake" C: at "real" C:? This is possible, but you should never do this and DOSBox will protest at the idea. Mouting at the root of an actual hard drive creates the risk of doing major damage to system folders if you're stupid. Perhaps some software will try and overwrite important files in the Windows system folders - this can happen, particularly if you are actually trying to emulate older versions of Windows. Mounting elsewhere can contain possible problems - C:\Games is totally safe.

But why "C:". Why can't we mount A: or B: drives? Because then you break a naming convention! A: and B: are reserved for floppy disk drives, and though you can theoretically mount A: or B: drives (you can mount drives of any letters), you can run into software issues. Older games will not expect you to be using fancy emulators - they will expect a hard drive at C:, and may throw exceptions if you tell it to save data on an A: or B: drive. You can be awkward and pick other letters, but there's no real benefit in doing so. Back in the 90s I had a hard drive at D: as well as C:, and some software couldn't cope with the former, even though the drive was perfectly fine.

But the "normal" method is tiresome, I'm not a huge fan of mounting drives like this. Yes it needs to be done, but DOSBox doesn't "remember" anything, meaning every time you boot up DOSBox you might have to contend with folders in far-off locations, which is both time consuming and error prone. Also DOSBox, unlike DOS, is built primarily to run games - you're only ever likely to be touching one or two files, and the emulation of everything is arguably a bit excessive. This is why front-ends exist to do some of this for you.

But let us assume for a moment that we don't have a front-end and we're restricted to the command line. The command line listens to various forms of syntax - I think the "mount" keyword may be a DOSBox exclusive one, but there are plenty of commands that are universal to (nearly) all forms of DOS. When Skynet becomes self aware and the terminators start attacking, your knowledge in twenty year old computers might stop the nukes... maybe. Here's a helpful command:

DIR. DIR displays the contents of the DIRectory (remember this syntax pre-dates the graphical representation of a "folder"), which can be used to make sure you're in the right place. DIR lists everything in the folder along with filenames and time stamps. The only issue is that in the days of DOS, nobody expected you to have a folder as big as the one I'm showing, where most of it doesn't fit on screen. So you might be better off typing dir/w.

If you make a mistake with any commands, the Up key will bring back previous commands so you're not having to re-type everything.

Lets boot something. I've mounted my C: drive at C:\Games, and I've chosen to run Wolfenstein 3D, which is located in
C:\Games\Wolf
or as DOSBox sees it
C:\Wolf

To change directory you need to use the cd command. cd Wolf goes forward to the Wolf directory. cd\ will go back to the root directory. This is is the DOS equivalent of double clicking a folder.

Now I'm pretty sure some versions of DOS force you to use more backslashes. cd\wolf will also take you forward, but DOSBox seems more relaxed about whether that extra character is present.

After changing directory you'll see
C:\WOLF>
which means you're in the wolf directory, and then you can use the "dir" command to see what's inside. Typically when we're looking for games we're looking for files which end in .exe, .bat or .com (or .img in rare cases) - I know that Wolf3D.exe is the executable I want, so all I need to do is type "wolf3D.exe", leading to a line of text that looks something like this:

C:\WOLF>WOLF3D.EXE

hit enter and shazzam

Oh god what does this all mean make it stop!

Oh, okay. Success? Yes, this is Wolfenstein 3D running as it should be - no gimped SNES ports for me. DOSBox has a 2xscaler set on by default, you can configure this as I have by opening up your DOSBox config file. More on that later.

And you too can kill Nazis. Top tip for higher performance games is to increase the CPU cycles using Ctrl+F12 so these things run a bit smoother. DOSBox tries to pick appropriate values but sometimes gets it wrong - if you go too fast things can stutter, but too slow and it might lag or even not boot at all. Ctrl+11 slows things down - older games which will need to be slowed down considerably because they can't cope, even on emulated hardware.

So to recap, the only commands you really need are dir and cd. There are plenty of others, but I would imagine you'd be doing all your file management in Windows. That's why Windows exists. Also many of these commands won't work in DOSBox for security reasons.

The Quick Method

We might have launched Wolfenstein 3D (which is a success), but the method of doing so, is as I have suggested, long and arduous. You can speed up the process by doing something like this

Z:\>mount C C:\Games\Wolf3D
Z:\>C:
C:\Games\Wolf3D\>Wolf3D

that's three steps instead of four (and sometimes you don't have to have the .exe part), but this is still stupid. You're still typing things. Let's discuss the simple solution - drag and drop. This may not be an option for non-Windows OSes, which is probably an indication that you're using a poor operating system. Perhaps.

Check it out it's my slightly falsified Wolfenstien 3D folder. The one I just used as an example

and now look, the DOSBox folder (defaults to C:\Program Files\DOSBox-0.xx)

Drag and drop. Click and drag the Wolf3D.exe icon over the DOSBox one and release

oh.

Yes, DOSBox is clever and will do all these steps for you. Now there will be even easier methods - maybe you can use your leet skillz to alter the right-click context menu and load things that way, but dragging and dropping circumvents the need for any sort of command line stuff at all. You may still want to use a front-end if this process scares you, but dragging and dropping in this manner likely makes DOSBox one of the easiest emulators to use ever. Likewise you can drag and drop things over DOSBox shortcuts - you may have one on your desktop after an install. Really simple stuff.

And note, this sort of behaviour isn't uncommon - several other emulators do this as well. So this idea that DOSBox is confusing is a farce - it's just poorly documented, as nobody will be quick to tell you this is a feature.

Graphics

Now of course, there are other issues to contend with as you should hopefully expect. Fifteen years of "DOS" computers - a lot can change in that time. When the IBM PC first launched it had low resolution 4-colour graphics, and produced all its audio from a tiny digital speaker from inside the unit. When DOS was retired in favour of Windows, the IBM PC line was top of its game and cutting edge. As standards change, DOSBox has to change.

If running games is the first big issue, configuring them to run well is a close second. Processors are covered by DOSBox - only poorly coded games will need to be slowed down and you can do that through keyboard commands. It's anything visual or audible which can cause concerns, because unlike today where everything works fine, technology was restrictive back then. IBM in their quest for computing standards were very good at keeping on top of backwards compatibility (moreso than the Macintosh), but there are things that can cause headaches.


Here's a typical option screen from fan favourite "Electro Body" (later Electro Man). Most games of the 1990s include something similar to this screen. If yours doesn't, it may be hidden away in an EXE called "Install" or "Setup" or it may not exist.

Hopefully a game will already be set up for the highest settings but if not here's a quick list, from oldest to newest. Note that many graphics cards have a selection of modes, sacrificing resolution in favour of colour, or vice versa. I can't cover everything here (particularly when you consider the crafty programmers who broke the rules), but the basic history is as follows:

Monochrome Display Adapter (MDA)
When the IBM PC first launched in 1981, it came equipped with a monochrome green/black screen, and it was the MDA card which powered it.

MDA was used primarily by businesses. It is the superior format for text-based applications, and offers a higher resolution than early colour modes. MDA is very rarely used for games because it's both colourless and can only cope with text, but there are some early examples of programmers getting games to run in MDA mode and it's not fair to ignore them.

Color Graphics Adapter (CGA)
CGA was also available at launch, but spent a few months being a pointless option. Though there were third-party alternatives, IBM did not release an official colour monitor until 1983, hence you're less likely to find games released in the 81-83 period.

There are a few CGA modes:

This is the monochrome 640x400 mode which is rarely seen. Yes, it's rather odd to see a "colour" card producing monochrome images, but it can. MDA still beats it in the text department though.


The most common use of CGA is this - a four colour 320x200 RGBI mode. CGA has a whopping sixteen colours to choose from (8 if you use an RGB monitor - not applicable with DOSBox) but can only access four colours at a time. For some reason, they're usually odd odd combinations such as the above, which end up looking more pleasant on monochrome monitors. "CGA" usually means this mode.

Though not applicable to DOSBox, if you're running a portable IBM PC (big clunky things from the 80s) with an LCD monitor, CGA graphics in this mode often turn into four shades of grey, similar to the Nintendo Game Boy. What useless knowledge.


There is also a "composite" mode which you won't be able to access unless you fiddle with the DOSBox config file. In the 80s it was often common to link up a PC to a television screen, and at the time, PC monitors and televisions weren't the same. Because the NTSC television standard for North America was stupid, you'd have colours "smearing" into each other and distorting the image. Composite mode takes advantage of these irregularities and can produce a more colourful picture than its RGBI counterpart, at the expense of graphical fidelity.

An example:

RGB.


Composite. Often developers aimed for composite options because again, many didn't own RGBI monitors. But by 1984, RGBI monitors were the standard.

The composite image is estimated by DOSBox, and is only accessible if you switch the graphics mode from "svga_s3" to "cga". Later cards had no support for composite signals because the physical ports stopped being included on later machines, so you'll just get a messy picture. But this can be the better option for mid-80s games and is worth checking out.


Hercules Graphics Card (HGC)
(change "svga_s3" to "hercules" to access)

Hercules was another option for monochrome users. Hercules Computer Technology were behind this one, and is essentially a souped-up MDA card with graphics modes comparable to the monochrome CGA mode. Basically, this saved you having two cards installed at once, but it was pointless if you wanted colour.

Hercules, like MDA, was popular among businesses and people who relied on text. Some games support it, most do not. It was very popular in the early 80s though.

PC Jr./Tandy 1000
(change "svga_s3" to "pcjr" or "Tandy" to access)

The PC Jr. was a stupid idea by IBM to create an even cheaper machine for the home with slightly different specs. 16 on-screen colours at 320x200 this time - the only option for a number of PC Jr.-made games.

The PC Jr. flopped, but Tandy Corporation took the specs, changed things a little and produced the Tandy 1000, which worked well. The two are mostly compatible with each other - my guess is the Tandy mode is more likely to work than the PC Jr. one, but if we're honest, the chances of you using either of these modes are pretty slim.

Enhanced Graphics Adapter (EGA)

EGA was the official successor to CGA, though took a while to catch on. 16 colours like the PC Jr. but fully backwards compatible with the CGA card, minus the composite feature (it also sometimes brings up the wrong colours - the CGA mode may still be preferable for older titles). EGA uses the same sixteen colour palette as CGA by default, but has a pool of 64 colours to choose from, and on rare occasions a game may dip into the remaining 48.

EGA is 320x200 most of the time, though there is also a 640x350 option that is sometimes seen. All things considered, I think I favour EGA mode over everything else - though not the prettiest of graphics cards, it forced artists to produce quality work due to the limitations on offer. Commander Keen 4 is a prime example of this.

Multi-Color Graphics Array (MCGA)
This a scarcely used card for PS/2 machines, offering 256 colours to play with. It is backwards compatible with CGA but not EGA. You're unlikely to come across it.

Video Graphics Array (VGA)

VGA is probably the card you're going to give a damn about in most cases. It supports up to 256 colours at various resolutions, and due to its compatibility with the EGA and CGA standards, is the best choice possible.

Electro Body offers a tweaked version for monochrome monitors:

This isn't so much a "mode" as it is software adjusting pixel colours, but I figured I should mention it so there's less confusion.

There are many extensions to VGA, including dozens of different "SVGA"s. By default, DOSBox will cope with "most" of them, but you can switch between various SVGA and VESA settings if you're desperate for a specific resolution. Setting the system to "vga_only" is meant to address the occasional graphical bug that SVGA can bring up - I've never encountered such a thing personally, but others say it's there.

After this standards become less about the number of colours, and more about resolutions. No doubt Wikipedia has much to say on this subject. We hit 16 million colours as a standard in the early 2000s and haven't really bothered to progress past that.


Audio

Graphics are fairly straight forward, but audio is trickier. Whereas IBM developed standards for graphics in the form of CGA, EGA and VGA, they never bothered with sound, so it was up to third parties to have a go. This lead to dozens of attempts between about 1987 and 1994, all fighting at the same time for market dominance.

Note that in some cases a game will not be able to support both music AND sound effects, and the "better" instruments may sound worse depending on the game. Audio is very much a personal choice, particularly as things converge towards CD quality audio around 1993. This is in a rough order from poorest to best.

PC Speaker
Up until recently, every computer had a built-in PC Speaker. You know when you hold down a key for too long and the PC makes a noise? That's your PC Speaker, though this is a feature slowly being phased out to save money. Until the late 80s, the PC speaker was the only option for sound the IBM PC line offered, so developers would be forced to make use of it.

DOSBox's attempts at emulting the PC Speaker are commendable, but lack the soul of the real thing, which always sounded muffled, and lacked any sort of volume control. This put DOSBox's old emulator rival, VDMSound at an advantage because this used the actual hardware, but alas, VDMSound was discontinued and no longer functions with newer computers.

The PC Speaker is a single square wave generator which makes abnoxious noises. Lots of people hate the PC Speaker for whatever reason - statistically it is worse than the sound capabilities almost every other home computer on the market, including systems made in the 70s, but even though it's a CPU-intensive mess, I'm a big fan.

Some later games like Pinball Fantasies make phenomenal use of the PC Speaker, and others force speech out of it and all sorts. Wonderful piece of kit, shame to see it go.

PC Jr./Tandy
IBM's failed PC Jr. machine/Tandy's successful Tandy 1000 series of machines had their own, slightly better PC Speakers with three times the channels! I doubt you'll come into this or even care that it exists, but hey.

Adlib
Adlib sound cards were the first sound cards to be released to the general public. They are widely supported by most games of the 90s, but Adlib is unlikely to be the best option for games made after 1989-ish.

"Adlib Gold" is a better option if it exists. Better than the original Sound Blaster, but not by much, and not often used by developers.

Creative Music System/GameBlaster (CMS)
I doubt you'll encounter these either. Made by Creative Labs, but pre-date Sound Blaster so aren't as good. Better than Adlib though.

Sound Blaster
Also developed by Creative Labs, Sound Blaster sound cards tend to be the best option for the true DOS experience. They are completely backwards compatible with Adlib cards, and became the de facto sound card for the IBM PC during the early 90s. Most post-1989 DOS games will support the original Sound Blaster - when in doubt, use this.

Music buffs may note that in some cases you can define how many "channels" are used, which in turn can lead to richer music (sometimes at the expense of CPU cycles). Sound cards require experimentation - they're not as clear cut as graphics cards, and often they're not used to their full potential (for example, in Wolfenstein 3D, the Sound Blaster option sounds identical to the Adlib one, because it runs in what you might call, "Adlib mode".

The second generation is "Sound Blaster Pro" (Pro 2), the third "Sound Blaster 16" (ViBRA16). I don't think DOSBox supports the fourth generation, "Sound Blaster AWE32" (32, AWE64) and after that we start getting PCI and Live! variants which aren't likely to pop up in DOS games. Sound Blaster sound cards still exist today so there has to be a cut-off point.

Wave Blaster is an upgrade Sound Blaster 16. Apparently. I've never seen any of these things in the wild. Thunderboard is a Sound Blaster-like clone which is pretty much the same. Honestly, every sound card manufacturer was trying to be as good or on a par with Sound Blaster.

Roland Multi-Timbre Sound Module (MT-32)
These were super high end cards from the late 80s. DOSBox officially isn't meant to support them because of licensing issues, but unofficial derivatives do.

Roland Sound Canvas (SC-55, SC-88 etc.)
Improvements. Again not supported officially. There are Roland devices which are though - often they're labeled "ROLAND".

Disney Sound Source/Covox Speech Thing (DAC)
This is perhaps one of the more interesting attempts at circumventing the PC Speaker. Rather than offer sound cards, Covox, and later Disney and a variety of others, decided to make use of the "Line Print Terminals" at the back of the computer, usually reserved for things like printers. LPTs are general names for parallel ports, SCSI ports etc., or at least that's how I understand it. All of these technologies have since been replaced by USB.

Anyway here we are dealing with digital-to-analogue converters (DAC) - they take a digital signal fom the LPT, convert it to an analogue one via a fairly simple circuit (so simple in fact that many people made their own from scratch) and send it to some external speakers. This allows you to output high quality audio, as things are being taken care of outside of the realms of the PC. It's an interesting concept.

Covox was big in the demo scene, and there were "emulators" which allowed it to output the likes of Sound Blaster audio too. But as a product, the Covox Speech Thing wasn't particularly successful. The Disney Sound Source, however sold in greater numbers and tends to be the one referred to by video games. DOSBox attempts to emulate all types of DAC.

Do not confuse the Covox Sound Thing with the Covox Sound Master and its derivatives - these are sound cards, and I'm not entirely sure DOSBox emulates them (though in truth, it doesn't really need to).

General MIDI
Towards the end of DOS's life-cycle games would often support MIDI music in a similar way as your modern PC does. Music fans can fight over whether this is better than Sound Blaster.

Try not to raise the fact that modern Sound Blaster sound cards let you change the default MIDI instruments and thus completely alter the sound of this option, because that would make things confusing!

Pro AudioSpectrum/SoundMan
This is meant to deliver CD-quality high-end audio, but likely won't because we're dealing with early-90s technology for the home.

Gravis Ultrasound (GUS)
Similar to the above. You have to turn this one on through DOSBox's config file, presumably because it can break support for other cards. Gravis Ultrasound is fairly common though, so I would imagine some games actually take advantage of it.

Any others
Test them out for yourself. By the end of DOS's lifespan there were tons, and there's bound to be some I'm missing. Vast chunks of the games on offer will use some form of Sound Blaster though - lots of sound cards are backwards compatible with the card, and it's only companies like Sierra, id Software and Apogee who liked to support a vast array of alternatives.

Generally when music was written, it was either done with Sound Blaster cards, MIDI or CD audio in mind, and most importantly, none of the options here will be as good as modern cards in modern machines, so you can throw the concept of crisp, clean audio out of the window straight away.

Here's a nice YouTube example which compares some of the music options for The Secret of Monkey Island which bothered to make use of a wide variety of cards. But most simply output Sound Blaster-esque audio because this was by far the most common sound card of them all.



So yes, in conclusion, DOSBox is easy. There are tons of great DOS games out there - go play them.

1 comment: