PDA

View Full Version : My Floppy Drive Image tool 1.00



alank2
January 7th, 2018, 04:30 PM
Hi Everyone,

I used to have another floppy disk tool that I wrote that I used for reading and writing diskettes, but it was only for 1.44mb diskettes and its compression made my 8088 come to a slow slow crawl. I decided to write a new tool that is a simple disk image read/write/verify, but this time it supports multiple formats and can also optionally split a disk image into multiple pieces to help for those times where you can't fit a disk image on a disk for example. I've learned that some of my other DOS tools wouldn't run on my 8088 because they had been compiled for 286, 386, etc. as well, so I made sure this tool would work on 8088's. There is also a windows version (WIN32 console application) that autodetects NT or 9X style environment and uses the correct system calls to work with a floppy, so you can run FDIMAGEW on 32-bit or 64-bit Windows operating systems as well.

Here is the help file for the tool and I've attached a ZIP with the help, DOS version, and Windows version. Let me know if you encounter any bugs that need to be fixed!

FDIMAGE 1.00
__________________________________________________ _____________________________

FDIMAGE is a floppy drive image tool that can image:
from drive to file
from file to drive
from drive to drive (effectively a diskcopy)
from file to file (for splitting or combining)

Here is the help and usage:

SA Development Floppy Drive Image 1.00 (WIN32)
Free to use; no warranty or responsibility provided.

Usage: FDIMAGEW [options] source target

Options:
The source and target can be a filename or floppy drive (a: or b: ).
/y will skip target filename overwrite prompting.
/v will verify an operation (the target will be verified, not written).
The source media format is determined automatically, but can be overridden
with /160, /180, /320, /360, /720, /1200, /1440, or /2880.
The target media format is checked unless the /smfc option is specified.
The /k will prompt the user to press a key before all operations so the
user can swap disks if necessary.
The /s2, /s4, and /s8 options indicate that the source is multiple files.
The /t2, /t4, and /t8 options indicate that the target is multiple files.
Options may appear anywhere on the command line.
/? will show this help.
__________________________________________________ _____________________________

There are two versions of this tool:

FDIMAGE.EXE - DOS version (16-bit) that can run under DOS as well as
environments that emulate dos bios calls for floppy drive
access. It also works under 32-bit versions of windows that
emulate the 16-bit environment, though the windows version may
be more optimal. This tool is compiled so that it can run
on machines even with old CPU's like the 8088.

FDIMAGEW.EXE - WIN32 version (32-bit) that can run under Windows 32-bit or
64-bit operating systems. This tool is compiled to run on
80386 and above.

Both versions have exactly the same options and functionality.
__________________________________________________ _____________________________

FDIMAGE generally works like a copy command except that the source and target
can be either a floppy drive letter (a: or b: ) or a filename. Given this, you
can copy from a file to drive, drive to file, or even drive to drive or file
to file.

The (/y) will skip overwrite prompting for files. There is no overwrite
prompting for disks. Be sure to have the correct command and correct disk
mounted in the correct drive so that a disk you care about is not overwritten
by accident. It is always safer to set any disk you don't want changed to
read only so that it can't occur. I am not be responsible for lost data.

The (/v) verify option does not do a copy, but verifies or compares the source
and target. *** No writing will be done with the /v command. ***

It currently supports these floppy formats:
5.25" - 160K, 180K, 320K, 360K, and 1200K (1.2M)
3.50" - 720K, 1440K (1.44M), and 2880K (2.88M)

It will determine the format automatically by looking at the media in the
source. If you want to override the format, you can use the /160, /180,
/320, /360, /720, /1200, /1440, or /2880 option.

It will also look at the target media format (if a drive) to verify it is
the correct media. You can override this with the /smfc (skip media format
check) option.

The (/k) option will prompt the user to press a key before each operation.
This gives the user the option to swap disks if necessary. The design of the
tool is that it uses available memory as a track buffer so it will load as
many tracks into memory as it can to reduce unnecessary swapping.

The (/s2, /s4, /s8, /t2, /t4, /t8 ) options allow you to specify that the file
is being referenced by the source or target is split into 2, 4, or 8 parts.
If a file is split, it will be mydisk.img, mydisk.002, mydisk.003, and so on.
This allows you to build up a full disk image even on drives that are smaller
than the disk image. It is very useful to use with the (/k) command.
__________________________________________________ _____________________________

Example #1 - read a disk in drive A: to a file.

