Roland Gerlach's TRS-80 page
Roland Gerlach's home page

CP/M Utilities for the xtrs Emulator

Contents

Programs
EXPORT
IMPORT
XTRS
Bug Reports
Download

Programs

These programs were written for CP/M and make use of the emulator traps in Tim Mann's xtrs Emulator.

IMPORT and EXPORT also work (with the exception of the -H option) when running CP/M on David Keil's Model 4/4P Emulator.

EXPORT

Export CP/M file(s) to the host operating system.

Usage

Usage:	EXPORT [-H][-L][-T][-V] cpmfileref [hostfilename]

Where:	cpmfileref is the local file to export
	   (use "?" and "*" to specify multiple files)
	hostfilename is the name of the file to create on the host
	   (converted to uppercase by default), use -L to convert
	   to lowercase and [ to toggle case of next character.
	-H switches emulator to high speed and restores speed when done.
	-L converts hostfilename to lowercase.
	-T export text file (CR LF becomes LF, stop at SUB character).
	-V (verbose) display "r" for block read, "w" for block written.

Notes

CP/M does not keep an accurate file size. Binary files are always multiples of 128 byte blocks; text files end at the first sub character.

The CP/M CCP converts all command line parameters to uppercase, hence the need of the -L option and the use of [ to toggle the case of the next character within the hostfilename.

Examples

EXPORT -LT HELPFILE.TXT README.TXT
Export local file "HELPFILE.TXT" as a text file to "readme.txt" on the host.

EXPORT RUNME.COM
Export local file "RUNME.COM" as a binary file to "RUNME.COM" on the host.

IMPORT

Imports a file from the host operating system to CP/M.

Usage

Usage:	IMPORT [-F][-H][-L][-T][-V] hostfilename [cpmfilename]

Where:	hostfilename is the name of the file on the host
	   (converted to uppercase by default), use -L to convert
	   to lowercase and [ to toggle case of next character.
	cpmfilename is the name of the CP/M file to create,
	   existing files will not be overwritten unless -F is used.
	-F overwrite existing files.
	-H switches emulator to high speed and restores speed when done.
	-L convert hostfilename to lowercase.
	-T import text file (LF becomes CR LF, add SUB at end of file).
	-V (verbose) display "r" for block read, "w" for block written.

Notes

CP/M does not keep an accurate file size, both binary and text files will be padded to multiples of 128 byte blocks.

The CP/M CCP converts all command line parameters to uppercase, hence the need of the -L option and the use of [ to toggle the case of the next character within the hostfilename.

Examples

IMPORT -LT README.TXT HELPFILE.TXT
Import "readme.txt" from the host as a text file to "HELPFILE.TXT".

IMPORT RUNME.COM
Import "RUNME.COM" from the host as a binary file to "RUNME.COM".

XTRS

Controls miscellaneous functions of the xtrs emulator.

Usage

Usage:	XTRS action [parameters]

Where:	action is one of the following:
	   BOOT - reboot emulator
	   CHANGE - signal disk change
	   DEBUG - enter debugger
	   EXIT - end emulator
	   HIGHSPEED - high speed (autodelay off)
	   MOUNT [-L] hostfilename disknum - mount disk
	   NORMALSPEED - normal speed (autodelay on)
	   REPORT - report status
	   SYSTEM command - execute command on host
	   UMOUNT disknum - umount disk
	hostfilename is the name of the virtual disk file on the host
	   (converted to uppercase by default), use -L to convert to
	   lowercase and [ to toggle case of next character.
	command is the command (and parameters) to execute on the host
	   (converted to lowercase by default), use [ to toggle case.
	   Note output from command is NOT displayed in the XTRS window.
	disknum is disk drive number (between 0 and 3 inclusive).
	-L converts hostfilename to lowercase.

Warning

The XTRS program assumes that the emulator's virtual disk files - diskM-U (where M is the TRS-80 model and U is the drive number) - are symbolic links. For example:

$ ls -l
-rw-r--r--    1 user  group    213504 Mar 21 15:24 cpmutil.dsk
lrwxrwxrwx    1 user  group        10 Mar  5 12:40 disk4p-0 -> system.dsk
lrwxrwxrwx    1 user  group        11 Mar  7 13:49 disk4p-3 -> cpmutil.dsk
-rw-r--r--    1 user  group    745984 Mar 24 17:38 system.dsk

The MOUNT action deletes the diskM-U file, replaces it with a symbolic link to the given filename and signals a disk change (as if F7 had been pressed).

The UMOUNT action deletes the diskM-U file and signals a disk change.

Notes

When changing disks, remember that CP/M must also be told of the disk change. This is usually done by pressing ctrl-C at the prompt.

Examples

XTRS MOUNT -L DATA.DSK 1
Mount the virtual disk file "data.dsk" on drive 1. The actual command that would be executed on the host is:
rm -f disk4p-1;test -f data.dsk && ln -s data.disk disk4p-1

XTRS UMOUNT 1
Unmount the virtual disk file associated with drive 1. The actual command that would be executed on the host is:
rm -f disk4p-1

Bug Reports

Send Bug Reports and comments to Roland Gerlach.

Download

cpmutil.tgz
Source code and programs in a gzipped tar file.

cpmutil.dsk.gz
All of these programs (including source code) on a virtual disk formatted as a "Montezuma Micro Standard DATA disk (40T, SS, DD, 200K)" with 512-byte sectors. Be careful to configure CP/M with the proper disk format and drive parameters (40 tracks, not 80 tracks), or you will have problems reading this disk.

Note: On this Debian system, the CP/M utility disk is already installed in uncompressed form, and is available at /usr/lib/xtrs/cpmutil.dsk.


Comments and suggestions are welcome, send them to Roland Gerlach.