CP/M 1.3 was designed to work with 8" 250k discs. Thus a stock CP/M 1.3 disc will be laid out in the following way:
77 tracks in total; 26 128-byte sectors per track, software skewed; 2 reserved tracks; 2 1k directory blocks, giving 64 directory entries; 240 1k data blocks, numbered 2-241.The skew table reads:
1,7,13,19,25,5,11,17,23,3,9,15,21,2,8,14,20,26,6,12,18,24,4,10,16,22The reserved tracks will contain an image of CP/M 1, used when the system is rebooted. It can therefore be deduced that CP/M 1 fits in 6.5k.
The CP/M 1.3 / 1.4 directory only has one type of entry:
SS 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 ................ SS = Status. 0 => File exists 0E5h => File deleted 80h => File exists and is hidden. This feature was undocumented and does not exist in later versions of CP/M. Fn - filename Tn - filetype. The characters used for these are 7-bit ASCII. EX = Extent counter. If a file grows above 16k, then it will have multiple directory entries. The first entry has EX=0, the second has EX=1 etc. EX ranges from 0 to 31, thus allowing files up to 512k. CP/M 1.4 only allows 256k discs anyway. S1 - reserved, set to 0. S2 - reserved, set to 0. RC - Number of records (1 record=128 bytes) used in this extent. If it is >= 80h, this extent is full and there may be another one on the disc. File lengths are only saved to the nearest 128 bytes. AL - Allocation. Each AL is the number of a 1k block on the disc. If an AL number is zero, that section of the file has no storage allocated to it (ie it does not exist). For example, a 3k file might have allocation 5,6,8,0,0.... - the first 1k is in block 5, the second in block 6, the third in block 8.
CP/M 1.4 is able to use other disc formats than the standard 250k — but it can only support one format at a time, and that format is used on all drives. At the start of the BDOS is an area of memory which defines the disc geometry:
xx06 JP BDOSE ;Jump to BDOS entry point xx09 DW PERSUB ;"Bad sector" error handler xx0B DW SELSUB ;"Select disk" error handler xx0D DW RODSUB ;"R/O disk" error handler xx0F-xx39 ;"TRSECT" sector translation function. Given ;a sector number in C, translates it to a ;physical sector and jumps to the BIOS SETSEC ;entry point ;The default implementation includes a ;translation table of sector numbers from ;xx1A-xx33. xx3A DB secsiz ;Sectors per track xx3B DB dirmax ;Number of directory entries - 1 xx3C DB blkshf ;Block shift, 3 => 1k, 4 => 2k, 5 => 4k etc. xx3D DB blkmsk ;Block mask, 7 => 1k, 0Fh => 2k, 1Fh => 4k etc. xx3E DB maxall ;Number of data blocks on the disc - 1 xx3F DB dirblk ;Directory allocation bitmap xx40 DB ostrks ;Number of operating system tracks
Compared to later CP/M versions, a number of limits are expressed in bytes rather than words. So under CP/M 1.4, a drive can have at most 256 tracks, 256 sectors, 256 data blocks and 256 directory entries.