PDA

View Full Version : Quick question about DIRBUF



JonB
December 8th, 2016, 09:34 PM
Hi

In the CP/M DPH table is an entry called DIRBUF. The DRI documentation describes it as a 128 byte scratchpad area for directory operations. It also says that all drives use the same DIRBUF.

Is there any relationship between the size of DIRBUF and the value of the DPB's DRM entry (maximum number of files the directory can hold -1)?

Cheers
JonB

Chuck(G)
December 8th, 2016, 09:57 PM
No relation. DIRBUF's an area that BDOS uses for disk I/O, such as checking for disk changes. It's always one CP/M logical sector in length--128 bytes.

JonB
December 8th, 2016, 10:05 PM
Thanks Chuck, I thought so.

There must be a bug in my driver. The guy testing it (Hans-01) had an "out of directory space" error, followed by corruption. He hasn't told me how many files there were on the disk yet, but the limit is set at 512 in the DPB.

The BDOS should raise the error then exit gracefully. Could be a Lifeboat CP/M problem.. but I doubt it!

Cheers
JonB

Chuck(G)
December 8th, 2016, 10:21 PM
A dump of the corrupted blocks might be informative.

JonB
December 8th, 2016, 10:39 PM
Indeed, and I have requested this. :)

Meanwhile, I am testing adding files until it runs out of directory space. Interesting how it slows down as the directory starts filling up. This is on a DOM, too (a type of SSD), so no seek time. The test files are zero bytes long and already it is taking 2 seconds per file to copy between user areas on the same disk, and there are only ~256 files so far.

..fascinating..

JonB
December 8th, 2016, 11:09 PM
OK, test complete.

Halfway through copying a batch of files with PIP.COM, got NO DIRECTORY SPACE and a CCP: prompt. No corruption. Interestingly, counting files in all user areas on the disk I have 511 total (and the utility I am using tells me how many directory entries are used too, and this matches, so each file is using one extent). The DPB has 511 as the directory limit, but the DRI documents say this value is the actual value -1. So I seem to have lost a directory entry somewhere!

Not that that is an issue, but I do wonder why..

Chuck(G)
December 9th, 2016, 10:04 AM
You have to keep in mind that the BDOS is processing directories 128 bytes at a time. Since the sector size on a DOM is 512 bytes, I trust that you're not issuing a physical read for every 128-byte directory sector request, but satisfying it from the available 512 byte buffer when possible.