Entropy
1 Dovey Close
Astley, Tyldesley, Manchester, M29 7NP
 
Our Ref: RFCSHD14.DOC
SAM Coupe Hard-Drive Details
(Partition Table Format)
For Immediate Release
Wednesday, November 09, 1994
Contact:        Simon Cooke
Entropy / Rooksoft
(01942) 886084 (6pm onwards)
        Email: [EMAIL PROTECTED]

We would like to propose, after long discussions for the past two weeks on
the SAM Coupe Internet 
mailing list, a format for the hard drive partition table to follow. This
has been drafted by myself (Simon 
Cooke), and is to go under serious review by the newsgroup over the next
couple of weeks. We are 
releasing this as a preliminary gesture until the final document is
produced.

SAM Hard drive partition table structure

To provide for multiple disk partitions for various operating 
systems (for example, Unix, CP/M, Driver, etc), it has been decided 
to define a partition table format for the new SAM Coupe hard 
drive. This will also allow future machines to access the drive in 
a defined way if their operating systems alter in the way by which 
they access the drive.
 
Provision is made for both Head/Cylinder/Sector addressing and 
Logical Block addressing modes (this is to allow easy cross over to 
the SCSI protocol if an interface to allow this becomes available, 
without superlatively extensive DOS rewrites).
 
The partition table should be loaded to address &8400 (33792 
decimal). This is to allow the loading of a boot sector before this 
address, for example from a SAM floppy disk. The value is 1024 
bytes from the start, as some boot sectors on the SAM utilise the 
1024 byte sector per sector format.
 
Partition table format (512 bytes long)
 
Offset  Length  Function
0               (372)           Partition boot routine
372             (1)             Device type(1)
 
(Head / Cylinder / Sector type device)
373             (1)             No sectors per cylinder
374             (2)             No of cylinders on device
376             (1)             No of heads on device
 
(Logical Block Addressing type device)
373             (4)             No of sectors on device
 
377             (1)             Bootable partition type
378             (4)             Boot sector address(2)
382             (4)             First partition's details
398             (16)            Second partition's details
414             (16)            Third partition's details
430             (16)            Fourth partition's details
446             (16)            Fifth partition's details
462             (16)            Sixth partition's details
478             (16)            Seventh partition's details
494             (16)            Eighth partition's details
510             (1)             Checksum byte(5)
511             (1)             1's complement of checksum byte
(1) Device type. Bit 7 set = LBA mode device, reset = HCS mode device
(2) Boot sector address format is defined by boot partition type 
byte.
(3) Partition address format is defined by partition type
(4) Partition name - 3 characters eg. SAM or CPM
(5) Bytes 372-510 XORed with each other.

Partition entry structure:
Offset  Length  Function
0               (1)             Partition type
1               (4)             Partition start address(3)
5               (4)             Partition end address(3)
9               (4)             Number of sectors in partition
13              (3)             Partition name(4)
 
Partition table description:
A boot routine sits at address &8400 (33792), which is called when 
the partition table has been loaded. This routine should check the 
integrety of the partition table (ie making sure that partitions do 
not overlap).
 
The device type is as follows:
If bit 7 is reset, the device operates in HCS 
(Head/Cylinder/Sector) mode. If bit 7 is set, the device operates 
in LBA (Logical Block Addressing) mode.
 
Device types include:
0:      IDE Hard drive
1:      SCSI Hard drive
All other values are currently undefined.
 
The partition and boot types work as follows:
If bit 7 is reset, then the device works in HCS configuration. If 
bit 7 is set, then the device works in LBA configuration
The partition type (also mirrored in the boot type) may have a 
value from 0 to 127. Values reserved so far are:
 
Type            Meaning
0               No partition present here
1               E-DOS partition
2               CP/M partition
3               West Coast DOS paritition
4-127           Currently unallocated. Contact Entropy for allocation of 
                these values to your system.
 
The partition name is a three byte identifier code. This is a 
secondary form of identification and should not be relied upon - it 
is really of cosmetic use only, and the partition type byte should 
be used instead.
 
Allocated partition names:
 
Type            Name string
0               Null (3 bytes of value &00)
1               EDS
2               CPM
3               WCD
4-127           Currently undefined. Contact Entropy to request 
                allocation these values to your system.
 
If a partition is unallocated, all of its 16 bytes should be null 
(contain &00). When partitions are allocated / deallocated, any 
space between partitions should be pushed together - ie, empty 
space remains at the end of the partition table; there are no gaps 
in the middle of the table formed by deallocated partitions.
The partition table is "protected" by a checksum byte and a 1's 
complement of this byte. This is so that an easy way of determining 
whether or not the partition table has been corrupted is available. 
The checksum may be calculated and checked by the following code:
(To calculate, instead of comparing the value, write it to the 
corresponding offset in the partition table).
 
        checksum:
                        LD HL,&8400
                        LD BC,510
                        XOR A
        csum.loop:
                        XOR (HL)
                        INC HL
                        DEC BC
                        LD E,A
                        LD A,B
                        OR C
                        LD A,E
                        JR NZ,csum.loop 
 
                        LD HL,&85FE
                        CP (HL)
                        JR NZ,error             ;checksum <> expected value
 
                        CPL
                        INC L
                        CP (HL)
                        JR NZ,error
                        ;... rest of routine

For further clarification of any part of this document, please 
contact me at the contact addresses listed above. Simon Cooke.
 

Reply via email to