Epson CP/M 2.2 format QX-10, TF-20 (HX-20, PX-4, PX-8)

The floppy format is:
- 40 tracks, 
- double sided, 
- double density, 
- 256 byte sectors,
- 16 sectors per track,
- track 0 - 3 are reserved for system files*,
- track 39 is never used,
- the directory is located at the first 8 sectors of track 4, containing 8 extends each (64 extends in total),
- a physical extend can contain up to two logical extends, containing 256 records of 128 byte max,
- a block is 2048 bytes, or 16 records, or 8 sectors.
This leaves 139 blocks available on an empty disk.
The PX-4 RefMan reports:
Number of directory entries:  64
Storage available for user:   54800H (284.672) bytes

*) The origin for this reservation is the QX-10 MultiFonts BIOS which with extended support for 
graphics printers, light pens, and the normal I/O, is 21.833 bytes large.
 
Files larger than 32 kByte are stored in multiple extends. In theory one file could span all 64 extends,
but in practice for this disk geometry it is limited to 8.7 extends. This makes the Xh byte always 0.

A directory extend consists of 32 bytes organized as:
St F0 F1 F2 F3 F4 F5 F6 F7 E0 E1 E2 Xl Bc Xh Rc
Al Al Al Al Al Al Al Al Al Al Al Al Al Al Al Al


St      is the status; possible values are:
        0x00-0x0F: used for file, status is the user number
	(0x20: used for disk label)*
	(0x21: used for date-time stamp for the files in the previous three directory extends)*
        0xE5: unused

F0 - F7 is the file name (bit 0 - 6)
E0 - E2 is the extension (bit 0 - 6)
        E0 (bit 7): read-only file
        E1 (bit 7): system file
        E2 (bit 7): archived file (maybe only CP/M 3?)

Xl      Extend number (bit 1 - 5) and Records in extend (bit 0, as overflow of Rc)
Bc      Effectively always 0. 
Xh      Effectively always 0.
Rc      Records in extend (bit 0 - 7, but higest value used is 128, 0x80)

Al      are the block numbers ranging from 0x01 to 0x8B. A value 0 means this allocation is not used.

*) found in CP/M Plus enabled disks; QX-10 only

Disk Parameter Block

This Disk Parameter Block is reconstructed from the information above and the description in "The Programmer's CP/M Handbook", page 33 - 36

Note this is the CP/M view of the disk geometry. It is up to the BIOS to convert sector and track data to real world floppy values.

DPB0:
	DW	64		; Sectors per track - equivalent 128 byte sectors of side 0 and 1 combined
	DB	4		; Block shift - value for 2048 byte Allocation Block Size
	DB	15		; Block Mask - value for 2048 byte Allocation Block Size
	DB	1		; Extend mask - value for 2048 byte Allocation Block Size 
				;  and less than 255 allocation blocks
	DW	138		; Max. allocation block number
	DW	63		; Number of directory entries minus 1
	DB	1000000B	; Bit map for allocation blocks
	DB	0000000B	;  used for directory
	DW	16		; No. of bytes in dir. check buffer
	DW	4		; No. of tracks before directory

This illustration is from the QX-10 Operation Manual matches quite nicely:

Epson QX-10 standard floppy format, also used by the floppy drive for the HX-20, PX-4 and PX-8, the TF-20

Sources:

fjkraan,2010-12-31