Saturday 3 November 2012

Tech tip: Emulation and DOSBox

While a lot of more enthusiastic PC users are already familiar with the potential benefits of emulation - having your desktop, laptop or even tablet PC pretend to be something else - there are still a great number of other people less involved in technology that may still be able to benefit from such things.  Today, I'd like to take a moment to write a little bit about one which I referenced in my previous review of the Saitek X52 Pro:

DOSBox.

While every modern computer is still technically capable of running DOS and everything that accompanies it, no version of MS Windows since 3.0 has ever been 100% DOS compatible - and I'm not entirely sure the earlier ones were, either.  Further to this, every consumer release of MS Windows since XP has been incapable of running a "native" DOS environment at all, while Windows Vista and Windows 7 x64 editions cannot run 16-bit software (even 32-bit DOS programs have 16-bit launchers), meaning most people either have to abandon their older software or resort to sometimes extreme measures, such as creating a bootable UFD (or USB Flash Drive).

DOSBox, as the name hints at, is effectively an emulator for an older x86 PC running MS-DOS.  At first glance, this might not seem like something anyone would be interested in.  After all, why would you want your brand new, shiny PC to act like a beige-box of the mid-90s?  The answer can be as simple as nostalgia or as frustrating as a piece of software which simply has no direct Windows (or Linux, if you're so inclined) alternative.

For myself, I have a rather large collection of MS-DOS based games.  While these are hardly technical marvels by today's standard, they're still extremely entertaining which makes it worth the effort of being able to play them.  I have a significant assortment, ranging from Apogee classics such as Hocus Pocus and Commander Keen (all 7 of them), through Sierra's legendary Quest for Glory series, up to the more elaborate titles such as Little Big Adventure, Dungeon Keeper, Syndicate Wars and Magic Carpet (why, oh why, did EA dissolve Bullfrog?).  And, of course, let's not forget the masterpieces that were Crusader: No Regret and No Remorse, and, of course, X-Wing and TIE Fighter as referenced in my X52 Pro review.

The number of these games which will run natively under Windows 7?  Exactly zero.

Enter DOSBox.

DOSBox not only allows me to re-live all of these games from my past, but also to improve on the experience significantly since I originally played them.  Modern PCs are exponentially faster than anything which was released during the reign of DOS, meaning settings can be ramped up literally as far as the game will let you.  Of course, that rarely if ever means going beyond 640x480 (VGA) but the reality is that the systems I had back then lacked the horsepower for such a resolution.  Sound also gets a boost due to support for MPU-401 "General MIDI" playback against the OPL3 "FM" capacity of more mainstream soundcards of the day.

INSTALLATION

DOSBox is available in many different distributions.  The "core" version of it, however, is available from www.dosbox.com.  As of writing, the latest full release is version 0.74, and it has been since around May of 2010.  However, to get the most out of it (especially for gaming) I would recommend the customized version from a fellow who goes by the name of Taewoong or Ykhwong - available from this website.  As of writing, his latest release is from October 3, 2012.

Why get this custom version?  Aside from being compiled from newer releases of the DOSBox source code, it also features 3DFX Glide and Roland MT32 emulation, networking support, better support for CD images and various accuracy improvements, such as PC speaker accuracy and monochrome support (for the really nostalgic).  For those interested it also allows you to run pixel shader effects over the output, but I prefer a more "raw" experience as most of the shaders only really offer novelty benefits.  Oh, and it also offers a GUI which can make configuring the whole thing much, much easier - or at least updating settings on the fly.

I should mention at this point that Ykhwong's release doesn't include all of the files necessary for MT32 emulation.  While it includes the emulator itself, it does not have the required ROMs from an actual MT32 which are necessary for it to actually do anything.  Roland still holds the license for these ROMs and, as such, you require an actual MT32 to extract them from (which you can do legally).  No DOSBox release includes the files necessary for Gravis Ultrasound to work either, but these can be installed from the original discs rather than requiring any special extraction (other than needing to find a floppy drive, anyway).

CONFIGURATION

By default, DOSBox - be it the core release or Ykhwong's modified version - is set up reasonably well to just dive in and get started.  However, there are a lot of things you can do in order to improve the experience.

If you use the installer for DOSBox, a link to the configuration file should be made in your start menu.  You can also access it directly in the folder (directory in DOS terms) you installed DOSBox to through the file dosbox.conf - any text editor (including Notepad) is suitable for editing it.  Inside this file are all the global configuration settings for DOSBox, and pretty much all of them include documentation explaining what they do.

Before anything else, I like to adjust the speed settings.  By default, DOSBox will try to guess the type of CPU it should be emulating and then try to guess how fast it needs to be.  That's a lot of guessing, which doesn't always work out right.  Some DOS games incorporated framerate limits, or at least timers, but most others will run as fast as they're able to.  In the case of something like the original MechWarrior, even being emulated on a modern 3GHz+ system is substantially faster than the 16MHz (that's 0.016GHz) 286 it was designed to run on, meaning the missions will be over before you can even get your bearings - usually with a loss for you.

