Disk images
What is it?
Disk images are a copy of the data of a floppy on another carrier, like a hard disk or an USB stick. These images can be used by programs like Star Commander, VICE, X1541 and several C64-emulators.Theory
Most Commodore related disk images store all the sectors of a Commodore floppy disk in one sequential file. The way the data is stored is quit simple: we first start with storing the 256 bytes of sector 0 of track 1 (track 0 does not exist!), then sector 1, 2 etc., etc. When all sectors of the first track have been stored, we start with the next track. We proceed like this until the last sector of the last track has been stored.The most well known disk image is the so called D64 file. A D64 file is 174.848 bytes big = 683 sectors = 664 data blocks + 18 directory blocks + 1 BAM block.
Some programs use halftracks, extended gaps etc. as a kind of copy protection, all kind of things the standard disk images cannot record. For this reason the G64 image was developed. G64 should be able to record all kind of deviations known so far (more or less). But as there isn't still much support for it AFAIK, I skip this one.
The known images until so far
Theoretically there exists an image type for every type of Commodore drive but some probably aren't used for the very simple reason that the drives are very rare.The following images can be used for the listed drives:
- D40 - 2040, 3040
- D60 - 9060
- D64 - 2031, 4040, 1540, 1541, 1551, 1570
- D71 - 1571
- D80 - 8050
- D81 - 1581
- D82 - 8250
- D90 - 9090
Additional I created the D16-image. This image handles an imaginary 1541-drive capable of handling 255 tracks with 256 sectors each. This is about 16 MB, therefore the "16" in the "D16". I intend to use it in several of my own programs.
Creating a Dxx file on a PC is no problem: there exist several programs, which enable you to connect an IEC or IEEE drive directly to your PC and to read all the sectors one by one. The problem lies in handling the file by the PC. To be able to handle a Dxx file you need to know four things:
- How many tracks has the original disk
- How many sectors does each track contain
- The structure of the BAM
- The structure of the directory
Tracks and sectors
Image Tracks Sectors D16 1 - 255 256 D40 1 - 17 21 18 - 24 20 25 - 30 18 31 - 35 17 D60 1 - 612 32 D64 1 - 17 21 18 - 24 19 25 - 30 18 31 - 35 17 D71 1 - 17 21 18 - 24 19 25 - 30 18 31 - 35 17 36 - 52 21 53 - 59 19 60 - 65 18 66 - 70 17 D81 1 - 80 40 D80 1 - 39 29 40 - 53 27 54 - 64 25 65 - 77 23 D82 1 - 39 29 40 - 53 27 54 - 64 25 65 - 77 23 78 - 116 29 117 - 130 27 131 - 141 25 142 - 154 23 D90 1 - 918 32
The Directory header block / BAM
Image Byte Contents Definition D40 - Directory header + BAM at 18/0 0 18 Track of first directory block 1 1 Sector of first directory block 2 1 Indicates version 1 format 3 0 Future use 4-143 Bitmap of available blocks 144-161 Disk name padded with shifted space 162-163 Disk ID 164-170 160 Shifted space 171-255 0 Not used D64 - Directory header + BAM at 18/0 0 18 Track of first directory block 1 1 Sector of first directory block 2 65 Indicates version 4040 format 3 0 Future use 4-143 Bitmap of available blocks 144-161 Disk name padded with shifted space 162-163 Disk ID 164 160 Shifted space 165 50 \ 166 65 -=> 2A, indicates DOS version and format type 167-170 160 Shifted space 171-255 0 Not used D80 - Directory header at 39/0 0 38 Track of first BAM block 1 0 Sector of first directory block 2 67 Indicates version 8050 format 3 0 Future use 4- 5 0 Unused 6- 21 Disk name padded with shifted space 22- 23 160 Shifted space 23- 25 Disk ID 26 160 Shifted space 27 50 \ 28 67 -=> 2C, indicates DOS version and format type 29- 32 160 Shifted space 33-255 0 Not used BAM table at 38/0 0 38 Track of second BAM block 1 3 Sector of second BAM block 2 67 Indicates version 8050 format 3 0 Future use 4 1 Lowest track number in this BAM block 5 51 Highest track number+1 in this BAM block 6 Number of unused blocks on track 1 7- 10 Bitmap of available blocks on track 1 11-255 BAM for tracks 2-50, 5 bytes per track BAM table at 38/3 0 39 Track of first directory block 1 1 Sector of first directory block 2 67 Indicates version 8050 format 3 0 Future use 4 51 Lowest track number in this BAM block 5 78 Highest track number+1 in this BAM block 6 Number of unused blocks on track 51 7- 10 Bitmap of available blocks on track 51 11-140 BAM for tracks 51-77, 5 bytes per track 141-255 Unused D82 - Directory header at 39/0 0 38 Track of first BAM block 1 0 Sector of first BAM block 2 67 Indicates version 8050 format 3 0 Future use 4- 5 0 Unused 6- 21 Disk name padded with shifted space 22- 23 160 Shifted space 23- 25 Disk ID 26 160 Shifted space 27 50 \ 28 67 -=> 2C, indicates DOS version and format type 29- 32 160 Shifted space 33-255 0 Not used BAM table at 38/0 0 38 Track of second BAM block 1 3 Sector of second BAM block 2 67 Indicates version 8050 format 3 0 Future use 4 1 Lowest track number in this BAM block 5 51 Highest track number+1 in this BAM block 6 Number of unused blocks on track 1 7- 10 Bitmap of available blocks on track 1 11-255 BAM for tracks 2-50, 5 bytes per track BAM table at 38/3 0 38 Track of third BAM block 1 6 Sector of third BAM block 2 67 Indicates version 8050 format 3 0 Future use 4 51 Lowest track number in this BAM block 5 101 Highest track number+1 in this BAM block 6 Number of unused blocks on track 51 7- 10 Bitmap of available blocks on track 51 11-255 BAM for tracks 52-100, 5 bytes per track BAM table at 38/6 0 38 Track of fourth BAM block 1 9 Sector of fourth BAM block 2 67 Indicates version 8050 format 3 0 Future use 4 101 Lowest track number in this BAM block 5 151 Highest track number+1 in this BAM block 6 Number of unused blocks on track 101 7- 10 Bitmap of available blocks on track 101 11-255 BAM for tracks 102-150, 5 bytes per track BAM table at 38/9 0 39 Track of first directory block 1 1 Sector of first directory block 2 67 Indicates version 8050 format 3 0 Future use 4 151 Lowest track number in this BAM block 5 155 Highest track number+1 in this BAM block 6 Number of unused blocks on track 151 7- 10 Bitmap of available blocks on track 151 11- 25 BAM for tracks 152-154, 5 bytes per track 26-255 Unused D16 - Directory header at 18/0 0 18 Track of first directory block 1 1 Sector of first directory block 2 82 Indicates version D16 format 3 0 Future use 4-143 0 Unused 144-161 Disk name padded with shifted space 162-163 Disk ID 164 160 Shifted space 165 50 \ 166 82 ==> 2R, indicates DOS version and format type 167-170 160 Shifted space 171-255 0 Not used first BAM table at 18/224 0-31 0 Not used 32-63 Track 1, every bit represents a sector 64-255 Track 2-7 second BAM table at 18/225 0-255 Track 8-15 ...... last BAM table at 18/255 0-255 Track 240-255I have information about the Directory header and BAM used on the 9060 and 9090. But both use only ONE byte to identify the track. Both drives have more then 255 tracks. So how is the identification done? The only thing that I can imagine is that the given track/sector is translated to a disk/track/sector. The next question then will be is: how many sectors does each track contain? I also noticed another anomaly: the Directory header is found on track 0 / sector 0. For one or another reason C= started to count from 0 instead of 1 as they used to do.
Although D16 uses separate BAM blocks, the directory header of D16 is not like D80 or D82. This is done to keep D16 as compatible as possible with D64. Two other features are that the D16-image can contain subdirectories and that if track 18 is not enough for all the needed directory blocks, any other free block can be used as well.
An entry of a subdirectory is treated as any other file. Only its code will differ: $86. Remark: These directories are not like the ones you can create on a 1581 !!!
You can email me here.