• Please review our updated Terms and Rules here

SAVEDSKF.EXE: meaning of "1 sector leader"

Allen

Guest
Joined
Jan 1, 2008
Messages
101
When using IBM's SaveDskF program (SAVEDSKF.EXE) to save an image of a diskette, one of the options is /D "omits the 1 sector leader and inhibits data compression." What is the "1 sector leader"? The documentation also states this as omitting the "file header."

The relevant options for the SaveDskF program are

/N inhibits data compression
/D omits the 1 sector leader and inhibits data compression
/A saves all sectors of the disk

If /N is used with /A the resulting image file size is 1,474,601 bytes, but if /D is used with /A the resulting image file size is 1,474,560 bytes. So what is this 41-byte difference?
 
Normally SaveDskf puts some meta data in the first part of the saved image probably to describe what version of SaveDskf created the image.

If you don't let SaveDskf write that extra information LoadDskf probably can't decompress the results, hence the need to disable compression. I would also think that /A would be required too, otherwise you just have a bunch of sectors and LoadDskf doesn't know where sectors were skipped during the save process.

If you look at the file size with /D and /A that is the exact number of bytes for a 1.44MB drive - all sectors saved, no compression, and no meta data. Such an image should work with other imaging programs and Linux DD.
 
In an old-style DSKF file (magic 0x58AA) the sectors begin at a fixed offset of 512, which is presumably why it refers to a one-sector leader. In later versions (magic 0x59AA or 0x5AAA) the sectors begin immediately after the comment.

The format of the header is:
Code:
+0  DW  magic     [all words are in Intel little-endian order]
            0x5AAA => Compressed 
            0x59AA => No compression
            0x58AA => Older format (no compression), with sector data 
                    beginning at fixed offset 0x200 rather than immediately 
                    after the comment. Created by SAVEDSKF with the 
                    undocumented /C option.

                (In fact, LOADDSKF accepts any magic number in the range 
                 58AAh-5AAAh, but these are the ones SAVEDSKF generates).

+2  DW  media type
                The first byte of the FAT.
+4  DW  sector size, bytes
+6  DB  cluster mask
                The number of sectors per cluster, minus 1.
+7  DB  cluster shift
                = log2(cluster size / sector size)
+8  DW  reserved sectors
                As in the BIOS parameter block
+10 DB  FAT copies
                As in the BIOS parameter block
+11 DW  Root directory entries   
                As in the BIOS parameter block
+13 DW  Sector number of first cluster (ie, count of sectors used by boot
        sector, FATs and root directory)
+15 DW  Number of clusters in image. This is probably less than the number of
        clusters the disc can hold, since empty clusters at the end are not
        saved.
+17 DB  sectors/FAT
                As in the BIOS parameter block
+18 DW  Sector number of root directory (ie, count of sectors used by 
                boot sector and FATs)
+20 DD  checksum
                Sum of all bytes in the file.
+24 DW  cylinders
                Number of cylinders, 40 or 80
+26 DW  heads
                Number of heads, 1 or 2
+28 DW  sectors/track
                Number of sectors per track
+30 DB  0,0,0,0    
                Do not appear to be used.
+34 DW  number of sectors in image
+36 DW  offset to comment
+38 DW  offset to the first sector. If this is 0, assume it is 0x200.

  After the header, an ASCII comment may follow. 

  The sectors then follow, stored in cylinder/head/sector order. If the magic
number is 5AAAh, the data will be compressed using a 12-bit LZW scheme.
 
1,474,560 bytes seems to be the standard

1,474,560 bytes seems to be the standard

"If /D is used, the file is not compatible with LOADDSKF unless the /A flag is also used," this according to SAVEDSKF command. So you don't have to use /N in SAVEDSKF for the resuling file to be compatible with LOADDSKF. I tried using just /D and /A, and backward tested using LOADDSKF--no problems.

The total disk space reported by CHKDSK and FORMAT of a 1.44 MB diskette is 1,457,664 bytes, not 1,474,560 bytes. Other disk image programs I see out there create images with file size 1,474,560 bytes (instead of 1,474,601 bytes produced by using /N and /A). Most of the image files I come across are 1,474,560 bytes. Since this appears to be the standard, I guess I should just use /D and /A, omitting the 1 sector leader/file header.
 
CHKDSK and FORMAT only show free space. You've got to include the boot sector, directory and FAT to get to 80*18*2*512 = 1474560
 
Back
Top