diff --git a/dsk.html b/dsk.html index 4adecd3..0f61b6e 100644 --- a/dsk.html +++ b/dsk.html @@ -1,9 +1,304 @@ - - -Unofficial Amstrad WWW Resource - - - -Sorry, you don"t appear to have frame support. -Go here instead - <a href="http://cpctech.cpc-live.com/docs/dsk.html">Unofficial Amstrad WWW Resource</a> - \ No newline at end of file + + + +Disk image file format + + + + + + +

Disk image file format

+ +

This document describes the standard disk image format. It has the file +extension ".DSK". + +

Disc Information block

+ +

The "Disc Information block" is always at offset 0 in the disk image file. +If track data exists, then this will immediatly follow the Disc Information Block and will start at +offset &100 in the disc image file. + +

The "Disc Information block" has the following structure: +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
offsetdescriptionbytes +
00-21"MV - CPCEMU Disk-File\r\nDisk-Info\r\n"34
22-2fname of creator14
30number of tracks1
31number of sides1
32-33size of a track + (little endian; low byte followed by high byte)2
34-ffnot used (0)204
+ +

Notes: +

+ +

Track Information Block

+ +

Each Track Block comprises a Track Information Block and sector data. +The sector data is always at an offset of &100 bytes from the start of the +track block. The data for the next track in the disc image immediatly +follows the data for the current track. + +

The first Track Block is located at offset &100 in the disk image file. +The track block starts with the Track Information Block and has this form. + +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
offsetdescriptionbytes
00 - 0c"Track-Info\r\n"13
0d - 0funused3
10track number1
11side number1
12 - 13unused2
14sector size1
15number of sectors1
16GAP#3 length1
17filler byte1
18 - xxSector Information Listxx
+

Notes: +

+ +

Sector info

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
offsetdescriptionbytes
00track (equivalent to C parameter in NEC765 commands)1
01side (equivalent to H parameter in NEC765 commands)1
02sector ID (equivalent to R parameter in NEC765 commands)1
03sector size (equivalent to N parameter in NEC765 commands)1
04FDC status register 1 (equivalent to NEC765 ST1 status register)1
05FDC status register 2 (equivalent to NEC765 ST2 status register)1
06 - 07notused (0)2
+

Notes: +

+ +

General format

+ +

Single sided DSK images

+ + + +

Double sided DSK images

+ + + + diff --git a/extdsk.html b/extdsk.html index 2f4825f..f1af2a8 100644 --- a/extdsk.html +++ b/extdsk.html @@ -1,9 +1,410 @@ - - -Unofficial Amstrad WWW Resource - - - -Sorry, you don"t appear to have frame support. -Go here instead - <a href="http://cpctech.cpc-live.com/docs/extdsk.html">Unofficial Amstrad WWW Resource</a> - \ No newline at end of file + + +Extended DiSK Image definition + + + + + +

Extended DSK image definition

+ +

The extended DSK image is a file designed to describe copy-protected floppy disk software. +It's definition was defined by Marco Vieth, Ulrich Doewich and Kevin Thacker. +

This format has been widely adopted and is one of the major file formats +used (the other major format is the standard disk image with the "MV - CPC" identifier). +

The extended disk image format should be used for copy-protected disc software, +or in place of a standard disk image if the resulting image is smaller than in the standard +disk image form. + +

Extended DiSK Format (Rev.5)

+ +

The disc image has the following format: + + + + + + + + +
DISK INFORMATION BLOCK (256 bytes)
TRACK INFORMATION BLOCK * number of tracks * number of sides
+

The track blocks are stored in increasing order 0..number of tracks, with alternating +sides interleaved if the disc image describes a double sided disk. +e.g. if the disk image represents a double sided disk, the order of tracks is: +track 0 side 0, track 0 side 1, track 1 side 0, track 1 side 1.... track (number of tracks-1) side 0, +track (number of tracks-1) side 1 +

The tracks are always ordered in this way regardless of the disc-format described by the disc +image. +

The location of the track information block is found by using the track size table. +

DISK INFORMATION BLOCK

+ +

