home *** CD-ROM | disk | FTP | other *** search
/ kermit.columbia.edu / kermit.columbia.edu.tar / kermit.columbia.edu / sinclairqlb / ql2kerdoc.txt < prev    next >
Text File  |  1988-08-15  |  20KB  |  507 lines

  1. File QL2KER.DOC
  2. ---------------
  3.                         Kermit for the Sinclair QL
  4.                         --------------------------
  5.  
  6.  AUTHOR       : David Harper
  7.                 Dept of Applied Maths and Theoretical Physics
  8.                 The University
  9.                 P.O. Box 147
  10.                 Liverpool  L69 3BX
  11.  
  12.  EMAIL        : SX36 at UK.AC.LIVERPOOL.IBM
  13.  
  14.  OPERATING
  15.  SYSTEM       : QDOS (Sinclair QL and derivatives)
  16.  
  17.  LANGUAGE     : BCPL (Metacomco)
  18.  
  19.  DATE         : 29 May   1987
  20.  
  21.  
  22.  (1) Generating the EXECable program
  23.  
  24.  This version of QL Kermit is written in BCPL and should be compiled using
  25.  Metacomco's BCPL Development Kit
  26.  
  27.  There are four source files. They should be renamed as follows (assuming
  28.  that you have disc drives - if not, change FLP to MDV).
  29.  
  30.  
  31.      File                 QDOS name               Purpose
  32.  
  33.   QL2KER.BCP          FLP2_KERMAIN_BCPL      Command parser & executive
  34.  
  35.   QL2SET.BCP          FLP2_KERSET_BCPL       Handles the SET command
  36.  
  37.   QL2PRO.BCP          FLP2_KERPROTO_BCPL     Kermit protocol routines
  38.  
  39.   QL2HDR.BCP          FLP2_KERHDR            Header file - defines globals
  40.                                               and manifest constants
  41.  
  42.  
  43.   The header file is imbedded in each of the other three files using the
  44.   BCPL GET directive. Within KERMAIN, KERSET and KERPROTO it is referred
  45.   to as FLP2_KERHDR so if you are using microdrives, you should edit
  46.   each of the three files and change the line
  47.  
  48.   GET "FLP2_KERHDR"
  49.  
  50.   to
  51.  
  52.   GET "MDV2_KERHDR"
  53.  
  54.  
  55.   To construct the EXECable program, compile the files KERMAIN, KERSET
  56.   and KERPROTO then use the linker 'BLINK' to join their object code
  57.   files together. The result is a program which can be run under QDOS
  58.   in tandem with other tasks, using QDOS's multi-tasking capability.
  59.   I use the name FLP2_KERMIT_EXE for the EXECable file.
  60.  
  61.  
  62.  
  63. ***** NOTE : Metacomco BCPL Development Kit versions 1.nn *****************
  64. *                                                                         *
  65. *  If you don't have a copy of version 2.0 (or later) of Metacomco's      *
  66. *  BCPL compiler, you will need to assemble the file 'qtrap_asm' and      *
  67. *  link it with the other object code files. You should alter the         *
  68. *  header file 'kerhdr' to include a suitable global reference to qtrap.  *
  69. *  Dr Alex Finch's version of qtrap has global number 276 so you should   *
  70. *  include                                                                *
  71. *                                                                         *
  72. *               GLOBAL $( qtrap : 276 $)                                  *
  73. *                                                                         *
  74. *  in 'kerhdr' at some point, or add it to the existing global list.      *
  75. *                                                                         *
  76. *  Versions from 2.0 have qtrap as part of the BCPL library at global 101 *
  77. *  and so they don't require this extra file.                             *
  78. *                                                                         *
  79. ***************************************************************************
  80.  
  81.  (2) Running Kermit
  82.  
  83.   To run the task, use
  84.  
  85.   EXEC FLP2_KERMIT_EXE
  86.  
  87.  
  88.   You can use EXEC_W if you prefer, but Kermit will run quite happily
  89.   alongside other tasks as long as they don't demand too large a share
  90.   of processor time. Besides, since Kermit doesn't support QDOS commands
  91.   such as DIR, it is useful to be able to switch to SuperBasic for a moment
  92.   to issue such commands directly. This doesn't interfere with Kermit
  93.   in any way, and you can even do it while Kermit is engaged in file-transfer.
  94.  
  95.  
  96.   When Kermit is expecting a command, you will see the prompt
  97.  
  98.   QL-Kermit (Local) >
  99.  
  100.   and the cursor should be flashing just after the '>'. (If the cursor is
  101.   somewhere else on the screen, e.g. the SuperBasic command window, use
  102.   Control-C to switch between tasks until the Kermit cursor begins to flash.)
  103.  
  104.  
  105.  (3) Kermit commands
  106.  
  107.   Kermit recognises the following commands :
  108.  
  109.   HELP                                 Lists all recognised commands, with
  110.                                         any operands.
  111.  
  112.  
  113.   HELP SET                             List all the settable options
  114.  
  115.  
  116.   EXIT )                               End the Kermit task i.e. remove it from
  117.   END  )                                QDOS
  118.  
  119.  
  120.   SET <parameter> <value>              Alter one of the settable options -
  121.                                         see next section.
  122.  
  123.  
  124.   SHOW                                 Show the values of some of the settable
  125.                                         options.
  126.  
  127.  
  128.   SERVER                               Enter server mode operation
  129.  
  130.  
  131.   CONNECT                              Open the serial communication line
  132.  
  133.  
  134.   DISCONN                              Close the serial communication line
  135.                                         (use this when you wish to change
  136.                                         the line attributes e.g. parity)
  137.  
  138.  
  139.   TAKE <local filename>                Take Kermit commands from a file
  140.  
  141.  
  142.  
  143.   SEND <local-file> <remote-file>      Send a file to a remote Kermit
  144.  
  145.  
  146.   GET  <remote-file> <local-file>      Fetch a file from a remote serving
  147.                                         Kermit
  148.  
  149.  
  150.   RECEIVE <local-file>                 Receive a file from a remote Kermit
  151.  
  152.  
  153.   FINISH                               Issue a FINISH command to a remote
  154.                                         serving Kermit.
  155.  
  156.  
  157.  
  158.  (4) Options of the SET command
  159.  
  160.   The SET command recognises the following options. (*) means that I haven't
  161.   yet implemented this option e.g. block-check type. Items in square brackets
  162.   [ ... ] are optional. N is any non-negative number. CHAR is a single
  163.   character.
  164.  
  165.  
  166.   Option           Values                           Notes
  167.   ------           ------                           -----
  168.  
  169.   BLOCK-CHECK      (*)
  170.  
  171.   DEBUG            ON [filename] | OFF [CLOSE]      See note 2
  172.  
  173.   DELAY            N  (less than 60)
  174.  
  175.   8BIT-PREFIX      ON | OFF                         Do we do 8th-bit prefixing
  176.  
  177.   END-OF-LINE      CR | LF                          The character we recognise
  178.                                                     as end-of-line
  179.  
  180.   ESCAPE-CHAR      F1 | F2 | F3 | F4 | F5 |         Key to escape from terminal
  181.                    ESC | CTRL-ESC                   emulation back to Kermit
  182.                                                     command mode
  183.  
  184.   FLOW-CONTROL     (*)
  185.  
  186.   HANDSHAKE        CTS | XON | NONE                 Type of handshaking to do
  187.                                                     with the other Kermit. See
  188.                                                     note 3.
  189.  
  190.   LOG              (*)
  191.  
  192.   MARKER           N  (0 <= N < 27)                 Start-of-packet character
  193.  
  194.   PACKET-LENGTH    N  (30 < N < 93)                 Largest packet we want to
  195.                                                     receive
  196.  
  197.  
  198.   PADDING          N                                Number of padding chara-
  199.                                                     cters we need to receive
  200.  
  201.   PAD-CHAR         N  (0 <= N < 32)                 The padding character we
  202.                                                     need to receive
  203.  
  204.   PARITY           EVEN | ODD | MARK | SPACE |      See note 4
  205.                    NONE
  206.  
  207.  
  208.   PAUSE            N
  209.  
  210.   PREFIX           CHAR                             The character we propose
  211.                                                     to use for 8th-bit prefix
  212.  
  213.   REPEAT-COUNT     (*)
  214.  
  215.  
  216.   RETRY            N                                Our retry threshold
  217.  
  218.   TIMEOUT          N                                Interval after which we
  219.                                                     should be timed-out
  220.  
  221.  
  222.   LINE             1 | 2                            To select port SER1 or SER2
  223.                                                     See note 5
  224.  
  225.   DIR              (*)
  226.  
  227.   OVERWRITE        (*)
  228.  
  229.   BAUD             75 | 150 | 300 | 600 | 1200 |    Baud rate. See note 6
  230.                    2400 | 4800 | 9600
  231.  
  232.  
  233.  TERMINAL-TYPE     (*)
  234.  
  235.  INTERFACE         NONE | RAW | QCONNECT            Type of interface hardware
  236.                                                     in use. See note 1.
  237.  
  238.  TAKE-ECHO         ON | OFF                         Whether we echo commands
  239.                                                     from TAKE files to the
  240.                                                     screen.
  241.  
  242.  
  243.  
  244.  
  245.  Notes
  246.  -----
  247.  
  248.  1. Kermit includes routines to enable it to communicate via the Tandata
  249.   QConnect communications module. This 'little black box' is particularly
  250.   useful in implementing  XON/XOFF handshaking to allow the QL to work
  251.   with mainframes and packet-switch systems (eg Gandalf PACX) that simply
  252.   don't use hardware CTS/RTS handshaking. The QL's serial ports only have
  253.   CTS/RTS capability, and I haven't written any cunning XON/XOFF-handling
  254.   code into Kermit. So if your mainframe uses XON/XOFF, a QConnect box
  255.   might be a good investment. As an added bonus, it comes with a rather
  256.   good  VT100 emulator - Kermit only has glass-teletype at the moment !
  257.  
  258.  2. The debugging facility writes out details of each packet as it is
  259.   received or sent, plus timeouts (if they occur) and each attempt to
  260.   open a file. By default, debugging reports are sent to the screen
  261.   and may be enabled using SET DEBUG ON and disabled using SET DEBUG OFF.
  262.   However, if you wish to direct the reports to a file, use the form
  263.  
  264.   SET DEBUG ON file-name
  265.  
  266.   After this, SET DEBUG ON/OFF enables or disables reporting to that file,
  267.   which remains open. To close a debugging  file, use
  268.  
  269.   SET DEBUG OFF CLOSE
  270.  
  271.   This closes the current debugging file (unless debugging is to the screen -
  272.   we don't want to close the screen channel !) and disables debugging. A
  273.   subsequent SET DEBUG ON will output to the screen.
  274.  
  275.   You may open a new debugging file without closing the previous one. For
  276.   example
  277.  
  278.   SET DEBUG ON flp2_debug_file1
  279.   ...
  280.   ...
  281.   ...
  282.   SET DEBUG ON flp2_debug_file2
  283.  
  284.   In this case, flp2_debug_file1 will still be open but Kermit has forgotten
  285.   its channel ID so it can't close it. It will remain open until you stop
  286.   the Kermit job, whereupon QDOS closes all outstanding open files as part
  287.   of its housekeeping.
  288.  
  289.  3. In the absence of a Tandata QConnect module (Note 1 above), the option
  290.   SET HANDSHAKE XON cannot be honoured, so you shouldn't use it. When using
  291.   raw (i.e. no little black boxes) communications, choose CTS or NONE.
  292.  
  293.  4. The Tandata QConnect box cannot operate using MARK or SPACE parity.
  294.  
  295.  5. The QL has two RS232 ports, SER1 and SER2. One of them is configured
  296.   as DTE and the other as DCE. In practical terms this means that you should
  297.   use SER2 (SET LINE 2) if you want to communicate  with a mainframe and
  298.   SER1 (SET LINE 1) if you are Kermitting with another micro which thinks
  299.   that it is a terminal. The Tandata QConnect box will only plug in to SER2,
  300.   so SET INTERFACE QCONNECT and SET LINE 2 must be issued together.
  301.  
  302.   When I link  my QL with a BBC micro, the Beeb's RS423 socket is connected
  303.   to the the QL's SER1 socket  (via two adaptor leads and a female-female
  304.   gender changer - why do I use two micros that have non-standard serial
  305.   comms hardware ?!).
  306.  
  307.  6. The QL supports these baud rates : 75, 300, 600, 1200, 2400, 4800, 9600
  308.  
  309.   If you are using a Tandata QConnect box, the baud rates are 150, 300, 600,
  310.   1200, 2400, 4800, 9600
  311.  
  312.  
  313.  
  314.  (5) General notes about using Kermit
  315.  
  316.  
  317.   TERMINAL EMULATION
  318.  
  319.   Most people will want to use Kermit to transfer files to/from mainframes.
  320.   A simple teletype terminal-emulator is included to allow you to call the
  321.   remote system. If you are using a QConnect box, don't worry about the
  322.   strange message which appears (in red) when you issue the CONNECT
  323.   command. It is simply telling you the command string which it has sent to
  324.   QConnect to set up the connection.
  325.  
  326.  
  327.   The terminal emulator will print out any ASCII character in the range 32 to
  328.   126. It interprets a CRLF sequence from the remote system as a single LF,
  329.   which is the QDOS newline character. Backspace (ASCII 08 dec) moves the
  330.   cursor one space to the left and formfeed (ASCII 12 dec) clears the screen.
  331.   Bell (ASCII 07 dec) causes the message '<beep>' to appear (in red) on the
  332.   screen. Any other character in the range 0 to 31 is displayed in the form
  333.   '<#Xnn>' where nn is the hexadecimal representation of the number.
  334.   As far as Bell is concerned, I will probably make this trigger the QDOS
  335.   BEEP routine in the next release.
  336.  
  337.   The  QL sends all ASCII characters from 0 to 127 (though ASCII 03, CTRL-C,
  338.   can never be sent because it is the key used by QDOS to switch from  one
  339.   task to another). The cursor keys and function keys are ignored, except
  340.   for Left and CTRL-Left which both generate ASCII DEL (127 dec) - so
  341.   CTRL-Left can be used as the delete key just as it is during QDOS buffered
  342.   terminal input.
  343.  
  344.   The key to be used to escape from terminal emulation back to Kermit command
  345.   mode can be altered using the SET ESCAPE option. To begin with, it is
  346.   the ESC key, but your mainframe might require that you use this key so
  347.   the next best alternative is probably F1 or one of the other function keys.
  348.  
  349.  
  350.   FILE TRANSFER
  351.  
  352.   The status reports during file transfer are fairly basic. Kermit prints
  353.   a message to indicate that it is sending/receiving a file, with the
  354.   name of the file. During transfer, it prints a full-stop '.' after every
  355.   5th packet it receives successfully, but for every packet which it fails
  356.   to receive (either because it timed out, or because the received packet
  357.   was incorrect in some way) it prints out a percent symbol '%'
  358.  
  359.   A successful file transfer might look like this :
  360.  
  361.  
  362.  
  363.   QL-Kermit (Local) > RECEIVE flp2_datafile1
  364.  
  365.       Receiving file flp2_datafile1
  366.       ......................
  367.  
  368.   QL-Kermit (Local) >
  369.  
  370.  
  371.   while a transfer which suffered one or two hiccups might appear as
  372.  
  373.  
  374.   QL-Kermit (Local) > RECEIVE flp2_datafile1
  375.  
  376.       Receiving file flp2_datafile1
  377.       .........%....%%.......
  378.  
  379.   QL-Kermit (Local) >
  380.  
  381.  
  382.   Here, three errors occurred but since there are twenty full-stops, the
  383.   average is three errors for 100 packets successfully received so it's
  384.   not as alarming as it might appear.
  385.  
  386.  
  387.   SERVER MODE
  388.  
  389.   Kermit can operate as a server. This is useful when transferring files to
  390.   and from another micro. Kermit recognises two generic exit commands,
  391.   FINISH and LOGOUT. FINISH returns Kermit to the state where it is waiting
  392.   for input from the QL keyboard, while LOGOUT can be used to terminate
  393.   the Kermit task from the other micro.
  394.  
  395.   Debugging can be carried out in server mode, and status reporting to the
  396.   QL console screen is carried out as in non-server mode.
  397.  
  398.  
  399.   TANDATA QCONNECT
  400.  
  401.   The QConnect device has a few idiosyncracies which affect Kermit. The
  402.   technical information provided by Tandata in the user manual is
  403.   brief and difficult to understand. Some of the things that the manual
  404.   claims QConnect can do are in error - for example, the QL <-> QConnect
  405.   serial line can only operate at 9600 baud. When the QConnect <-> remote
  406.   line is working at a lower speed, this causes serious buffering problems
  407.   inside the QConnect when the QL sends a burst of more than 20 bytes -
  408.   in practise, this means that files can be received by QL-Kermit at any
  409.   baud rate (when it only has to send short packets), but QL-Kermit can
  410.   only send files via a QConnect at 9600 baud. At lower speeds, data packets
  411.   become garbled as they pass through the QConnect.
  412.  
  413.   Terminal emulation works at lower speeds, however. Perversely,
  414.   the terminal emulation code is a little slow and operation at
  415.   9600 baud sometimes encounters framing errors. I'm afraid that
  416.   4800 is the maximum reliable speed for terminal emulation, but
  417.   file-transfer can only be done at 9600.
  418.  
  419.   This situation  reflects a design flaw in the QConnect and I shall be
  420.   taking it up with Tandata in the near future. I hope that a subsequent
  421.   release of QL-Kermit will be able to make use of an improved QConnect !
  422.  
  423.  
  424.   FILES and QDOS
  425.  
  426.   Kermit doesn't (at present) do any clever file-name translation when it
  427.   is in server mode and it receives a file name in an R or F packet from
  428.   the other Kermit. So the other Kermit must use full QDOS filenames in
  429.   its SEND and GET commands. I know that this is contrary to the guidelines
  430.   on file nomenclature in the protocol since the file names must contain
  431.   underscores - I'll amend the next release so that underscores can be
  432.   replaced by full-stops. For example, flp2_data_file ought to be sent in
  433.   an R or F packet as flp2.data.file
  434.  
  435.   Kermit will not overwrite an existing file - the transfer is abandoned
  436.   as if the file name were unacceptable to QDOS. This is where it is
  437.   particularly useful to multi-task Kermit so you can switch to SuperBasic
  438.   to check the directory and delete files.
  439.  
  440.   I haven't tried to use Kermit with microdrives - it works very well with
  441.   disc drives and RAMdisc, but I will include software buffering in the
  442.   next release so that an entire file can be loaded into a buffer on the
  443.   QL to avoid having to read repeatedly from microdrives. In an ideal world,
  444.   QDOS would be able to do this automatically but the microdrives are
  445.   notoriously slow.
  446.  
  447.  
  448.   CATASTROPHES
  449.  
  450.   Kermit is still imperfect. I'm sure that users can find some way of
  451.   crashing it - at least, I hope so because it means that I can (hopefully)
  452.   correct the error. One or two QDOS errors will prove fatal to Kermit.
  453.   For example, if it is unable to open a serial line (or to close it !),
  454.   this will be detected in the software and Kermit will shut itself down
  455.   with (usually) a message to explain why.
  456.  
  457.   Some catastrophes are unforeseen  by the program, but they may be picked
  458.   up by the BCPL run-time system. If this happens, the BCPL routine called
  459.   ABORT is called (by BCPL itself, not by Kermit) and a traceback of all
  460.   calling routines is printed  to the screen. The most useful information
  461.   here is the list of the routine names - they appear as the first (non-
  462.   numeric) item on each line and are generally 7 characters long. (The
  463.   run-time system only stores the first 7 characters of each routine name
  464.   for the purpose of error tracing.)
  465.  
  466.   If Kermit stops with an error report, make a note of what is on the screen
  467.   and (if possible) what Kermit was supposed to be doing when it failed.
  468.   I'd be interested to hear about this.
  469.  
  470.   (On a slightly mischievous note : you can make the BCPL run-time system
  471.   do an ABORT by typing                     ----
  472.  
  473.     SET TAKE-ECHO ON
  474.  
  475.   This is a known bug, but I'm afraid I don't know how to solve it !)
  476.  
  477.  
  478.  
  479.   ACKNOWLEDGEMENTS  (Not the Kermit kind !)
  480.  
  481.   Several individuals and companies have helped in the production of this
  482.   Kermit and deserve credit.
  483.  
  484.   First of all, C.G.Selwyn wrote the original version for the Tripos operating
  485.   system. I take responsibility for all of the errors I may have introduced
  486.   into his program in the course of converting it to work under QDOS.
  487.   My thanks to  Mr Selwyn, and to Icarus Sparry of the Microcomputer Unit
  488.   at Bath University who sent me the original program.
  489.  
  490.   Dr Alex Finch of the Physics Dept at Lancaster University wrote the
  491.   assembler version of the routine 'qtrap' which is needed to compile
  492.   Kermit using Metacomco's BCPL Development Kit prior to version 2.0
  493.  
  494.   Thanks also to Tandata Marketing Ltd who provided me with the source code
  495.   of their communications package which drives the QConnect device. Their
  496.   programs helped me to understand how the device should be used with
  497.   Kermit.
  498.  
  499.   Many thanks to Metacomco for sending me a pre-release copy of version 2.0
  500.   of their BCPL development system. This includes a very useful library
  501.   routine for invoking QDOS traps directly.
  502.  
  503.   Finally, thanks to Mike Lewis of Liverpool University Computer Lab for
  504.   arranging the loan of a line-monitor to me while I was trying to
  505.   understand why the QL/QConnect couldn't send files properly. The line
  506.   monitor proved to be a very useful tool.
  507.