Next: , Previous: , Up: The emulator file formats   [Contents][Index]


17.12 The DHD disk image format

The DHD image is bit-for-bit copy of a Creative Micro Designs (CMD) Hard Drive (HD). CMD designed their DOS so that it could co-exist with other operating systems from other computer platforms. At the time, SCSI HDs were very expensive, making this a likely scenario for some. In this section, a block refers to a SCSI HD data block which is 512 bytes. A SCSI HD refers to the location of a blocks on the disk as logical block address (LBA). A sector refers to a commodore disk sector which is 256 bytes. SCSI, being a smarter disk system (compared to earlier ones), translates the LBAs into physical head, sector, cylinder coordinates internally thus simplifying the host’s interface. So, for example, a 40 MB HD of that era would have had 82332 (or $1419C) LBAs. As HD technology improved, the number of sectors per cylinder became variable depending on the cylinder which allowed for greater capacity. The host therefore has no information about the HD geometry other than the total number of LBAs. Most operating systems place their partition tables or boot code near the beginning of the HD. Because of this variability, CMD designed their DOS to begin at any location in increments of 128 blocks. It was therefore possible to configure foreign partitions on various operating system so that the CMD data was ignored. The starting location of the CMD whole disk partition will be referred to as X blocks.

Upon reset, the boot ROM looks for the CMD whole partition by examining LBA X+2 (starting at X=0) and checking for a special signature in the block. If it does not find it, X will increase by 128, and it will try again. It will do this until it finds the signature, or until it gets a read error from the HD signaling the end of disk space. The device will the switch to installation mode.

The following is an example configuration block of a 40 MB drive:

X *     00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F        ASCII
$200 +  -----------------------------------------------   ----------------
000400: 94 6C 00 0E 7D E7 00 00 00 00 00 00 00 00 00 00
000410: 20 20 20 20 31 2E 39 32 30 33 2F 32 32 2F 39 36   ....1.9203/22/96
000420: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
000430: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
000440: 03 02 00 7E C9 55 00 00 00 00 00 00 00 00 00 00
000450: 20 20 20 20 32 2E 30 30 30 33 2F 32 32 2F 39 36   ....2.0003/22/96
000460: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
...
000500: 00 FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF
000510: FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF
000530: FF FF FF FF FF FF FF FF 00 01 FF FF FF FF FF FF
000540: FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF
000570: 00 41 FF FF FF FF FF FF FF FF FF FF FF FF FF FF
000580: FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF
0005A0: FF FF FF FF FF FF FF FF 00 9C FF FF FF FF FF FF
0005B0: FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF
0005E0: 00 0C 01 01 0C 80 01 00 00 00 00 00 00 00 00 00
0005F0: 43 4D 44 20 48 44 20 20 8D 03 88 8E 02 88 EA 60   CMD HD..........
...
000E00: < start of first OS, n=0, CMD DOS, see $402-$403 >
007E00: < start of second OS, n=1, GEOS overlay, see $442-$443 >
010000: < start of partition table, see $5E6-$5E7 >

The first 256 bytes of the configuration block appear to be a list of loadable operating systems for the drive. Each entry, "n", uses 64 bytes, so there can be at most 4. The first is the standard CMD DOS, while the second is an overlay for GEOS. The boot ROM explicitly loads the first (n=0).

The CMD DOS supports up to 56 connected HDs: 7 devices with 8 logical units (LUNs) each. For that era, most HDs only supported a single LUN (0), whereas more exotic array devices would allow for multiple LUNs. The relative location of the disk, "d", in the whole drive map, is stored in the next 224 bytes. For example, the first disk would start at location 0. The next disk following the first, would start at LBA $01419C (the size of the first disk plus its starting point in the map). The 24-bit values used here for the placement are adequate since a fully populated CMD HD can only access 255 16 MB partitions, which his just under 4 GiB.

The last portion of the configuration block holds the device parameters (device number, partition location, default partition) as well as the CMD HD signature.

