Go Back   Forums > Abandonia.com > Troubleshooting > Tutorials
Memberlist Forum Rules Search Today's Posts Mark Forums Read
Search Forums:
Click here to use Advanced Search

Thread Tools Display Modes
Old 05-07-2008, 12:57 PM   #1
Autonomous human
Japo's Avatar

Join Date: Mar 2006
Location: ,
Posts: 4,613
Default Advanced DOSBox Tutorial

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 the Windows start menu > Programs > DOSBox-x.xx > Options > DOSBox x.xx Options".

(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 this file 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. Let's clarify this.

Before we continue let's get a little organized. We'll create a folder where we'll put all the shortcuts we'll create (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--"DOS games".

We need a second folder to contain custom configuration files. We'll create it in the Desktop too (again use any other location you prefer), and name it "DOSBox custom files" for example.

The easiest way of creating a new configuration file is to copy the default file and edit 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 files in the same session: DOSBox would load first the default configuration, and when loading the next one the new options would override the default ones, but the options not specified in the second file remain as they are.

The idea is to load always the default configuration--which we can customize too--while the other files for particular games will only include "incremental" options that we want different from the default. Whenever we want to change the default configuration we won't need to edit every single file, just the default one accessible from the Windows start menu, that sets the default options common to every session unless another file overrides them. If you haven't grasped it, don't worry because we'll be seeing an example shortly.

As we said, we can start from the default file accessible from the start menu under "DOSBox x.xx Options", edit the necessary lines, then delete the rest of the lines we didn't change. Be careful not to delete the headings--the lines with words between square brackets ("[]"). Then we save this custom file in the "DOSBox custom files" folder we created.

The files don't need to have a .conf extension. If you use a .txt extension you'll be able to open them in the Windows notepad by double-clicking on them. Of course you can associate .conf files with the notepad too. In any case don't get confused if Windows hides the extension, you'll later need the full name of the file including extension. (Note that it's displayed in the title bar of the Windows notepad, see the screenshot below).

For example, this is my file to run UFO - Enemy Unknown:

The rest of the options will remain as default. 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.

If at any time we mess the default file, you can click on "Reset Options" in the DOSBox folder in the Windows start menu. Although you'll lose any changes you did to it before, as I recommended at the end of the basic tutorial and later in this one.

Anyway, once you have the config file we want, save it in the "DOSBox custom files" folder you created. Now we want to make a shortcut that will run DOSBox with that configuration, and every time we wish to use it (running a particular game) we only have to double-click on the shortcut.

So we go back to the other "DOS games" folder we created, and copy the "DOSBox x.xx" shortcut from the start menu to this folder:

(Remember that dragging with the left mouse button is moving, so if you want to copy instead, not to remove the shortcut from the start menu, drag with the right mouse button and choose "copy here".)

We rename it (select it and press F2 or click on the name label)...

And then we need to modify the properties of the shortcut. So we right-click on it and select "properties" (or press Alt+Enter while it's selected). Before any changes it should look like this:

We need to add a parameter to make the shortcut load our configuration file. (You can read about all the DOSBox parameters in the "manual" accessible from the Windows start menu.) There are two changes we need in the shortcut, first we must add to the "Target" field the text

 -conf (filename)
without erasing what's already there, and leaving a space between it and our new text. Now's when it's important not to miss the file extension, even if Windows hides it.

The second change is replace what's in the "Start in" field for the path to the "DOSBox custom files" folder where we keep our custom configuration files. You can get the path opening that folder and clicking on the address bar and copying the path from there:

The final result must look like this:

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 configuration files (in the same "DOSBox custom files" folder) and other corresponding shortcuts, which we can easily make by copying this one and changing what's behind "-conf " with the name of the particular file--since the "Start in" field will be the same for all the games.

Last edited by Japo; 24-01-2011 at 12:26 AM.
Japo is offline                         Send a private message to Japo
Reply With Quote
Old 05-07-2008, 01:01 PM   #2
Autonomous human
Japo's Avatar

Join Date: Mar 2006
Location: ,
Posts: 4,613

We've learned how to create custom configuration 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. But you may remember that I postponed the explanation of the "[autoexec]" heading of DOSBox configuration 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 the interface of DOS was a command line--where instructions were typed and then entered with the Enter key--; so the interface of DOSBox 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 configuration files, so they'll be entered automatically every time we use the shortcuts.

The first and most important DOSBox command is "mount". It's difficult to understand at first, but DOSBox doesn't access our drives (disks) directly. Instead we must "mount" folders (or also 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 (not recommended!) as the virtual C drive in DOSBox, but we can also mount any other folder of any other real drive as the virtual C drive, or as any other virtual drive.

You'll find all the details of the mount command in DOSBox's manual, but using DOSBox for Windows, in order to mount a folder as a virtual hard disk, 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 a 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 folders as 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
There are additional options that you can look up in the manual accessible from the Windows start menu (such as -label, which lets us specify a label for the drive).

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 manual, 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 cdrom
To "unmount" a virtual drive (and be able to reassign another folder or image to the same virtual drive letter), the instruction is--regardless of whether it was mounted with mount or imgmount:

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
(Also, 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


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 can mount always the same virtual hard drive by default--where all our games will be accessible in individual folders--in our default file, and leave the rest of the commands for the configuration files particular to each game or profile; that way if we start DOSBox with the default configuration only, we still don't have to type in the mount command every time. Be warned however, that if we include the mount command for a C: drive in the default configuration, we won't be able to start games by dragging them onto the DOSBox shortcut, as the basic tutorial describes. (Because this auto-mounts the concerned folder as the C: virtual drive, but if that letter is already taken, an error happens. So we can include the mount command in every custom file to leave it outside the default one--specially if it's not the case that we have all our DOS games hanging from the same parent folder--or include there a mount command for a drive with a different letter than C:--although this may cause problems with some games). It's a matter of personal preference; I'll describe the first approach, but by now you'll know how to adapt it. An ideal solution, if you want to continue being able to drag'n drop, may be copying the default configuration file to your custom files folder along with the others, and replace in the shortcut parameters "-userconf" with "-conf dosbox.conf" (if this custom default file is named "dosbox.conf"). That way you can edit your custom dosbox.conf, and leave the other file unchanged as out of the box; so drag'n dropping can still work alongside your shortcuts.

Ideally all our DOS games will be in separate folders, but these will be children of the same one folder. We'll mount this folder as the virtual C: drive in the default configuration file. We need its full pathname, to learn it simply click on the address bar as we saw before. We can add any number of other commands, and it's always a good idea to add one to switch the current drive to the newly mounted C: drive. So we should have at least:

mount c "c:\users\public\documents\oldgames"
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: : virtual hard disk would already be mounted and 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 file 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, where "-userconf" represents the default file and is always loaded first)--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 file 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

cd \xcom
call ufocd.bat
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.bat".

(The last command, "exit", would quit DOSBox once we end the game, so we don't have to do it by hand every time, although that doesn't matter if we quit the game by closing DOSBox itself (Ctrl+F9). The "call" before the executable is almost optional, you can read here about it.)

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 the manual):

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.

Last edited by Japo; 30-01-2011 at 10:49 PM.
Japo is offline                         Send a private message to Japo
Reply With Quote

Similar Threads
Thread Thread Starter Forum Replies Last Post
Abandonia's Dosbox Tutorial Rogue Old Suggestions 11 02-03-2006 06:48 PM
Help With The Dosbox Tutorial. gamebounty Tech Corner 28 21-02-2006 04:52 PM

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On
Forum Jump

The current time is 12:20 AM (GMT)

Powered by vBulletin® Version 3.7.1
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.