Amstrad CP/M disc formats
Amstrad computers use standard CP/M 2 or
CP/M 3 formats. The additional information comes in their detection system.
Amstrad and Locomotive Software have made a number of non-CP/M systems which use the
CP/M 2 disc format. These are:
- LocoScript - word processor with built-in operating system.
- Amsdos - disc operating system for the CPC computers.
- +3DOS - disc operating system for the Spectrum +3.
Amstrad CP/M (and +3DOS) has an eXtended Disc Parameter Block (XDPB):
DEFW spt ;Number of 128-byte records per track
DEFB bsh ;Block shift. 3 => 1k, 4 => 2k, 5 => 4k....
DEFB blm ;Block mask. 7 => 1k, 0Fh => 2k, 1Fh => 4k...
DEFB exm ;Extent mask, see later
DEFW dsm ;(no. of blocks on the disc)-1
DEFW drm ;(no. of directory entries)-1
DEFB al0 ;Directory allocation bitmap, first byte
DEFB al1 ;Directory allocation bitmap, second byte
DEFW cks ;Checksum vector size, 0 or 8000h for a fixed disc.
;No. directory entries/4, rounded up.
DEFW off ;Offset, number of reserved tracks
DEFB psh ;Physical sector shift, 0 => 128-byte sectors
;1 => 256-byte sectors 2 => 512-byte sectors...
DEFB phm ;Physical sector mask, 0 => 128-byte sectors
;1 => 256-byte sectors, 3 => 512-byte sectors...
DEFB sidedness
;Bits 0-1: 0 => Single sided
; 1 => Double sided, flip sides
; ie track 0 is cylinder 0 head 0
; track 1 is cylinder 0 head 1
; track 2 is cylinder 1 head 0
; ...
; track n-1 is cylinder n/2 head 0
; track n is cylinder n/2 head 1
; 2 => Double sided, up and over
; ie track 0 is cylinder 0 head 0
; track 1 is cylinder 1 head 0
; track 2 is cylinder 2 head 0
; ...
; track n-2 is cylinder 2 head 1
; track n-1 is cylinder 1 head 1
; track n is cylinder 0 head 1
;Bit 7 set if the format is double track.
DEFB tracks/side
DEFB sectors/track
DEFB first physical sector number
DEFW sector size, bytes
DEFB uPD765A read/write gap
DEFB uPD765A format gap
DEFB MFM/Multitrack flags byte
;Bit 7 set => Multitrack else Single track
;Bit 6 set => MFM mode else FM mode
;Bit 5 set => Skip deleted data address mark
DEFB freeze flag ;Set to nonzero value to force this format
;to be used - otherwise, attempt to determine
;format when a disc is logged in.
Format detection
CPC system
This simple system is used by CPC computers:
If the first physical sector is 41h, the disc is in System format, ie:
single sided, single track, 40 tracks, 9 sectors/track, 512-byte sectors, 2 reserved tracks,
1k blocks, 2 directory blocks, gap lengths 2Ah and 52h, bootable.
If the first physical sector is C1h, the disc is in Data format, ie:
single sided, single track, 40 tracks, 9 sectors/track, 512-byte sectors, no reserved tracks,
1k blocks, 2 directory blocks, gap lengths 2Ah and 52h, not bootable.
In addition to the above system, the PCW and Spectrum +3 can determine the
format of a disc from a 16-byte record on track 0, head 0, physical sector 1:
DEFB format number ;0 => SS SD, 3 => DS DD. Other values => bad format.
;1 and 2 are for the CPC formats, but those
;formats don't have boot records anyway.
DEFB sidedness ;As in XDPB
DEFB tracks/side
DEFB sectors/track
DEFB physical sector shift ;psh in XDPB
DEFB no. reserved tracks ;off in XDPB
DEFB block shift ;bsh in XDPB
DEFB no. directory blocks
DEFB read/write gap length
DEFB format gap length
DEFB 0,0,0,0,0 ;Unused
DEFB checksum fiddle byte ;Used to indicate bootable
;discs. Change this byte so that the 8-bit
;checksum of the sector is:
; 1 - sector contains a PCW9512 bootstrap
; 3 - sector contains a Spectrum +3 bootstrap
;255 - sector contains a PCW8256 bootstrap
;(the bootstrap code is in the remainder of the sector)
If all bytes of the spec are 0E5h, it should be assumed that the disc is a
173k PCW/Spectrum +3 disc, ie:
single sided, single track, 40 tracks, 9 sectors/track, 512-byte sectors, 1 reserved track,
1k blocks, 2 directory blocks, gap lengths 2Ah and 52h, not bootable.