If you want to read the disk in drive A: and store it to a file in the current
path, you can use:

FDIMAGE A: mydisk

It will automatically add a .img file extension if one is not specified.

In this case, it will read the entire disk in drive A: (autodetecting the
format) and store it in a file called mydisk.img in the current path.

If mydisk.img exists, it will ask if you want to overwrite it unless you also
add the /y option.
__________________________________________________ _____________________________

Example #2 - read a file and write a disk in drive B:

The opposite of example #1, one can use:

FDIMAGE mydisk b:

Again, it will automatically append .img to mydisk to look for mydisk.img.

It will read the contents of mydisk.img in the current path, check the disk in
drive B: to make sure it is the same format, and then write that disk.
__________________________________________________ _____________________________

Example #3 - verify the disk from example #2:

FDIMAGE mydisk b: /v

The /v option means that drive B: will not be written, instead it will be read
and compared to the file in mydisk.img. Any difference in data will be
reported.
__________________________________________________ _____________________________

Example #4 - write a 360K diskette on a system without a hard drive:

One issue with creating a disk from an image is that you need a drive that is
able to hold the size of that full image in a file. You can't fit a 360K disk
image for example on a 360K because of filesystem overhead. FDIMAGE has a
solution for this where it can split an image file into 2, 4, or 8 pieces.

I had an old Compaq Portable (8088 ) that had two 360K floppy drives and no
hard drive yet. I had an older bootable DOS disk, so I could boot that, but I
wanted to make a DOS 6.22 bootable diskette. I had a 360K disk image of DOS
6.22, but no other system that could write 5.25" disks. The solution is to
split the image into 2 pieces so that each piece will fit on a 360K disk, and
then recombine them back to a single diskette. I was able to transfer files
across a serial link to the machine.

Step #1 - split the image on the computer with the image:

FDIMAGE dos622.img dossplit.img /t2

This produced a dossplit.img and dossplit.002. I copied these over the serial
connection along with the FDIMAGE.EXE tool to two separate disks. I then ran:

FDIMAGE dossplit.img /s2 b: /k

In this case I was using a: as my source drive, and b: as my target drive,
though I could have used a: as my target drive too if I had had only one
drive.

The /s2 says that the source file will be split into two files, so it will
expect 2 files. The /k option will pause before each disk operation so I can
swap the correct disk into place. When it prompts for the dossplit.img file,
I can put that disk in, then when it prompts for the dossplit.002 file, I can
put that disk in. I had enough memory that it could cache a full disk in
memory, so it will prompt for dossplit.img, then prompt for dossplit.002,
and then finally prompt to write the disk.

Chuck(G)
January 7th, 2018, 04:41 PM
Limited to 512 byte sectors and MFM encoding, as well as plain-jane sector ID schemes?

Can you do 1.23MB PC98 DOS-formatted floppies?

alank2
January 7th, 2018, 06:06 PM
Yes exactly, it is limited to 512 byte sectors and plain-jane sector ID schemes (if that means all tracks have the same sectors, etc.)

It uses the number of sectors/maxsect/maxhead values found in the FAT header to automatically determine the tracks, heads, and sectors. You can override that with an option though. Either way, ultimately it attempts to use the BIOS to load a track at a time by iterating through the tracks/heads into memory.

I'm not sure the encoding comes into play as I think that would be abstracted from my code in the hardware, right? I don't think you can change the encoding in the BIOS as all, right?

I don't know much about PC98 formats - do they have a FAT boot sector or do they use a different filesystem?

Chuck(G)
January 7th, 2018, 07:39 PM
1) By encoding, I mean modulation scheme. Many floppy controllers can handle FM as well as MFM, even though there's no support for it in the BIOS. Interestingly there was support for it in SC-DOS.

2. PC98 uses 8x1024 byte sectors and an HD drive spinning at 360 RPM (not 300). Interestingly, most USB floppies can handle it just fine. No so much for legacy controllers, unless you have a 3-mode drive.

alank2
January 8th, 2018, 05:10 AM
That is interesting. I am using the BIOS only for floppy access (in FDIMAGE), and operating system calls in the Windows version (FDIMAGEW) which probably get translated and make it down the BIOS in 9X, but are likely emulated in NT/2K/XP/7/8/10/etc.

alank2
January 18th, 2018, 06:04 AM
Here is version 1.01 - I added DMF (1.68M) support to it last night.