
CPMFS -  Matthew Phillips, 2000
================================

0. Conditions of use
--------------------

There are three conditions which you must agree to before using this
software:

a) that you use it entirely at your own risk,

b) that you inform me of any improvements that could be made or any problems
   you have with the software, and

c) that you send me a cheque in sterling or banknotes in any currency to
   the value of five pounds sterling, if you think the software is worth
   that much to you.

Note that you are not obliged to pay me if the software is not much use to
you.  If you just want to use it to show off to your friends how many disc
formats RISC OS can cope with, that's fine by me!

You may copy this software and distribute it providing that all files remain
unaltered and intact, and providing no charge is made other than the costs
of the media and the copying.  Anyone wishing to distribute it on CD-ROM or
with a commercial hardware or software package should contact me for
permission and to obtain the latest version.  Authors of emulators of CP/M
machines are particularly encouraged to distribute CPMFS with their software.

Although the software has been tested fairly thoroughly, you use it entirely
at your own risk, as explained above.  I cannot accept responsibility for
horrible things happening through the use or misuse of this software.
Having said that, if anything horrible or even mildly inconvenient does
happen, let me know so that I can improve the software for the future.

Contact details, for fulfilling conditions (b) and (c) are as follows:

  M.E. Phillips
  15 Lynn Close
  Marston
  Oxford
  OX1 1DP
  United Kingdom

  E-mail: matthew.phillips@chch.ox.ac.uk
 
New versions of the software will be announced on comp.sys.acorn.announce
and made available on my web site, at http://www.mephillips.co.uk/software/

I'd be glad to hear from people using the software, so that I can prioritise
work on enhancements.


1. Instructions
---------------
Double-click on !CPMFS.

That was easy, wasn't it?!

Your RISC OS computer will now be able to recognise, format, read and write
various CP/M disc formats.

CPMFS has been tested with RISC OS 3.71 and RISC OS 4.02, but may well work
with all versions of RISC OS from 3.10.

CPMFS supports ResFind.  I would welcome translations of the Messages and
!Help files to add to the distribution.


2. CP/M formats supported
-------------------------
There is no single standard CP/M disc format, other than the original
eight-inch single-density IBM 3740 formatted disc with two system tracks, and
even this format cannot be read by many more modern CP/M machines.

CPMFS therefore supports only a small subset of the CP/M formats in use:

  PCW -  the generic Amstrad PCW disc format, also used on the Spectrum +3
  D10 \
  D2   } three Amstrad CPC formats supported by ROMDOS and ParaDOS.
  D20 /

If you would like me to try to support any other CP/M format, please contact
me with the following information:

  no. of heads, density, no. of tracks, lowest sector number,
  physical sector size, no. of directory entries, no. of reserved tracks,
  no. of sectors per track, BSH, DSM.

If you do not know this information, please contact me anyway, as I may be
able to work it out.

It is not possible to support disc formats where the lowest numbered sector
is numbered greater than &3F.  This is a shortcoming of the design of RISC
OS.  Unfortunately this means that the standard Amstrad CPC data and system
formats cannot be used.

CPMFS will also allow you to open DSK and EDSK files, which are used with
Amstrad CPC emulators, as though they are directories, allowing you to
extract the files contained therein and to add new ones.  The DSK and EDSK
files should be given the registered filetype of &190 "DSK".  This filetype
replaces the unregistered filetype of &065 which was previously used by !CPC
and !CPCEmu.  Both these emulators are being updated to use the new official
filetypes.

Only DSK and EDSK files containing the image of a disc with a recognised
format can be opened in this way.  The formats recognised are as follows:

Amstrad PCW and Spectrum +3:
  All formats recognised, providing they have a valid 16 byte disc
  specification in the first sector.

Amstrad CPC, standard formats:
  Data, System, and IBM format are recognised.  Note that "IBM" format is for
  specialist use, being logically the same as the single-sided format used by
  CP/M 86 on the IBM PC.

Amstrad CPC, extended formats:
  CPMFS recognises all formats supported by ParaDOS, except the "electro"
  formats and ROMDOS D1 format.  CPMFS thus supports:
  
  ROMDOS D2, ROMDOS D10, ROMDOS D20, ROMDOS D40, S-DOS, ParaDOS 80,
  ParaDOS 41, ParaDOS 40D, Ultraform.


