Each process has a pointer to a structure describing that process's current directory on all 16 drives; I have called this structure a "PROC_dirname". There is a fixed number of these structures; at any moment in time, each one can be "in use" or "free". In CP/M-86 4.1, there are four, corresponding to the limit of four runnable processes.
Offset Size Data Description ============================================================================ 00 DW drv_a, drv_b,...; Pointers to the current directory on all ; 16 drives (near pointers in CP/M data ; segment) 20 DW refcount ; 0 if this structure is free, ; otherwise number of processes using ; this structure. 22 DW nextfree ; If this structure is free, then it's ; part of a linked list. This is the ; address of the next element, 0 if the ; structure is in use or last in the chain.
All the pointers are near pointers within the CP/M data segment.
The pointer to the first free PROC_dirname is at 0192h in the CP/M data segment.
If a process is using a PROC_dirname structure, the word at 0011h in its process table entry will hold its offset relative to the CP/M data segment.
Pointers to directory definitions for a drive will be zero if the process is not using that drive.
There will be one of these structures for each drive that a process has logged in; it is pointed to by the PROC_dirname structure above.
Offset Size Data Description ============================================================================ 0 DW nextfree ; If this is on the free list, next ; entry in the list, 0 if last. 0 DB drive ; If in use, drive letter this structure ; applies to 1 DB fs ; If in use, filesystem type on this drive ; (bit 7 set for DOS FS) 2 DW parent ; Cluster of parent directory, 0 for root 4 DW count ; Offset of this directory's entry in ; parent directory? 6 DW cluster ; Cluster of this directory 8 DW refcount ; Reference count
Again, PROC_drvdir structures are allocated from a linked list; the head of the list is pointed to by the word at 0194h in the CP/M data segment. CP/M-86 itself allows 8 of these structures (two drives for four processes), but the XIOS can add more. For example, in PC1512 DOSPLUS, the XIOS allocates another 19, making 27 in total. (3 drives + 3 "assignable" drives (N: O: P:) per process; 3 spare, perhaps N: O: and P: for the DOS module).
John Elliott 14 May 2007