DOSPLUS 1.2 (CP/M-86 4.1) allows CP/M programs to access DOS-formatted discs via conventional BDOS calls, emulating (as far as possible) the behaviour of a normal CP/M FS. The behaviour is probably a good starting point for anyone writing a CP/M emulator which uses a hierarchical or non-CP/M filesystem.
This document is a work in progress. It is not guaranteed to be accurate.
The standard test is to perform a Search First (BDOS function 11h) with the first 12 bytes of the FCB containing '?' marks. On a DOS disc, this will return a "disc label" directory entry, and byte 0Fh of this entry will be 80h. On a CP/M disc, it may or may not return the label, but if it does byte 0Fh of the label entry will be zero.
If bit 7 of the "drive" byte in the FCB is set, then the call is assumed to apply to directories rather than files. The following calls appear to support directories:
FCB functions behave normally, but the allocation area (16 bytes at FCB+10h) contains the following data:
fl fl of 00 cc cc ci ci dd dd cl cl le le le le ................ Where: fl = flags: d7 always set d6 set if file is a directory d5 set if file is hidden d4-d0 are high bits of file number of = file number, low 8 bits. Number is 0 for 1st dir entry, 1 for 2nd, etc. cc = current cluster, 0 if none ci = index of current cluster (0, 1, 2, ...) in file chain. Only meaningful if cc is nonzero. dd = DOS date cl = DOS cluster le = DOS length
Functions 11h and 12h will return a fake directory record with:
uu F1 F2 F3 F4 F5 F6 F7 F8 T1 T2 T3 ex s1 s2 rc .FILENAMETYP.... fl fl of 00 00 00 tt tt dd dd cl cl le le le le ................ Where: uu = current CP/M user number, or 20h for volume label. ex = simulated extent number, 0-31. s1 = Last record byte count. s2 = simulated extent number, high bits. rc = simulated record count. fl = flags: d7 always set (thus "block" number is either >80h (8bit blocks) or >8000h (16bit blocks) d6 set if file is a directory (only shows up with user "?" in search FCB, or if bit 7 is set in FCB "drive" byte) d5 set if file is hidden d4-d0 are high bits of file number of = file number, low 8 bits. Number is 0 for 1st dir entry, 1 for 2nd, etc. tt = DOS time dd = DOS date cl = DOS cluster le = DOS length
The emulation goes to some pains to ensure that if a '?' is in byte 0Ch of the search FCB, a suitable list of "extents" is returned.
The DOSPLUS XIOS returns an Extended DPB (call it an EDPB) for DOS media:
DW -1 or -2 ;Signals EDPB ;-1 for FAT12 ;-2 for FAT16 DW no of FATs DW Sectors/FAT DW no of clusters? DW bytes/cluster? DW no of reserved sectors - then normal DPB
I believe that the BDOS returns the normal DPB rather than the EDPB to function 1Fh.