Find the [cpu] section.  I like to change the core to dynamic, set the cputype to pentium and set cycles to 15000 (that's fifteen thousand).  This doesn't actually translate to any particular speed system of the past - I just find it's a good baseline speed to work from.  I also then set cycleup to 5000 and cycledown to 1000 for fine-tuning the speed of a given title - older games may need less, newer or higher resolution games may need much, much more.

As a guideline, I have found that most games are comfortable at 15000.  However, high-resolution or 3D games such as Fade to Black and Crusader: No Remorse can benefit from being set to 60000 or higher.  Some games may also need multiple settings for maximum playability, such as Syndicate Wars (I find 20000 is enough for the menus, while 100000 is required in-game with high resolution enabled).  Some high-resolution, 3D games like Dungeon Keeper can simply be set to Max for the best experience.  At the other end of the scale, older or simpler games like MechWarrior and Death Track need to be set down to 5000, while the lowest I have ever used is just 1000 for Gods.

For now, this is enough to get going.  However, I would recommend looking through the configuration file to see what settings are available, as well as reading the instructions to get a feel for what DOSBox can actually do.  If you decide to start changing things like memory settings, remember that the DOS environment is very, very old.  I've personally found that going beyond a setting of 63 [megabytes] for memsize and 7 [megabytes] for vmemsize will start to cause problems as those amounts just simply didn't exist in home PCs back then.

GETTING STARTED

When you first run DOSBox, regardless of the version, you'll come to a command prompt on Z-drive.  This is a virtual drive which simply exists because DOS needs something to work.  However, you can't really do much with just this drive so you'll need to tell it to use something more useful.  You'll need to mount a drive.  But before you get to that, you'll want to create a folder for that drive to "live" in, such as C:\DOS.  Then, o mount a drive, type the following command into DOSBox:

mount c C:\DOS -freesize 500

This will create for you a C-drive (I recommend you start with C, as most DOS stuff will only recognise C-drive for your harddrive), based on the contents of the C:\DOS folder on your PC.  If you created a different folder for it than feel free to change that accordingly.  I really don't recommend giving it access to an entire drive (unless you're dedicating a drive strictly to DOS stuff), so it's best to create a folder for it.  Myself, I use C:\Games\DOS.

Most DOS programs recognise the first four drive letters only.  Drive A and B are floppy disc drives, drive C is a harddrive and drive D is a CD-ROM.  You can use different letters but keep in mind that the vast majority of software wasn't designed for it.  Having multiple harddrives was practically unheard of for most of DOS's lifetime, while assigning non-sequential drive letters past C didn't hit home PCs until Windows XP.  In fact, harddrives assigned to A or B drive can still cause issues in modern operating systems due to this legacy.

The -freesize 500 command simply tells it that the drive will always report itself with 500 megabytes of free space.  Most, if not all DOS programs don't understand the concept of gigabytes, much less terabytes, so this will stop any errors such a massive amount of free space would cause.  500 is a good compromise between being able to install CD-ROM based software and keeping floppy disc software happy, but you may need to raise or lower that depending on your program.  This doesn't actually limit the amount of space it can use - it only limits the amount of free space it reports when asked.

From here, you can simply load your programs into the folder you created and navigate it like DOS.  If you're not an old-school user who's trying to relive their youth, a list of commands is available on Wikipedia - I recommend looking up the CD and DIR commands to begin with.  Just about everything else can be done from Windows until you're more comfortable with DOS.

Note that any file changes you make within DOSBox will affect what happens outside DOSBox.  This is another reason you don't want to give it access to your entire harddrive - if you accidentally rename, move or delete something you shouldn't have, your computer may not be too happy with starting up next time.

Once you've decided on your setup, you can add a mounting command to the end of the configuration file so you don't need to type it in every time - it will just run it automatically.  You can also mount your optical drive for use in DOSBox to give your games or other software access to it, or even disc images directly from your harddrive in the interest of speed and convenience.

LEGALITY

Emulators represent a rather thorny area legally.  While the emulators themselves are not illegal in most countries, you do still need to legally own the software you intend to use them for.  As I mentioned earlier, Ykhwong's release of DOSBox supports both Gravis Ultrasound and Roland MT32 compatability, but cannot do either without the appropriate extras.  In order to use these extras legally, you must own the appropriate hardware - or at least still have the discs in the case of the Ultrasound.  Naturally, any actual software you run within the emulator you must legally own.

There are also some grey areas when it comes to the legality of emulator software.

In the case of DOSBox, large communities of "Abandonware" have been established.  Abandonware is essentially software which the developers no longer distribute, meaning it is no longer possible to actually buy it.  Many argue this means you're allowed to have it without paying for it, since no option exists to pay for it, but the law may or may not agree with that stance.  It's a much better idea to simply obtain things from such sites that you do own but cannot access - such as games which are on floppy disc, given to the lack of appropriate drives on modern machines.

Another grey area is "dumping."  Dumping is a means of getting the contents of a medium which a PC cannot read - such as a C64 tape, a console cartridge or an arcade machine board - onto a medium it can.  Since dumping does not require any encryption to be broken, it is generally not considered illegal to dump the data into a PC-readable format.  However, you are still not allowed to have a copy of a dump without actually owning an appropriate source.  For example, if you own the cartridge but lack the tools to create your own dump, it's generally legal to download one someone else has made of the same thing (keeping in mind many cartridges and arcade machines actually have regional variants - ensure the dump you get matches what you own).

The last grey area is one of temporary ownership.  Most emulation sites advise you that you can download anything from them, whether you own it or not, but can only keep it for 24 hours if you don't own it for "educational purposes."  I do not know whether this is true or not, but it seems to be a very popular message.

I would recommend checking the laws in your county, state, province and/or county to be sure.  Better safe than sorry.

OTHER EMULATORS

These days, just about everything can be emulated - at least by a Windows-based PC. You can get emulators for gaming consoles (though not currently the Playstation 3, X-Box 360 or Wii, that I know of), other personal computers (Commodore 64, Linux, etc), arcade machines - even Texas Instruments calculators! Chances are if you have something and want it to behave as something else than someone, somewhere will have written an emulator for it.

DOSBox can also emulate some earlier Windows environments.  Myself, I have a fully-functional installation of Windows 3.11 for Workgroups in order to play Mordor: Depths of Dejenol.  Though I have not successfully done it myself, I have also heard that it can be used to run Windows 95 or even Windows 98.

No comments:

Post a Comment