CP/M Callback Filesystem

cpmcbfs is the use of the EldoS Callback Filesystem library, combined with the cpmtools project by Michael Haardt, to allow Windows to mount CP/M filesystems. This project is essentially the Windows equivalent to cpmfuse.

It was written because some users of my Memotech related projects prefer not to use command line tools. Memotech computers used CP/M 2.2 filesystems, even when accessing floppy disks from BASIC. I include appropriate diskdefs for these.

Example

Usage :-

c:\cpmcbfs>cpmcbfs --help
usage: cpmcbfs [flags]
flags: -f,--format format  format (default %CPMTOOLSFMT% or memotech-type18)
       -i,--image image    image (must be specified)
       -u,--user user      CP/M user (default 0)
       -v,--invert-case    toggle case to match what CP/M uses
       -d,--drive d:       mount as drive d: (default Z:)
       -r,--read-only      read only access
       --install           install cbfs driver
       --uninstall         uninstall cbfs driver
       --status            is the driver installed and running

Installation and uninstallation of the driver requires that you be running as Administrator, and that cbfs.cab be in the current directory. Other uses of the program don't require this :-

c:\cpmcbfs>cpmcbfs --install
Reboot the computer to complete the installation

Is the driver installed and running :-

c:\cpmcbfs>cpmcbfs --status
Driver (5.0.143.31) installed, service is running

Normal use :-

c:\cpmcbfs>cpmcbfs -f memotech-type18 -i sddisc.bin -v
Drive Z: should exist until you press Enter

In another Window :-

c:\>dir z:S*.COM
 Volume in drive Z is CbFS CP/M filesystem
 Volume Serial Number is 4350-4D5A

 Directory of Z:\

01/01/1970  00:00               640 SDIR.COM
01/01/1970  00:00               384 STARTUP.COM
01/01/1970  00:00             5,248 STAT.COM
01/01/1970  00:00             1,280 SUB.COM
01/01/1970  00:00               512 SYSCOPY.COM
01/01/1970  00:00            45,952 SMG2M.COM
01/01/1970  00:00            35,968 SMG.COM
01/01/1970  00:00            15,488 STAR.COM
               8 File(s)        105,472 bytes
               0 Dir(s)       5,554,176 bytes free

c:\>

Or use Windows Explorer or other programs to access files on Z:.

Using this program with devices directly requires that you run it as Administrator. You can enumerate suitable block devices like so :-

c:\cpmcbfs>cpmcbfs -i ?
\\.\PhysicalDrive0                       fixed       60801 255 63  512 465.76GB
\\.\PhysicalDrive3                       removable      15 255 63  512 117.66MB
\\.\C:                                   fixed       60801 255 63  512 465.76GB
\\.\D:                                   fixed       60801 255 63  512 465.76GB
\\.\G:                                   removable      15 255 63  512 117.66MB
cpmcbfs: can't open ? (available devices were enumerated instead)

If you do this before you plug in your SD Card or other media, and then again afterwards, you can easily spot the device to use. Note how the SD Card I used above appears twice, once accessible as \\.\PhysicalDrive3 and once as \\.\G:. If you get no devices listed, its probably because you're not running as Administrator.

You can then use a command like this :-

c:\cpmcbfs>cpmcbfs -i \\.\PhysicalDrive3 -v

Because cpmcbfs is built using code from cpmtools it uses the same diskdefs or c:\cpmtools\diskdefs configuration file, and also uses the same filesystem format names.

If -f is not used cpmcbfs honors the %CPMTOOLSFMT% environment variable, and failing that falls back to memotech-type18.

Note how the -i argument must be specified, and can refer to a device, such as an SD Card.

CP/M filesystems support the concept of 16 (or maybe even 32) users. You can specify the user when you mount.

Although CP/M actually uses uppercase filenames, cpmtools makes it look as if they are lowercase. Ordinarily this is not a problem, except for the case where CP/M programs actually break the rules and write files with lowercase names. The -v problem toggles the case so that the files appear in uppercase on Windows.

Limitations

cpmcbfs doesn't expose any special files such as passwords or labels. Raw cpmtools does, as specially named files.

Read only status is affected by the 0200 weighted file permission. Other file attributes are not supported. cpmcbfs doesn't fabricate the execute bits if the filename ends in .com as Windows won't be able to execute these files anyway.

cpmtools seems to have a bug in cpmfs.c line 812, causing it to apply exact file length logic to all versions of CP/M, not just the ISX variant, as it should.

If you create a file and then don't write anything to it, you seem to end up with a file containing 128 bytes of 0. I think this may be a consequence of cpmCreat locating a file extent, prior to any cpmWrite that might follow.

Attempts to create subdirectories will fail.

Attempts to create files with certain characters in their names (those not allowed by CP/M) will fail.

Attempts to change file ownership will fail.

Attempts to set creation, modification and access times may work on CP/M filesystem versions that support it, but silently do nothing otherwise.

I didn't keep all the configure stuff in the original cpmtools source code. You can easily tweak the makefile and config.h if needs be.

At the moment, its only a command line program and there is no Windows GUI. It would be nice to be able to pick the file or device to mount and the drive to mount it as, and perhaps even be able to do this from Explorer. I don't know how to do this at present.

This software should not be sold. EldoS sell licenses to use their CbFS library. They also generously offer free non-commercial licenses to developers creating software for non-commercial purposes (only). A non-commercial license is used by cpmcbfs.

As I am using Visual Studio 2013 to compile the code, and the earliest Windows subsystem level it will let me specify to the LINKer is 5.01, this program requires Windows XP or later.

Folding

It is interesting to note that Michael Haardt wrote a folding editor (called fe) and the cpmtools source code is folded. I too wrote a folding editor (called ae) and the cpmcbfs source code is also folded, although differently. Hopefully the result isn't too crumpled.

Download

cpmcbfs can be downloaded from http://www.nyangau.org/cpmcbfs/cpmcbfs.zip.


This page maintained by Andy Key
andy.z.key@googlemail.com