CPM(1)

NAME
cpm - read and write CP/M® floppy disks

SYNOPSIS
cpm [ options ] [ filename ]

DESCRIPTION

Cpm reads and writes files with an internal structure like a CP/M file system. By default cpm assumes that the specified file has the parameters of a standard IBM format single sided single density 8" CP/M floppy disk, i.e., 2002 records containing 128 bytes each, of which 52 are reserved for system use and 16 (2 blocks) are used by the directory (maximum 64 directory entries). These parameters may be changed by specifying the appropriate flags (see below). Thus, various double density formats may also be read and written, provided that the hardware can handle the actual format.

The specified file may be a floppy disk drive (e.g., /dev/floppy on an 11/780 or /dev/rrx?b if rx02 drives are available on your system), or a standard UNIX™ file with the appropriate structure. Since it may be inconvenient (and slow) to access the device directly, in particular the console floppy on an 11/780, it is always a good idea to copy the contents of the diskette into a standard file using dd(1), e.g.,

	dd if=/dev/floppy of=yourfile bs=128 count=2002

On most systems you have to be superuser to access the console floppy and to be able to write to rx02's.

Flags:

-d  display directory on standard output

-B  the files specified with the c or C flag contain binary code rather than plain text (default)

-c name1 name2
    copy the CP/M file name1 to the UNIX file name2

-C name1 name2
    copy the UNIX file name1 to the CP/M file name2

-p name
    copy the specified CP/M file to standard output

-i  enter interactive mode (all the above flags are turned off)

-I  force initializtion of the specified CP/M file (e.g., delete all files)

-sn skew factor (sector interleaving); default is 6

-bn block size (in bytes); default is 1K bytes

-mn max number of directory entries; default is 64

-ln sector size (in bytes); default is 128

-rn number of sectors per track; default is 26

-tn number of tracks; default is 77

-Rn number of reserved tracks (i. e., for the bootstrap system); default is 2

If the -i flag is specified, the filename argument must always be present. If the specified file does not exist, a new file will be initialized. The -C, -c and -p flags are mutually exclusive.

The following commands are available in interactive mode:

ccopyin unixfile cpmfile
    copy UNIX binary file to CP/M

ccopyout cpmfile unixfile
    copy CP/M binary file to UNIX

copyin unixfile cpmfile
    copy UNIX text file to CP/M

copyout cpmfile unixfile
    copy CP/M text file to UNIX

del[ete] filename
    a synonym for erase

dir[ectory] or ls
    display directory

era[se] filename
    delete the given file

hel[p]
    print a short description of each command

log[out] or exi[t]
    terminate, return to the shell

ren[ame] file1 file2
    rename file1 to file2

typ[e] filename
    print CP/M file to console; if the environment variable PAGER exists, it is interpreted as a command to pipe the output through

The commands may be abbreviated as indicated by brackets. CP/M file names are automatically converted to upper case. The copy commands refuse to overwrite any existing files.

If the CP/M floppy file becomes full during a file transfer from UNIX, the file is closed and the command terminated. The data already written to the CP/M file will be saved.

The copyout command assumes that CP/M text files have cr+lf as line terminators and removes carriage returns. Copyin adds a carriage return in front of each line-feed, and adds a ^Z to the end of the file. The binary copy commands provide for ``raw'' file copying, thus making it possible to copy code files to and from diskettes.

Interrupts are recognized in interactive mode, and will return you to the command level.

FILES
/dev/floppy
/dev/rrx?b
/usr/new/lib/cpm.hlp

SEE ALSO
dd(1), rx(4v)

BUGS
CP/M user numbers are ignored, files written to the CP/M floppy file will always have user number 0.

CP/M filename extensions containing more than 3 characters will quietly be truncated.

Wildcards are not supported.

Binary input/output is always handled in multiples of the physical sector size; CP/M handles it in multiples of 128 byte records.

TRADEMARKS
CP/M is a registered trademark of Digital Research, Inc.
UNIX is a trademark of AT&T Bell Labs.

HISTORY
The original program has been written in 1982 and 1983 by Helge Skrivervik at the University of California, Berkeley. It has been adapted by Joerg Wunsch (joerg_wunsch@uriah.sax.de), to make it work with double density disks, especially with those having block numbers > 255. After getting written permission by Helge Skrivervik to redistribute the program under a Berkeley-style Copyright, it has been made available with the FreeBSD distribution in 1994.

AUTHOR
Helge Skrivervik (now [1994] helge@mellvik.no)