• Please review our updated Terms and Rules here

Anomolies around STAT - and the meaning of certain displays.

Sorry, the last post wasn't very specific. Here's a more comparative output to show the problem between specifying the drive and using the default.

M>stat *.* $S Size Recs Bytes Ext Acc 256 128 16k 1 R/W M:DRIVE-L:.IMG 64 128 4k 1 R/W M:L:_DRIVE.DSK 256 128 16k 1 R/W M:ROOT_CPM.IMG 32 32 1k 1 R/W M:RST-#08H.INT 32 32 1k 1 R/W M:RST-#10H.INT 32 32 1k 1 R/W M:RST-#18H.INT 32 32 1k 1 R/W M:RST-#20H.INT 32 32 1k 1 R/W M:RST-#28H.INT 32 32 1k 1 R/W M:RST-#30H.INT 32 32 1k 1 R/W M:RST-#38H.INT 128 256 8k 2 R/W M:Screen_1.IMG 512 256 32k 2 R/W M:VIDEO1.IMG Bytes Remaining On M: 41k M>stat M:*.* $S Size Recs Bytes Ext Acc 256 512 64k 1 R/W M:DRIVE-L:.IMG 64 512 16k 1 R/W M:L:_DRIVE.DSK 256 512 64k 1 R/W M:ROOT_CPM.IMG 32 32 4k 1 R/W M:RST-#08H.INT 32 32 4k 1 R/W M:RST-#10H.INT 32 32 4k 1 R/W M:RST-#18H.INT 32 32 4k 1 R/W M:RST-#20H.INT 32 32 4k 1 R/W M:RST-#28H.INT 32 32 4k 1 R/W M:RST-#30H.INT 32 32 4k 1 R/W M:RST-#38H.INT 128 1024 32k 2 R/W M:Screen_1.IMG 512 1024 128k 2 R/W M:VIDEO1.IMG Bytes Remaining On M: 732k M>
 
So, the procedure STAT uses for this display is fairly specific, and a non-CP/M OS has plenty of opportunity to mess it up.

STAT first makes the target drive the default disk, using BDOS function 14. However, if no drive is specified in the command, then STAT assumes that current default disk is the one. Normal CP/M processes subsequent BDOS functions the same in either case. Then, STAT starts a search through the directory, but it sets '?' in the FCB ext and mod fields, so that it gets every extend, not just the first one for each file. It then uses the data in the DPB to compute the various size values for the files that are found.

So, could be lots of places that things go wrong. Could be the DPB is not quite correct. The directory entries returned by the searches might be malformed or misrepresented. The handling of the default/current drive might be flawed and not taking effect. And the "bytes remaining on ..." depends on the ALV being correct. Any short-cuts being taken with any of that could result in the wrong data being presented to STAT. For example, if the ALV is not unique to this drive (i.e. it is a shared space), subsequent operations might cause it to be overwritten and render the data invalid. Same could be true for the DPB. CP/M programs expect the areas used for DPB and ALV to be exclusive to the given drive, and the data should never change (until the drive is logged-out and back in) (well, ALV data changes as files are extended, but the ALV data at the given address is always for that drive).
 
Back
Top