Implementation of KERMIT for Version IV of the UCSD p-System

                         Kate MacGregor / Steven Pacenka
                               Cornell University

                          (Test) Version 0.1, May 1984


            KERMIT-UCSD4 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  IBM  Personal  Computer   under  Network  Consulting,  Inc.'s
        excellent adaptation of the p-System.

            This implementation was done by Steven Pacenka, based largely
        on  an  implementation  by  Kate MacGregor of  Cornell  Computing
        Services for the Version II.0 p-System on a Terak 8510a.




                 USING KERMIT with the NCI p-SYSTEM on an IBM PC


            You must  have  NCI release C1F or later to use this program.
        Earlier  releases  suffered  from  bugs in the  serial  interface
        support which caused incoming characters  to  be lost even at low
        speeds.

            You need to do two things  with  your  boot  diskette  before
        trying to execute the distributed .CODE file:

          -  Enable serial interrupts using the NCI CONFIG program; and

          -  Place the SYSTEM.SERIAL file on your boot disk.

            You need to reboot to get  these to take effect for the first
        time.  Then and thereafter just eX(ecute the KERM.CODE program.












                                      - 1 -













                            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.

            The source files (and their short names on  the  distribution
        tape) are:

           UCSD Name          KERMIT                     Contents
                         Distribution Name
        --------------   -----------------   --------------------------------
        KERMIT.DOC.TEXT  UC4KRM.DOC          This documentation
        KERMIT.TEXT      UC4KRM.PAS          Main program
        SETSEND.TEXT     UC4STS.PAS          Include file for KERMIT.TEXT
        RECEIVER.TEXT    UC4RCV.PAS          UNIT Receiver (file receiving)
        SENDER.TEXT      UC4SND.PAS          UNIT Sender (file sending)
        HELPER.TEXT      UC4KHP.PAS          UNIT Helper (online help info)
        KERMPACK.TEXT    UC4PKT.PAS          UNIT KermPack (packet utilities)
        KERMUTIL.TEXT    UC4KUT.PAS          UNIT KermUtil (misc utilities)
        KERMGLOB.TEXT    UC4GLB.PAS          UNIT KermGlob (declarations)
        PARSER.TEXT      UC4PRS.PAS          UNIT Parser (command parsing)
        KERM.CODE        UC4NCI.COD          p-code file that will run with
                                         NCI p-system release C1F on IBM PC

            The  .PAS  files are Pascal source files, and the  .DOC  file
        (obviously) contains this user  documentation,  instructions  for
        building UCSD Pascal Kermit for the IBM PC, and hints on adapting
        it to other machines.  The .COD file is a p-code file for the NCI
        p-System on an IBM PC.

            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
        Pascal 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 -









          2.  Gather all of the source  Pascal  files  onto  your  prefix
              volume along with the REMUNIT.CODE file.

          3.  Compile the  Pascal  units  in  this  sequence: 1--KERMGLOB
              2--KERMUTIL  3--KERMPACK  4--PARSER   5--HELPER   6--SENDER
              7--RECEIVER 8--KERMIT.

          4.  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.




                                   LIMITATIONS


          1.  No wild card designations of file names are allowed.  Files
              are transmitted and received individually.

          2.  No eight-bit character  quoting  is  allowed.  In practice,
              this means that only text files can be transferred.

          3.  No character repeat counts are used in packets.

          4.  '?'  and <esc> 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.

          5.  No server communications are supported.

          6.  Instead of using  a  clock  to  time out when waiting for a
              packet, KERMIT-UCSD has a limit  on  the number of times it
              will look for a response before giving up.

          7.  All  linefeed characters received during 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.










                                      - 3 -













                                    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 'C'.   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

                        <Escape char>
                                    Two consecutive  escapes are required
                                    to send one  such  character  to  the
                                    communications line

        EXIT            To return to main p-System command level.

        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.  Note
                        that ".TEXT" will be concatenated onto the end of
                        the  received  file  name  if it is  not  already
                        present.







                                      - 4 -










        SEND            To send a file to the  remote  system.   Takes  a
                        filename as a parameter.  In creating a file name
                        for the remote Kermit,  all  periods  in the name
                        except the rightmost  are  deleted.   This is for
                        compatibility with most other operating systems.

        SET             To  establish  system-dependent parameters.   The
                        SET options are as follows:

                        BAUD        To  set the communications baud  rate
                                    to 110, 300,  1200,  2400,  4800,  or
                                    9600 (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).

                        END-OF-LINE
                                    To change the character used  at  the
                                    end  of  packets to  something  other
                                    than the  default of CR. It must be a
                                    digit between 0 and 31.

                        ESCAPE      To change  the  escape  sequence that
                                    lets you return to the PC Kermit from
                                    the  remote  host.   The  default  is
                                    CTRL-] c.

                        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 and
                                    activates local echoing.

                        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.






                                      - 5 -










                        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.

        SHOW            To  see  the  values  of parameters that  can  be
                        modified via the SET command.  SHOW ALL shows all
                        parameters; SHOW followed by a  parameter  listed
                        under  SET  will  show  the  value  of only  that
                        parameter.




                          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.

          2.  Timing  of   file  transfers  using  the  system  clock  to
              determine the effective transmission rate.

          3.  More intelligent handling of received linefeed characters.

          4.  Implementation  of  the  immediate '?'   (help)  and  <esc>
              (abbreviate) commands in the parsing routines;

          5.  A DIR command to list a local volume directory.

          6.  Text  file  capture  with memory  buffering,  and  XON/XOFF
              protocol.  (For remote computers not supporting Kermit.)

          7.  Text file transmission without protocol.

          8.  Eight-bit quoting for  sending  and receiving data and code
              files.

          9.  Timeouts during  send and receive using the hardware clock,
              and a related SET TIMEOUT command.






                                      - 6 -