Implementation of KERMIT for Pecan Software Systems UCSD p-System R. Tim Coslet R_Tim_Coslet@cup.portal.com Version 1.1 KERMIT-UCSD is a program which implements the KERMIT file- transfer protocol for use under the Version IV.x UCSD p-System on various computers. The distributed version has been developed on an Atari MEGA ST2 under Pecan Software Systems, Inc. p-System Version IV.2.2 with the Standard File System (SFS). This implementation was done by Tim Coslet from the UCIBMPC implementation by Steven Pacenka, which was based largely on an implementation by Kate MacGregor of Cornell Computing Services for the Version II.0 p-System on a Terak 8510a. Summary of Kermit-UCSD Capabilities at a Glance -------------------------------------------------------------- Local operation Yes Remote operation No Transfers text files Yes Transfers binary files Yes Wildcard send Yes ^X,^Z interruptions Yes Filename collision avoidance Yes Send Literal/Converted filenames Yes Can time out Yes 8th-Bit prefixing Yes Repeat count prefixing No Alternate block checks No Communication settings Yes, Baud & Parity Transmit break Yes, dependent on REMUNIT Support for dialout modems No IBM mainframe communications Yes Transaction logging No Session logging No Packet logging No Debug logging Yes Raw file transmit No Act as server No Talk to server Yes Local file management No File Attributes packets Yes, date only Selectable user interfaces Yes, Kermit & UCSD styles Take initialization command file Yes, *KERMITINFO.TEXT Take commands from file Yes Command macros No Login Scripts No Large packets No Extra Large packets No Sliding windows No Terminal emulation ?? Has Datamedia from UCIBMPC but I had problems with it. Didn't need it on Atari ST as it already partially emulates a VT52 terminal. CONSTRUCTING A NEW KERMIT The program consists of several Pascal source files which need to be compiled. Also required is a REMUNIT.CODE to interface with your computer's serial port. REMUNIT's are available for most computers running the p-System, from USUS. This version also uses several Library Units provided by Pecan Software Systems: KERNEL, SCREENOPS, DIRINFO, WILD, and optionally ERRORHANDLING. If you have the Advanced File System (AFS) you may also use Pecan's Library Unit ATTRIBUTES. (current versions of this unit appear to have a bug that prevents them from operating correctly under the Standard File System (SFS).) The source files (which are concatenated into a single large file on the distribution tape) are: KERMIT UCSD Name Distribution Contents Name -------------- ------------ -------------------------------------------- UCPECAN.D.TEXT UCPECA.DOC This documentation UCPECAN.P.TEXT UCPECA.PAS Following source files (self separating) KERMIT.TEXT " Main program SENDER.TEXT " UNIT Sender (file sending) RECEIVER.TEXT " UNIT Receiver (file receiving) CLIENT.TEXT " UNIT Client (talks to server) HELPER.TEXT " UNIT Helper (online help info) PARSER.TEXT " UNIT Parser (command parsing) INTFUTIL.TEXT " Interface part of KermUtil UNIT FAKEUTIL.TEXT " UNIT KermUtil (fake implementation) KERMUTIL.TEXT " UNIT KermUtil (misc utilities) SETSHOW.TEXT " Include file for KERMIT.TEXT KERMENUS.TEXT " UNIT KerMenus (UCSD style Menus) KERMPACK.TEXT " UNIT KermPack (packet utilities) KERMGLOB.TEXT " UNIT KermGlob (declarations) UCPECAN.M.TEXT " "make" file (compiles in correct order) UCPECAN.U.TEXT UCPECA.UPD Update information (V1.0 -> V1.1) The .PAS file is a "self separating" text file containing the Pascal source files, the .DOC file (obviously) contains this user documentation and instructions for building UCSD Pascal Kermit, and the .UPD file contains a list of the changes made from V1.0 to V1.1 of Kermit-UCSD. All of the .PAS modules should compile and execute on any adaptation of Version IV of the UCSD p-System, provided that an equivalent of the REMUNIT.CODE unit is available for the particular computer being used. (This file implements the UCSD p-System Users' Society (USUS) "standard remote unit.") To generate a variant of this KERMIT for another computer running the Version IV p-System: 1. Create or obtain a REMUNIT that implements the USUS standard remote unit. Specifications and implementations for a variety of different computers are available from USUS. For communications above 300 baud, the incoming characters to REMIN: should be processed in a buffered, interrupt-driven mode. The buffer should be at least 256 characters long. 2. Change all instances of the volume name "syslibr:" in the .PAS file to the name of your volume containing the Pecan Library Units. 3. Using ASE (Advanced System Editor) separate the Pascal source files in the "self separating" .PAS file by performing the following steps: a) Create a Volume with at least 720 free blocks. Make this Volume your "Prefix Vol" (default). Note: This will run fastest from ramdisk. So if your RAMDISK: Volume is large enough ( >1030 blocks ) then you may creat this Volume as a .SVOL on RAMDISK:. If your RAMDISK: is not large enough to do this then a Virtual Vol on HardDisk is next best. If you have only floppies available, it will be very slow, but will still work (provided they are large enough. 720 blocks is the size of a SSDD "Native" p-System floppie on the Atari ST). b) Make sure that the RAMDISK: still has at least 300 block of free space left over (for the extracted source files). c) Put the "self separating" .PAS file on your "Prefix Vol" as UCPECAN.P.TEXT (its UCSD Name, see table above). d) E(dit UCPECAN.P e) Press the Function Key. This will initiate the file extraction, which takes several minutes. f) If it completes with NO Errors then Q(uit E(xit ASE. Note: If errors occur attempt to correct them and try again (e.g. "not enough room on vol" means you need more space, try again with larger Volumes). If problems persist you may extract the files by hand; they are separated with lines in the format below... {>>>> filename} The file UCPECAN.M.TEXT must have this line removed before X(ecuting it (this is normally done automagically in the "self separation" process). g) It would be a good idea to copy the extracted .TEXT files to another Volume at this time (i.e. backup floppy). 4. Place all of the source Pascal files together on your usual prefix volume along with the REMUNIT.CODE file. 5. Configure the conditional compilation switches in these files to the state required by your environment: Unit Compiler Control -------- ---------------------------------------------- KERMUTIL {$D OS_ERHDL+} change + to - if ERRORHANDLING is not available. {$D OS_TIMER+} change + to - if time() does not work on your machine. SENDER {$D AFS-} change - to + if AFS available RECEIVER {$D AFS-} change - to + if AFS available 6. Compile the Pascal units by selecting the X(ecute command and entering the following execution-option string: i=ucpecan.m 7. At this point you can use the standard p-System LIBRARY.CODE program to combine the units (including REMUNIT) into one code file for easier and faster loading, or you can enter their individual .CODE file names into the USERLIB.TEXT file on your root disk. 8. Optionally creat a file (with ASE) called KERMITINFO.TEXT in your boot volume containing any initialization commands that you may need. Example: set system-id atari mega ST2 set file-warning on set baud 4800 LIMITATIONS 1. No character repeat counts are used in packets. 2. '?' and cannot be used when entering a command line. Some versions of Kermit parse commands from the keyboard character by character as they are entered. This version interprets the line after it has been terminated by a carriage return. Use the HELP command in place of '?', and type out the command names in full. 3. All linefeed characters received during TEXT file transfer are stripped from the local file that is being created, since the p-System does not recognize them in text files. This may cause difficulties in files received from certain other computers which omit carriage returns at the ends of lines, particularly blank lines. But if both Kermits are correctly set for TEXT (ASCII) transfer you should not have a problem. 4. BINARY file transfers are exact only if you use the ATTRIBUTES Unit (which at this time only works under AFS). Without this Unit file size will be rounded up to the next full block (512 bytes) and filled with NUL characters: chr(0). 5. In this version of Kermit-UCSD the "UCSD style" user interface Unit remains resident durring file transfers (unlike the PARSER Unit used by the "Kermit style" user interface). This could present problems on machines using an internal Codepool. If this causes problems for you (e.g. *STACK OVERFLOW* while transfering files) then avoid using the menus, just use the "normal" Kermit command mode. 6. I was not able to get access to a "Known working" Kermit that implements attribute packets to verify the operation of the protocol. They have only been tested against another copy of this program. 7. Limited server communications are supported (only GET, PUT, BYE, and FINISH) in this version. The CLIENT Unit contains code for handling "X" packets sent by a server, but I only had access to a "Known working" Kermit Server for a limited time so this code is untested (and probably won't work). 8. V1.0 had a problem where occasionally the Creation Date passed in an attribute packet was not correctly recorded. While trying to locate this problem I added some test code to the RECEIVER Unit (debugdate) that rereads the file's date and have been unable to duplicate the problem since then (I was duplicating it regularly before this). I have left this code in, since it appears to fix the problem. But as I do not know the cause of the problem I can not be sure that it is really fixed. If anyone using this program encounters this problem, please send me a copy of a debug log file showing the problem. COMMANDS The commands recognized by KERMIT-UCSD are listed below. CONNECT To make a "virtual terminal" connection to a remote system. The CONNECT command may be abbreviated to 'CON'. When in CONNECT mode, all typed characters are sent to the serial interface except the escape character (see SET ESCAPE, below). The escape character may be followed by another character which is interpreted as follows: c Break the connection and "escape" back to the micro b Send a "break" signal over the communications line; this is only useful on mainframes such as the IBM 3081/370/4341 et. al. s Same as the "show all" command in command mode; displays the current parameter settings for the local KERMIT. ? Displays the possible characters to follow the escape code Two consecutive escapes are required to send one such character to the communications line EXIT To return to main p-System command level. QUIT Same as EXIT. HELP To get a list of KERMIT commands. HELP can be followed by any command, in which case the help will refer only to that command. RECEIVE To accept a file from the remote system. If FILE-TYPE is TEXT the suffix ".TEXT" will be appended, if not already present in the received file name. If FILE-TYPE is BINARY the name will be used as received without modification. SEND To send a file to the remote system. Wildcards may be used in the filename to send multiple files. The wildcard system used here (From Pecan's WILD Library Unit) is an "extension" of "standard UCSD" wildcards. ? - Matches any single character. = - Matches any sequence of 0 or more chars. % - Escape char. to allow special characters to be matched literally. {} - Matches any in specified set. a-c is subrange. , seperates elements. ~ excludes char from set. {a-c,~b} is same as {a,c} * - Following {} matches 0 or more of the specified characters. + - Following {} matches 1 or more of the specified characters. GET To request a file from a remote Kermit in SERVER mode. PUT To send a file to a remote Kermit in SERVER mode. Wildcards may be used in the filename to send multiple files. BYE Shutdown and logout a remote Kermit in SERVER mode. FINISH Shutdown a remote Kermit in SERVER mode. SET To establish system-dependent parameters. The SET options are as follows: BAUD To set the communications baud rate. Permisable values are dependant on your Hardware and REMUNIT. (default is 1200). DEBUG To set debug mode ON or OFF (default is OFF). EMULATE To set DataMedia 1520A screen control code interpretation ON or OFF (default is OFF). ESCAPE To change the escape sequence that lets you return to the PC Kermit from the remote host. The default is CTRL- ] c. FILE-NAMES LITERAL/CONVERTED, Default is CONVERTED, In this Kermit LITERAL Names have Volume name Stripped, while CONVERTED Names also have all but the final '.' removed. FILE-TYPE BINARY/TEXT Default is TEXT. FILE-WARNING ON/OFF, default is OFF. If ON, Kermit will rename an incoming file so as not to write over a file that currently exists with the same name. IBM ON/OFF, default is OFF. This flag should be ON only when transfering files between the PC and an IBM VM/CMS system. It also causes the parity to be set appropriately (mark) and activates local echoing. INTERFACE KERMIT/UCSD, default is KERMIT. Permits selection of prefered User Interface: KERMIT command line or UCSD menus. LOCAL-ECHO ON/OFF, default is OFF. When on, this causes characters typed at the keyboard during connect mode to be echoed to the screen. PARITY EVEN, ODD, MARK, SPACE, or NONE. NONE is the default but if the IBM flag is set, parity is set to MARK. This flag selects the parity for outgoing and incoming characters during CONNECT and file transfer to match the requirements of the remote computer. SYSTEM-ID Specify the System-ID for your REMUNIT if your REMUNIT needs it specified. Called "model" in the REMUNIT specs. Default System-ID is UNKNOWN SHOW To see the values of parameters that can be modified via the SET command. For an explanation of the parameter, see the help for the matching SET command. Additional SHOW options are as follows: ALL Show all parameters. VERSION Show version information. Note: there is no SHOW INTERFACE command (it was not needed as you already can see which interface you are using). TAKE This command instructs Kermit to take further commands from a specified file. COMMENT Comments a TAKE file. (ignored) LOG This command opens a selected log file. LOG options are as follows: DEBUG open specified file for debug output. CLOSE This command closes a selected log file previously opened via the LOG command. WISH LIST FOR FUTURE VERSIONS If anyone tries these, please consider portability and share your work with the rest of the p-System community. 1. Increased memory buffering of sent and received packets. Now only the standard 512 character buffers provided by the operating system are utilized. On floppy disk systems the throughput is slowed considerably by frequent disk access. This may require you to write your own UCSD .TEXT output formatter (which will need to be bypassed if the file being received is not a .TEXT or .BACK type file). 2. Implementation of the immediate '?' (help) and (abbreviate) commands in the parsing routines. 3. A DIR command to list a local volume directory. 4. Text file capture with memory buffering, and XON/XOFF protocol. (For remote computers not supporting Kermit.) Note: on the Atari XON/XOFF protocol is already implemented in the Host's Operating System (TOS). 5. Text file transmission without protocol. 6. SET TIMEOUT command. (Hardware timing is now available, but the timeout is currently fixed at 5 seconds). CREDITS AND ADDRESSES 1. Pecan Software Systems, Inc. 1410 39th Street Brooklyn, NY 11218 (800) 63-PECAN (orders) (718) 851-3100 Library Units used by this program. 2. USUS (UCSD p-System Users' Society) P.O. Box 1148 La Jolla, CA 92038 REMUNIT specification and sources. 3. R. Tim Coslet Usenet: R_Tim_Coslet@cup.portal.com {sun,atari}!portal!R_Tim_Coslet BIX: r.tim_coslet Programmer (me). The above e-mail addresses may be used to contact me if you have problems with this version of Kermit.