Difference between revisions of "IBM System 34 double density format"

From CPCWiki - THE Amstrad CPC encyclopedia!
Jump to: navigation, search
(Syncing)
Line 36: Line 36:
  
 
NOTE: A1/C2 are the only MFM-words which have a missing clock. All the others are written like normal data bytes.
 
NOTE: A1/C2 are the only MFM-words which have a missing clock. All the others are written like normal data bytes.
 +
 +
===CRC===
 +
 +
The CRC is initialised to FFFF. It is updated byte by byte and uses the CCITT-CRC16 algorithm. It is written to the track high byte and then low byte.
  
 
===Syncing===
 
===Syncing===

Revision as of 10:13, 29 July 2018

The IBM System 34 double density format is a structure used by NEC765 compatible disc controllers when writing in MFM mode.

The data has this form:

The values below are unencoded data bytes. The data is encoded using MFM when written to the disc.

Gap 0 (80 bytes of data 4E)
Sync (12 bytes of 0)
Index mark IDAM which contains 3 bytes of C2 (which have a missing clock) followed by 1 byte FC.
Gap 1 (50 bytes of data 4e)

Then follows the data for each sector:

Sync (12 bytes of 0)
ID mark IDAM which contains 3 bytes of A1 (which have a missing clock) followed by 1 byte FE.
1 byte 'C' (defined by FDC format command)
1 byte 'H' (defined by FDC format command)
1 byte 'R' (defined by FDC format command)
1 byte 'N' (defined by FDC format command)
2 bytes CRC (stored big endian, i.e. high 8 bits, then low 8 bits).
Gap 2 (22 bytes of 4E)

The CRC for the ID field is computed from the 3 bytes of A1, the 1 byte FE, C,H,R and N. When verifying include the CRC and if the result is 0, then the CRC is correct.

Then comes the data field for the sector:

Sync (12 bytes of 0)
Data mark IDAM which contains 3 bytes of A1 (which have a missing clock) followed by 1 byte FB for Data or F8 for Deleted Data.
'n' bytes of sector data (defined by format when formatting, or by ID field when reading/writing)
2 bytes CRC (stored big endian)
Gap 3 ('n' bytes of data 4E) (defined by FDC format command)

After the last sector:

Gap 4 ('n' bytes of 4E all the way to the end of the track).

NOTE: A1/C2 are the only MFM-words which have a missing clock. All the others are written like normal data bytes.

CRC

The CRC is initialised to FFFF. It is updated byte by byte and uses the CCITT-CRC16 algorithm. It is written to the track high byte and then low byte.

Syncing

In order to read the data correctly and to ensure the bits are in the expected order a specific bit pattern is used for syncing. This bit pattern is specific to the format used by the FDC.

When this pattern is recognised then all data following is synced and will always read the same.

This special value used by the NEC765 is 4489 and has the following properties.

  • 4489 is an encoded version of the data byte A1 and has bit 7 set. It doesn't matter what the value of the previous byte is, the first clock of 4489 will always be 0. Therefore the pattern 4489 can't be influenced by data around it.
  • To make the value special, it has a "missing clock". What this means is that one of the clocks is forced to 0. The equivalent A1 byte encoded to MFM without the missing clock is different, therefore it is unique.