For a long time I have needed a way to transfer data into my DOS virtual machines. I came somewhat close to a solution by using Keka to archive directories as ISO files, but I was unable to create what I truly needed – a floppy disk image containing the archived contents of a directory. Well, now I’ve found a way to do just that, partly by doing some research on Google and partly by just figuring stuff out on my own.
The first thing you need to do is create a 1.44 MB empty file with an extension of .ima, .img, or some other raw floppy image extension. This can be done using
dd, with the following command:
dd if=/dev/zero of=floppy.img bs=1024 count=1440
I took a screenshot of the output of
dd for a visual:
The next step is to format the file with an MS-DOS FAT filesystem. The easiest way to do this is in DOS. So insert the blank disk image in the VM and type
Now you have a blank floppy image and are ready to add files to it. To verify that the floppy had been formatted, I ran a hexdump in the Unix terminal.
Next you need to mount the floppy image. The easiest way to do this is to just double click on its icon in the GUI, then copy and paste the files from the source directory or directories to the directory that the image is mounted on. I tested this first with a couple of simple standalone programs – Visicalc and DOS Cal:
Now I have installed two programs:
VC.COM. Indeed, when I go to the
C: drive and type
cal, the program starts.
Just a side note here: the default path in MS-DOS is set to
C:\DOS, so if you want to run programs from a different directory you need to edit the search path in the AUTOEXEC.BAT file:
For some reason, my DOS VM would only read the first floppy image that I created. Creating further floppy images using the same technique resulted in an Abort-Retry-Fail error message. To work around this, I have written a C program that automates the process of creating and formatting the floppy image, using the hexdump of the original image. That way I know the file will be exactly the same and I’ll be able to create multiple floppy images for software that requires a multi-disk installation. I will talk about this program, as well as MS-DOS 6.22, MS-DOS disk labels, and some additional software that I’ve installed in the next few blog entries. For now, farewell.