• Please review our updated Terms and Rules here

is there a chkdsk type tool for CP/M?

Thanks to Chris Radek, FSCK has now been tested on vintage hardware and not just my one-of-a-kind lockdown project. This is an Imsai, a Z80 S100 machine running CP/M 2.2 with an 8" single sided single density (standard IBM 3740 format) floppy. There were some issues, but these have been fixed with the help of the owner and we now have FSCK 1.2. See: https://github.com/rundel-tech/ZARC/tree/main/software/cpm/cpm_dev/fsck for details.

Nice project - I'll pull it down and have a play with it later. From the source comments; (which provides an idea of what it does.)

signon_msg byte "*** CP/M File System Checker V1.2 ***", 0x0d, 0x0a, 0x0d, 0x0a, "$" no_z80_msg byte "Z80 CPU required", 0x0d, 0x0a, "$" op_err_msg byte "Operand error. Expected format: fsck <drive>[:] [/s]", 0x0d, 0x0a, "$" exit_msg byte "Returning to CP/M.", 0x0d, 0x0a, "$" memory_msg byte "Insufficient memory", 0x0d, 0x0a, "$" sel_err_msg byte "Can't select drive.", 0x0d, 0x0a, "$" disk_err_msg byte "Disk I/O error.", 0x0d, 0x0a, "$" dir_done_msg byte "Directory checks complete", 0x0d, 0x0a, "$" files_msg byte "Files found: $" unused_msg byte "Unused directory entries: $" blocks_used_msg byte "Blocks used: $" block_map_msg byte 0x0d, 0x0a, "Block map ('D': directory, 'F': file and '-': unused).", 0x0d, 0x0a, "$" errors_msg byte "Errors and warnings: $" no_ss_msg byte "Surface scan skipped", 0x0d, 0x0a, "$" surf_scan_msg byte 0x0d, 0x0a, "Checking all blocks are readable (surface scan)", 0x0d, 0x0a, "$" track_msg byte 0x0d, "Track: $" sector_msg byte ", sector: $" scan_done_msg byte 0x0d, 0x0a, "Scan complete", 0x0d, 0x0a, "$" ; Directory entry error messages bad_user_msg byte " - bad user number$" bad_name_msg byte " - bad file name$" bad_ex_cnt_msg byte " - bad extent count$" bad_s1_msg byte " - bad S1$" ext_dup_msg byte " - duplicated physical extent$" dble_blk_msg byte " - block not unique$" sparse_msg byte " - is sparse (holed) [warning]$" blk_too_big_msg byte " - block number out of range$" no_alloc_msg byte " - no allocations in physical extent [warning]$" bad_rc_msg byte " - RC not 0x80 in intermediate extent$" empty_msg byte " - has no data [warning]$"

I wrote some consistency checks into my PC based DSK editor I wrote last year to move files to and from Spectrum CP/M disks ( Spectum +3 reads Amstrad disks ) - and perhaps the best use of the cross-linked files check was to tell me if I had the disk structure correct.

But different applications seem to use the OS access to disk differently. I noted Wordstar creates extent 3F for temp files so that they don't typically show on a "Directory" listing but are still valid and cannot be overwritten until deleted, and they show on STAT - so the lack of rules around CP/M directory structure probably leads to issues with a FSCK program in some cases - so reporting stuff is nice, and not trying to fix it is nicer - :)

I intentionally cross-link files in my new OS too, as it's completely valid for that architecture to cross-link CP/M files if the disk is memory - as it just means that multiple programs are using that same page - so the flexibility of CP/M and the lack of rules is actually a really powerful tool and capability. It also means that when I switch back to real CP/M it doesn't cause errors or issues as anything CP/M accepts seems valid by design.

Thanks for sharing - Looking forward to checking out the binary later.

David.
 
Hi David. I hope you enjoy it. There is a write-up (fsckGuide.pdf, in the same folder as the .COM file) so you don't have to examine the source (but feel free, obviously).
 
I like it - it works well. If there was anything I'd like more in it, it would be;
* Case Insensitivity on the CLI and
* If no drive is specified, default to the current logged drive.
* A way to stop it scrolling when it needs to display more lines than the screen has available - especially when there's a lot of files with problems.

Case insensivity probably isn't a problem with DR's CP/M but might affect other BDOS/CCPs. In my case it just means I have to type in the command in caps.

screenshot.PNG
 
Regular CCP always upper-cases the command line. I'm fairly sure many programs rely on that behaviour.
 
Regular CCP always upper-cases the command line. I'm fairly sure many programs rely on that behaviour.

I Imagine that's exactly the reason. There is not a lot of value in sanitising the input if the OS can be relied upon to do it for you. It just means more code required to do the same thing.

CP/M Plus was the same, though I wonder, had CP/M continued and we got 4,5,6 etc, would it have become case insensitive - After all, history was written by then and DRDOS was out - IIRC, it didn't fix case and wasn't case sensitive. But my memory of that could be wrong.

But as was just pointed out, the BDOS would let you put other characters into the FCB, yet it is case sensitive. BDOS being case-sensitive and CCP being Case Setting is a bit of a long-term issue IMHO.

Also, implementing a new CCP that was case insensitive made sense around that time, so I assume some of the CCP replacements that came out may have possibly supported case insensitivity in filenames also. That's certainly what I did, but mainly for compatability with non-CP/M systems which was also a goal when I wrote mine. I can't imagine I wrote the only CCP/BDOS that lets a=A

Where's an online emulator of every version of DOS that ever came out when I want one !

Anyway, I really like this program. Though it highlights the issues of producing more characters than the display can handle. Did CP/M ever solve that like DOS did in later years when it started to implement more unix-like commands?
 
MBASIC will let you create files with lower case letters.
Not through the CCP-provided command line, on regular CP/M. But it puts lower-case letters in the FCB, which is arguably a bug or at least a very bad design decision.

Though it highlights the issues of producing more characters than the display can handle. Did CP/M ever solve that like DOS did in later years when it started to implement more unix-like commands?
No, terminal handling always was an application issue; codepages did not exist on CP/M. DOS only solved this when they introduced NLS, and the world was standardizing on PC-compatibles by then.

Where's an online emulator of every version of DOS that ever came out when I want one !
Isn't pcjs good enough? :)
 
Not through the CCP-provided command line, on regular CP/M. But it puts lower-case letters in the FCB, which is arguably a bug or at least a very bad design decision.
What he said was correct though - MBASIC doesn't work through the CCP CLI. It has it's own CLI.
So if you do something like;
10 PRINT "Funny Filename"
SAVE "FunnyCHR.Bas"
then it will save it as FunnyCHR.Bas - with the mixed case.

Then you go and do something like ERA FunnyCHR.Bas and it says something like "FUNNYCHR.BAS Not Found" - I can't remember the exact message. Basically, BDOS is case sensitive and it gets rewritten as CAPs. It's a bit messy like that.

So it's a good example of when the CCP CLI fails CP/M - espcially given MBASIC is a pretty common basic - You can manage the files through BASIC too, but given the CCP is the entry point to the OS, it's a problem. You can use Wildcards in some cases to deal with the filenames, but that's just a workaround.

Thank you for the PCJs mention! That's perfect.
 
Back
Top