Thursday, 5. June 2008, 17:48:32
This tutorial explains how to use DOSBox in all its might and with no need of third-party programs (frontends). It's certainly more difficult than the
basic tutorial (recommended for beginners), but the main reason why this is going to be so long, is that every single step is explained with detail so that it's impossible to get lost.
We'll see how it's not so difficult to create shortcuts that directly run in DOSBox each game with their appropriate configuration:

First let's take a look at the file where DOSBox stores its default configuration. It's a text file we can modify with the Windows Notepad or any other editor; it may look rough to the average user, but in the end changing options here is the same as changing them using a
frontend like
DBGL. To access this file we can go to "Start > Programs > DOSBox-X.XX >
DOSBox.conf".


(We briefly came across this file already at the end of the
basic tutorial.) The lines starting with "#" are comments with no effect, and explain the meaning of the configuration options, that is the rest of the lines in the form "(option)=(value)". As you can see the options are grouped in 14 headings whose names are inside square brackets ([sdl], [dosbox], [render], [cpu], [mixer], [midi], [sblaster], [gus], [speaker], [joystick], [serial], [dos], [ipx] and [autoexec]).
The most important options are reviewed
here, but I don't recommend reading them all now. Rather go on with this tutorial, and afterwards you'll look up the options as soon as you need them.
Some people may be thinking by now that it would be impractical to edit dosbox.conf every time we need to change any setting for this or that game, and it's better to make different profiles with a frontend. But the point is that we can do the very same without need for a third-party program: on the one hand
we can create as many configuration files as we want, and we can easily tell DOSBox to use a particular one for each game; and on the other hand
we can load more than one config file in the same DOSBox session. (The second feature is new in DOSBox versions 0.70 and higher, old versions can use a different file each time, but only one at a time.) Let's clarify this.
Before we continue let's get a little organized. We'll create a folder wherein to put all the shortcuts we'll be creating (maybe someone will prefer to have them scattered over the Desktop or wherever). To create it right-click on a blank space where you want the folder (for example the Desktop) and select "New > Folder", and name it--for example--"DOSBox".

Now the first shortcut we're creating is the very folder where DOSBox is installed; this way we'll be able to readily access the config files. So we double-click on the new folder we just created to open it, and then we right-click again on a blank space, this time inside the folder, and select "New > Shortcut":

One the ensuing dialog box, we must click on "Browse..." and find the existing folder where DOSBox is installed:

