View Single Post
Old 05-07-2008, 01:01 PM   #2
Japo
Autonomous human
 
Japo's Avatar


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

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

Code:
mount  (virtual drive letter)  "(real folder)"
for example

Code:
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:

Code:
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:

Code:
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:

Code:
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

Code:
cd \
cd one
cd two
are totally equivalent to the single instruction

Code:
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

Code:
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 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:

Code:
[autoexec]
mount c "c:\users\public\documents\oldgames"
c:
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

Code:
[autoexec]
cd \xcom
call ufocd.bat
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.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