The "DISK INFORMATION BLOCK" is always located at offset 0 in the disk image file, and has +the following structure: + +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
offsetdescriptionbytes +
00 - 21"EXTENDED CPC DSK File\r\nDisk-Info\r\n"34
22 - 2fname of creator (utility/emulator)14
30number of tracks1
31number of sides1
32 - 33unused2
34 - xxtrack size tablenumber of tracks*number of sides
+ +

NOTES: +

+ + +

TRACK OFFSET TABLE

+ + + + + + + + + + + + + + + + + + + + + +
offsetdescriptionbytes
01high byte of track 0 length (equivalent to track length/256)1
.........
+ +

NOTES: +

+ +

TRACK INFORMATION BLOCK

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
offsetdescriptionbytes
00 - 0c"Track-Info\r\n"13
0d - 0funused3
10track number1
11side number1
12 - 13unused2
14sector size1
15number of sectors1
16GAP#3 length1
17filler byte1
18 - xxSector Information Listxx
+ + +

NOTES: +

+ +

SECTOR INFORMATION LIST

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
offsetdescriptionbytes
00track (equivalent to C parameter in NEC765 commands)1
01side (equivalent to H parameter in NEC765 commands)1
02sector ID (equivalent to R parameter in NEC765 commands)1
03sector size (equivalent to N parameter in NEC765 commands)1
04FDC status register 1 (equivalent to NEC765 ST1 status register)1
05FDC status register 2 (equivalent to NEC765 ST2 status register)1
06 - 07actual data length in bytes2
+ +

NOTES: +

+ +

Extensions to the above specification

+ +
    +
  1. This extension was proposed by John Elliott. + +

    Extension to TRACK INFORMATION BLOCK: +

    + + + + + + + + + + + + + + + + + + + +
    offsetdescriptionbytes
    12Data rate. (See note 1 and note 3)1
    13Recording mode. (See note 2 and note 3)1
    + +

    Notes: +

      +
    1. Data rate defines the rate at which data was written to the track. +This value applies to the entire track. +

      + + + + + + + + + + + + + + + + + + + + + + + + +
      Date ratedescription
      0Unknown.
      1Single or double density
      2High Density
      3Extended density
      + +

      Existing files should have zeroes in these bytes; hence the use of 0 for unknown. + +

    2. Recording mode is used to define how the data was written. It defines the encoding used to write the data to the disc +and the structure of the data on the disc including the layout of the sectors. This value applies to the entire track. + +

      + + + + + + + + + + + + + + + + + + + + +
      Date ratedescription
      0Unknown.
      1FM
      2MFM
      + +

      Existing files should have zeroes in these bytes; hence the use of 0 for unknown. + +

    3. How to determine the actual rate. +

      The NEC765 floppy disc controller is supplied with a single clock. When reading from and writing to a disc using the NEC765 you can choose FM or MFM +recording modes. Use of these modes and the clock into the NEC765 define the final rate at which the data is written to the disc. +

      When FM recording mode is used, data is read from or written to at a rate which is double that of when MFM is used. The time for each bit will be twice the time for MFM. +

      Examples: +

      + + + + + + + + + + + + + + + + + + + +
      NEC765 ClockFM/MFMActual rate
      4MhzFM4us per bit
      4MhzMFM2us per bit
      + +

    + +
  2. This extension was proposed by Simon Owen. + +
      +
    1. It has been found that many protections using 8K Sectors (N="6") do store more +than &1800 bytes of useable data. It was thought that &1800 was the maximum useable limit, but +this has proved wrong. So you should support 8K of data to ensure this data is read correctly. +The size of the sector will be reported in the SECTOR INFORMATION LIST as described above. +

      For sector size N="7" the full 16K will be stored. It is assumed that sector sizes are defined +as 3 bits only, so that a sector size of N="8" is equivalent to N="0". + +

    2. Storing Multiple Versions of Weak/Random Sectors. +

      Some copy protections have what is described as 'weak/random' data. Each time the sector is read one or more bytes will change, the value may be random between consecutive reads of the same sector. +

      To support these formats the following extension has been proposed. +

      Where a sector has weak/random data, there are multiple copies stored. The actual sector size field in the SECTOR INFORMATION LIST describes the size of all the copies. +To determine if a sector has multiple copies then compare the actual sector size field to the size defined by the N parameter. For multiple copies the actual sector size field will have a value which is a multiple of the size defined by the N parameter. +The emulator should then choose which copy of the sector it should return on each read. + + + + +