Amstrad CP/M disc formats

Amstrad computers use standard CP/M 2 or CP/M 3 formats. The disc formats used also include automatic format detection systems.

Amstrad and Locomotive Software have made a number of non-CP/M systems which use the CP/M 2 disc format. These are:

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...
;
; (Amstrad extension starts here)
;
	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 6 set if the format is for a high-density disc
			;      (This is an extension in PCW16 CP/M, BIOS 
			;       0.09+. It is not an official part of the spec.)
			;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.

	
The DPB is not written to disc.

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.

PCW/Spectrum system

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.

PCW16 extended boot record

I have extended the above "boot record" system in PCW16 CP/M (BIOS 0.09 and later). The extension is intended to allow a CP/M "partition" on a DOS-formatted floppy disc.

An extended boot sector (cylinder 0, head 0, sector 1) has the following characteristics:

Some common Amstrad formats

XDPB fieldPCW 180kCPC systemCPC dataPCW 720kPCW16 1.4Mb
SPT 24h 24h 24h 24h 48h
BSH 3 3 3 4 5
BLM 7 7 7 0Fh 1Fh
EXM 0 0 0 0 1
DSM 0AEh0AAh0B3h164h164h
DRM 3Fh 3Fh 3Fh 0FFh0FFh
AL0 0C0h0C0h0C0h0F0h0C0h
AL1 0 0 0 0 0
CKS 10h 10h 10h 40h 40h
OFF 1 2 0 1 1
PSH 2 2 2 2 2
PHM 3 3 3 3 3
Sidedness 0 0 0 81h 0C1h
Cylinders28h 28h 28h 50h 50h
Sectors 9 9 9 9 12h
1st phys sec141h 0C1h1 1
Sec size 200h200h200h200h200h
R/W gap 2Ah 2Ah 2Ah 2Ah 1Bh
fmt gap 52h 52h 52h 52h 54h
MFM mode 60h 60h 60h 60h 60h
Freeze flag0 0 0 0 0FFh

Back to the formats listing

Back to the CP/M archive list


John Elliott 11-9-1998