home *** CD-ROM | disk | FTP | other *** search
/ ftp.barnyard.co.uk / 2015.02.ftp.barnyard.co.uk.tar / ftp.barnyard.co.uk / cpm / walnut-creek-CDROM / CPM / TURBOPAS / TKERMIT.LBR / K.DQC / K.DOC
Text File  |  2000-06-30  |  17KB  |  412 lines

  1.  
  2. Turbo Pascal Kermit  CP/M-80
  3.  
  4. Author: Jeff Duncan
  5. Language: Turbo Pascal
  6. Version: 1.1
  7. Date: 29 December 1984
  8.  
  9. Turbo Kermit Capabilities at a Glance
  10.  
  11. Local Operation            Yes
  12. Remote Operation        No
  13. Transfers Text Files        Yes
  14. Transfers Binary Files        Yes
  15. Wildcard Send            No (planned feature)
  16. ^X/^Y Interruption        No
  17. Filename Collision Avoidance    Yes
  18. Can Time Out            No
  19. 8th Bit Prefixing        Yes
  20. Repeat Count Prefixing        No
  21. Alternate Block Checks        No
  22. Terminal Emulation        No
  23. Communications Settings        Yes (parity)
  24. Transmit Break            No
  25. IBM Communication        No
  26. Transaction Logging        No
  27. Session Logging            No
  28. Raw Upload            No
  29. Act as Server            No
  30. Talk to Server            Yes
  31. Advanced Commands for Server    No
  32. Local File Management        Yes (dir)
  33. Command/Init Files        No
  34. Printer Control            Yes
  35.  
  36.   This  is  a  third  release  of  Turbo Pascal Kermit for CP/M 80.  It is not
  37. complete or fully debugged.  Comments, fixes, bug reports, etc.  are  welcome.
  38. I am available at (617) 839-5673 evenings, or at
  39.  
  40.             3 Anderson Lane
  41.             No. Grafton, Ma. 01536
  42.  
  43.   Much  thanks  go to Bernie Eiben for help and encouragement, and to Columbia
  44. University for creating  Kermit.   Thanks  also  to  those  who  have  offered
  45. comments, fixes, and enhancements.
  46.  
  47. Modification History:
  48.  
  49. 29-DEC-84 Jeff Duncan - Extensively remodeled Turbo Kermit.  Major areas
  50.                         changed were:
  51. V1.1
  52.  
  53. 1. Binary files will now be transmitted and received correctly.
  54.  
  55. 2. Added more extensive comments to entire program.
  56.  
  57. 3. Added section in documentation to list operating system dependent code.
  58.  
  59. 4. Announce procedure added by Alan Hull temporarily eliminated to keep
  60.    basic release generic. (but I liked the logo)
  61.  
  62. Limited/no testing has been done in the following areas:
  63.  
  64. 1. 8'th bit quoting.
  65.  
  66. 2. Generating parity.
  67.  
  68. 3. Printer logging.
  69.  
  70. V1.0
  71.  
  72. 08-DEC-84 Alan Hull - Corrected Directory function to work on all drives.
  73. Version 0 was hardcoded to drive C only.  Enhanced the directory 
  74. display to 5 columns, better filename display.
  75.  
  76. Added Sign-on logo for DEC Robin.  Easily changed for other 
  77. systems by recoding announce procedure.
  78.  
  79. Added file delete option (any drive).
  80.  
  81. Updated Help, command prompt, and all routines affected by the
  82. above enhancements.
  83.  
  84. V0.0
  85.  
  86. 05-DEC-84 Jeff Duncan - Initial release of Turbo Pascal Kermit for CP/M-80.
  87.  
  88.  
  89.                Turbo Pascal Kermit Description
  90.  
  91.   The  motivation  behind  writing a Kermit implementation in Turbo Pascal was
  92. principally to have a generic Kermit that would run on a  variety  of  systems
  93. without  any  modification.   Turbo  Pascal  has  turned  out  to be a popular
  94. language because of its speed, ease of use, and features.  It  seemed  logical
  95. therefore  to  write  a  Kermit  in  Pascal  that could be transported without
  96. difficulty to many machines.
  97.  
  98.   This program is still in its developmental stage.  There are still some bugs
  99. that have to be worked out, and there are features that should be added, but I
  100. hope this is a good starting point!
  101.  
  102.   The original goal of this project was to produce a Kermit that could compete
  103. speed-wise with an assembly language version, but be written in a higher level
  104. language  that  would  be easier to maintain and could be used in a variety of
  105. systems.  It would also be easily adaptable to other  operating  systens  that
  106. can  run  Turbo Pascal such as MS-DOS and CP/M-86.  To a large extent, this is
  107. true.  There is  more  operating  system  dependent  code  than  I  originally
  108. intended,  but  most of it is in a few routines that could be rewritten easily
  109. for another operating system.  The performance is good considering that it  is
  110. written in Pascal.  Connect mode appears to be glitch-free at 9600 baud, and I
  111. have  had  no  problems  with  file tranfer due to speed at 9600 baud as well,
  112. using two DEC VT-180's, running both normal CP/M and  ZCPR2.   The  degree  of
  113. buffering on various computers could affect this.
  114.  
  115.                       Command Summary
  116.  
  117. *****************************************************************************
  118.  
  119.                     IMPORTANT NOTE
  120.  
  121.   To  abort  form  send  or  receive  use -- ^D -- NOT ^C.  This is because of
  122. testing problems using ^C.
  123.  
  124. *****************************************************************************
  125.  
  126.  
  127.  
  128.  
  129.   I  have  no  intention in this preliminary documentation to provide detailed
  130. descriptions of all the commands in this version of  Kermit.   They  are  well
  131. documented  in  the  Kermit  Users  Manual and the Protocol manual provided by
  132. Columbia.  I hope  that  the  following  will  help  show  what  features  are
  133. available  and  any  bugs  or  unresolved  issues there are in the implemented
  134. commands.
  135.  
  136.   A note about the command parser: This parser will not allow ?  and escape as
  137. in  DEC-20  and  others.   However,  the  minimum  unique abbreviation will be
  138. recognized as a valid command.  A good portion of the parser to  do  this  has
  139. been  written,  and  may be added to Turbo Kermit at a later time.  Both upper
  140. and lower case letters are acceptable as input.
  141.  
  142. Connect - Establish  a  virtual  terminal  connection to a host connected to a
  143.           serial port on the  computer.   The  current  version  supports  the
  144.           reader/punch  port  and  the  UC1: port, because it was written on a
  145.           VT180.  Selection of port is done  by  the  SET  command,  and  port
  146.           switching  is  done  by  manipulating  the  CP/M  standard IOBYTE at
  147.           location 3.  I/O is done by calls to BIOS via Turbo Pascal  standard
  148.           functions  and  procedures.   Escape  from CONNECT mode is done with
  149.           ^\-C.  Operation, as mentioned before, appears correct at 9600  baud
  150.           on a VT180.
  151.  
  152. Send -    Send  the  selected file to the remote Kermit.  At present wildcards
  153.           are not supported, but hooks are there to add this feature.
  154.  
  155. Receive - Receive  file(s) from the remote Kermit.  Files will be received and
  156.           stored in the same names that the remote  Kermit  specifies  in  its
  157.           file  header  packet(s).   Multiple  files  may  be  received.  This
  158.           command does not request files from the  remote  Kermit.   It  waits
  159.           until  the  remote  Kermit  initiated  the  file  transfer.   If the
  160.           filename being sent already exists, Turbo  Kermit  will  attempt  to
  161.           create  a  unique  filename  for the file.  If this is successful, a
  162.           message to this effect will be printed on the screen.
  163.  
  164. Get <filespec> -
  165.       Request  from  a  remote  server  that certain file(s) be sent.  The
  166.           filespec as typed is sent exactly to the remote Kermit.  Files  will
  167.           be received and stored as in receive mode.
  168.  
  169. Bye -      When  sent  to  a remote server, log out the server, and log out the
  170.           host.  If the logout of the server is successful, exit to CP/M.   If
  171.           it  is unable to logout the remote host, Turbo Kermit returns to the
  172.           prompt level.  This is to allow reconnection to  the  remote  system
  173.           for further action without having to reload Kermit.
  174.  
  175. Finish -  Log  out  the  remote server.  If this is unsuccessful, a message is
  176.           displayed at the terminal.
  177.  
  178. Logout -  Logout the remote server and the remote system and remain in Kermit.
  179.  
  180. Dir -      Print  a  directory listing for any drive.  Wildcards are allowed in
  181.           the filespec following the Dir command.
  182.  
  183. Era -      Erase  any file(s) specified on any drive.  Wildcards are allowed in
  184.           the filespec following the Era command.
  185.  
  186. Set -      Set  a  Turbo  Pascal  Kermit  parameter.   The  following are valid
  187.           parameters:
  188.  
  189.       PRINTER - on of off.  WIll turn the printer on for logging a virtual
  190.           terminal connection only.
  191.  
  192.       PARITY - mark, space, even, odd, or none.  this will convert the 8th
  193.           bit  of a file transfer to the appropriate parity for file transfer.
  194.           Parity is stripped on receive.  Any parity except none will  attempt
  195.           8th bit quoting if binary files are selected.
  196.  
  197.       FILE - Binary or Ascii.  If ASCII is selected, all files transmitted
  198.           will  be terminated on the first ^Z detected in the file.  Receiving
  199.           will continue until an end of file packet is received.  When  binary
  200.           is  selected,  the  files  will  be sent until CP/M signals the last
  201.           sector.  As mentioned above, binary file transfer will be  attempted
  202.           using 8th bit quoting if parity other than none is selected.
  203.  
  204.       PORT  - Currently only reader/punch and UC1: are supported using the
  205.           CP/M standard IOBYTE.
  206.  
  207.                   Program Organization
  208.  
  209.   Because  the program is not fully documented, the following is a description
  210. of the organization of the program to help find what's where.   Because  Turbo
  211. will  only  handle  a  limited size file, there are a number of include files.
  212. This was also done so that the program will compile  in  memory  to  speed  up
  213. debug.
  214.  
  215.   The files required are:
  216.  
  217.    K.PAS    - program header, include's, and main procedure
  218.    KINIT.PAS    - type, const, and var declarations, and general utilities
  219.    KDIR.PAS    - directory listing procedures
  220.    KOPEN.PAS    - open a file on the micro
  221.    KDISPLAY.PAS    - display procedures for send and receive
  222.    KHELP.PAS    - help displays and set parameter procedures
  223.    KREC.PAS    - general receive procedures
  224.    KTERM.PAS    - virtual terminal mode
  225.    KSEND.PAS    - sending a file to remote
  226.    KREC1.PAS    - receiving a file from remote
  227.    KCMD.PAS    - command parser
  228.  
  229.   The following is a list of procedures and functions by file:
  230.  
  231. File -    K.PAS
  232.            none
  233.  
  234. File -    KINIT.PAS
  235.  
  236.         Tab        generates a string of spaces
  237.         Ctl        conversion to/from control character
  238.         Char40        adds 40 hex to integer to produce character
  239.         Unchar        subtracts 40 hex from character to produce
  240.                 integer
  241.         Ltrim        removes leading spaces from string
  242.         Rtrim        removes trailing spaces from string
  243.  
  244. File -    KDIR.PAS
  245.  
  246.         Adjust_Fn    expands string to CP/M filename format
  247.                 also inserts wildcard characters
  248.         Init_Fcb    sets up FCB for filename search
  249.         Searchfirst    calls bdos for searching for filename
  250.         Searchnext    calls bdos for searching for filename
  251.         Dir        generates directory listing
  252.         Delfile        delete specified file(s)
  253.         Deletefile    calls BDOS for the delete
  254.  
  255. File -    KOPEN.PAS
  256.  
  257.         Open_File    tries to open a file
  258.         Open_For_Write    tries to open a file for Writing
  259.  
  260. File -    KDISPLAY.PAS
  261.  
  262.         Displayt    base display for send mode
  263.         Displayr    base display for receive mode
  264.         Update        update the display
  265.  
  266. File -    KHELP.PAS
  267.  
  268.         Show        show local parameters
  269.         Help        display help message
  270.         Set_Param    sets up local parameter
  271.  
  272. File -    KREC.PAS
  273.  
  274.         Get_Char    tries to get a character form port
  275.                 also monitors crt for abort or retry
  276.         Receive_Packet    get a complete packet from remote
  277.  
  278. File -    KTERM.PAS
  279.  
  280.         Send_Char    send a character to port
  281.         Term        virtual terminal mode
  282.  
  283. FILE -    KSEND.PAS
  284.  
  285.         Check_Init    sets up parameters from send init dialogue
  286.         Check_Ack    checks ack packet for correctness
  287.         Send_Packet    send a packet to remote
  288.         Build_Packet    put checksum and parity on packet
  289.         Quit        return to CP/M unconditionally
  290.         Finish        handle bye, finish, and logout commands
  291.         Send        send a file to remote host
  292.         Get_File_Data    build a data packet
  293.         Sinit        send init state handler
  294.         Sheader        send file header handler
  295.         Sfile        send file data handler
  296.         Seof        send end of file handler
  297.         Sbreak        send break handler
  298.         Send_Ack    send an ack packet
  299.         Send_Nak    send a nak packet
  300.  
  301. File -    KREC1.PAS
  302.  
  303.         Rheader        receive file header packet
  304.         Get        send server get command
  305.         Rinit        receive send init packet
  306.         Expand_Packet    disect received data packet
  307.         Rfile        receive file data
  308.  
  309. File -    KCMD.PAS
  310.  
  311.         Parse        parse the command line
  312.         Prompt        display a prompt
  313.         Get_Command_Line dispatch command per typed command line
  314.  
  315.  
  316.                 System Dependent Code
  317.  
  318.   The  original  intent  of  Turbo  Pascal  Kermit was to produce a version of
  319. Kermit that would be written with a minimal need for  system  dependent  code.
  320. Turbo  Pascal provides general procedures for screen handling that obviate the
  321. need for much system (or terminal dependent) code, but there  are  some  areas
  322. that must be written with the target system in mind.  Somethings just can't be
  323. done without these routines, and speed is enhanced by using them.
  324.  
  325.   However,  Turbo Pascal is quite fast.  In this implementation, I have had no
  326. need to add assembly language routines to implement the  most  critical  speed
  327. related routines, terminal mode and send/receive packets.  I have, though, had
  328. to  add  system  dependent code.  This version of Kermit is designed to run on
  329. CP/M-80 only.  In all the terminal and communications  port  routines  I  have
  330. used BIOS calls.  These have allowed a terminal mode that will operate at 9600
  331. baud.  BIOS calls have also been used to send and receive data packets.  These
  332. are  not  quite as fast, but appear to limited to slightly less than 4800 baud
  333. with no buffering of data in the basic operating system.  The  other  area  of
  334. this  program  that  uses  CP/M-80  system  calls  is  the  directory printing
  335. routines.
  336.  
  337.   I  was  planning  to separate all the system dependent code into one module,
  338. but decided against that because there is too much of it and the routines span
  339. several blocks that do not logically fit together.  Instead, this  section  of
  340. the manual for Turbo Kermit is intended to detail those areas that have system
  341. dependent  code  for those who may be interested in modifying this version for
  342. other operating systems.
  343.  
  344.    1. Directory Listings
  345.  
  346.       The  directory  listing  code of Turbo Kermit are almost entirely system
  347.     dependent.  The directory information is extracted via BIOS calls, and the
  348.     directory mask is converted to upper case and expanded to be  readable  by
  349.     CP/M-80.   This  will  probably  be  different  for  most  other operating
  350.     systems.
  351.  
  352.    2. IOBYTE
  353.  
  354.       All  communications  (terminal  mode  and send/receive packets) are done
  355.     with CP/M Bios calls.  In order to interrogate the various ports, the CP/M
  356.     IOBYTE is changed to reflect  the  desired  communications  port  desired.
  357.     This  version  presumes  that  the  IOBYTE  is located in RAM at 0003 hex.
  358.     Three  variables  are  used  to  set  the  IOBYTE.   They  are   'iobyte',
  359.     'base_iobyte',  and  'port_iobyte'.   'base_iobyte'  is a copy of 'iobyte'
  360.     when the program is entered.  'port_iobyte' is initially set to  point  at
  361.     the  reader/punch port.  This variable can be changed using the 'SET PORT'
  362.     command (procedure located in file 'khelp.pas'.  Additional ports  can  be
  363.     added in this routine.
  364.  
  365.   3. Sending characters to communications port
  366.  
  367.       The include file 'kterm.pas' includes the virtual terminal mode, and the
  368.     only  procedure  that  transmits  to  the remote ports, 'send_char'.  This
  369.     procedure resets the IOBYTE to point at the appropriate port and sends the
  370.     character using a BIOS call.  This routine could  be  easily  replaced  to
  371.     send a character on another type of system.
  372.  
  373.   4. Receiving packet data
  374.  
  375.      When  receiving  packet  data  from  a  communications  port, a procedure
  376.     located in the include file 'krec.pas' is used.   This  procedure,  called
  377.     'get_char'  performs  the  same type of port switching required by CP/M to
  378.     check status as virtual terminal mode.  This routine can  be  replaced  by
  379.     something a different operating system can understand.
  380.  
  381.   5. Virtual terminal mode
  382.  
  383.      Virtual terminal mode is riddled with CP/M BIOS calls.  Because CP/M does
  384.     not  allow  port  status  to  be  read except when the port is the logical
  385.     console, termianl mode is a loop that changes the ports to be the console,
  386.     and checks the status.  When the status indicates a character is available
  387.     at the communications port, it is fetched and sent to the screen.  When  a
  388.     character  is typed at the keyboard, it is sent to the communications port
  389.     via the 'send_char' procedure above.   Terminal  mode  would  have  to  be
  390.     rewritten for any other type of system.
  391.  
  392.      There  is  no terminal emulation package in this version of Kermit.  This
  393.     would be difficult to accomplish and still maintain any reasonable speed.
  394.  
  395.   6. Opening files
  396.  
  397.      File  opening  and  closing  is  all  done  with Turbo Pascal procedures.
  398.     However, the size of the the filenames is hard encoded into  the  routines
  399.     so  some messing around will be required for systems that handle different
  400.     length filenames.
  401.  
  402.      Note also that the procedure 'adjust_fn' located in 'kdir.pas' is used to
  403.     find  places  to  insert  characters  in the filename if a naming conflict
  404.     occurs when opening a file for  writing.   If  you  change  the  directory
  405.     listing  routines,  leave  that  one  in  there, or implement the filename
  406.     conflict routine differently.
  407.  
  408.   7. Deleting files
  409.  
  410.      Deleting  files  is done with CP/M BIOS routines.  This will also have to
  411.     be rewritten for another system.   listing  routines,  leave  that  one  in  there, or implement the filename
  412.     conflict routine diffe