As I said in the
basic tutorial, I recommend installing DOSBox someplace where elevated rights aren't needed to write, preferably within the Shared Documents; and the same goes for the games themselves. Otherwise you will experience problems in Vista, or in previous Windows versions if using a limited account.
After selecting the folder, clik on "OK", then "Next >", and "Finish". Finally, use the shortcut you just created (double-click) to access the DOSBox program folder. Once inside you can open and edit dosbox.conf (if Windows doesn't know what program to use when you double-click on dosbox.conf, chose "Select the program from a list" and associate .conf files with the Notepad). But what's more interesting, you can
create new config files and assign them to particular games as profiles.
The easiest way of creating a new config file is copying dosbox.conf and editing only the options we need to change for a certain game or set of games. This works for old DOSBox versions, but new ones also allow us to load several config files in the same session: DOSBox would load the first configuration, and when loading the next one the new options would have preference, but the config options not specified in the second config file remain as the first one set them.
The idea is always loading a default configuration in dosbox.conf, while the other config files for particular games will only include the options that we want different from the default. Whenever we want to change the default configuration we won't need to edit every single config file, just dosbox.conf that contains the default config--the options common to every session unless another config file says otherwise. (Again, this is a feature of DOSBox versions 0.70 and higher.) If you haven't grasped it, don't worry because we'll be seeing an example shortly.
As we said, we can start from a copy of dosbox.conf, edit the necessary lines, and then we'd delete the rest of the lines we didn't change, since they're already in dosbox.conf, which will always be loaded before any other config file.
When deleting the unchanged options, be careful to keep the headings--the lines with words between square brackets ("[]").
So first we make a copy of dosbox.conf. We were inside the DOSBox program folder, here we drag
with the right mouse button the dosbox.conf file to a blank space in the same folder, and select "Copy Here":

While the newly created file's selected, press F2 to change its name (to something related to the config it will store, typically the game it will be associated with). Then edit the necessary lines and delete the rest, keeping the headings. (Remember that
here's an explanation of the most important options in DOSBox config files.) For example, this is my config file to run
UFO - Enemy Unknown:

The rest of the options will remain as default in dosbox.conf. Don't worry about the lines under "[autoexec]", we'll explain that part last. If a game works fine with DOSBox's default config (what will happen a lot) there's no big need to change any setting, and so you can leave this file blank except for the [autoexec] section; later we'll see what lines you need to write here.
Anyway, once you have the config file we want, save it. Now we want to create a shortcut which will run DOSBox with that configuration, and every time we wish to use that config (like running a particular game) we'll just double-click the shortcut. So we
go back to the folder we created that so far contains only a shortcut to the DOSBox program folder, and create another shortcut just like before (right-click, "New > Shortcut"). However this time the shortcut won't point to a folder but to DOSBox itself, so we click "Browse..." and select the
dosbox program:

After selecting we click "OK", but before clicking on "Next >" we'll add the parameters which tell DOSBox what configuration to load. You have all the DOSBox parameters in the
README.txt, but the one we'll use here is "
-conf (filename)", that makes DOSBox load a config file, and as we said can be used more than once.
We want DOSBox to load first the default configuration in dosbox.conf, and then the specific options in a second file, in this example "ufo.conf". So in the "Type the location of the item" field, following what's already written without deleting anything of it, and
after the quotation marks (if there are any), we write:
-conf dosbox.conf -conf (filename)
In our example it would be like this:

(You may not see the ".conf" extension in configuration files, but if you've followed this tutorial and you have associated them with the Notepad as we said, and you can open them double-clicking on them, you must write the .conf extension here even if you don't see it. Anyway you could try with or without it until it works.)
We just did what we said we wanted: tell DOSBox that we want it to load the default configuration first, and then the specific one for a game or whatever. The latter overrides the former, but the options not specified in the second file will be left as the first one set them. We can create more "profiles" for more games in the same way, creating more config files (with a different name) and other corresponding shortcuts with the parameters "-conf dosbox.conf -conf (filename)".
By the way, at any moment we can correct the parameters right-clicking on the shortcut and selecting "Properties":

We've learned how to create config files and shortcuts that load those configurations. Then a simple double-click on the shortcut will start the desired game, and we won't need any other manipulation until we want to add a new game. (As you can see below, besides the shortcut to DOSBox's installation folder and another shortcut for each game, I also like to make shortcuts to DOSBox with the default configuration and no game--command line--, to the folder where DOSBox stores captured images and clips, and the one mounted by default as virtual drive C:

However I'm afraid many of you'll have been unable to make it work, and be at loss about what "mounting" and "virtual drive" mean.

Worry not, you may remember that I postponed the explanation of the "[autoexec]" heading of config files; sorry but an order was necessary, and now's the moment to go back to that--we'll be finished after this, promised.

DOSBox emulates (along with a full x86 machine) the old MS-DOS operating system that these old games were designed for, and DOS's interface was a command line--where instructions were typed and then entered with the Enter key--; so DOSBox's interface is a command line too (even Windows has a command line interface, even if most of you never need it). In this tutorial we'll write every command we need in the config files, so they'll be entered automatically every time we use the shortcuts.
The most important DOSBox command is "mount". It's difficult to understand at first, but DOSBox doesn't access our drives (discs) directly. Instead we must "mount" folders (or image files) as "virtual" drives of the DOSBox session. Our real drives' letters and the virtual ones' are unrelated, no matter if they coincide or not; for example we can mount the root folder of our (real) C drive as virtual C drive in DOSBox, but we can also mount any other folder of any other real drive as virtual C drive, or as any other virtual drive.
You'll find all the details of the mount command in DOSBox's README.txt, but using DOSBox for Windows, in order to mount a folder as virtual hard drive, the necessary command is simply
mount (virtual drive letter) "(real folder)"
for example
mount c "d:\oldgames"
Be warned that DOS won't support long filenames (with more that 8.3 characters or spaces or addition dots), and so DOSBox won't either inside its virtual drives (DOSBox won't crash but will shorten the filenames); however you may mount as virtual drive a folder whose name or path are long or includes spaces (but in this case you must include quotation marks as seen above), as long as its child folders (which will be seen as folders inside DOSBox's virtual drive) don't have long filenames.
In order to mount virtual floppy diskettes or CD-ROMs, we'll add to the mount command the
-t parameter, followed by
floppy or
cdrom in either case. For example, the following instructions would mount a folder as virtual A: floppy drive, and our real E: CD drive as virtual D: CD drive:
mount a "d:\oldgames\game\disc1" -t floppy
mount d "e:\" -t cdrom
You can also mount image files instead of folders with the
imgmount command instead of mount. (Actually if some copy-protected CDs don't work in DOSBox, their images may work.) Again you have all the options documented in the README.txt, for example in order to mount a certain image file as virtual D: CD drive it could be like this:
imgmount d "d:\oldgames\game\cd.cue" -t iso
To "unmount" a virtual drive (and be able to reassign another folder or image to the same virtual drive letter), the instruction is
mount -u (virtual drive letter)
We've learned to mount drives in DOSBox. The rest of commands we'll need are basically the names of the programs that start the games, and
cd to change the active folder within virtual drives. When writing folder paths, the "
\" symbol separates a parent folder (left of the symbol) from its child one (right), and when there's nothing left of "\" it represents the root folder. For example, the three following instructions
cd \
cd one
cd two
are totally equivalent to the single instruction
cd \one\two
(Just like "\" means the root folder, two suspension points "
.." mean the current folder's parent one.)
The cd command switches active folders, but not drives. To change the active virtual folder, simply type its letter followed by two points ":", for example
c:
d:
a:
At last we know everything necessary for out shortcuts to start the games directly!

(And in the meantime we've also learned how to handle DOSBox by hand from its command line.) To start a game we have to: mount--at least--a virtual drive where the game is, define it as the currently active one, then define the exact folder as the current one, and lastly we must call the program that starts the game.
We could mount always the same virtual hard drive by default--where all our games will be accessible in individual folders--in our dosbox.conf, and leave the rest of the commands for the config files particular to each game or profile; or we could place all the commands in the latter; or however we please. I'll illustrate an example of the first approach, which is the one I personally recommend.
So ideally all our DOS games will be in separate subfolders inside a folder which is in turn in the Shared Documents (or maybe a subfolder thereof according to your chosen organization). We'll mount this folder as the virtual C drive, so we need its full pathname. Don't worry if you're not sure about it, simply check the address bar, or the properties of any individual game's folder (be sure to get the full pathname and not only the portion that fits the width of the address bar or the properties window):

A possible example would be:
[autoexec]
mount c "c:\users\all users\documents\oldgames"
mount d "d:\" -t cdrom
c:
The first line (instruction) creates ("mounts") the C: virtual hard drive where all our DOS games will be found. It's just an example, replace the pathname between quotation marks with the one your games are in. (Notice that a folder with the same purpose is called "Users" in Windows Vista and "Documents and Settings" in XP.) However C is the recommended letter for the virtual hard drive since it's what many DOS games expect.
The second line mounts our D: real CD-ROM drive (if yours has a different letter replace the "d:\") as D: virtual CD-ROM drive so DOSBox can access it, and the last one places us in (sets as active) the recently mounted C: virtual drive where the games are.
If we ran DOSBox without parameters--for example from the Start menu or from any other shortcut that we haven't added the "-conf" parameters to, DOSBox would start the command line only and no game; but the C: and D: virtual hard and CD-ROM drives would be already mounted, and the first one would already be active (instead of Z:).
But what we want is the created shortcuts to automatically start their respective games, not just to load the particular configuration appropriate for them. For this purpose we only have to write the instructions that start each game in the [autoexec] section of each config file, so we don't have to enter them by hand into the command line every time.
Remember that the shortcut we created will load the default configuration in dosbox.conf as well as (and before) the specialized lines in the other one (ufo.conf in our example), and that includes the [autoexec] sections of both files. The instructions in both [autoexec] sections will be run (in the order specified in the shortcut parameters)--whereas the lines under the rest of the configuration headings ([sdl], [dosbox]...) are overridden every time an additional config file is specified. So, since the default dosbox.conf already has the lines above, that mount the necessary drives and set the hard one with the games as active, the only remaining instructions would be switching to the precise folder where the particular game is, and calling the program (executable) that starts the game. Going back to the previous example, the [autoexec] section of ufo.conf would be
[autoexec]
cd \xcom
call ufocd
exit
supposing that the game was for example installed in the
real folder "C:\Users\All Users\Documents\oldgames\xcom"--that is the
virtual folder "C:\xcom" according to the example mounting we did--, and that the executable to start the game is called "ufocd". The last command, "
exit", would quit DOSBox once we end the game, so we don't have to do it by hand every time.
We've reached the end of the tutorial,

but here you are some other commands you may find useful (again they're explained in detail along with others in DOSBox's README.txt):
loadfix takes up an amount of conventional memory, since some old games may crash if they find an unusually high value. It isn't usually necessary to specify parameters, just enter this command and then call the game.
keyb changes the keyboard layout--like the "keyboardlayout" option in the config files but within a single session. For example, the instruction "keyb sp" switches to Spanish keyboard, and "keyb us" to American keyboard.
boot boots floppy disc image files.