Hi Doug, Chuck,
I am not concerned about the security issues with accessing the hard disk directly - more I am trying to figure out what is correct behaviour of the FCB when using files with large extent masks.
For example, in normal disks, you open the file ( or just start accessing it directly through reads without opening, as Chuck pointed out ) and you set the extent and CR and go for it. Everything works. If you want another extent, you change the extent number. CP/M copies the directory entry over the FCB from bytes 2 to 32 if you "open" the file in advance, populating the allocation group tables in the second 16 bytes, but it also copies RC, EX, S1 and S2 regardless. EX stays the same because it was used to access the entry via the FCB - and the entry on the disk matches the entry in the FCB. The CR field doesn't get copied as also the R0, R1 and R2 fields because they are used to track current position.
This is not the case in large file extents that contain more than 16K per directory entry. If the entire directory entry is copied, then the EX field is either clobbered or not copied. ( At the moment I've gone with "Not Copied" ) when opening a file. This means I'll have to "open" the next "extent" via a full disk operation once again, which will read the disk again and just return the same directory entry, but reflecting the new EX value I placed there.
Alternately, If the EX field if copied on opening a file, then a "Current EX" field of some kind is needed. It does exist in R0 and R1 ( Bit 7 and bits 0,1,2,3 respectively ) so could be tracked via R0, R1, R2 if they are simultaneouly used along with CR, then changing EX is not manually required except when opening the actual FCB.
Or CP/M might have done something completely different.
What I don't know is which way CP/M went on this, since I don't have a machine with a big enough storage medium to do the test and see what the result is.
While I am rewriting the entire OS much like MS-DOS did, I am also trying to achieve the exact same outcome as CP/M - ie, a "Clone" CP/M operating system.
My OS presently handles disks with extents of 16K just fine, and software recognizes them without issue. It's just the large disk I have which stores 64K per directory entry that I am not sure about how this should be represented.
Or, to phrase it another way, If I have a single directory entry like this example Doug first provided,
0000 - 00 52 4F 4F 54 5F 43 50 4D 49 4D 47 03 00 00 80 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 10 - +ROOT_CPMIMG++++++++++++++++++++
and if I set EX to 0 and open it, what will I see in the FCB?
Will I see EX as 0 in the FCB post-open, or will I see 3 as per the directory entry post-open?