Friday, December 13, 2013

Tutorial - DOSBox and Floppy Disk Game Installation

Usually I do not write specifically about DOSBox because my main interest is real hardware, but DOSBox is an invaluable tool for anyone into retro-PC DOS gaming.  DOSBox can play just about any DOS game, and can certainly play all the widely-known classic games.  One of its lesser-acknowledged strengths is its ability to install games from floppy disks, or more usually, from floppy disk images.  In this entry I will describe the ways DOSBox can install games off floppy "disks".

If you have floppy disks, your first task should be to make floppy disk images.  Of course, you can mount a physical floppy disk drive directly with DOSBox, but relatively few people have floppy drives connected to modern systems these days.  Floppy disks should be preserved, so I would always first image the disk, then install it.

A program like Winimage works for unprotected DOS-readable floppy disks, and the resulting image files have a .ima extension.  On older hardware, I use a free program called img2dsk.  If you read original floppy disks in a Windows machine, you should enable write protection on the disks otherwise Windows will make (usually harmless) changes to the first sector of a disk.  Winimage and other simple disk imaging utilities only understands what DOS understands, so you will not be able to make useful backup copies of any game with disk-based floppy protection.  Fortunately, this is almost never a problem with games that were released on high density floppy disks, since no game (except for Lemmings 2 : The Tribes) released on high density floppies is known to use disk based protection.  Hopefully the images will not contained damaged files, but a disk imaging program should be able to report any errors.

Always dump a disk to its right size.  Regular disk images are sector dumps and will dump all the formatted sectors on a disk, whether there is anything in the sectors or not.  Remember that 5.25" double density disks have a hub ring and a rust brown color to the recording media while 5.25" high density disks have no hub ring and a shiny black finish on the recording media.  3.5" double density disks only have a hole on one side of the disk while 3.5" high density disks have a hole on either side of the disk.  The size of the files should be able to tell you what kind of disk is being used.  160K, 180K and 320K disks are usually copy protected.

If you do not have floppy disks or images, it is much harder to find them than "full" installs of games.  Disk images are generally unadulterated, they have not been cracked and can be used to install alternative features to the standard installed versions found everywhere else.  Some games like Wing Commander require a reinstall off the disks to select Tandy or EGA graphics when the standard install or CDs with the game just have a VGA-only installation.

Now that you have some images of your floppy disk install disks, you need to mount them so DOSBox can find them.  There are three ways you can do this.  First, in Windows you can use a program like Virtual Floppy Drive 2.1, which will mount a DOS-formatted disk image of any regular size and emulate one to two floppy drives.  If A:\ is your emulated drive, in DOSBox, you would use mount a a:\ -t floppy.  The benefit to this method is that you can load new floppy disks just by double clicking on them once Windows associates the .ima extension with VFD.  The author of VFD 2.1 doesn't like Windows Vista or 7 or 64-bit Operating Systems, but other users have found way around the program's limitations. There are workarounds, namely signed 64-bit drivers for VFD.   The answers can be found here : http://superuser.com/questions/183335/how-to-create-a-virtual-floppy-drive

If you cannot or will not use VFD or another program like it, DOSBox can mount floppy images directly, but it is a complex process, at least in the official 0.74 version.  If using the latest or recent SVN, the process is much easier.  http://www.emucr.com/ has good basic builds of the current SVN, so let's start with the SVN method. The IMGMOUNT command in SVN supports multiple floppy images, just like it does with CD images in 0.74.  DOSBox, however, does not mount files that do not conform to the 8.3 filename convention, so lengthy descriptive filenames will need to be condensed into disk1.ima, disk2.ima and so on.  Here is a sample mounting command in the [autoexec] section of dosbox.conf :

imgmount a c:\dos\images\disk1.ima c:\dos\images\disk2.ima -t floppy

Images can use an IMG or IMA extension, but each image file must have the full path on the line for it to be recognized.  It does get kind of tedious with a game like Discworld, which came on 15 disks (versus one CD-ROM).  With this method, you can install a game to an ordinary mounted folder.

Some games have installers that do not work with DOSBox's DOS, but will work with MS-DOS.  Dynamix games just don't like DOSBox when it comes to floppy installs.  DOSBox emulates enough PC hardware that you can use it as a virtual machine for MS-DOS or PC-DOS.  I generally see no need to use DOSBox as a virtual MS-DOS machine because getting EMM386 to work is tricky and MSCDEX needs ATAPI emulation not found in the standard SVN.  But for those tricky floppy installation programs, it can be very useful and certainly beats using real hardware and copying floppy drive images to back to real blankdisks.

You will need a hard drive image, and you can make your own with a program called BXIMAGE or  download one from here : https://sites.google.com/site/dotalshoff/games/dosbox  I would not use a disk image size of more than 528,482,304 bytes because you cannot easily make it bootable with DOSBox.  This is not coincidentally the old 520/504MB limit caused by the lowest common denominator between Int 13 and ATA/IDE hard drive size support.  You will also need floppy images for a version of MS-DOS or PC-DOS.  5.0 is the minimum version I recommend, but MS-DOS 6.22 is the most up to date version of pure DOS commonly used.  If you use MS-DOS 6.x, you should install the utilities off the Supplemental Utilities Disk, as they contain some utilities used in some weird game installs that were previously included in DOS 5.0.  Floppy images can be found if you look hard enough.  I do NOT recommend using FreeDOS, since many game installers rely on quirks of MS-DOS that have not been emulated well with FreeDOS.

Assume your hard drive image is named hdd-520mb.img and your MS-DOS 6.22 floppy images are msdosd1.img, msdosd2.img and msdosd3.img.  Here is how your dosbox.conf should look :

