% type cpmkermit .doc 1. CP/M-80 KERMIT Program: Bill Catchings, Columbia University, with contributions from Bernie Eiben (DEC), Nick Bush (Stevens), John Bray (University of Tennessee), Bruce Tanner (Cerritos College), Greg Small (University of California at Berkeley), Kimmo Laaksonen (Helskini University of Technology), and many others. Language: 8080 Assembler or MAC80 Version: 3.9 Date: April 1984 Documentation: Frank da Cruz, Columbia University KERMIT-80 Capabilities At A Glance: Local operation: Yes Remote operation: No Transfers text files: Yes Transfers binary files: Yes Wildcard send: Yes ^X/^Y interruption: Yes Filename collision avoidance: Yes Can time out: Yes 8th-bit prefixing: Yes Repeat count prefixing: No Alternate block checks: Yes Terminal emulation: Yes, VT52 and others Communication settings: Yes; duplex, parity Transmit BREAK: Yes; some versions IBM communication: Yes Transaction logging: No Session logging (raw download): Yes Raw upload: Yes Act as server: No Talk to server: Yes; SEND, GET, FIN, BYE Advanced commands for servers: No Local file management: Yes; DIR, ERA, SET DEFAULT disk Handle file attributes: No Command/init files: No Printer control: Yes, limited SUMMARY OF CP/M CP/M-80 (version 2.2) has only five built-in commands, and they all deal with files; other functions are done by invoking programs. CP/M file specifications are of the form DEV:XXXXXXXX.YYY, where DEV: is a device name, normally the A: or B: floppy. If omitted, the device name defaults to your connected diskette. XXXXXXXX is a filename of up to 8 characters. YYY is the file type, up to 3 characters. File names and file types may contain letters, digits, and some special charac- ters, including dash, dollar sign, and underscore, but no imbedded spaces. Up- per and lower case letters are equivalent. "Wildcard" file-group specifications are permitted in file names and file types (but not device names) within certain contexts; a "*" matches a whole field, a "?" matches a single character, including space. Examples: "*.F??" specifies all files whose types start with F and are 1, 2, or 3 characters long; "F?.*" specifies all files whose names start with F and are no more than two charac- ters long (before the trailing spaces). The five CP/M commands are: DIR file Lists the the names of the specified files. The default file specification is "*.*". Example: "DIR B:*.FOR". ERA file Erases (deletes) the specified file(s); wildcards allowed. REN new old Changes the name of a file from old to new, e.g. "REN NEW.FOR=OLD.FOR". SAVE Saves the specified number of memory blocks into a file. TYPE file Types the specified file on the screen, e.g. "TYPE FOO.TXT". The most important programs are: STAT Gives statistics on disk usage. PIP Peripheral Interchange Program. Copies files. In response to the "*" prompt, give a command of the form disk:outfile=disk:infile Wildcards ("*" for a whole field or "?" for a letter) can be used. Examples: "A:=B:*.*" to copy a whole disk, "A:=B:*.FOR" to copy all the Fortran programs from disk B to disk A. If the disk specification is omitted, your "connected" disk is as- sumed. Command line arguments are also accepted, e.g. "PIP A:=B:*.*". For further information on CP/M, consult your microcomputer manual or a CP/M handbook. KERMIT-80 DESCRIPTION Implementations of Kermit-80 presently exist for the DEC VT180 (Robin), the DECmate II, the Intertec Superbrain, the Heath/Zenith 89 and Z100, the Apple II with the Z80 SoftCard, the Osborne 1, the TRS-80 II with CP/M, the Telcon Zorba, the Kaypro, the Vector Graphics CP/M system, the Morrow Decision I, the Nokia MikroMikko, and others. There is also a "generic" CP/M version that should run on most 8080-compatible CP/M 2.2 systems, but which may provide less performance, and another for CP/M 3.0. Since Kermit-80 runs on a standalone micro, it is always in control of the screen -- it is always local. Thus, it always keeps the screen updated with the file name and the packet number, whether sending or receiving. Kermit-80 is capable of an imprecise or "fuzzy" timeout on an input request, and can break deadlocks automatically. In most cases, this is not important, because the KERMIT on the other side is most likely able to handle the timeouts. The timeouts done by Kermit-80 are fuzzy because they depend on the speed of the Z80 processor and other factors that can vary from system to system. If despite the timeout capability, the transmission appears to be stuck (and you can tell that this has happened if the screen fails to change for a while) you can type carriage return to have the micro do what it would have done on a timeout, namely NAK the expected packet to cause to foreign host to send it again (or, if the micro is sending, to retransmit the last packet). Micro/ micro or micro/IBM-mainframe transfers could require this kind of manual inter- vention. File transfers may be interrupted in several ways. Control-C This will return you to Kermit-80 command level immediately, so that you can connect back to the remote system, or take any other desired action. Control-X When sending a file, this will terminate the sending of the current file with a signal to the KERMIT on the other side to discard what it got so far. If there are more files to be sent, KERMIT-80 will go on to the next one. When receiving a file, KERMIT-80 will send a signal to the remote KERMIT to stop sending this file. If the remote KERMIT understands this sig- nal (not all implementations of KERMIT do), it will comply, otherwise the file will keep coming. In any case, the remote KERMIT will go on to the next file in the group, if any. Control-Z Like Control-X, except if a file group is being transmitted, this will stop the transmission of the entire group. If only a single file is being transmitted, it works exactly like Control-X. Carriage Returns If you type carriage return repeatedly Kermit-80 will retry the current packet up to its retry limit (somewhere between 5 and 16 times) and then, if no valid response was received, return to Kermit-80 command level. KERMIT-80 COMMANDS KERMIT-80 uses the DECSYSTEM-20 keyword style command language. Each keyword may be abbreviated to its minumum unique length. "?" may be typed to request a menu of the available options for the current field at any point in a command. ESC may be typed at any point in a command to fill out the current keyword or filename; if sufficient characters have not been typed to identify the current field uniquely, KERMIT-80 will sound a beep and allow you to continue from that point. CONNECT Establish a "virtual terminal" connection to any host that may be con- nected to the serial port, i.e. pass all typein to the serial port and display all input from the serial port on the screen. Also, emulate a DEC VT52 to allow cursor control, screen clearing, etc., if VT52-EMULATION is ON (see below), in which case you should also set your terminal type on the remote host to VT52. (Some versions emulate other terminals.) The escape character differs from micro to micro; when you issue the CONNECT command, the micro will print a message telling you how to get back. The escape sequence is generally an uncommonly-used control character, like CTRL-backslash or CTRL-rightbracket, followed by a single letter "command". C Close Connection, return to Kermit-80> command level. S Display Status of connection, but maintain remote connection. ? List available single-character commands. 0 (zero) Send a null (0) character. B Send a BREAK signal. Only some systems provide this function. ^] (or whatever - a second copy of the escape character) Send the es- cape character itself to the remote host. SEND filespec Send file(s) specified by filespec to the remote Kermit. The filespec may contain CP/M wildcards. RECEIVE Receive file(s) from the remote Kermit. Store them under the names provided in the file headers supplied by the remote host. If the names aren't legal, use as many legal characters from the name as possible (see the description of SET FILE-WARNING below). If there's a con- flict, and FILE-WARNING is ON, warn the user and try to build a unique name for the file by adding "&" characters to the name. GET filespec When Kermit-80 is talking to a Kermit Server on the host, you should use the GET command to request the server to send files to you, for ex- ample: get hlp:k*.hlp Limitation: If you request an alternate block check type using the SET BLOCK command, the GET command will not com- municate it to the remote server. If you want to have type 2 or 3 block checks done when getting files from the server, you have to issue the appropriate SET BLOCK command to the remote KERMIT before putting it in server mode. LOG filespec When CONNECTed to a foreign host as a terminal, log the terminal ses- sion to the specified diskette file. This functionality depends to some extent on the remote host's ability to do XON/XOFF flow control, and does not guarantee a complete transcript (after all, that's what the KERMIT protocol is for). The log file is closed when the connec- tion is closed by typing the escape character followed by the single- character command "C". TRANSMIT filespec Send the specified file to the system on the other end of the connec- tion as though it were being typed at the terminal, one line at a time. No KERMIT protocol is involved. You must manually confirm each line. This is useful for sending files to systems that don't have a KERMIT program. During transmission, you may type the escape character fol- lowed by one of these single-character commands: C Cease transmission R Re-transmit the previous line BYE When talking to a remote Kermit Server, this command shuts down the server and logs it out, and also exits from Kermit-80 to CP/M command level. LOGOUT Like BYE, but leaves you at Kermit-80 command level. FINISH Like LOGOUT, but shuts down the remote server without logging it out. Leaves you at Kermit-80 command level; subsequent CONNECT commands will put you back at host system command level. SET parameter [value] Set the specified parameter to the specified value. Possible settings: WARNING ON (or OFF) Warn user of filename conflicts when receiving files from remote host, and attempt to generate a unique name by adding "&" characters to the given name. ON by default. VT52-EMULATION ON (or OFF) When connected as a terminal to a foreign host, controls whether the micro emulates a VT52 or runs in "native mode". VT52 emulation is ON by default, except on micros that already have terminal functionality built in, such as the DEC VT180 and DECmate (these act as VT100-series terminals). Some systems emulate other terminals, like the ADM3A. LOCAL-ECHO ON (or OFF) When you CONNECT to a remote host, you must set LOCAL-ECHO ON if the host is half duplex, OFF if full duplex. OFF by default. ESCAPE Change the escape character for virtual terminal connections. Kermit-80 will prompt you for the new escape character, which you enter literally. BAUD Change the baud rate of the communications port. This command only works on some systems, and its actual operation can vary from system to system. Type SET BAUD followed by a question mark, and follow the directions. On systems that do not sup- port this command, you must set the port baud rate from CP/M or other setup mechanism outside of KERMIT-80. PARITY Sets parity for outgoing characters to one of the following: NONE, SPACE, MARK, EVEN, or ODD. On input, if parity is NONE, then the 8th bit is kept (as data), otherwise it is stripped and ignored. The parity setting applies to both terminal con- nection and file transfer. If you set parity to anything other than none, KERMIT-80 will attempt to use "8th bit prefixing" to transfer binary files. If the other KERMIT is also capable of 8th bit prefixing, then binary files can be transferred suc- cessfully; if not, the 8th bit of each data byte will be lost (you will see a warning on your screen if this happens). TIMER ON (or OFF) Enable or disable the "fuzzy timer". The timer is off by default, because in the normal case KERMIT-80 is communicating with a mainframe KERMIT that has its own timer. Mainframe KER- MIT timers tend to be more precise or adaptable to changing conditions. You should SET TIMER ON if you are communicating with a KERMIT that does not have a timer. You should SET TIMER OFF if you are communicating over a network with long delays. IBM ON (or OFF) Allow the transfer of files to and from an IBM mainframe com- puter. This makes Kermit-80 wait for the IBM turnaround character (XON), ignore parity on input, add appropriate parity to output, and use local echoing during CONNECT. As dis- tributed, KERMIT-80 uses MARK parity for IBM communication. If you don't give this command, IBM mode is OFF. Since IBM VM/CMS KERMIT does not have timeout capability, SET IBM ON also turns on the "fuzzy timer" automatically. BLOCK-CHECK-TYPE The options are: 1-CHARACTER-CHECKSUM Normal, default, standard 6-bit checksum. 2-CHARACTER-CHECKSUM A 12-bit checksum encoded as two characters. 3-CHARACTER-CRC-CCITT A 16-bit CCITT-format Cyclic Redundancy Check, encoded as 3 characters. The 2 and 3 character options should only be used under conditions of extreme line noise. Many implementations of KERMIT only sup- port the single character checksum. FILE-MODE Tells KERMIT-80 what kind of file it is sending, so that KERMIT can correctly determine the end of the file. SET FILE BINARY means to send all the 128-byte blocks of the file, including the last block in its entirety; SET FILE ASCII is used for text files, and transmission stops when the first Control-Z is en- countered anywhere in the file (this is the CP/M convention for marking the end of a text file). If binary transmission is used on a text file, some extraneous characters (up to 127 of them) may appear at the end of the file on the target system. If ASCII transmission is used on a binary file, the entire file will not be sent if it happens to contain any data bytes that correspond to Control-Z. DEFAULT-DISK This allows you to set the default disk as source and destina- tion of file transfers. In addition, issuing this command causes you to switch to the specified disk and log it in, write-enabled. The selected disk appears in your KERMIT-80 prompt, for instance Kermit-80 A:> PORT Allows you to switch between different communication ports. This command is not available on all systems. PRINTER ON or OFF. Turns copying of CONNECT session to printer on and off. No attempt is made to do buffering or flow control; it is assumed printer can keep up. DIR This provides a directory listing of the specified files. If no files are specified, all files on the default disk are listed. File sizes, in K, are included. You may interrupt the listing at any time by typing any character. The listing (even if interrupted) concludes with a display of the amount of free storage left on the disk. ERA This executes the CP/M ERA command on the specified file(s). The names of the files being erased are not displayed. 1.1. Generic KERMIT-80 "Generic Kermit-80" is a implementation of Kermit that should run on any 8080- compatible CP/M system no modification at all, or perhaps only a minor one. Unlike other Kermit-80 implementations, it contains no system-dependent manipulation of the serial port or screen. All I/O is done with standard CP/M BIOS calls, and I/O redirection is done using the CP/M IOBYTE function, which, according to the Digital Research CP/M Operating System Manual, is an optional feature of any particular CP/M implementation. If your system does not provide the IOBYTE function, Generic Kermit-80 will not work; furthermore, not all sys- tems that implement IOBYTE do so in the same way. The reason all Kermit-80 implementations aren't generic is that a good deal of speed is sacrificed by getting all services from the operating system. While a specific implementation of Kermit-80 may be able to operate at 4800, 9600, or even 19200 baud, Generic Kermit will fail to work on some systems at speeds in excess of 1200 baud. Generic Kermit also differs from other Kermit-80 implementations in that it does not do fancy screen control during file transfer; it simply types the file names, packet numbers, and messages in sequence across and down the screen. This works best if you can put your micro or terminal in "autowrap" mode; otherwise the packet numbers will pile up in the rightmost column; the filenames and messages will always appear on a new line, however. Neither does generic Kermit-80 do termimal emulation; thus a generic Kermit-80 acts either as a "dumb terminal" (sometimes called a "glass TTY"), or else its own built in terminal firmware provides cursor control functions independent of the Kermit program. Note that VT180 and DECmate-II Kermit are simply adaptations of Generic Kermit that do VT100 (ANSI) screen control during file transfer. 1.2. Installation Kermit-80 was written originally for the Intertec SuperBrain in lowest-common- denominator 8080 code with the standard assembler, ASM (no macros, no advanced instructions), so that it can be assembled on any CP/M-80 system(The 8080 as- sembler is distributed as a standard part of CP/M-80, whereas the fancier Z80 or macro assemblers are normally a commercial product). It has since been modified to run on many other systems as well. Kermit-80 should be able to run on any 8080-, 8085- or Z80-based microcomputer under CP/M with only minor modifications (see below). All versions of Kermit-80 are assembled from the same source, with system dependencies taken care of by assembly-time conditionals. The most important system dependencies are terminal emulation (when CONNECTed to the remote host) and screen handling, which are dependent on the individual micro's escape codes (these features are table driven and easily modified for other CP/M systems), and the lowest level i/o routines for the serial communications port. The port routines are best done only with BDOS calls, but some systems do not allow this, primarily because the BDOS routines strip the parity bit during port i/o, and the parity bit is used for data when transmitting binary files. Also, using BDOS calls, there's no way to poll the serial port; you must hang until input appears. Kermit-80's i/o routines must check the port status and go elsewhere if no in- put is available; this allows for virtual terminal connection, keyboard inter- ruption of stuck transmissions, etc. On systems that fully implement i/o redirection via the optional CP/M IOBYTE facility, this may be done by switch- ing the IOBYTE definition. On others, however, IN/OUT instructions explicitly referencing the port device registers must be used. CP/M-80 KERMIT version 3.8 and above includes a "fuzzy timer" that allows a timeout to occur after an interval ranging from 5 to 20 seconds (depending upon the speed of the processor and the operating system routines) during which ex- pected input does not appear at the port. In this case, retransmission occurs automatically. In any case, you may type a carriage return during transmission to simulate a timeout when the transfer appears to be stuck. 1.2.1. Downloading Kermit-80 If you already have a version of Kermit on your micro and you want to install a new version, simply use your present version to get the new one. If it's stored in the form of a .COM file, you can run it directly. If it's stored as a .HEX file, you must first LOAD it on your micro to produce a .COM file. If you do not have a copy of KERMIT on your micro, and you cannot borrow a Ker- mit floppy but you do have access to a mainframe computer with a copy of the Kermit-80 distribution, you should read this section. There are several ways to get Kermit from a host system to your micro. The easiest is to "download" the precompiled "hex" file into your micro's memory and then save it on the disk. The following is a procedure which, though far from foolproof, should allow you to get a version of Kermit to your CP/M based micro. It depends upon the host prompt, or at least the first character of the host prompt, being some character that cannot appear in a hex file (the valid characters for hex files are the digits 0-9, the upper case letters A-F, the colon ``:'', carriage return, and line feed). As soon as any other character is encountered, the transfer will terminate. If your host does not issue a prompt that will accommodate this scheme, you can achieve the same effect by modifing the adding an atsign ``@'' to the very end of the hex file before sending it from the host. The program below looks for an atsign (the normal DEC-20 prompt, hex 40). DECSYSTEM-10 users would look for a dot, hex 2E. 1. Look for the appropriate hex file in the host's KERMIT area. The name will be something like CPMROBIN.HEX, CPMHEATH.HEX, CPMOSBORN.HEX, etc. If you don't find it, but you do find a cor- responding .ASM or .M80 file, you'll either have to build a new hex file on the host using a cross assembler (see below for how to do this on a DEC-10 or DEC-20), or else bring the M80 source file to your micro and assemble it there. 2. Connect to your host using a terminal or a terminal emulation facility. Ensure that your host does not have your terminal in "page mode". E.g. on the DEC-20, give the Exec command TERMINAL NO PAUSE END-OF-PAGE. 3. Tell the host to display the hex file at your terminal. E.g. on the DEC-20, give the Exec command TYPE KERMIT.HEX, without a terminating carriage return. 4. Return to your micro. Connect to a floppy disk with plenty of free space. Make sure your IOBYTE is set so that RDR: and PUN: cor- respond to the I/O port that is connected to the DEC-20 (this would normally be the case unless you have done something special to change things). Run DDT and type in the following (the comments should not be typed in; they are there just to tell you what's happening): -ikermit.hex ;Setup FCB for file KERMIT.HEX. -a100 ;Begin assembling code at 100. 0100 lxi h,ffe ;Where to put HEX file. 0103 shld 300 ;Save the address. 0106 mvi e,d ;Get a CR. 0108 mvi c,4 ;Output function. 010A call 5 010D mvi c,3 ;Input function. 010F call 5 0112 ani 7f ;Turn off the parity. 0114 cpi 40 ;Our DEC-20 prompt atsign? 0116 jz 124 ;Yes, we have whole file. 0119 lhld 300 ;Get the pointer. 011C mov m,a ;Else, store the char. 011D inx h ;Increment the pointer. 011E shld 300 ;Save the pointer. 011F jmp 10d ;Go around again. 0124 mvi a,1a ;Get a control-Z. 0126 lhld 300 ;Get the pointer. 0129 mov m,a ;Store the char. 012A shld 300 ;Save the pointer. 012D lxi h,1000 ;Pointer to file. 0130 shld 310 ;Save the pointer. 0133 mvi c,16 ;Make file. 0135 lxi d,5c 0138 call 5 013B lhld 310 ;Get the file pointer. 013E xchg ;Put it in DE. 013F mvi c,1a ;Set DMA. 0141 call 5 0144 mvi c,15 ;Write DMA to file. 0146 lxi d,5c 0149 call 5 014C lhld 310 ;Get the file pointer. 014F lxi d,80 ;Get the DMA size. 0152 dad d ;Adjust file pointer. 0153 shld 310 ;Save it. 0156 lda 301 ;Get high order byte. 0159 cmp h ;Have we passed the end? 015A jm 170 ;Yes. 015D jz 163 ;Maybe. 0160 jmp 13b ;No. 0163 lda 300 ;Get low order byte. 0166 cmp l ;Passed the end? 0167 jm 170 ;Yes. 016A jz 170 ;Yes. 016D jmp 13b ;Not quite. 0170 mvi c,10 ;Close file. 0172 lxi d,5c 0175 call 5 0178 ret 0179 -g100,179 ;Execute the program. - ;Reboot Now there should be a file KERMIT.HEX on your connected disk. 5. Load this using the CP/M command LOAD to produce KERMIT.COM. This should be a runnable version of Kermit. Note that CP/M hex files have checksums on each line. If there were any transmission errors during the downloading process, the CP/M loader will notice a bad checksum and will report an error (something like "Illegal Format"). If you get any errors during loading, either fix the hex file locally with an editor, or repeat the previous step. You now should have a running version of Kermit-80. 1.2.2. Building KERMIT.HEX The source for Kermit-80 should be available on your host computer. It is written using 8080 assembler mnemonics, so it can be assembled on most 8080s and Z80s using the standard 8080 assembler provided with CP/M. If you have KERMIT.ASM on your CP/M system, you can assemble it directly on the micro using ASM, setting the desired assembly switches as explained below. If you don't have it, you can attempt to download the source file from the host using the procedure outlined above. A cross assembler is provided that runs on the DEC-10 and DEC-20, called MAC80, contributed by Bruce Tanner at Cerritos College, that may be used for cross as- sembling KERMIT-80 as shown in this example (for TOPS-20): 1. Copy PS:CPMKxx.M80 to your directory, as KERMIT.M80. TOPS-10 filename rules must be followed. This is the 8080 assembler source file; xx is the current version number; for instance version 3.8 would be stored as CPMK38.M80. 2. Edit KERMIT.M80 to set the conditional assembly switch for your machine. These are right near the top of the file. The switch for your machine should be set to TRUE and all the others to FALSE. 3. The "ibm-flag" setting is site dependent. As shipped from Columbia, it turns on half duplex line handshaking, using CTRL-Q as the tur- naround character, sets LOCAL-ECHO ON, TIMER ON, and PARITY MARK. Make any changes required for your site. 4. The default FILE-MODE is ASCII as shipped from Columbia. This means that when text files are sent from the CP/M system, no extraneous characters will be sent after the end, but that outgoing binary files may be truncated erroneously if the user forgets to SET FILE BINARY. You can change the default to BINARY, so that no data is ever lost from any file, but text files will usually have extraneous junk at the end. 5. Run MAC80: @mac80 *kermit=kermit *^Z The result will be in your directory as KERMIT.HEX. 6. Use Kermit, MODEM, or any other downloading mechanism to transfer KERMIT.HEX to the micro, or download it using the DDT program shown above. 7. On the micro, load the hex file: A>load kermit KERMIT.COM will appear on the floppy. 8. The new Kermit should be ready to run. 1.2.3. Generic Kermit-80 If your CP/M 2.2 system implements i/o redirection via the (optional) IOBYTE mechanism, you can probably run Generic Kermit on it, either without modifica- tion, or by a very simple change to the program. The standard CP/M IOBYTE is set up as follows: I/O Byte assignments (four 2-bit fields for 4 devices at location 3) : bits 6+7 LIST field 0 LIST is Teletype device (TTY:) 1 LIST is CRT device (CRT:) 2 LIST is Lineprinter (LPT:) 3 LIST is user defined (UL1:) bits 4+5 PUNCH field 0 PUNCH is Teletype device (TTY:) 1 PUNCH is high speed punch (PUN:) 2 PUNCH is user defined #1 (UP1:) 3 PUNCH is user defined #2 (UP2:) bits 2+3 READER field 0 READER is Teletype device (TTY:) 1 READER is high speed reader (RDR:) 2 READER is user defined #1 (UR1:) 3 READER is user defined #2 (UR2:) bits 0+1 CONSOLE field 0 CONSOLE is console printer (TTY:) 1 CONSOLE is CRT device (CRT:) 2 CONSOLE is in Batch-mode (BAT:); READER = Input, LIST = Output 3 CONSOLE is user defined (UC1:) (Here, bit zero is the least significant, "rightmost", bit). I/O redirection is accomplished by switching the IOBYTE between two values, "batch i/o" and "normal i/o". In normal i/o mode, the keyboard is defined to be the console. In batch i/o mode, the serial port is defined to be the con- sole. This switching is necessary because the console is the only device that can be tested to see if input is available, but KERMIT must shuttle back and forth between the keyboard and the serial port looking for input. Here are the batch and default i/o mode definitions used in "standard" Generic KERMIT-80: batio EQU 056H ;I/O byte CON=BAT,LIST=CRT,READER=RDR defio EQU 095H ;I/O byte CON=CRT,LIST=LPT,READER=RDR Other systems may have other logical devices that point to the serial port, in which case you'll need to redefine these symbols to point to those devices and then reassemble the program (with assembly switch GENER set to TRUE, all others FALSE). If your system runs CP/M 3.0, then the CPMPLUS version of KERMIT should run on your system without modification, except perhaps for screen control or baud rate setting. Index 8080 2 Baud 2 BIOS 2 Block Check 2 Bootstrap 3 BYE 2 Connect 1 CP/M 2 Cross Assembler 3 DECsystem-10 3 DECSYSTEM-20 3 Downloading 3 Eighth-Bit Prefix 2 Escape Character 1, 2 File-Warning 1 FINISH 2 Generic Kermit-80 2, 4 GET 1 Hex File 3 IBM 2 IOBYTE 4 Local 1 Local-Echo 2 LOG 2 LOGOUT 2 MAC80 3 NAK 1 Parity 2 RECEIVE 1 SEND 1 SET 2 Superbrain 2 Timeout 1, 3 TIMER 2 TRANSMIT 2 Virtual Terminal 1 VT100 2 VT52 2 Warning 2 XON/XOFF 2 Z80 2 Table of Contents 1. CP/M-80 KERMIT 1 1.1. Generic KERMIT-80 2 1.2. Installation 2 1.2.1. Downloading Kermit-80 3 1.2.2. Building KERMIT.HEX 3 1.2.3. Generic Kermit-80 4 Index 5 % % % % % % % ty cpmgener.doc "Generic Kermit-80" is a implementation of Kermit that should run on many 8080-compatible CP/M-80 2.2 system with little or no modification. (There's also a generic Kermit-80 for CP/M-80 3.0). Unlike other Kermit-80 implementations, it contains no system-dependent manipulation of the serial port or screen. All I/O is done with standard CP/M BIOS calls, switching devices by manipulating the IOBYTE. Whether Generic Kermit runs, or can be made to run, on a particular micro depends upon two things: (1) Did the manufacturer fully implement the "optional" CP/M IOBYTE? (2) Is the IOBYTE implemented "correctly?", that is, are the four fields defined correctly and in the right order, and do the CON:, LST:, PUN:, and BAT: devices indicate the devices that KERMIT expects? KERMIT wants the serial port to correspond to the RDR: and PUN: devices, and wants to be able to switch the console between the CRT: and BAT: devices, where BAT: should be defined to use RDR: for input and LST: for output. Generic Kermit is known to run without modification on the DEC VT180 (up to 9600 baud) and other DEC micros. It was tested on the Intertec Superbrain and failed to work because the IOBYTE did not point to the CRT screen in the expected way. Similarly for the DECmate-II CP/M option, but in this case the correct IOBYTE definitions were discovered, and a "specific" version of generic Kermit-80 was built for the DECmate II; if you look for DMII in the CPMGENERI.ASM source file, you'll see that only a couple definition statements were necessary to do the trick. The other way in which generic Kermit-80 is generic is that it does not assume anything about terminal; it does not attempt to emulate a VT52 or any other type of terminal, and it does not use fancy screen control when updating the screen during file transfer. It assumes the micro has the ability to auto- matically wrap long lines around on the screen. The present VT180 and DECmate Kermits are actually generic Kermit slightly modified to do VT100 display screen updating during file transfer. To get Generic Kermit on to your system (if you can't get it on a floppy disk), use whatever procedure is available to you on your micro to download the file KER:CPMGENERIC.HEX. The DDT program listed in the Kermit Users Manual will do the trick on most systems, or use MODEM7 or some other file transfer package if you have it. To modify Generic Kermit to run on a new system on which it does not run as distributed, see the instructions in the section "Generic Kermit-80" in the back of the Kermit User Guide. How did it get done (in the words of Bernie Eiben, "inventor"): The "standard" CP/M system allows limited assignment of "logical" devices to physical devices. This is handled by the I/O byte. The I/O byte allows one to "assign" 4 "physical" devices to 4 "logical" devices. This allows one to use the CP/M call CONSTAT ( is there a Input at the "logical" CONSOLE-device ? ) to be used for any of the "other" four assignable devices for CONSOL. One of these devices is BAT:, the BATCH device ( Input comes from "logical" device READER, Output goes to "logical" device LIST ). We use in GENERIC Kermit during CONNECT-state (terminal-emulation) and SEND/RECEIVE state the CONSOLE=BAT: assignment, to be able to "poll" for pending character-input from the physical device READER=RDR: , which is for the DEC-VT180 (aka ROBIN) and the DEC-RAINBOW the COMM-Port. To circumvent BDOS-implementation differences, we call the BIOS directly. This is accomplished in routine INIADR, which grabs location 1 and 2 ( at 0 is a JMP WARMSTART ), adds increments of 3 ( we got the second entry of the BIOS-JMP vector -- the next three entries are JMP CONSTAT, JMP CONIN and JMP CONOUT ) and plugs them into our BIOS-CALL routines. % % % % % % % % type cpmkermi.bwr CP/M-80 KERMIT STATUS CP/M-80 KERMIT (Kermit-80) was originally written for a single system (by Bill Catchings, formerly of Columbia), and then support for additional systems was added (at Columbia and elsewhere) using conditional assembly to select a particular machine's device addresses, screen control codes, or other system dependent features. Meanwhile, a way of supporting different CP/M systems without device dependent code was discovered (by Bernie Eiben at DEC), involving tricky manipulation of the IOBYTE. When Kermit-80 is built in this way, it is called "Generic Kermit-80". It can generally be made to run on any system that implements the "optional" CP/M IOBYTE facility, either as-is, or by changing the IOBYTE definitions. The source still contains conditional assembly support for many systems from the pre-generic version, but not all of this support has been tested when built from the current source. If you want to build Kermit-80 for a particular micro, try the following in this order: 1. Download CPMGENERI.HEX, which is "Generic Kermit-80", load it, and see if it works. If it does, you're done. 2. Look in the source, at the definitions of the symbols BATIO and DEFIO. These are the two IOBYTE values that Kermit-80 switches between for the console and the serial port. See if these need to be redefined for your system. If so, change the definitions, make sure assembly switch GENER is TRUE and all others are FALSE, reassemble, download the resulting hex file and try it out. If it works, you're done. The current source is CPMBASE.M80. Accept no substitutes! 3. If generic Kermit-80 doesn't work, look for an assembly switch for your micro, set it to TRUE and all others to FALSE, assemble, download, try it out. If it works, fine, you're done. If it doesn't work, you'll have to debug it. 4. If generic Kermit-80 doesn't work, and there's no assembly switch for your micro, add a new assembly switch and conditional code to support your system, debug it, and send it back to us. CPMKERMIT.DOC contains detailed information about KERMIT-80. This information also appears as a chapter in the Kermit User Guide. Here is a list of known problems with KERMIT-80: 1. No command files or initialization files. 2. The incredibly ugly IF...ENDIF structure of the program makes it almost impossible to read and maintain, and to add support for new systems without endangering the support for old ones. The program needs to be completely rewritten, broken up into separate modules for protocol, disk i/o, screen i/o, console i/o, port/modem i/o, command parsing, terminal emulation, data and definitions. Of these, only the protocol module would be system independent. 3. Lower case letters in an incoming file header should be raised to upper case and nulls or other control characters in the filename should be discarded. 4. A NAK for the next packet is NOT an ack for the current one if the current one was a Send-Init. 5. Check for packet number wrap-around when checking for things like "is this a NAK for the previous packet?" when comparing packet numbers. 6. May want to verify other side's Send-Init parameters more rigorously and force them to legal values if illegal. 7. Junk in command buffer after a file transfer (or is it just an unsuccessful file transfer?) sometimes prevents the first command after the transfer from being parsed. 8. The old file stepping mechanism -- which allowed only 16 files to be sent in a wildcard send command -- has been replaced by a new mechanism that lets any number be sent. However, the new mechanism is very costly, requiring on the order of n**2 directory lookups to send n files. The new method should incorporate the old -- build a table of, say, 16 (32? 64?) files to send, and when that gets used up, build another table. 9. KERMIT-80 (and all the other micro versions) badly need to be able to send a BREAK signal. You need it to talk to IBM systems, and to get the attention of various kinds of port switchers, multiplexers, etc. Code has been added to allow the VT180 and DECmate II to do this, but none of the other implementations have it. This is, of course, highly system dependent. 10. Fix logging function. Most implementations don't have it; those that do lose characters. Log to a big area in memory; when buffer gets nearly full, send ^S, dump it to disk, send ^Q. Look at MODEM, see what it does. 11. Retry count still isn't updated in every case. 12. Here's a bug that has not yet been fixed in CPMBASE.M80 or the .HEX files: Date: 29 May 1984 0242-PDT From: Charles Carvalho Subject: Fix for Kermit-80 V3.9 To: CC.FDC at COLUMBIA-20 Kermit-80 v3.9 will always prefix all &'s in the data with #'s. This should only be done if 8th-bit prefixing has been requested. This problem will only be seen when the other Kermit does not request (or permit) 8th-bit quoting, since Kermit-80 always agrees to use 8th-bit quoting. To fix it, replace the following three lines between gtch4a: and gtch4b:. lxi h,qbchr ;[jd] point to 8-bit quote char cmp m ;[jd] is it our quote character? jz gtch4b ;[jd] yes, have to quote it... with: lda quot8 ; Are we doing 8th-bit quoting? ora a jz gtch4c ; if not, skip this test and restore character. lda qbchr ; get 8th-bit quote character cmp d ; same as current character? jz gtch4b ; yes, have to quote it... gtch4c: mov a,d ; no. get character back again. The next release will have this fix, and many other enhancements. [This fix is installed in an interim release called 3.9A -- If your version of KERMIT-80 announces itself as 3.9A, then it has this fix.] % % % % % % % type cpmkermi.mss @Part(CPMKERMIT,root="USER") @Chapter @Begin @i(Program:)@\Bill Catchings, Columbia University, with contributions from Bernie Eiben (DEC), Nick Bush (Stevens), John Bray (University of Tennessee), Bruce Tanner (Cerritos College), Greg Small (University of California at Berkeley), Kimmo Laaksonen (Helskini University of Technology), and many others. @i(Language:)@\8080 Assembler or MAC80 @i(Version:)@\3.9 @i(Date:)@\April 1984 @i(Documentation:)@\Frank da Cruz, Columbia University @end @label<-k80> @i @begin @tabclear()@tabset(3.5inches,4.0inches) Local operation:@\Yes Remote operation:@\No Transfers text files:@\Yes Transfers binary files:@\Yes Wildcard send:@\Yes @q<^X/^Y> interruption:@\Yes Filename collision avoidance:@\Yes Can time out:@\Yes 8th-bit prefixing:@\Yes Repeat count prefixing:@\No Alternate block checks:@\Yes Terminal emulation:@\Yes, VT52 and others Communication settings:@\Yes; duplex, parity Transmit BREAK:@\Yes; some versions IBM communication:@\Yes Transaction logging:@\No Session logging (raw download):@\Yes Raw upload:@\Yes Act as server:@\No Talk to server:@\Yes; SEND, GET, FIN, BYE Advanced commands for servers:@\No Local file management:@\Yes; DIR, ERA, SET DEFAULT disk Handle file attributes:@\No Command/init files:@\No Printer control:@\Yes, limited @end @heading CP/M-80 (version 2@q<.>2) has only five built-in commands, and they all deal with files; other functions are done by invoking programs. CP/M file specifications are of the form @q(DEV:XXXXXXXX.YYY), where @begin @q(DEV:)@\is a @i, normally the A:@ or B:@ floppy. If omitted, the device name defaults to your connected diskette. @q(XXXXXXXX)@\is a @i of up to 8 characters. @q(YYY)@\is the @i, up to 3 characters. @end File names and file types may contain letters, digits, and some special characters, including dash, dollar sign, and underscore, but no imbedded spaces. Upper and lower case letters are equivalent. "Wildcard" file-@|group specifications are permitted in file names and file types (but not device names) within certain contexts; a "@q(*)" matches a whole field, a "@q(?)" matches a single character, including space. Examples: "@q(*.F??)" specifies all files whose @i start with F and are 1, 2, or 3 characters long; "@q(F?.*)" specifies all files whose names start with F and are no more than two characters long (before the trailing spaces). The five CP/M commands are: @Begin DIR @i@\Lists the the names of the specified files. The default file specification is "*.*". Example: @w<"@q(DIR B:*.FOR)">. ERA @i@\Erases (deletes) the specified file(s); wildcards allowed. REN @i @i@\Changes the name of a file from @i to @i, e.g.@* @w<"@q(REN NEW.FOR=OLD.FOR)">. SAVE@\Saves the specified number of memory blocks into a file. TYPE @i@\Types the specified file on the screen, e.g. @w<"@q(TYPE FOO.TXT)">. @End The most important programs are: @Begin STAT@\Gives statistics on disk usage. PIP@\@u

eripheral @unterchange @u

rogram. Copies files. In response to the "@q(*)" prompt, give a command of the form @example Wildcards ("@q(*)" for a whole field or "@q(?)" for a letter) can be used. Examples: "@q(A:=B:*.*)" to copy a whole disk, "@q(A:=B:*.FOR)" to copy all the Fortran programs from disk B to disk A. If the disk specification is omitted, your "connected" disk is assumed. Command line arguments are also accepted, e.g. "@q(PIP A:=B:*.*)". @End For further information on CP/M, consult your microcomputer manual or a CP/M handbook. @heading Implementations of Kermit-80 presently exist for the DEC VT180@ (Robin), the DECmate II, the Intertec Superbrain, the Heath/Zenith 89 and Z100, the @w with the Z80 SoftCard, the @w, the TRS-80 II with CP/M, the Telcon Zorba, the Kaypro, the Vector Graphics CP/M system, the Morrow @w, the Nokia MikroMikko, and others. There is also a "generic" CP/M version that should run on most 8080-@|compatible CP/M 2.2 systems, but which may provide less performance, and another for CP/M 3.0. @index Since Kermit-80 runs on a standalone micro, it is always in control of the screen -- it is always @i@index. Thus, it always keeps the screen updated with the file name and the packet number, whether sending or receiving. Kermit-80 is capable of an imprecise or "fuzzy" timeout on an input request, and can break deadlocks automatically. In most cases, this is not important, because the KERMIT on the other side is most likely able to handle the timeouts. The timeouts done by Kermit-80 are fuzzy because they depend on the speed of the Z80 processor and other factors that can vary from system to system. If despite the timeout capability, the transmission appears to be stuck (and you can tell that this has happened if the screen fails to change for a while) you can type carriage return to have the micro do what it would have done on a @Index[Timeout] timeout, namely NAK@Index[NAK] the expected packet to cause to foreign host to send it again (or, if the micro is sending, to retransmit the last packet). Micro/@|micro or micro/@|IBM-@|mainframe transfers could require this kind of manual intervention. File transfers may be interrupted in several ways. @begin Control-C@\This will return you to Kermit-80 command level immediately, so that you can connect back to the remote system, or take any other desired action. Control-X@\When sending a file, this will terminate the sending of the current file with a signal to the KERMIT on the other side to discard what it got so far. If there are more files to be sent, KERMIT-80 will go on to the next one. When receiving a file, KERMIT-80 will send a signal to the remote KERMIT to stop sending this file. If the remote KERMIT understands this signal (not all implementations of KERMIT do), it will comply, otherwise the file will keep coming. In any case, the remote KERMIT will go on to the next file in the group, if any. Control-Z@\Like Control-X, except if a file group is being transmitted, this will stop the transmission of the entire group. If only a single file is being transmitted, it works exactly like Control-X. Carriage Returns@\If you type carriage return repeatedly Kermit-80 will retry the current packet up to its retry limit (somewhere between 5 and 16 times) and then, if no valid response was received, return to Kermit-80 command level. @end @heading KERMIT-80 uses the DECSYSTEM-20 keyword style command language. Each keyword may be abbreviated to its minumum unique length. "?" may be typed to request a menu of the available options for the current field at any point in a command. ESC may be typed at any point in a command to fill out the current keyword or filename; if sufficient characters have not been typed to identify the current field uniquely, KERMIT-80 will sound a beep and allow you to continue from that point. @begin @Index[Virtual Terminal]@Index[Escape Character]@Index[Connect] CONNECT@\Establish a "virtual terminal" connection to any host that may be connected to the serial port, i.e.@ pass all typein to the serial port and display all input from the serial port on the screen. Also, emulate a DEC VT52 to allow cursor control, screen clearing, etc., if VT52-EMULATION is ON (see below), in which case you should also set your terminal type on the remote host to VT52. (Some versions emulate other terminals.) The escape character differs from micro to micro; when you issue the CONNECT command, the micro will print a message telling you how to get back. The escape sequence is generally an uncommonly-@|used control character, like CTRL-backslash or CTRL-rightbracket, followed by a single letter "command". @begin C@\Close Connection, return to @q(Kermit-80>) command level. S@\Display Status of connection, but maintain remote connection. @q@\List available single-character commands. 0@\(zero) Send a null (0) character. B@\Send a BREAK signal. Only some systems provide this function. @q<^]>@\(or whatever - a second copy of the escape character) Send the escape character itself to the remote host. @end @Index[SEND]SEND @i@\Send file(s) specified by @i to the remote Kermit. The @i may contain CP/M wildcards. @Index[RECEIVE]@Index[File-Warning] RECEIVE@\Receive file(s) from the remote Kermit. Store them under the names provided in the file headers supplied by the remote host. If the names aren't legal, use as many legal characters from the name as possible (see the description of SET FILE-WARNING below). If there's a conflict, and FILE-WARNING is ON, warn the user and try to build a unique name for the file by adding "@q<&>" characters to the name. @IndexGET @i@\When Kermit-80 is talking to a Kermit Server on the host, you should use the GET command to request the server to send files to you, for example: @q[@w] Limitation: If you request an alternate block check type using the SET BLOCK command, the GET command will not communicate it to the remote server. If you want to have type 2 or 3 block checks done when getting files from the server, you have to issue the appropriate SET BLOCK command to the remote KERMIT before putting it in server mode. @Index[LOG]LOG @i@\When CONNECTed to a foreign host as a terminal, log the terminal session to the specified diskette file. This functionality depends to some extent on the remote host's ability to do @Index[XON/XOFF]XON/XOFF flow control, and does not guarantee a complete transcript (after all, that's what the KERMIT protocol is for). The log file is closed when the connection is closed by typing the escape character followed by the single-@|character command "C". @Index[TRANSMIT]TRANSMIT @i@\Send the specified file to the system on the other end of the connection as though it were being typed at the terminal, one line at a time. No KERMIT protocol is involved. You must manually confirm each line. This is useful for sending files to systems that don't have a KERMIT program. During transmission, you may type the escape character followed by one of these single-@|character commands: @begin C@\Cease transmission R@\Re-transmit the previous line @end BYE@\When talking to a remote Kermit Server, this command shuts down the server and logs it out, and also exits from Kermit-80 to CP/M command level.@Index[BYE] @Index[LOGOUT]LOGOUT@\Like BYE, but leaves you at Kermit-80 command level. @Index[FINISH]FINISH@\Like LOGOUT, but shuts down the remote server without logging it out. Leaves you at Kermit-80 command level; subsequent CONNECT commands will put you back at host system command level. @Index[SET]SET @i [@i]@\Set the specified parameter to the specified value. Possible settings: @begin @Index[Warning]WARNING ON (or OFF)@\Warn user of filename conflicts when receiving files from remote host, and attempt to generate a unique name by adding "@q<&>" characters to the given name. ON by default. @Index[VT52]VT52-EMULATION ON (or OFF)@\When connected as a terminal to a foreign host, controls whether the micro emulates a VT52 or runs in "native mode". VT52 emulation is ON by default, except on micros that already have terminal functionality built in, such as the DEC VT180 and DECmate (these act as @indexVT100-@|series terminals). Some systems emulate other terminals, like the ADM3A. @Index[Local-Echo]LOCAL-ECHO ON (or OFF)@\When you CONNECT to a remote host, you must set LOCAL-@|ECHO ON if the host is half duplex, OFF if full duplex. OFF by default. @Index[Escape Character]ESCAPE@\Change the escape character for virtual terminal connections. Kermit-80 will prompt you for the new escape character, which you enter literally. @Index[Baud]BAUD@\Change the baud rate of the communications port. This command only works on some systems, and its actual operation can vary from system to system. Type SET BAUD followed by a question mark, and follow the directions. On systems that do not support this command, you must set the port baud rate from CP/M or other setup mechanism outside of KERMIT-80. @Index[Parity]PARITY@\Sets parity for outgoing characters to one of the following: NONE, SPACE, MARK, EVEN, or ODD. On input, if parity is NONE, then the 8th bit is kept (as data), otherwise it is stripped and ignored. The parity setting applies to both terminal connection and file transfer. If you set parity to anything other than none, KERMIT-80 will attempt to use @Index "8th bit prefixing" to transfer binary files. If the other KERMIT is also capable of 8th bit prefixing, then binary files can be transferred successfully; if not, the 8th bit of each data byte will be lost (you will see a warning on your screen if this happens). @Index[TIMER]TIMER ON (or OFF)@\Enable or disable the "fuzzy timer". The timer is off by default, because in the normal case KERMIT-80 is communicating with a mainframe KERMIT that has its own timer. Mainframe KERMIT timers tend to be more precise or adaptable to changing conditions. You should SET TIMER ON if you are communicating with a KERMIT that does not have a timer. You should SET TIMER OFF if you are communicating over a network with long delays. @Index[IBM]IBM ON (or OFF)@\Allow the transfer of files to and from an IBM mainframe computer. This makes Kermit-80 wait for the IBM turnaround character (XON), ignore parity on input, add appropriate parity to output, and use local echoing during CONNECT. As distributed, KERMIT-80 uses MARK parity for IBM communication. If you don't give this command, IBM mode is OFF. Since IBM VM/CMS KERMIT does not have timeout capability, SET IBM ON also turns on the "fuzzy timer" automatically. @Index[Block Check]BLOCK-CHECK-TYPE@\The options are: @begin 1-CHARACTER-CHECKSUM@\Normal, default, standard 6-bit checksum. 2-CHARACTER-CHECKSUM@\A 12-bit checksum encoded as two characters. 3-CHARACTER-CRC-CCITT@\A 16-bit CCITT-format Cyclic Redundancy Check, encoded as 3 characters. @end The 2 and 3 character options should only be used under conditions of extreme line noise. Many implementations of KERMIT only support the single character checksum. FILE-MODE@\Tells KERMIT-80 what kind of file it is sending, so that KERMIT can correctly determine the end of the file. SET FILE BINARY means to send all the 128-@|byte blocks of the file, including the last block in its entirety; SET FILE ASCII is used for text files, and transmission stops when the first Control-Z is encountered anywhere in the file (this is the CP/M convention for marking the end of a text file). If binary transmission is used on a text file, some extraneous characters (up to 127 of them) may appear at the end of the file on the target system. If ASCII transmission is used on a binary file, the entire file will not be sent if it happens to contain any data bytes that correspond to Control-Z. DEFAULT-DISK@\This allows you to set the default disk as source and destination of file transfers. In addition, issuing this command causes you to switch to the specified disk and log it in, write-@|enabled. The selected disk appears in your KERMIT-80 prompt, for instance @example[Kermit-80 A:>] PORT@\Allows you to switch between different communication ports. This command is not available on all systems. PRINTER@\ON or OFF. Turns copying of CONNECT session to printer on and off. No attempt is made to do buffering or flow control; it is assumed printer can keep up. @end DIR@\This provides a directory listing of the specified files. If no files are specified, all files on the default disk are listed. File sizes, in K, are included. You may interrupt the listing at any time by typing any character. The listing (even if interrupted) concludes with a display of the amount of free storage left on the disk. ERA@\This executes the CP/M ERA command on the specified file(s). The names of the files being erased are not displayed. @end @section @index@index<8080> "Generic Kermit-80" is a implementation of Kermit that should run on any 8080-@|compatible CP/M system no modification at all, or perhaps only a minor one. Unlike other Kermit-80 implementations, it contains no system-@|dependent manipulation of the serial port or screen. All I/O is done with standard CP/M BIOS@index calls, and I/O redirection is done using the CP/M IOBYTE function, which, according to the Digital Research @i, is an optional feature of any particular CP/M implementation. If your system does not provide the IOBYTE function, Generic Kermit-80 will not work; furthermore, not all systems that implement IOBYTE do so in the same way. The reason all Kermit-80 implementations aren't generic is that a good deal of speed is sacrificed by getting all services from the operating system. While a specific implementation of Kermit-80 may be able to operate at 4800, 9600, or even 19200 baud, Generic Kermit will fail to work on some systems at speeds in excess of 1200 baud. Generic Kermit also differs from other Kermit-80 implementations in that it does not do fancy screen control during file transfer; it simply types the file names, packet numbers, and messages in sequence across and down the screen. This works best if you can put your micro or terminal in "autowrap" mode; otherwise the packet numbers will pile up in the rightmost column; the filenames and messages will always appear on a new line, however. Neither does generic Kermit-80 do termimal emulation; thus a generic Kermit-80 acts either as a "dumb terminal" (sometimes called a "glass TTY"), or else its own built in terminal firmware provides cursor control functions independent of the Kermit program. Note that VT180 and DECmate-II Kermit are simply adaptations of Generic Kermit that do VT100 (ANSI) screen control during file transfer. @section Kermit-80 was written originally for the @Index[Superbrain] Intertec SuperBrain in lowest-@|common-@|denominator @Index[8080] 8080 code with the standard assembler, ASM (no macros, no advanced instructions), so that it can be assembled on any CP/M-80 system@foot{The 8080 assembler is distributed as a standard part of CP/M-80, whereas the fancier Z80@Index[Z80] or macro assemblers are normally a commercial product}. It has since been modified to run on many other systems as well. Kermit-80 should be able to run on any 8080-, 8085- or Z80-@|based microcomputer under @Index[CP/M] CP/M with only minor modifications (see below). All versions of Kermit-80 are assembled from the same source, with system dependencies taken care of by assembly-@|time conditionals. The most important system dependencies are terminal emulation (when CONNECTed to the remote host) and screen handling, which are dependent on the individual micro's escape codes (these features are table driven and easily modified for other CP/M systems), and the lowest level i/o routines for the serial communications port. The port routines are best done only with BDOS calls, but some systems do not allow this, primarily because the BDOS routines strip the parity bit during port i/o, and the parity bit is used for data when transmitting binary files. Also, using BDOS calls, there's no way to poll the serial port; you must hang until input appears. Kermit-80's i/o routines must check the port status and go elsewhere if no input is available; this allows for virtual terminal connection, keyboard interruption of stuck transmissions, etc. On systems that fully implement i/o redirection via the optional CP/M IOBYTE facility, this may be done by switching the IOBYTE definition. On others, however, IN/OUT instructions explicitly referencing the port device registers must be used. @index CP/M-80 KERMIT version 3.8 and above includes a "fuzzy timer" that allows a timeout to occur after an interval ranging from 5 to 20 seconds (depending upon the speed of the processor and the operating system routines) during which expected input does not appear at the port. In this case, retransmission occurs automatically. In any case, you may type a carriage return during transmission to simulate a timeout when the transfer appears to be stuck. @subsection If you already have a version of Kermit on your micro and you want to install a new version, simply use your present version to get the new one. If it's stored in the form of a @q<.COM> file, you can run it directly. If it's stored as a @q<.HEX> file, you must first LOAD it on your micro to produce a @q<.COM> file. If you do not have a copy of KERMIT on your micro, and you cannot borrow a Kermit floppy but you do have access to a mainframe computer with a copy of the Kermit-80 distribution, you should read this section. @Index[Bootstrap]@index There are several ways to get Kermit from a host system to your micro. The easiest is to "download" the precompiled "hex" file into your micro's memory and then save it on the disk. The following is a procedure which, though far from foolproof, should allow you to get a version of Kermit to your CP/M based micro. It depends upon the host prompt, or at least the first character of the host prompt, being some character that cannot appear in a hex file (the valid characters for hex files are the digits 0-9, the upper case letters A-F, the colon ``@q<:>'', carriage return, and line feed). As soon as any other character is encountered, the transfer will terminate. If your host does not issue a prompt that will accommodate this scheme, you can achieve the same effect by modifing the adding an atsign ``@@'' to the very end of the hex file before sending it from the host. The program below looks for an atsign (the normal DEC-20 prompt, hex 40). DECSYSTEM-10 users would look for a dot, hex 2E. @Begin Look for the appropriate hex file in the host's KERMIT area. The name will be something like @q, @q, @q, etc. If you don't find it, but you do find a corresponding @q<.ASM> or @q<.M80> file, you'll either have to build a new hex file on the host using a cross assembler (see below for how to do this on a DEC-10 or DEC-20), or else bring the M80 source file to your micro and assemble it there. Connect to your host using a terminal or a terminal emulation facility. Ensure that your host does not have your terminal in "page mode". E.g. on the DEC-20, give the Exec command @q. Tell the host to display the hex file at your terminal. E.g. on the DEC-20, give the Exec command @q, @i<@u(without) a terminating carriage return>. Return to your micro. Connect to a floppy disk with plenty of free space. Make sure your IOBYTE is set so that @q and @q correspond to the I/O port that is connected to the DEC-20 (this would normally be the case unless you have done something special to change things). Run DDT and type in the following (the comments should not be typed in; they are there just to tell you what's happening): @Begin -ikermit.hex ;Setup FCB for file KERMIT.HEX. -a100 ;Begin assembling code at 100. 0100 lxi h,ffe ;Where to put HEX file. 0103 shld 300 ;Save the address. 0106 mvi e,d ;Get a CR. 0108 mvi c,4 ;Output function. 010A call 5 010D mvi c,3 ;Input function. 010F call 5 0112 ani 7f ;Turn off the parity. 0114 cpi 40 ;Our DEC-20 prompt atsign? 0116 jz 124 ;Yes, we have whole file. 0119 lhld 300 ;Get the pointer. 011C mov m,a ;Else, store the char. 011D inx h ;Increment the pointer. 011E shld 300 ;Save the pointer. 011F jmp 10d ;Go around again. 0124 mvi a,1a ;Get a control-Z. 0126 lhld 300 ;Get the pointer. 0129 mov m,a ;Store the char. 012A shld 300 ;Save the pointer. 012D lxi h,1000 ;Pointer to file. 0130 shld 310 ;Save the pointer. 0133 mvi c,16 ;Make file. 0135 lxi d,5c 0138 call 5 013B lhld 310 ;Get the file pointer. 013E xchg ;Put it in DE. 013F mvi c,1a ;Set DMA. 0141 call 5 0144 mvi c,15 ;Write DMA to file. 0146 lxi d,5c 0149 call 5 014C lhld 310 ;Get the file pointer. 014F lxi d,80 ;Get the DMA size. 0152 dad d ;Adjust file pointer. 0153 shld 310 ;Save it. 0156 lda 301 ;Get high order byte. 0159 cmp h ;Have we passed the end? 015A jm 170 ;Yes. 015D jz 163 ;Maybe. 0160 jmp 13b ;No. 0163 lda 300 ;Get low order byte. 0166 cmp l ;Passed the end? 0167 jm 170 ;Yes. 016A jz 170 ;Yes. 016D jmp 13b ;Not quite. 0170 mvi c,10 ;Close file. 0172 lxi d,5c 0175 call 5 0178 ret 0179 -g100,179 ;Execute the program. - ;Reboot @End Now there should be a file @q on your connected disk. Load this using the CP/M command LOAD to produce @q. This should be a runnable version of Kermit. Note that CP/M hex files have checksums on each line. If there were any transmission errors during the downloading process, the CP/M loader will notice a bad checksum and will report an error (something like "Illegal Format"). If you get any errors during loading, either fix the hex file locally with an editor, or repeat the previous step. @End You now should have a running version of Kermit-80. @subsection The source for Kermit-80 should be available on your host computer. It is written using 8080 assembler mnemonics, so it can be assembled on most 8080s and Z80s using the standard 8080 assembler provided with CP/M. If you have @q on your CP/M system, you can assemble it directly on the micro using ASM, setting the desired assembly switches as explained below. If you don't have it, you can attempt to download the source file from the host using the procedure outlined above. A cross assembler @index is provided that runs on the @index@index DEC-10 and DEC-20, called MAC80, contributed by Bruce Tanner at Cerritos College, that may be used for cross assembling KERMIT-80 as shown in this example (for TOPS-20): @begin Copy @q(PS:CPMK@i.M80) to your directory, as @q. TOPS-10 filename rules must be followed. This is the 8080 assembler source file; @i is the current version number; for instance version 3.8 would be stored as @q. Edit @q to set the conditional assembly switch for your machine. These are right near the top of the file. The switch for your machine should be set to TRUE and all the others to FALSE. The "ibm-flag" setting is site dependent. As shipped from Columbia, it turns on half duplex line handshaking, using CTRL-Q as the turnaround character, sets LOCAL-ECHO ON, TIMER ON, and PARITY MARK. Make any changes required for your site. The default FILE-MODE is ASCII as shipped from Columbia. This means that when text files are sent from the CP/M system, no extraneous characters will be sent after the end, but that outgoing binary files may be truncated erroneously if the user forgets to SET FILE BINARY. You can change the default to BINARY, so that no data is ever lost from any file, but text files will usually have extraneous junk at the end. @begin @index@index Run MAC80: @begin @@@u *@ux *@ux<^Z> @end The result will be in your directory as @q. @end Use Kermit, MODEM, or any other downloading mechanism to transfer @q(KERMIT.HEX) to the micro, or download it using the DDT program shown above. On the micro, load the hex file: @example{A>@ux[load kermit]} @q(KERMIT.COM) will appear on the floppy. The new Kermit should be ready to run. @end @subsection @index@Index If your CP/M 2.2 system implements i/o redirection via the (optional) IOBYTE mechanism, you can probably run Generic Kermit on it, either without modification, or by a very simple change to the program. The standard CP/M IOBYTE is set up as follows: @begin I/O Byte assignments (four 2-bit fields for 4 devices at location 3) : bits 6+7 LIST field 0 LIST is Teletype device (TTY:) 1 LIST is CRT device (CRT:) 2 LIST is Lineprinter (LPT:) 3 LIST is user defined (UL1:) bits 4+5 PUNCH field 0 PUNCH is Teletype device (TTY:) 1 PUNCH is high speed punch (PUN:) 2 PUNCH is user defined #1 (UP1:) 3 PUNCH is user defined #2 (UP2:) bits 2+3 READER field 0 READER is Teletype device (TTY:) 1 READER is high speed reader (RDR:) 2 READER is user defined #1 (UR1:) 3 READER is user defined #2 (UR2:) bits 0+1 CONSOLE field 0 CONSOLE is console printer (TTY:) 1 CONSOLE is CRT device (CRT:) 2 CONSOLE is in Batch-mode (BAT:); READER = Input, LIST = Output 3 CONSOLE is user defined (UC1:) @end (Here, bit zero is the least significant, "rightmost", bit). I/O redirection is accomplished by switching the IOBYTE between two values, "batch i/o" and "normal i/o". In normal i/o mode, the keyboard is defined to be the console. In batch i/o mode, the serial port is defined to be the console. This switching is necessary because the console is the only device that can be tested to see if input is available, but KERMIT must shuttle back and forth between the keyboard @i the serial port looking for input. Here are the batch and default i/o mode definitions used in "standard" Generic KERMIT-80: @begin batio EQU 056H ;I/O byte CON=BAT,LIST=CRT,READER=RDR defio EQU 095H ;I/O byte CON=CRT,LIST=LPT,READER=RDR @end Other systems may have other logical devices that point to the serial port, in which case you'll need to redefine these symbols to point to those devices and then reassemble the program (with assembly switch GENER set to TRUE, all others FALSE). If your system runs CP/M 3.0, then the CPMPLUS version of KERMIT should run on your system without modification, except perhaps for screen control or baud rate setting. %