BytesDescription
(X*$200)+($400-$4FF)Operating System Table
(X*$200+$400+n*$40)+$00Destination memory page
(X*$200+$400+n*$40)+$01Number of pages
(X*$200+$400+n*$40)+$02-$03Location of data offset from X in sectors (256 bytes); MSB format
(X*$200+$400+n*$40)+$04-$05Checksum of data; MSB format
(X*$200+$400+n*$40)+$06-$0FAll 0x00
(X*$200+$400+n*$40)+$10-$17ASCII of version number
(X*$200+$400+n*$40)+$18-$1FASCII of date
(X*$200+$400+n*$40)+$20-$3FAll 0x00
(X*$200+$500+d*$38)+$00SCSI ID of HD in bits 7-4, LUN in bits 3-0; $FF means not present
(X*$200+$500+d*$38)+$38MSB of disk location in drive map
(X*$200+$500+d*$38)+$70Middle byte of disk location in drive map
(X*$200+$500+d*$38)+$A8LSB of disk location in drive map
(X*$200+$500)+$E00x00 (unknown)
(X*$200+$500)+$E1Device number (12 or 0x0C by default)
(X*$200+$500)+$E20x01 (unknown)
(X*$200+$500)+$E30x01 (unknown)
(X*$200+$500)+$E4Device number (12 or 0x0C by default)
(X*$200+$500)+$E50x80: 2 to the power of the SCSI ID of host (which is always 7)
(X*$200+$500)+$E6-$E7Location of CMD partition table offset from X in sectors (256 bytes); MSB format
(X*$200+$500)+$E8Default partition number
(X*$200+$500)+$E9-$EFAll 0x00
(X*$200+$500)+$F0-$F70x43 0x4D 0x44 0x20 0x48 0x44 0x20 0x20: First half of signature
(X*$200+$500)+$F8-$FF0x8D 0x03 0x88 0x8E 0x02 0x88 0xEA 0x60: Second half of signature; decodes to STA $8803, STX $8802, NOP, RTS

The CMD partition table is a special disk image with one track and 32 sectors. It is very similar the standard directory structure of most CBM drives. The first two bytes of the sector indicate the location of the next track/sector of the partition table; it is usually in sequence. If the next track is set to $00 (the next sector will be $ff), then it is the last sector of the partition table.

The standard partition table sectors:

BytesDescription
$00-$1FFirst partition entry for this sector
$20-$3FSecond partition entry for this sector
$40-$5FThird partition entry for this sector
$60-$7FFourth partition entry for this sector
$80-$9FFifth partition entry for this sector
$A0-$BFSixth partition entry for this sector
$C0-$DFSeventh partition entry for this sector
$E0-$FFEighth partition entry for this sector

The standard partition entry:

BytesDescription
$00-$01Track/Sector location of next partition sector ($00 $00 if not the first entry in the sector)
$02Partition type: 0x00=none, 0x01=native, 0x02=1541, 0x03=1571, 0x04=1581, 0x05=1581CPM, 0x06=Print Queue, 0x07=Foreign, 0xFF=System. Only partition 0 can be a system type, and type 6 isn’t known to be implemented on any CMD DOS.
$03-$040x00 0x00
$05-$1416 character partition name (in PETASCII, padded with $A0)
$15-$17Location of the partition data offset from X in sectors (256 bytes); MSB format; partition 0, the system partition always starts a 0.
$18-$1DAll 0x00
$1E-$1FSize of partition (in blocks) in MSB format. Partition 0, the system partition is always 0x90 blocks, which includes blocks from X to the end of the partition table.

When a partition is deleted, its entry is removed and all others stay in their existing place. The partition data following the deleted partition is moved back to fill in the gap from the deletion; this can be very time consuming. So, when deleting a partition, it is suggested to start with the one with the highest start LBA.

The data at the starting LBA is simply the associated disk image of the partition type. It follows the formats (D64, D71, and D81) documented previously.


Next: The P00 image format, Previous: The D90 disk image format, Up: The emulator file formats   [Contents][Index]