imgmount c c:\dos\images\hdd-520mb.img
boot c:\dos\images\msdosd1.img c:\dos\images\msdosd2.img c:\dos\images\msdosd3.img

Note that with the BOOT command, the extension must be .IMG, .IMA will not work.  The file hdd-520mb.img is already partitioned and formatted, so you need not use FDISK and FORMAT to prepare the image file.  Just use the install program or use the SYS command to make the drive bootable and copy all the commands over to c:\dos in DOSBox.  Ctrl + F4 will switch the active disk image.

Ordinary disk images cannot be booted, so you will need an MS-DOS boot disk with the version installed on the hard drive to start the process.  With the boot disk named msdosbd.img, The [autoexec] section may look like this :

imgmount c c:\dos\images\hdd-520mb.img
boot c:\dos\images\msdosbt.img c:\dos\images\disk1.img c:\dos\images\disk2.img

After the boot disk boots, use Ctrl + F4 to switch to the first game disk image and install away.

BOOT should be the last command in the section.  In order to transfer the installed files from the hard disk image to a regular mounted hard drive using a folder on your real hard drive, start with lines like these in your [autoexec] section :

ver set 6 22
imgmount c c:\dos\images\hdd-520mb.img
mount d c:\dos\games

The VER set command will allow you to use MS-DOS 6.22's XCOPY command to copy whole directories from the hard drive disk image to your mounted real folder.  Regular DOSBox does not have an XCOPY command, so with regular DOSBox you will need to manually recreate the directory and subdirectory structure with the md command.  With XCOPY, use the /E switch to copy over subdirectories.

One remaining issue is that you cannot IMGMOUNT floppy images and BOOT to a hard drive image at the same time.  You need to BOOT the MS-DOS boot disk and the disks you wish to install.  The hard drive image becomes a receptacle to hold the installed files, which you can transfer later.

8 comments:

  1. This has more information on it than the DOSBox wiki itself does. Someone should link to this.

    ReplyDelete
  2. Another tool for mounting images on Windows is the excellent ImDisk utility (http://www.ltr-data.se/opencode.html/#ImDisk) which comes with signed 32- and 64-bit drivers, and can mount not only floppy images, but images of hard drives, optical media, etc., in a wide variety of formats.

    For creating archival-quality images, the KryoFlux board (http://www.kryoflux.com/) actually records the low-level magnetic flux data from the floppy, preserving everything, including copy protection. It can export into a wide variety of image formats, so it's suitable for imaging not just DOS game disks, but floppies from almost all classic platforms, and some emulators can now use KryoFlux's native format, which will allow everything including the copy-protection to be preserved in the disk image.

    ReplyDelete
  3. ImDisk is certainly eaiser to get working with Windows Vista/7/8, but I find Virtual Floppy Drive, when it is assigned to files with the .ima extension, to be much, much faster and opening disk images. This makes multiple-disk floppy installs go by much more quickly.

    DOSBox only supports unprotected floppy disks, so Kyroflux's only possible use for DOSBox is to try to recover a damaged disk. That assumes that you can make a standard disk dump from the data Kyroflux generates. As I recall, Kyroflux saves the data as a raw stream of flux reversal data which must be sent to the Software Preservation Society, which may send you back an IPF file which you can write to disk, then image it with a standard program.

    ReplyDelete
  4. I tried and tried, but I cannot get VFD to work in Windows 8.1, so I guess I will have to use ImDisk in the future.

    ReplyDelete
  5. Wow, so basically it's extremely hard (impossible for mortals) to install software in DOSBOX. Isn't this a problem with installing basically everything on DOS? This emulator shouldn't have been released in this state. In fact, I can't find any DOS emulators that can deal with multiple floppy disk installs, despite that being the form that most DOS applications are delivered in.

    I've just spend hours scouring the net for information on how to install software. It seems like the easiest method would be to buy a USB floppy drive and write the disk images onto floppy disks and complete the installation like its 1984 because the emulator authors couldn't be bothered making a way to switch floppy disk images?

    Is there another DOS emulator that be used to install software? So far I've tried DOSEMU on Linux, DOSEMU2 on Linux, DosBox on Windows, DosBox on Linux, and vDos on Windows.

    ReplyDelete
    Replies
    1. This comment is untrue, DOSBox SVN certainly supports installing DOS games off multiple floppy disks and this feature has not been deleted. I have used it several times in the past to make clean installs. While it may not be perfect, the source has had some recent improvements which should improve compatibility and reduce the instances where you need to boot true MS-DOS and a hard disk image to install a game.

      Delete
  6. THIS GUIDE IS OUTDATED

    It is no longer possible to specify multiple floppy disk images in DOSBOX, they removed the feature instead of fixing bugs.

    This means there is no NO WAY to install games that require multiple floppy disks except to purchase a floppy disk drive with the correct connections for a modern PC and then buy some floppy disks from somewhere and then write the images onto actual floppy disks and swap them like its 1982.

    Until the lazy and ignorant developers of the emulator realize their mistake, DOSBOX is essentially useless because you can't install anything. Every other emulator of old hardware has a mechanism to handle this problem, but DOSBOX removed theirs and don't seem to be replacing it.

    To make matters worse, if you have installed the Linux or Android subsystems, you're running Hyper-V which means even emulators like VirtualBox or VMware won't work until you delete your Linux and Android installations.

    Hopefully someone has a copy of DOSBOX that still works or perhaps one of the forks works properly or the future of DOS emulation is looking pretty bleak.

    ReplyDelete