CP/M 4.1 (DOS Plus) allows the use of two filesystems - CP/M and DOS. The version I have seen (supplied with the Amstrad PC1512) cannot handle larger floppies than 360k (CP/M) / 1.2Mb (DOS), or larger hard drive partitions than 32Mb.
For implementation details (ie: how CP/M calls behave on a DOS system) there is a separate document on the DOS filesystem .
The Disc Parameter block is
DEFW spt ;Number of physical sectors per track. ;This differs from previous versions. 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 ;These bitmaps are zero if the disc has a DOS format. 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... The directory allocation bitmap is interpreted as: al0 al1 b7b6b5b4b3b2b1b0 b7b6b5b4b3b2b1b0 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 - ie, in this example, the first 4 blocks of the disc contain the directory.
The CP/M 4.1 directory has four types of entry:
0U F1 F2 F3 F4 F5 F6 F7 F8 T1 T2 T3 EX S1 S2 RC .FILENAMETYP.... AL AL AL AL AL AL AL AL AL AL AL AL AL AL AL AL ................
The meanings of the bytes are:
An extent is the portion of a file controlled by one directory entry. If a file takes up more blocks than can be listed in one directory entry, it is given multiple entries, distinguished by their EX and S2 bytes. The formula is: Entry number = ((32*S2)+EX) / (exm+1) where exm is the extent mask value from the Disc Parameter Block.
(EX & exm) * 128 + RC
If RC is 80h, this extent is full and there may be another one on the disc. File lengths are optionally saved exactly (using the S1 byte); this is mainly apparent in files copied from DOS-formatted media.
20 F1 F2 F3 F4 F5 F6 F7 F8 T1 T2 T3 LB PB RR MT LABENAMETYP.... P1 P2 P3 P4 P5 P6 P7 P8 D1 D1 D1 D1 D2 D2 D2 D2 ................ 20h - Characteristic number of a disc label F1-F8, T1-T3 - Label name, 7-bit ASCII LB - Label byte. Bit 0 set => Label exists Bit 4 set => Time stamp on create --+ Bit 5 set => Time stamp on update +--These 2 are mutually Bit 6 set => Time stamp on access --+ exclusive Bit 7 set => Password protection enabled PB - Used to decode the label password RR - Reserved, set to zero. MT - Media type, set to zero for CP/M. If you search for the disc label on a DOS-formatted drive, a fake disc label will be generated with MT set to 80h. P1-P8 - password, rather feebly encrypted. D1 - Label create datestamp D2 - Label update datestamp
21 D1 D1 D1 D1 D2 D2 D2 D2 M1 00 D3 D3 D3 D3 D4 !............... D4 D4 D4 M2 00 D5 D5 D5 D5 D6 D6 D6 D6 M3 00 00 ................ 21h - Characteristic number of a date stamp. D1 - File 1 create OR access date D2 - File 1 update date D3 - File 2 create OR access date D4 - File 2 update date D5 - File 3 create OR access date D6 - File 3 update date M1 - File 1 password mode M2 - File 2 password mode M3 - File 3 password mode 00 - Reserved. The format of a date stamp is: DW day ;Julian day number, stored low byte first. ;Day 1 = 1 Jan 1978. DB hour ;BCD hour, eg 13h => 13:xx DB min ;BCD minute
1U F1 F2 F3 F4 F5 F6 F7 F8 T1 T2 T3 PM PB RR RR .FILENAMETYP.... P1 P2 P3 P4 P5 P6 P7 P8 RR RR RR RR RR RR RR RR ................ 1U = 16+User number (ie 16-31). The user number will be the number of the file to which the password belongs. F1-F8 - Filename of the file to which the password belongs T1-T3 - Filetype of the file to which the password belongs PM - Password mode byte Bit 7 set => Password required to read from file Bit 6 set => Password required to write to file Bit 5 set => Password required to delete file PB - Used to decode the password P1-P8 - The password, rather feebly encrypted. RR - Reserved, set to 0.
This system is extremely simple:
The DOS filesystem can be either FAT12 or FAT16. The format is exactly as in PCDOS 2.11, except: