Content-type: text/html
Sector size in bytes
Number of tracks
Number of sectors
Block size
Number of directory entries
Logical sector skew
Number of reserved system tracks
System tracks (optional)
Directory
Data
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 AlAl
0-15: used for file, status is the user number
16-31: used for file, status is the user number (P2DOS)
or used for password extent (CP/M 3 or higher)
32: disc label
33: time stamp (P2DOS)
0xE5: unused
F0-E2 are the file name and its extension. They may consist of any printable 7 bit ASCII character but: < > . , ; : = ? * [ ]. The file name must not be empty, the extension may be empty. Both are padded with blanks. The highest bit of each character of the file name and extension is used as attribute. The attributes have the following meaning:
F0: requires set wheel byte (Backgrounder II)
F1: public file (P2DOS, ZSDOS), forground-only command (Backgrounder II)
F2: date stamp (ZSDOS), background-only commands (Backgrounder II)
F7: wheel protect (ZSDOS)
E0: read-only
E1: system file
E2: archived
The wheel byte is (by default) the memory location at 0x4b. If it is zero, only non-privileged commands may be executed.
Xl and Xh store the extent number. A file may use more than one directory entry, if it contains more blocks than an extent can hold. In this case, more extents are allocated and each of them is numbered sequentially with an extent number. If a physical extent stores more than 16k, it is considered to contain multiple logical extents, each pointing to 16k data, and the extent number of the last used logical extent is stored. Note: Some formats decided to always store only one logical extent in a physical extent, thus wasting extent space. CP/M 2.2 allows 512 extents per file, CP/M 3 and higher allow up to 2048. Bit 5-7 of Xl are 0, bit 0-4 store the lower bits of the extent number. Bit 6 and 7 of Xh are 0, bit 0-5 store the higher bits of the extent number.
Rc and Bc determine the length of the data used by this extent. The physical extent is divided into logical extents, each of them being 16k in size (a physical extent must hold at least one logical extent, e.g. a blocksize of 1024 byte with two-byte block pointers is not allowed). Rc stores the number of 128 byte records of the last used logical extent. Bc stores the number of bytes in the last used record. The value 0 means 128 for backward compatibility with CP/M 2.2, which did not support Bc.
Al stores block pointers. If the disk capacity is less than 256 blocks, Al is interpreted as 16 byte-values, otherwise as 8 double-byte-values. A block pointer of 0 marks a hole in the file. If a hole covers the range of a full extent, the extent will not be allocated. In particular, the first extent of a file does not neccessarily have extent number 0. A file may not share blocks with other files, as its blocks would be freed if the other files is erased without a following disk system reset. CP/M returns EOF when it reaches a hole, whereas UNIX returns zero-value bytes, which makes holes invisible.
1 byte status 0x21
8 bytes time stamp for third-last directory entry
2 bytes unused
8 bytes time stamp for second-last directory entry
2 bytes unused
8 bytes time stamp for last directory entry
2 bytes (little-endian) days starting with 1 at 01-01-1978
1 byte hour in BCD format
1 byte minute in BCD format
1 byte status 0x20
F0-E2 are the disc label
1 byte mode: bit 7 activates password protection, bit 6 causes time stamps on
access, but 5 causes time stamps on modifications, bit 4 causes time stamps on
creation and bit 0 is set when a label exists. Bit 4 and 6 are exclusively set.
1 byte password decode byte: To decode the password, xor this byte with the password
bytes in reverse order. To encode a password, add its characters to get the
decode byte.
2 reserved bytes
8 password bytes
4 bytes label creation time stamp
4 bytes label modification time stamp
1 byte status (user number plus 16)
F0-E2 are the file name and its extension.
1 byte password mode: bit 7 means password required for reading, bit 6 for writing
and bit 5 for deleting.
1 byte password decode byte: To decode the password, xor this byte with the password
bytes in reverse order. To encode a password, add its characters to get the
decode byte.
2 reserved bytes
8 password bytes