home *** CD-ROM | disk | FTP | other *** search
/ Columbia Kermit / kermit.zip / a / cpsker.asm < prev    next >
Assembly Source File  |  2020-01-01  |  15KB  |  316 lines

  1. ; CPSKER.ASM
  2. ;       KERMIT - (Celtic for "FREE")
  3. ;
  4. ;       This is the CP/M-80 implementation of the Columbia University
  5. ;       KERMIT file transfer protocol.
  6. ;
  7. ;       Version 4.0
  8. ;
  9. ;       Copyright June 1981,1982,1983,1984
  10. ;       Columbia University
  11. ;
  12. ; Originally written by Bill Catchings of the Columbia University Center for
  13. ; Computing Activities, 612 W. 115th St., New York, NY 10025.
  14. ;
  15. ; Contributions by Frank da Cruz, Daphne Tzoar, Bernie Eiben,
  16. ; Bruce Tanner, Nick Bush, Greg Small, Kimmo Laaksonen, Jeff Damens, and many
  17. ; others. 
  18. ;
  19. ;
  20. ; This is the header for the system-independent portion of KERMIT, which
  21. ; consists of the following files (in this order):
  22. ;
  23. ;       CPSKER.ASM - this file
  24. ;       CPSDEF.ASM - definitions for both KERMIT and KERSYS
  25. ;       CPSMIT.ASM - \initialization, main loop, miscellaneous commands 
  26. ;    CPSCOM.ASM - /(BYE, EXIT, LOG, SET, SHOW, and STATUS) (Part1 of 2)
  27. ;       CPSPK1.ASM - \the KERMIT protocol handler (SEND, RECEIVE, LOGOUT,
  28. ;       CPSPK2.ASM - / and FINISH commands) (In two parts)
  29. ;    CPSREM.ASM - REMOTE commands etc
  30. ;    CPSSER.ASM - SERVER commands etc (Empty as yet)
  31. ;       CPSTT.ASM  - the transparent commands (TRANSMIT, CONNECT)
  32. ;       CPSCPM.ASM - CP/M commands (DIR, ERA)
  33. ;       CPSWLD.ASM - the wildcard handler
  34. ;       CPSCMD.ASM - the command parser
  35. ;       CPSUTL.ASM - utility routines
  36. ;       CPSDAT.ASM - Data space and the overlay link space
  37. ;
  38. ; When building the system-independent part with M80 or MAC80, CPSKER
  39. ; INCLUDEs the other files; when building with LASM, each file LINKs to
  40. ; the next file.
  41. ;
  42. ; For now, the system-dependent routines are all in CPSSYS.ASM, with
  43. ; the actual configuration defined in CPSTYP.ASM.
  44. ;
  45. ; revision history (latest first):
  46. ;
  47. ;    Begin CP/M Kermit-80 version 4.11.
  48. ;edit 32, 1-Apr-1991 by MF. Official release of work to date as CP/M Kermit
  49. ;    (Kermit-80) Version 4.11.
  50. ;    Modified edit level of cpscpm.asm to reflect a bug fix for the TYPE
  51. ;    command introduced with edit 13.
  52. ;edit 31, 29-Mar-1991 by MF. Modified edit levels of cpsker.asm,
  53. ;    cpscom.asm and cpsdat.asm to reflect rename of parameter vermin to
  54. ;    revno (revision level) and change of SET COLLISION REPLACE to
  55. ;    SET COLLISION OVERWRITE to conform with C-Kermit. Modified
  56. ;    edit level of cpsrem.asm to reflect change from REMOTE SET FILE
  57. ;    COLLISION REPLACE to REMOTE SET FILE COLLISION OVERWRITE.
  58. ;    Modified edit level of cpsutl.asm to reflect code tightening and
  59. ;    edit levels of cpsmit.asm and cpspk2.asm to close any open TAKE-file
  60. ;    and abort take-file processing if ^C is typed from the console
  61. ;    Also corrected ^Z test in cpsmit.asm in INPUT command ("inp2b")
  62. ;    Implement "file not found" complaint if a TAKE command can't find
  63. ;    the TAKE-file and it's not the initial TAKE (KERMIT.INI)
  64. ;    Modified edit level of cpscpm.asm to reflect modification of the
  65. ;    TYPE and PRINT commands to cancel file typeout/printout completely
  66. ;    if ^C is entered on the console (either immediately or after a key
  67. ;    has been pressed to induce a pause) and to immediately begin
  68. ;    typeout/printout of the next file (if the filespec was wild-carded)
  69. ;    if ^X is entered (either immediately or after a key has been pressed
  70. ;    to induce a pause).
  71. ;    Modified edit levels of cpsmit.asm and cpscom.asm to reflect addition
  72. ;    of the STAY command as a synonym for SET NO-EXIT.
  73. ;edit 30, 27-Feb-1991 by MF. Modified edit levels of cpscom.asm,
  74. ;    cpsmit.asm, cpsutl.asm and cpsdat.asm to reflect provision for
  75. ;    a "revision level" field (1-26=A-Z), addition of QUIT as a synonym
  76. ;    for the EXIT command, recognition of C, R and S as abbreviations
  77. ;    for the CONNECT, RECEIVE and SEND commands, respectively, display
  78. ;    of Kermit version in the VERSION command and a fix to the TAKE-file
  79. ;    input routine "r1tchr" to prevent semicolons from being interpreted
  80. ;    as command separators during TAKE-file execution. This last fix
  81. ;    allows such commands as REMOTE DELETE *.*;* to Kermit-32 to
  82. ;    operate as expected.
  83. ;edit 29, 14-Feb-1991 by MF. Updated edit levels of cpscom.asm,
  84. ;    cpscpm.asm, cpsdat.asm and cpsrem.asm to reflect bug fixes,
  85. ;    code tightening and simplified routine "remcli" (in cpsrem.asm)
  86. ;    which gets text to be passed on to a remote Kermit in REMOTE
  87. ;    Kermit commands.
  88. ;edit 28, 8-Feb-1991 by MF. Changed edit level of cpscpm.asm to reflect
  89. ;    a bug fix to make TAKE-files work properly with commands such as
  90. ;    INPUT which check the keyboard for input.
  91. ;edit 27, 30-Jan-1991 by MF. Changed edit levels of cpscpm.asm, cpsrem.asm,
  92. ;    cpstt.asm and cpsutl.asm to reflect bug fixes and enhancements
  93. ;edit 26, 17-Jan-1991 by MF. Changed edit level of cpscmd.asm to
  94. ;    reflect fixes to allow leading spaces/tabs to be ignored when
  95. ;    parsing keywords (this was the intent but the code never worked
  96. ;    correctly) and to blank the entire fcb in "cmifil" to allow successive
  97. ;    COPY commands to function properly. Also changed edit level of
  98. ;    cpspk1.asm to reflect further work on "disk full" error reporting.
  99. ;edit 25, 14-Jan-1991 by MF. Incremented edit level of cpspk1.asm to
  100. ;    reflect bug fix to "disk full" error reporting code so <cr><lf>
  101. ;    is not sent directly to the Remote Kermit. This per a report from
  102. ;    Russell Lang of Australia's Monash University.
  103. ;edit 24, 10-Jan-1991 by MF. Modified edit level of cpxtyp.asm to
  104. ;    reflect addition of "terminal required" message for some.
  105. ;    machines.
  106. ;edit 23, 7-Jan-1991 by MF. Modified edit levels of cpxtyp.asm, cpxswt.asm,
  107. ;    cpxbbi.asm to reflect addition of Ampro Little Board support.
  108. ;edit 22, 3-Jan-1991 by MF. Incremented edit levels of cpspk1.asm/cpspk2.asm
  109. ;    to reflect further mods to "sdata" and "inchr" routines.
  110. ;edit 21, 2-Jan-1991 by MF. Incremented edit level of cpspk1.asm to reflect
  111. ;    code cleanup in "sdata" routine.
  112. ;edit 20, 26-Dec-1990 by MF. Modified edit level of CPSCMD.ASM to reflect
  113. ;    fix to allow leading white space to be skipped in lines from
  114. ;    TAKE-files as well as from the CP/M command-line tail; this per a
  115. ;    phoned-in bug-report to Dr. Martin J. Carter of Nottingham
  116. ;    University in the U.K. (PPZMAJOC@vax.ccc.nottingham.ac.uk)
  117. ;edit 19, 14-Dec-1990 by MF.  Modified edit level of cpspk2.asm to reflect
  118. ;    modification to "gofil" to allow drive specifications in 2nd
  119. ;    filename of GET and RECEIVE commands; also modified edit levels of
  120. ;    cpspk1.asm and cpsrem.asm to reflect addition of "<<>>" around
  121. ;    "X" or "F" packets coming as a reply to a REMOTE command and
  122. ;    deletion of an unnecessary instruction before label remc2d
  123. ;    in cpsrem.asm.
  124. ;edit 18, 9-Dec-1990 by MF. Modified edit levels for Version 4.10
  125. ;    yet another time to reflect changes in CPSDAT.ASM to clarify
  126. ;    "File size on DIR" status message.
  127. ;edit 17, 4-Dec-1990 by MF. Adjusted edit levels of cpscom.asm/cpsdat.asm
  128. ;    to reflect addition of Autoreceive status to SHOW/STATUS display.
  129. ;edit 16, 30-Nov-1990 by MF. Adjusted edit levels of cpscom.asm/cpsdat.asm
  130. ;    to reflect fix to SHOW/STATUS routines to show terminal display
  131. ;    mode (quiet/regular). Also adjusted edit level of cpsutl.asm to reflect
  132. ;    change to routine "p20ln" to use "pausit" to save code space.
  133. ;    Adjusted edit level of cpsdef.asm to reflect change in "fairness"
  134. ;    counter prfair from 100 to 50 to make terminal a bit more responsive
  135. ;    during CONNECTs.
  136. ;edit 15, 27-Nov-1990 by MF. Adjusted edit level of cpspk1.asm to reflect
  137. ;    a bug fix.
  138. ;edit 14, 27-Nov-1990 by MF. Again adjusted edit level of cpspk1.asm to
  139. ;    reflect modifications of "disk-full"and SET INCOMPLETE-FILES behavior.
  140. ;edit 13, 23 Nov-1990 by MF.  Adjusted edit level of cpspk1.asm to reflect
  141. ;    code changes for "disk full" processing.
  142. ;edit 12, 8-Nov-1990 by MF.
  143. ;    Adjusted edit levels shown for cpscom.asm/cpspk1.asm/cpsdat.asm to
  144. ;    reflect bug fixes and code revisions.
  145. ;edit 11, 5-Nov-1990 by MF.
  146. ;    Cosmetic changes for main help text for COPY and RENAME commands.
  147. ;    Begin CP/M Kermit-80 version 4.10.
  148. ;edit 10, 2-Nov-1990 by MF.  Moved Overlay address to 7000H (cpsdat.asm).
  149. ;edit 9, 1-Nov-1990 by Mike Freeman (BPA).  Cosmetic changes (command-name
  150. ;    changes:  SET BAUD-RATE==>SET SPEED, FCOPY==>COPY, FRENAME==>RENAME,
  151. ;    STRING==>OUTPUT, REMOTE CWD==>REMOTE CD per suggestions of FDC
  152. ;    to aid in uniformity of nomenclature for various Kermits.
  153. ;edit 8, 30-Oct-1990 by Michael Freeman; 301 N.E. 107th Street;
  154. ;    Vancouver, WA 98685 USA; Telephone (206)574-8221.
  155. ;    Work:  Bonneville Power Administration
  156. ;    P.O. Box 491 M/S MORF
  157. ;    Vancouver, WA USA 98666
  158. ;    Telephone (206)690-2307
  159. ;    Implemented FRENAME command to rename a CP/M file.
  160. ;    Implemented many Remote commands, variable-length packets up thru
  161. ;    94 characters in length.  Fixed a bug in CPSCOM.ASM in the
  162. ;    routine "getnp" and a bug in CPSCOM.ASM which caused garbage to appear
  163. ;    on the screen when PRTSTR was called with QUIETD flag set.
  164. ;    Modified code in module CPSCMD.ASM to skip leading spaces and tabs
  165. ;    when getting Kermit commands from the CP/M command line.  This also
  166. ;    obviates the necessity to type a leading semicolon to separate the
  167. ;    Kermit command from the Kermit commands on the CP/M command line.
  168. ;    Fixed code in CPSPK2.ASM which handles file collision detection
  169. ;    and resulting file rename per my entries in CPKERM.BWR.
  170. ;    and included fix by Russell Lang of Dept. of Electrical and Computer
  171. ;    Engineering, Monash University, Australia, to prevent renamed
  172. ;    files with SET WARNING ON from having the attributes (e.g., R/O)
  173. ;    copied from original file.  Mr. Lang's E-mail address is:
  174. ;    Russell Lang    Email: rjl@monu1.cc.monash.edu.au  Phone: (03) 565 3460
  175. ;    Department of Electrical and Computer Systems Engineering
  176. ;    Monash University, Australia
  177. ;    Also fixed a bug in CPSPK2.ASM which prevented completion messages
  178. ;    from being displayed if terminal was set to QUIET.
  179. ;    Implemented most proposed SET FILE-COLLISION (COLLISION) commands.
  180. ;    Implemented SET INCOMPLETE file disposition command.
  181. ;    Implemented a few of the proposed REMOTE SET commands.
  182. ;    Implemented other fixes suggested in CPKERM.BWR.
  183. ;    Moved overlay address to 6C00H.
  184. ;    Changed location of .printx in this file so LASM doesn't complain.
  185. ;    In system-dependent modules, included HP-125 support.
  186. ;    Also modified Telcon Zorba code in CPXHEA.ASM to enable setting
  187. ;    of baud-rates and sending of a break.
  188. ;    Included Russell Lang of Monash Univ. Australia's implementation
  189. ;    for the Microbee series of computers (CPXBEE.ASM).
  190. ;    Fixed COMPUPRO version of Kermit to compile correctly and to
  191. ;    conform to current syntax for setting baud-rate.
  192. ; edit 7, September, 1987.  Added files for SERVER and REMOTE 
  193. ;    modules (CPSSER/CPSREM).  SERVER is still empty, and may be 
  194. ;    only wishfull thinking.  I have ideas, but I dont think I 
  195. ;    will have the time to implement it.
  196. ;
  197. ; edit 6: 30 March, 1987 by OBSchou.  Start Kermit-80 V4.09 with the 
  198. ;    overlay address at 6000h.  Also adjusted the INCLUDEs to allow
  199. ;    M80 to assmeble these files.
  200. ;
  201. ; edit 5: 20 June, 1986.  Have added so much code etc that the overlay had to 
  202. ;       be moved again.. give it to 5000h.  This starts off Kermit-80 V4.08
  203. ;
  204. ; edit 4 22 April 1986
  205. ;       Start work on 4.06.  This should clear up a couple of bugs, add in
  206. ;       a few features, and split the system dependent stuff into 
  207. ;       smaller units.
  208. ;
  209. ; edit 3a 7 March 86 OBSchou Loughborough england.  Minor additions
  210. ;       to cpsker.asm, cpscmd.asm and cpspkt.asm.
  211. ;
  212. ; edit 3: February 10, 1985 (CJC)
  213. ;       Update for v4.05; add "verno" so CPSUTL doesn't have to change
  214. ;       just because some other module did.
  215. ;
  216. ; edit 2: September 10, 1984 (CJC)
  217. ;       Update for v4.03.
  218. ;
  219. ; edit 1: July 27, 1984 (CJC)
  220. ;       Created to allow assembly of Kermit by LASM as well as MAC80 and M80.
  221.  
  222. verno    EQU    11        ; minor version number
  223. revno    EQU    0        ;[MF]Revision level
  224.                 ;[MF]0-26 yields A-Z
  225.     
  226. ; Version 4.10 of Kermit consists of the following edit levels:
  227. ;       cpsker.asm edit 32
  228. ;       cpsdef.asm edit 9
  229. ;       cpsmit.asm edit 30
  230. ;       cpscom.asm edit 13
  231. ;       cpspk1.asm edit 23
  232. ;       cpspk2.asm edit 11
  233. ;       cpsrem.asm edit 13
  234. ;       cpsser.asm edit 1
  235. ;       cpstt.asm  edit 12
  236. ;       cpscpm.asm edit 14
  237. ;       cpswld.asm edit 4
  238. ;       cpscmd.asm edit 13
  239. ;       cpsutl.asm edit 30
  240. ;    cpsdat.asm edit 19
  241. ;       cpxlnk.asm edit 8 (cpslnk.asm is not assembled with cpsker, but it
  242. ;               defines the linkage area expected by cpsker, and so must
  243. ;               match the description in cpsutl.asm)
  244. ;    cpxswt.asm edit 10
  245. ;
  246. ; Version 4.10 of Kermit has been tested with the following edit levels of
  247. ; the system-dependent files:
  248. ;       cpxtyp.asm edit 34
  249. ;       cpxsys.asm edit 40
  250. ;    cpxhea.asm edit 4
  251. ;    cpxtor.asm edit 4
  252. ;    cpxbbi.asm edit 4 (Ampro Little Board)
  253. ;
  254. ; Version 4.10 of Kermit is still to be tested fully against all known systems
  255. ; so far included in the system dependent overlays.
  256. ;
  257.  
  258.  
  259. FALSE    equ    0
  260. TRUE    equ    NOT FALSE
  261.  
  262. cpsker    equ    TRUE    ; building system-independent part
  263. debug    equ    FALSE    ; set false for running system.  True => does some
  264.             ; unusual or unexpected things.
  265. ;
  266. ; Assembler type.  Define the appropriate one TRUE, the rest FALSE.  (We can't
  267. ; use ASM, because it cannot handle multiple input files)
  268. mac80    EQU    FALSE        ; For assembly via MAC80 cross-assembler.
  269. m80    EQU    false        ; For assembly via Microsoft's M80.
  270. lasm    EQU    true        ; For assembly via LASM, a public-domain
  271.                 ; assembler.
  272. ;
  273. ;       Get the other modules...
  274.  
  275. IF lasm                ; If we're linking, go on to the next file.
  276.     LINK    CPSDEF
  277. ENDIF;lasm
  278.  
  279. ; If we're still here, we must be using M80 or MAC80.  M80 doesn't
  280. ; like ENDs inside conditionals, but the END statement has to be
  281. ; in CPSUTL for LASM (otherwise, we'd need a file containing just an
  282. ; END statement).  So, we leave off the IF m80 OR mac80 conditional
  283. ; that ought to be around these INCLUDEs.  No problem until the next
  284. ; incompatible assembler comes along...
  285. ; Let's first say where we are:
  286. ;
  287. .printx    * CPSKER.ASM (or nearest offer)    *
  288. ;
  289. .printx    * CPSDEF.ASM *
  290.     INCLUDE    CPSDEF.ASM    ; definitions
  291. .printx    * CPSMIT.ASM *
  292.     INCLUDE    CPSMIT.ASM    ; initialization, main loop, some commands
  293. .printx * CPSCOM.ASM *
  294.     INCLUDE CPSCOM.ASM    ; part of command/status/set etc
  295. .printx    * CPSPK1.ASM *
  296.     INCLUDE    CPSPK1.ASM    ; KERMIT protocol handler (Part 1)
  297. .printx    * CPSPK2.ASM *
  298.     INCLUDE    CPSPK2.ASM    ; KERMIT protocol handler (Part 2)
  299. .printx * CPSREM.ASM *
  300.     INCLUDE CPSREM.ASM    ; Kermit REMOTE code (little in it, as yet)
  301. .printx * CPSSER.ASM *
  302.     INCLUDE CPSSER.ASM    ; Kermit SERVER code (As yet, empty)
  303. .printx    * CPSTT.ASM *
  304.     INCLUDE    CPSTT.ASM    ; transparent communication handler
  305. .printx    * CPSCPM.ASM *
  306.     INCLUDE    CPSCPM.ASM    ; CP/M command support (DIR, ERA)
  307. .printx    * CPSWLD.ASM *
  308.     INCLUDE    CPSWLD.ASM    ; wildcard handler
  309. .printx    * CPSCMD.ASM *
  310.     INCLUDE    CPSCMD.ASM    ; command parser
  311. .printx    * CPSUTL.ASM *
  312.     INCLUDE    CPSUTL.ASM    ; Various utilities and data, and END [ToadHall]
  313. .printx * CPSDAT.ASM *
  314.     INCLUDE CPSDAT.ASM
  315.     END            ; MAC80 ignores END's in included files...
  316.