General Information on CP/M CP/M File References CP/M Line Editing and Output Control CP/M Built-In Commands CP/M Transient Commands Physical Device Assignments for ARIES-1 CP/M STAT Command CP/M PIP Command CP/M ED Command CP/M ASM Command CP/M LOAD Command The UNLOAD Command CP/M DDT Command The ZDT Command CP/M SYSGEN Command CP/M SUBMIT and XSUB Commands CP/M BDOS -- Basic I/O Operations CP/M BDOS -- Basic Disk Operations CP/M File Types CP/M BIOS Jump Vector :General Information on CP/M CP/M is a monitor control program for microcomputer software development which uses IBM-compatible flexible disks (floppy disks) for mass storage. Using a microcomputer mainframe based on Intel's 8080 or Zilog's Z80 microprocessor, CP/M provides a general environment for program construction, storage, and editing, along with assembly and program debug facilities. An important feature of CP/M is that it can be easily altered to execute with any computer configuration which uses an Intel 8080 or Zilog Z80 Microprocessor and has at least 20K bytes of main memory with up to eight IBM-compatable diskette drives. The CP/M monitor provides access to programs through a comprehensive file management system. The file subsystem supports a named file structure, allowing dynamic allocation of file space as well as sequential and random file access. Using this file system, up to 128 distinct programs can be stored in both source and machine-executable form. Digital Research, the designer of CP/M, has provided a set of nine manuals which describe the use and operation of CP/M in detail. These manuals are: 1. An Introduction to CP/M Features and Facilities 2. ED: A Context Editor for the CP/M Disk System 3. ASM: CP/M Assembler User's Manual 4. DDT: CP/M Dynamic Debugging Tool User's Manual 5. CP/M 1.4 Interface Guide 6. CP/M 1.4 System Alteration Guide 7. CP/M 2.0 User's Guide 8. CP/M 2.0 Interface Guide 9. CP/M 2.0 System Alteration Guide As the reader can see, CP/M supports a context editor, an assembler (Intel-compatable), and a debugger system. These are available in the basic CP/M package. There is a large variety of other software available which can run under CP/M with little or no modification. Such software includes several assemblers (both 8080 and Z80), a symbolic debugger, several high-level languages (including FORTRAN IV {compiler}, BASIC-E {translator}, CBASIC {translator}, many interpretive BASICs, ALGOL, FOCAL, and C), and several special-purpose applications programs (such as text formatting systems and accounting systems). This HELP File addresses itself specifically to the CP/M 2.x Operating Systems. :CP/M File References A file reference identifies a particular file or group of files on a particular disk attached to CP/M. These file references can be either unambiguous (ufn) or ambiguous (afn). An unambiguous file reference uniquely identifies a single file, while an ambiguous file reference may be satisfied by a number of different files. An unambiguous file reference is an exact name of the specified file. It consists of up to eight characters in the file name and three characters in the file type. An unambiguous file reference is of the form -- pppppppp.sss The characters used in specifying an unambiguous file reference may not contain any of -- < > . , ; : = ? * [ ] An ambiguous file reference is used for directory search and pattern matching. The form of an ambiguous file reference is similar to an unambiguous reference, except the symbol '?' may be interspersed throughout the file reference. In various commands throughout CP/M, the '?' symbol matches any character of a file name in the '?' position. For example, X?Y.C?M will match XZY.COM and X3Y.CEM. The '*' symbol is used to match all characters of a file name or file type. For example, *.COM will match XZY.COM and HELP.COM, while HELP.* will match HELP.COM and HELP.HLP. :CP/M Line Editing and Output Control The following are the line editing functions supported by CP/M -- rubout Delete and echo the last character typed at the console. Ctrl-H Delete the last character typed; Backspace one character; CRT-oriented Ctrl-U Delete the entire line typed at the console. Ctrl-X Delete the entire line typed at the console; Backspace to the beginning of the current line; CRT-oriented. Ctrl-R Retype current command line: types a "clean line" following character deletion with rubouts. Ctrl-E Physical end of line: carriage is returned, but line is not sent until the carriage return key is depressed. Ctrl-M Terminates input (carriage return). Ctrl-J Terminates current input (line feed); CRT-oriented Ctrl-C CP/M system reboot (warm start). Ctrl-Z End input from the console (used in PIP and ED). Other control functions affect console output -- Ctrl-P Copy all subsequent console output to the currently- assigned list device (LST:). Output is sent to both the list device and the console device until the next Ctrl-P is typed. Ctrl-S Stop the console output temporarily. Program execution and output continue when the next character is typed at the console. Typing Ctrl-C returns control to CP/M. Input lines can generally be up to 255 characters in length. They are not acted upon until the carriage return key is typed. :CP/M Built-In Commands ERA afn -- The ERA (erase) command removes files from the currently logged-in disk. DIR afn -- The DIR (directory) command causes the names of all files which satisfy the ambiguous file name afn to be listed on the console device. All files are listed if no afn is given. REN ufn1=ufn2 -- The REN (rename) command allows the user to change the names of files on disk. The file satisfying ufn2 is changed to ufn1. SAVE n ufn -- The SAVE command places n pages (256-byte blocks) onto disk from the TPA and names this file ufn. TYPE ufn -- The TYPE command displays the contents of the ASCII source file ufn on the currently logged-in disk at the console device. USER n -- Upon cold boot, the user is automatically logged in to User Area 0, which is compatable with CP/M 1.4 directories. The USER command allows the user to move to another logical area within the same directory; areas are numbered 0-15. The ERA, DIR, REN, SAVE, and TYPE commands apply to the current User Area. :CP/M Transient Commands The CP/M standard transient commands are -- STAT List the number of bytes of storage and data on the currently logged-in disk, provide statistical information about particular files, and display or alter device assignment. PIP Load the Peripheral Interchange Program for subsequent disk file and peripheral transfer operations. ED Load and execute the CP/M text editor program. SUBMIT Submit a file of commands for batch processing. XSUB Used in conjunction with SUBMIT, transfers all buffered console input from CON: to the SUBMIT File. ASM Load the CP/M assembler and assemble the specified program from disk. LOAD Load the file in Intel "hex" machine code format and produce a file in machine executable form which can be loaded into the TPA (this loaded program becomes a new command under the CCP). DDT Load the CP/M debugger into the TPA and execute it. DUMP Dump the contents of a file in hex. SYSGEN Create a new CP/M system diskette. MOVCPM Regenerate the CP/M system for a particular memory size. :Physical Device Assignments for ARIES-1 Logical Device Physical Device CON: TTY: Model 43 Teletype CRT: Hazeltine 1500 CRT BAT: CRT and Modem UC1: In=CRT, Out=CRT and Modem RDR: TTY: Model 43 Teletype PTR: Modem UR1: CRT and Modem w/CRT Output UR2: CRT and Modem PUN: TTY: Model 43 Teletype PTP: Modem UP1: CRT and Modem UP2: CRT and Modem LST: TTY: Model 43 Teletype CRT: Hazeltine 1500 CRT LPT: Modem UL1: CRT and Modem :CP/M STAT Command The STAT Command takes any of the following forms -- STAT Calculate the storage remaining on all active drives and print a message like x: R/W, SPACE: nnnK -- if disk is Read/Write x: R/O, SPACE: nnnK -- if disk is Read Only STAT x: Calculate the storage remaining on the specified drive and print BYTES REMAINING ON x: nnnK STAT x:afn [$S] Scan the specified files on the specified drive (x: is optional), and list all files which satisfy the unambiguous reference in alphabetical order with storage requirements. A table like the following is generated -- Size Recs Bytes Ext Acc sssss rrrr nnnk ee a/b d:pppppppp.sss where sssss -- number of virtual 128-byte records in file This field is display if the optional $S is given rrrr -- number of 128-byte records in each extent of the file nnnK -- number of bytes (in K, K=1024) allocated to the file ee -- number of 16K extensions a/b -- access mode of file; R/O or R/W d:pppppppp.sss -- drive name (d may be A, B, C, D) and file name STAT x:=R/O Set the specified drive to Read Only. This is cleared by a warm boot. When a disk is Read Only, the message BDOS ERR ON x: READ ONLY will appear if there is an attempt to write to it. STAT VAL: Summarize the status commands. STAT VAL: will print the list -- Temp R/O Disk: d:=R/O Set Indicator: d:filename.typ $R/O $R/W $SYS $DIR Disk Status : DSK: d:DSK: User Status : USR: Iobyte Assign: CON: = TTY: CRT: BAT: UC1: RDR: = TTY: PTR: UR1: UR2: PUN: = TTY: PTP: UP1: UP2: LST: = TTY: CRT: LPT: UL1: STAT DEV: Display the current logical to physical device mapping. For example, the list may appear as -- CON: = CRT: PUN: = PTP: RDR: = UR1: LST: = TTY: STAT d:afn [$R/O or $R/W or $SYS or $DIR] Set the various permanent file indicators. R/O=Read/Only, R/W=Read/Write, SYS=System, DIR=Non-System STAT ld1=pd1, ld2=pd2, ... Change the logical to physical device assignments. Logical device ld1 is assigned to physical device pd1, etc. The valid logical device names are -- CON: The system console device RDR: The paper tape reader device PUN: The paper tape punch device LST: The output list device The valid physical device names are -- TTY: Slow speed output device (teletype) CRT: High speed output device (cathode ray tube) BAT: Batch processing (CON: input is RDR:, CON: output is LST:) UC1: User-defined console PTR: Paper tape reader PTP: Paper tape punch UR1: User-defined reader #1 UR2: User-defined reader #2 UP1: User-defined punch #1 UP2: User-defined punch #2 LPT: Line printer UL1: User-defined list device #1 STAT d:DSK: List the characteristics of the disk named "d:"; if "d:" is not specified, list the characteristics of all active disks. A sample listing: d: Drive Characteristics 65536: 128 Byte Record Capacity 8192: Kilobyte Drive Capacity 128: 32 Byte Directory Entries 0: Checked Directory Entries 1024: Records/ Extent 128: Records/ Block 58: Sectors/ Track 2: Reserved Tracks STAT USR: List the User Number the user is currently in and the User Numbers which have files on the currently addressed disk. A sample listing: Active User : 0 Active Files: 0 1 3 :CP/M PIP Command PIP (Peripheral Interchange Program) is the CP/M transient which implements the basic media conversion operations necessary to load, print, punch, copy, and combine disk files. PIP is initiated by one of the following forms -- PIP Engage PIP, prompt the user with '*', and read command lines directly from the console. PIP used in this way is exited by either typing an empty command line (just a carriage return) or a Ctrl-C as the first character of the line. PIP cmnd Engage PIP, execute the specified command, and return to CP/M. The form of each command line in PIP is -- destination = source#1, source#2, source#3, ..., source#n The general forms of PIP command lines are -- x:=y:afn Copy all files satisfying afn from drive y to drive x. 'y' may be omitted, and, if so, the currently logged-in drive is selected. x:ufn=y: Copy the file given by ufn from y to x. 'x' may be omitted, and, if so, the currently logged-in drive is selected. x:afn=y:afn Like the above, but x and/or y may be omitted; the default drive is selected for the omitted drive(s). ld=pd Copy from the specified physical device to the specified logical device. Valid logical devices are -- CON:, RDR:, PUN:, LST: Valid physical devices are -- TTY:, CRT:, UC1:, PTR:, PTP:, UR1:, UR2:, UP1:, UP2:, LPT:, UL1: Additional device names which may be used in PIP commands are -- NUL: Send 40 Nulls (ASCII 0) to the device. EOF: Send a CP/M End of File character (ASCII Ctrl-Z). INP: Special PIP input source to be patched (see manual). OUT: Special PIP output destination to be patched (see manual). PRN: Same as LST:, but tabs are expanded at every eighth character position, lines are numbered, and page ejects are inserted every 60 lines with an initial eject. The user can also specify one or more PIP parameters enclosed in square brackets separated by zero or more blanks. These parameters are -- B Block mode transfer. Data is buffered by PIP until an ASCII X- Off character (Ctrl-S) is received from the source device. Dn Delete characters which extend past column n in the transfer of data to the destination from the character source. E Echo all transfer operations to the console. F Filter (remove) form feeds from the file. Gn Get File from User Number n (n in the range 0 - 15) H Hex data transfer. All data is checked for proper Intel hex file format. I Ignore ':00' records in the transfer of Intel hex format file. L Translate upper case to lower case alphabetics. N Add line numbers to each line transferred to the destination. O Object file (non-ASCII) transfer. Ignore End of File. Pn Include page ejects at every n lines. Qs^Z Quit copying from the source device or file when the string s (terminated by Ctrl-Z) is encountered. R Read system files Ss^Z Start copying from the source file when the string s is seen. Tn Expand tabs to every nth column. U Translate lower case to upper case alphabetics. V Verify that data has been copied correctly. W Write over R/O files without console interrogation Z Zero the parity bit on input for each ASCII character. :CP/M ED Command The ED Program is the CP/M system context editor, which allows creation and alteration of ASCII files. Complete details are given in the user's manual. The following are the error indicators given by ED -- ? Unrecognized Command > Memory buffer full # Cannot apply command the number of times specified O Cannot open LIB file in R command The following are the control characters recognized by ED -- ^C System reboot ^E Physical (not entered in command) ^H Character delete (backspace) ^I Logical tab ^J New line (line feed) ^L Logical in search and substitute strings ^M New line (carriage return) ^U Line delete ^X Line delete and backspace ^Z String terminator Rubout Character delete Break Discontinue command The following are the commands recognized by ED -- nA Append lines +/- B Beginning/Bottom of buffer +/- nC Move character positions +/- nD Delete characters E Exit nFs^Z Find string H End edit, close and reopen files Is^Z Insert characters nJ Place strings in juxtaposition +/- nK Kill (delete) lines +/- nL Move down/up lines nM Macro definition O Return to original file +/- nP Move and print pages Q Quit with no file changes R Read library file nSs1^Zs2^Z Substitute s2 for s1 +/- nT Type lines +/- U Translate lower to upper case if U; none if -U +/- V Engage/disengage line numbers (verify) 0V Print memory buffer info (free/total usage) nW Write lines nX Transfer n lines to X$$$$$$$.LIB 0X Empty X$$$$$$$.LIB nZ Sleep +/- n Move and type (+/- nLT) n: Move to absolute line (V engaged) :n Process from current line to specified line (V engaged) :CP/M ASM Command The ASM Command loads and executes the CP/M 8080 assembler. It is of the form -- ASM filename.xyz where filename ... is the name of the file 'filename.ASM' to assemble x ... designates the disk name which contains the source y ... designates the disk name to contain the hex file (y=Z suppresses generation of the hex file) z ... designates the disk name to contain the print file (y=X lists on CON:, y=Z suppresses listing) Refer to the ASM Manual for further details. :CP/M LOAD Command The LOAD Command reads the file specified, which is assumed to contain Intel hex format machine code and produces a memory image file which can be subsequently executed (converts .HEX to .COM files). It is of the form -- LOAD filename where filename is the name of the file 'filename.HEX'. :The UNLOAD Command The UNLOAD Command does the reverse of the LOAD Command -- it converts COM files to HEX files. It is of the form -- UNLOAD filename where filename is the name of the file 'filename.COM'. :CP/M DDT Command The DDT Program allows dynamic interactive testing and debugging of programs generated in the CP/M environment. It is invoked by -- DDT DDT filename.HEX DDT filename.COM where 'filename' is the name of the program to be loaded or tested. DDT responds to the normal CP/M input line editing characters. DDT responds to the following commands -- As Perform inline assembly starting at the specified address s. D Display memory from the current address for 16 display lines. Ds Display memory from address s for 16 display lines. Ds,f Display memory from address s to address f. Fs,f,c Fill memory from start address s to final address f with byte c. G Start execution at the current value of the PC. Gs Start execution at the specified address s. Gs,b Start execution at the specified address s and set a breakpoint at the address b. Gs,b,c Same as above with breakpoints at b and c. G,b Start execution at the current value of the PC with breakpoint b. G,b,c Same as above with breakpoints at b and c. If Insert a file name f into the default FCB. L List 12 lines of disassembled code from the current address. Ls List 12 lines from the specified address s. Ls,f List lines of disassembled code from s to f. Ms,f,d Move the block from address s to f to destination at address d. R Read file in FCB into memory at 100H. Rb Read file in FCB into memory with offset b from 100H. Ss Set (examine and alter) memory starting at address s. T Trace the next instruction. Tn Trace the next n instructions. U Untrace -- like Trace, but intermediate steps are not displayed. X Examine all registers and flags. Xr Examine specified registers or flag, where r may be -- C Carry flag Z Zero flag M Minus (sign) flag I Interdigit Carry flag A Accumulator B BC Reg pair D DE Reg pair H HL Reg pair S Stack pointer P PC :The ZDT Command ZDT is a Z80 version of DDT. It is invoked by typing -- ZDT The commands recognized by ZDT are input in single-character input mode. No input line editing is done, and each command expects an exact input. All byte values are exactly two characters, and all addresses are exactly four characters. The commands recognized by ZDT are -- A bbbb Enter ASCII characters into memory from keyboard starting at address bbbb. B Warm Boot -- Return to CP/M. C bbbb eeee nnnn Compare memory from address bbbb to address eeee to block starting at nnnn. D bbbb eeee Dump memory from bbbb to eeee. E bbbb eeee Search for ASCII string from bbbb to eeee. String is at most 16 characters. String is terminated by . F bbbb eeee Search for hex string from bbbb to eeee. String is terminated by . G Go to next breakpoint. H aaaa nnnn Hex add and subtract. Computes aaaa+nnnn and aaaa-nnnn. I nn Input. Prints value at port nn. J nnnn Jump to and execute at location nnnn. K Keyboard echo. L filename.typ nnnn Loads specified disk file into location nnnn. M bbbb eeee nnnn Move block from bbbb to eeee-1 to nnnn. N aaaa Enter offset aaaa for loading. O nn dd Output byte dd to port nn. P bbbb Input hex into memory from keyboard starting at bbbb. advances pointer, or backs pointer. Q bbbb eeee Dumps from bbbb to eeee in ASCII. R n ll tt ss bbbb Read block of data from disk n of length ll (256-byte pages) starting at track tt and sector ss placing the data at bbbb. S bbbb eeee Disassembly (symbolic dump) from bbbb to eeee. T bbbb eeee Destructive memory test from bbbb to eeee-1. U bbbb Set breakpoint at bbbb. V Display all currently-set breakpoints. W n ll tt ss bbbb Write on disk n the data at bbbb for a length of ll starting at track tt, sector ss. ll is in 256-byte pages. X Display registers. Z bbbb eeee dd Zero or set memory from bbbb to eeee-1 with byte dd. :CP/M SYSGEN Command The SYSGEN transient command allows generation of an initialized disk containing the CP/M Operating System. It is invoked by typing SYSGEN Once invoked, the user is prompted through the session. Refer to the CP/M Manual for further details. :CP/M SUBMIT and XSUB Commands The SUBMIT command allows CP/M commands to be batched together for automatic processing. The form of this command is SUBMIT ufn parm1 parm2 ... parmn The ufn given in the SUBMIT command must be the filename (not type) of a file which exists on the currently logged-in disk with an assumed file type of '.SUB'. Refer to the CP/M Manual for further details. The XSUB command extends the power of the SUBMIT facility. When specified as the first line of a SUBMIT File, it self-relocates directly below the CCP. All subsequent SUBMIT command lines are processed by XSUB, so that programs which read buffered console input (BDOS Function 10) receive input directly from the SUBMIT File. While XSUB is in memory, it prints the message "(xsub active)" on each warm boot. An example of the use of XSUB to display memory from 100H to 1FFH is -- XSUB DDT D100,1FF G0 :CP/M BDOS -- Basic I/O Operations Function and Number Input Parameters Output Parameters System Reset 0 None None Read Console 1 None ASCII Char in A Write Console 2 ASCII Char in E None Read Reader 3 None ASCII Char in A Write Punch 4 ASCII Char in E None Write List 5 ASCII Char in E None Direct Con I/O 6 ASCII Char in E I/O Status in A if E=0FFH Get I/O Status 7 None I/O Status in A Put I/O Status 8 I/O Status in E None Print Buffer 9 Address of string None terminated by $ in DE Read Buffer 10 Address of Read Read Buffer is filled Buffer in DE Console Ready 11 None LSB of A is 1 if char ready *All function numbers are passed in Reg C. I/O Status Byte -- Value Bits 6&7 Bits 4&5 Bits 2&3 Bits 0&1 00 CON:=TTY: RDR:=TTY: PUN:=TTY: LST:=TTY: 01 CRT: PTR: PTP: CRT: 10 BAT: UR1: UP1: LPT: 11 UC1: UR2: UP2: UL1: Read Buffer -- Byte Function 1 Maximum Buffer Length 2 Current Buffer Length (returned value) 3-n Data (returned values) :CP/M BIOS -- Basic Disk Operations Function and Number Input Parameters Output Parameters Return Version # 12 None Version Info in HL H=0 CP/M, H=1 MP/M L=00 CP/M 1.x, 2x 2.x Init BDOS 13 None None Log-In Disk 14 Value in Reg E None A=0, B=1, C=2, D=3 Open File 15 Address of FCB Byte address of FCB in DE if found or 0FFH if not Close File 16 Address of FCB Byte address of FCB in DE if found or 0FFH if not Search for File 17 Address of FCB Byte address of FCB (0-3) in DE if found or 0FFH if not Search for Next 18 Address of FCB Byte address of next FCB in DE if found or 0FFH if not Delete File 19 Address of FCB Byte address of FCB (0-3) in DE if found or 0FFH if not Function and Number Input Parameters Output Parameters Read Next Record 20 Address of FCB 0=successful read in DE 1=read past EOF 2=reading random data Write Next Rec 21 Address of FCB 0=successful write in DE 1=error in extending 2=end of disk data 255=no more dir space Make File 22 Address of FCB Byte address of FCB or in DE 255 if no more dir space Rename FCB 23 Address of FCB Byte Address of Dir entry in DE or 255 if no match Return Log Code 24 None Login vector in HL Read Drive No 25 None Number of logged-in drive (A=0, B=1, C=2, D=3) Set DMA Address 26 Address of 128 None byte buffer in DE Function and Number Input Parameters Output Parameters Get Alloc Vect 27 None Allocation Vect Addr in HL Write Prot Disk 28 None None Get R/O Vect 29 None HL=R/O Vect Val Set File Attrib 30 Ptr to FCB in DE Dir code in A Get Disk Parms 31 None HL=DPB Address Set/Get Usr Code 32 E=0FFH (get)/Code A=Current code (get)/no (set) value (set) Read Random 33 DE=FCB addr A=return code 1=reading unwritten data 2=(not used) 3=can't close curr ext 4=seek to unwritten ext 5=(not used) 6=seek past end of disk Function and Number Input Parameters Output Parameters Write Random 34 DE=FCB addr A=return code 1=reading unwritten data 2=(not used) 3=can't close curr ext 4=seek to unwritten ext 5=dir overflow 6=seek past end of disk Compute File Siz 35 DE=FCB addr Random Rec Field set to file size Set Random Rec 36 DE=FCB addr Random Rec Field set *All function numbers are passed in Reg C :CP/M File Types AIN ALGOL 60 Intermediate ALG ALGOL 60 Source File ASM Assembler Source File BAK Backup File BAS BASIC Source File C C Source File COB COBOL Source File COM "Command" File FOR FORTRAN IV Source File HEX Intel "hex" code file HLP HELP File INT BASIC Intermediate File LST Listing File MAC MACRO-80 Source File PAS PASCAL Source File PRN Assembler Listing File REL Relocatable Module SRC PASCAL/MT Source File SUB SUBMIT File SYM Symbol File TC Tiny-C Source File TFS TFS Source File TXT Text File $$$ Temporary File :CP/M BIOS Jump Vector The following is a table representing the entry points into the CP/M BIOS of the major routines accessable to the user -- Routine Relative Offset Comment BOOT 00H Cold Start WBOOT 03H Warm Start CONST 06H Console Status Reg A = 00 if no char ready Reg A = FF if char ready CONIN 09H Console char in (Reg A) CONOUT 0CH Console char out (Reg C) LIST 0FH List out (Reg C) PUNCH 12H Punch out (Reg C) READER 15H Reader in (Reg A) Routine Relative Offset Comment HOME 18H Move to track 00 SELDSK 1BH Select disk given by Reg C (A=0,B=1,...) SETTRK 1EH Set track address given by Reg C (0...76) SETSEC 21H Set sector address given by Reg C (1...26) SETDMA 24H Set subsequent DMA address (RP B&C) READ 27H Read track/sector (block) WRITE 2AH Write track/sector (block) LISTST 2DH List Device Status Reg A = 00 if no char ready Reg A = FF if char ready SECTRAN 30H Translate sector number in Reg C using table pointed to by DE; physical sector number returned in Reg L