3. More about CP/M
------------------
CP/M was the first standard operating system for microcomputers, it was used
on hundreds of types of machine, many produced in kit form, using the Intel
8080 ond later the Zilog Z80 processors.  Just as CP/M was dying out in the
U.S. in the face of the IBM PC running MS-DOS, it enjoyed an unexpected
new lease of life in Britain as the operating system for the Amstrad PCW
computers.

When you open a CP/M disc under RISC OS, you will see fifteen directories
named [User01] to [User15].  These represent fifteen of the sixteen CP/M user
areas on the disc.  CP/M does not support subdirectories.  Instead files are
kept in one of the user areas.  The files in user area 0 are displayed in the
root directory of the disc under CPMFS.

Filenames under CP/M are of the same form as DOS filenames.  This is because
MS-DOS copied many ideas (and allegedly some code) from CP/M.  Each filename
may therefore have a three-letter extension, which usually indicates the type
of file it is.  CPMFS uses these extensions to guess the RISC OS filetypes
that should be used.  The extension is looked up in the MimeMap database, and
if found, the appropriate filetype is returned to RISC OS.

There are, of course, occasions on which the CP/M file may not be of the
same type as one with the same extension on a DOS disc.  You can therefore
override the MimeMap settings using the CPMMap command.

  CPMMap DOC Text

would set up a mapping to prevent DOC files on CP/M discs being treated as
MS-Word files - they are far more likely to be text files.

Earlier versions of CP/M did not support the concept of exact file lengths. 
Essentially files could only be a multiple of 128 bytes long.  CP/M Plus,
which was used on the Amstrad PCW, can support exact file lengths, but few
programs actually did.  This is normally not a problem, as the file formats
were designed to indicate which parts of the file were data and which were
garbage.  In the case of text files, this was indicated by ending the useful
part of the file with Ctrl-Z, ASCII 26.

If CPMFS finds that the exact file length has been stored in CP/M Plus style,
it will use this information, otherwise the whole file, which may include
some garbage, is returned.  This means that when loading a text file, you may
have to delete a little bit of data at the end.  There is no easy way round
this problem.  When creating new files on a CP/M disc, CPMFS stores the exact
file length.  This may occasionally cause problems if the length of the file
is subsequently changed under CP/M and then read back with CPMFS.  See the
TechNotes file in the !CPMFS directory for more details.

Only with the arrival of CP/M Plus were datestamps able to be stored for each
file.  CPMFS supports these, but at present when formatting a new disc it
does not make provision for these to be stored.  You can use the INITDIR and
SET commands from CP/M Plus to enable datestamps on a disc.


4. Future enhancements
----------------------
I have several ideas for improvements to CPMFS, and I would be glad to hear
which ideas would be most useful to you, and of any other suggestions you may
have.  E-mail me on matthew.phillips@chch.ox.ac.uk

 Add a CPMMapDefault command
  This would set the default filetype mapping for CP/M files if the extension
  could not be matched.  At the moment they are mapped to type DOS (&FE4).

 Hide user areas which are empty
  This would make it easier to be sure you had copied all the files off a
  CP/M disc without having to go through all the user area directories.  To
  work properly though, I would also need to allow the "creation" of those
  user areas which were hidden.

 Remember setting of filetypes
  It is not possible to store the RISC OS filetype information anywhere on
  a CP/M disc, but it may be possible to allow the filetypes to be set and
  remembered by CPMFS while the image is open.

 Support more formats
  Let me know of any CP/M formats you would like supported, for example, the
  new PcW16 formats, MyZ80 disc images, CPCEmu style images, CP/M 86, etc.

 Format discs with datestamps enabled
  This could apply to PCW discs.  It would be reasonably easy to implement.

 Application to convert CP/M files
  For example, Locoscript and Protext to RTF, DR and CUT to Sprite.  Let me
  know what would be of most use and I'll see if I can do it.

 Enforce CP/M+ passwords
  I don't know how I'd build these into RISC OS!

 Application to create DSK and EDSK files

 Cope with DSK/EDSK images which contain two sides of a disc, each formatted
  to a single-sided format.

 Implement ImageFunc33 for DSK and EDSK files
  If anyone really wants me to do this, I'd be very interested to know why!


5. Further documentation
------------------------
More documentation of a technical nature, is in the file !CPMFS.TechNotes.
If you are a technical sort of person, I would be very glad to have
feedback on any of the things mentioned in that file.


6. Acknowledgements
-------------------
Many thanks to the following:

Stewart Brodie
John Elliott
Richard Hallas
David Pilling
Mark Rison
Andreas Stroiczek
John Tytgat
Richard Wilson

and to all the inhabitants of comp.sys.acorn.programmer