home *** CD-ROM | disk | FTP | other *** search
/ Columbia Kermit / kermit.zip / ccpm86 / cn8ker.a86 < prev    next >
Text File  |  2020-01-01  |  39KB  |  1,351 lines

  1. ; * * * * * * * * * * * * * * *  version 2.9  * * * * * * * * * * * * * * *
  2. ;
  3. ; [35]  Change file names in INCLUDE statements, fdc, 5 Jun 85
  4. ;
  5. ; [34]
  6. ; (c)    Make memory allocation global, add sorted SEND capability.
  7. ; (b)    Add LOCAL TYPE command to display files on screen
  8. ; (a)    Fix directory file size calculation errors
  9. ;    RonB, 11/13/84
  10. ; * * * * * * * * * * * * * * *  version 2.8  * * * * * * * * * * * * * * *
  11. ; [33] Fix printer on hanging system problem by letting CP/M handle the
  12. ;    interrupts from the 7201 that we don't care about.  Thanks to
  13. ;    Paul Ford, U. of Chicago Graduate School of Business
  14. ;    WBC3, 10/1/84
  15. ; [32]
  16. ; (e)    Change all LEA xx,yy instructions to MOV xx,OFFSET yy
  17. ; (d)    Add LOCAL and REMOTE command table entries, implementing LOCAL
  18. ;    DELETE, DIRECTORY and SPACE commands (KERMIT,KERUTL)
  19. ; (c)    Fix RECEIVE FILENAME to be different from GET (KERMIT,KERCMD,KERFIL)
  20. ; (b)    Fix minor bugs (KERMIT,KERCMD)
  21. ; (a)    Add SET option for default drive and user (KERMIT,KERCMD,KERUTL)
  22. ;    RonB, 09/20/84
  23. ;* * * * * * * * * * * * * * * version 2.7 * * * * * * * * * * * * * * *
  24. ; [31]    Fix display of file rename
  25. ;    RonB, 05/05/84
  26. ;[fdc]    Add help message about "?" when starting up.
  27. ;    Add help message about "<esc-char>?" when connecting.
  28. ;    Fix glitch in Bernie's command level flagging (KERCMD).
  29. ;    F. da Cruz, Columbia
  30. ;
  31. ;[]    Prefixed all ermes'sages with bell and changed ermes3 (secondary
  32. ;    command didn't parse) from "?Not confirmed" to "?Unrecognized
  33. ;    command-option".
  34. ;    Prettied up (TABs between INSTR and AC's) and fixed SET command
  35. ;    using RSKP convention - B.Eiben, EIBEN at DEC-Marlboro, 2-May-84
  36. ; [30]
  37. ; (e)    Recombine KERSYS and KERMIT.
  38. ; (d)    Add SET PORT command, currently unimplemented (KERMIT,KERIO)
  39. ; (c)    Isolate all machine dependencies in KERIO.
  40. ; (b)    Make DEL work like BS and ^X like ^U in command input (KERCMD).
  41. ; (a)    Add keyboard DEL key alteration for APC (KERIO).
  42. ;    RonB, 04/18/84
  43. ; [29]
  44. ; (g)    Add 8th bit quoting (KERPRO,KERFIL,KERSYS).
  45. ; (f)    Add QUIT command, synonymous to EXIT (KERSYS).
  46. ; (e)    Move logging code to terminal module, make it a SET command,
  47. ;    add quit/resume (^Q/^R) to make it more standard (KERTRM,KERSYS)
  48. ; (d)    Expand receive buffer and check for packet overruns (KERPRO)
  49. ; (c)    Clear FCB prior to opening or creating a file (KERUTL)
  50. ; (b)    Add TAKE file processing, initially from KERMIT.INI
  51. ;    (KERMIT,KERSYS,KERUTL)
  52. ; (a)    Send error packet whenever a fatal error occurs (KERPRO)
  53. ;    RonB, 04/08/84
  54. ;* * * * * * * * * * * * * * * version 2.6 * * * * * * * * * * * * * * *
  55. ; [28]
  56. ; (e)    Add local stack for use in interrupt handling (KERIO)
  57. ; (d)    Improve input filename processing, allow valid special chars
  58. ;    (KERFIL,KERCMD)
  59. ; (c)    Make disk full error messages more accurate (KERSYS)
  60. ; (b)    Include filename in file-not-found error message (KERPRO,KERSYS)
  61. ; (a)    Clear attribute bits from filename before sending (KERPRO)
  62. ;    RonB, 03/27/84
  63. ; [27]    add "Kermit-86" to interrupt messages.    Rg 20-Mar-1984
  64. ; [26]    Move terminal emulation (TELNET) to a separate module: KERTRM.
  65. ;    This is to "modularize" terminal emulation. Rg
  66. ;
  67. ; [25]    Move logic for "seteol" and "escape" from KERSYS into KERCMD so those 
  68. ;    routines need not use internal CMD routines and variables.  For this 
  69. ;    purpose add 2 parse routines and codes: "cmcha" and "cmnum".  Also
  70. ;    eliminate the use of some KERCMD text strings in KERPRO.  The point
  71. ;    of this is to keep calls to CMD modular since I want to eventually
  72. ;    replace the whole thing.
  73. ;    R. Garland    9-Mar-1984
  74. ; [24]
  75. ; (a)    Add terminal session logging (KERMIT,KERSYS,KERUTL)
  76. ; (b)    Allow escape character to local-echo (KERMIT)
  77. ;    RonB, 03/15/84
  78. ;
  79. ; [23]    Fix ASCII-mode-junk-at-end-of-file bug.  (KERFIL)    Rg
  80. ;* * * * * * * * * * * * * * * version 2.5 * * * * * * * * * * * * * * *
  81. ; [22]
  82. ; (a) - Cosmetics - changed FILE-Warning to Warning, parallel to CP/M
  83. ;    Version and makes SET FI Binary painless
  84. ; (b) - made this version 2.5 to stop confusion -B.Eiben DEC Marlboro
  85. ;    7-March-84
  86. ; [21]
  87. ; (a) - Add SET TIMER ON/OFF option, default is OFF (KERSYS,KERPRO)
  88. ; (b) - Change SET FILE-MODE to SET FILE-TYPE to match VAX/VMS (KERSYS)
  89. ; (c) - Move all Set/Show processing to KERSYS (KERMIT,KERSYS)
  90. ;    RonB, 03/05/84
  91. ; [20]
  92. ; (a) -    Fix version & send/receive header for APC (KERSYS,KERPRO)
  93. ; (b) - Add Break processing & set clock rate for NEC (KERIO)
  94. ; (c) - Add escape character help in telnet mode (KERMIT,KERSYS)
  95. ; (d) - Add a pseudo time-out to PRTOUT so it doesn't loop forever (KERIO)
  96. ; (e) - Clean up environment better on KABORT (KERPRO,KERUTL)
  97. ;    RonB, 03/02/84
  98. ;* * * * * * * * * * * * * * * version 2.4 * * * * * * * * * * * * * * *
  99. ; [19]    (let Bill's and Jeff's changes be 17 and 18)
  100. ; (a) - Add flow control for input comm port buffer.  This is primarily to
  101. ;  allow smooth scrolling and "Hold Screen" to work on the Rainbow.  Add
  102. ;  associated Set, Show, and Help for same.  (KERSYS and KERIO)
  103. ; (b) - Clear screen at beginning and end of program. (KERSYS and KERIO)
  104. ; (c) - Give "bdos" mnemonic to interrupt 224. (KERUTL)
  105. ; (d) - Change telnet to check keyboard between comm port reads. (KERMIT)
  106. ;  Woops - can't get this dumb simple thing to work.  Save for later.
  107. ; (e) - Put in Break transmission in connect mode. (KERMIT,KERIO)
  108. ; (f) - Put in ^X/^Z file interruption. (KERSYS, KERPRO, KERFIL)
  109. ; (g) - Put in timeouts for packet receive routines. (KERPRO)
  110. ; [Rg] R. Garland, 2/84,    OC.GARLAND%CU20B@COLUMBIA-20.ARPA
  111. ;    Columbia Univ.        OC.GARLAND@CU20B.BITNET  
  112. ;* * * * * * * * * * * * * * * version 2.3 * * * * * * * * * * * * * * *
  113. ; Fill in the missing parity routines to allow this program to work with
  114. ; IBM mainframes and other systems that require parity (edit marked "[par]").
  115. ; Include RonB's fixes for places where previous edit broke the NEC APC.
  116. ; Jeff Damens, Columbia, 6 Feb 84
  117. ;* * * * * * * * * * * * * * * version 2.2 * * * * * * * * * * * * * * *
  118. ; Added CFIBFs (buffer clearing) where necessary, put conditional assembly
  119. ; code all in two modules (86KERIO and 86KERSYS), created new module
  120. ; (86KERSYS), added CTLPRT routine to print out control chars for the SHOW
  121. ; command, made SERINI called once at the beginning of the program and nowhere
  122. ; else and added user protocol timeouts (hitting a <CR>).
  123. ; Bill Catchings:  12:36pm  Thursday, 19 January 1984
  124. ;* * * * * * * * * * * * * * *  version 2.1  * * * * * * * * * * * * * *
  125. ;  [B.E. 3-Jan-83] added DTR-code (in 86kermit and 86kerio) for RAINBO
  126. ;
  127. ;  [16]    Add file-mode ASCII or BINARY processing.
  128. ;  [15]    Clear screen lines before displaying packet debug.
  129. ;  [14]    Fix nout to print decimal. (KERPRO)
  130. ;  [13]    Use control-Z's for filler in partial sectors instead of nulls. (KERPRO)
  131. ;  [12]    Allow user abort from the keyboard in the send and receive routines.
  132. ;  [11]    Capitalize and parse filename being received. (KERFIL)
  133. ;  [10]    Correct missing elements in the Show display.
  134. ;  [9]    Fix filename parsing, and add wildcard ability. (KERCMD,KERPRO,KERFIL)
  135. ;  [8]    Show choices for ambiguous keywords, finish keyword on '?' (KERCMD)
  136. ;  [7]    Do tab expansion and suppress nulls while in telnet mode. (KERUTL)
  137. ;  [6]    Add support for changing baud rate.
  138. ;  [5]    Put OFF/ON command table in alphabetical order.
  139. ;  [4]    Change default escape character to '^' because NEC keyboard doesn't
  140. ;    generate a control-\.
  141. ;  [3]    Change "esc,'[H'" to "esc,'[1;1H'" to get around bug in NEC BIOS.
  142. ;    This should not affect operation on the Rainbow.
  143. ;  [2]    Add a de-initialization routine for the serial port, to restore
  144. ;    changed interrupt vectors, etc. (KERIO)
  145. ;  [1]    Add I/O support for the NEC Advanced Personal Computer (KERIO)
  146. ;    RonB,12/23/83
  147. ;
  148. ;
  149. ; * * * * * * * * * * * * * * *  version 2.0  * * * * * * * * * * * * * * *
  150. ; KERMIT - KL10 Error-free Reciprocal Micro Interconnect over TTY-lines
  151. ;
  152. ;    Kermit Protocol Version 2
  153. ;
  154. ;    Based on the KERMIT Protocol.
  155. ;
  156. ;    Copyright (C) 1983 William B. Catchings III
  157.  
  158. ; This program implements the Kermit Protocol developed at Columbia
  159. ; University.  This version is being written specifically for the
  160. ; DEC Rainbow 100.  It will hopefully take advantage of much of what
  161. ; was learned in implementing the CP/M-80, DEC-20 and other versions.
  162.  
  163. ; Things to do:
  164. ;    Add new features from Kermit-80, like local CP/M functions
  165. ;    Make all commands the same as those in Kermit-80
  166.  
  167. ; Now all system dependencies have been isolated in 86KERIO, which
  168. ; will be implemented as a separate module for each system.  This
  169. ; eliminates source code ballooning when other systems are added
  170. ; which have (for example) non-ANSI screen controls and terminal
  171. ; emulation capabilities, as well as specific port drivers.
  172. ; Information about what routines are needed in the 86KERIO module
  173. ; is given in the 86KERMIT.HLP and 86KERIO.HLP files.
  174. ;
  175. ; So far the systems supported are:
  176. ;    NEC APC        in 86KERIO.APC
  177. ;    DEC Rainbow    in 86KERIO.RB
  178. ;
  179. ; PIP 86KERIO.A86=86KERIO.???    - will make system-dependent routines available
  180. ; ASM86 86KERMIT $PZ        - will assemble without listing
  181. ; GENCMD 86KERMIT        - will LOAD
  182. ; REN KERMIT.CMD=86KERMIT.CMD    - will make it "real" after testing
  183.  
  184.     TITLE    'Kermit'
  185.  
  186. TRUE    EQU    1
  187. FALSE    EQU    0
  188.  
  189. ; Definitions:
  190.  
  191. soh    EQU    01O
  192. bell    EQU    07O
  193. tab    EQU    11O
  194. lf    EQU    12O
  195. ff    EQU    14O
  196. cr    EQU    15O
  197. xon    EQU    21O
  198. xoff    EQU    23O
  199. esc    EQU    33O
  200. del    EQU    177O
  201.  
  202. parevn    EQU    00H        ;Even parity.            ;[21c] begin
  203. parmrk    EQU    01H        ;Mark parity.
  204. parnon    EQU    02H        ;No parity.
  205. parodd    EQU    03H        ;Odd parity.
  206. parspc    EQU    04H        ;Space parity.
  207. ibmpar    EQU    parmrk        ;IBM's parity (mark).
  208. defpar    EQU    parnon        ;Default parity (none).
  209. defeco    EQU    00H        ;Default is echo off        ;[21a]
  210. defesc    EQU    '\'-100O    ;Escape char is Control backslash by default.
  211.                 ;note: generated by INS key on the APC.
  212. deftmr    EQU    00H        ;Default is timer off        ;[21a]
  213. deflog    EQU    00H        ;Default is logging off        ;[24a]
  214. floxon    EQU    1        ;[19a]
  215. flonon    EQU    0        ;[19a]
  216. diasw    EQU    00H        ;Default is diagnostics off.    ;[21c] end
  217.  
  218.  
  219. ; The actual program:
  220.  
  221.     CSEG            ;Start coding!
  222.  
  223.     call    getdrv        ;Save initial disk and user    ;[32a] begin
  224.     mov    cpmdrv,al
  225.     mov    defdrv,al
  226.     call    getusr
  227.     mov    cpmusr,al
  228.     mov    defusr,al                    ;[32a] end
  229.  
  230. ;    The allocation amount of 245 pages was arrived at by trial and
  231. ;    error.  This figure causes Concurrent CP/M on the NEC APC to only
  232. ;    allocate one additional memory block.  (Since the blocks are 4K
  233. ;    each, one would expect 256...)
  234.  
  235.     mov    cx,245
  236. start1:    push    cx
  237.     mov    word ptr membuf+2, cx    ;Allocate 4K (or less) bytes of memory
  238.     mov    dx, offset membuf    ;   for sorting filenames
  239.     call    allmem
  240.     pop    cx
  241.     cmp    al,0
  242.     loopne    start1
  243.     cmp    cx,0
  244.     jne    reboot
  245.     mov    dx, offset erms25    ;Not enough memory available:
  246.     call    tcrmsg            ;   local dir, del, and type will
  247.     mov    word ptr membuf+2, 0    ;   not be enabled, nor will wildcard
  248.                     ;   sends.        ;[34c] end
  249.  
  250. reboot:    pushf            ;Push flags on CCP's stack.    ;[12]
  251.     pop    ax        ;flags in AX.
  252.     cli                            ;[32b]
  253.     mov    bx, ds        ;Set SS to DS.
  254.     mov    ss, bx
  255.     mov    sp, offset stack ;Set up the stack pointer.
  256.     push    ax        ;Restore the flags.
  257.     popf
  258.  
  259.     call    inidma        ;Set DMA base and offset    ;[34c] begin
  260.     call    serini        ;Do any necessary serial port initialization.
  261.  
  262.     call    dspver        ;Clear screen and print version header
  263.     mov    dx, offset hlpmsg ;[fdc] Give help message about "?"
  264.     call    tmsgcr        ;[fdc]
  265.  
  266. ; This is the main KERMIT loop.  It prompts for and gets the user's commands.
  267.  
  268. kermit:    mov    dx, offset kerm
  269.     call    prompt        ;Prompt the user.
  270.     mov    dx, offset comtab
  271.     mov    bx, offset tophlp
  272.     mov    ah, cmkey
  273.     call    comnd
  274.      jmp    kermt2        ;Tell them about the error.
  275.     mov    cmlevl, 1    ;we're going into options
  276.     call    bx        ;Call the routine returned.
  277.      jmp    kermt3        ;Tell them about the error.
  278.     cmp    extflg, 0    ;Check if the exit flag is set.
  279.     je    kermit        ;If not, do it again.
  280.     call    serfin        ;clean up serial port environment ;[2]
  281.     mov    dl,cpmdrv    ;reset disk and user        ;[32a] begin
  282.     call    setdrv        ; to initial defaults
  283.     mov    dl,cpmusr
  284.     call    setusr                        ;[32a] end
  285.     call    haltf
  286.     retf            ;Just in case!            ;[32b]
  287.  
  288. kermt2:    mov    dx, offset ermes1 ;Give an error.
  289.     call    tcrmsg
  290.     jmp    kermit
  291.  
  292. kermt3:    mov    dx, offset ermes3 ;Give an error.
  293.     call    tcrmsg
  294.     jmp    kermit
  295.  
  296.  
  297. ; This is the EXIT command.  It leaves KERMIT and returns to CP/M.
  298.  
  299. exit:    mov     ah, cmcfm
  300.     call    comnd        ;Get a confirm.
  301.      jmp    r
  302.     mov    extflg, 1    ;Set the exit flag.
  303.     jmp    rskp
  304.  
  305. ; This is the HELP command.
  306.  
  307. help:    mov    ah, cmcfm
  308.     call    comnd        ;Get a confirm.
  309.      jmp    r
  310.     mov    dx, offset tophlp ;Print some help.
  311.     call    tmsg
  312.     jmp    rskp
  313.  
  314.  
  315. ; LOCAL - parse and perform local command            ;[32d] begin
  316.  
  317. loccmd:    mov    dx, offset loctab ;Parse a keyword from the local table.
  318.     mov    bx, offset lochlp
  319.     mov    ah,cmkey
  320.     call    comnd
  321.      jmp    r
  322.     call    bx        ;Call the specific local routine
  323.      jmp    r        ;We got an error
  324.     jmp    rskp
  325.  
  326.  
  327. ; DIRECTORY of local files
  328.  
  329. locdir:    mov    ah, cmifi    ;Parse an input filename
  330.     mov    dx, offset fcb
  331.     call    comnd
  332.      jmp    r
  333.     push    ax        ;Save length of filename
  334.     mov    ah, cmcfm    ;Confirm it
  335.     call    comnd
  336.      jmp    r
  337.     pop    ax
  338.     cmp    ah, 0        ;Read in any chars?
  339.     jne    locd1
  340.     mov    di, offset fcb+1
  341.     call    wldfcb        ;If not, set filename to all wild
  342. locd1:    cmp    byte ptr fcb,0    ;Replace unspecified drive with default
  343.     jne    locd2
  344.     mov    al,defdrv
  345.     inc    al
  346.     mov    byte ptr fcb,al
  347. locd2:    call    dirutl        ;perform directory action (in KERUTL)
  348.      jmp    rskp        ;On error a message has already been issued
  349.     jmp    locs2        ;jump to display space remaining
  350.  
  351.  
  352. ; ERASE local files
  353.  
  354. locera:    mov    ah, cmifi    ;Parse an input filename
  355.     mov    dx, offset fcb
  356.     call    comnd
  357.      jmp    r
  358.     push    ax        ;Save length of filename
  359.     mov    ah, cmcfm    ;Confirm it
  360.     call    comnd
  361.      jmp    r
  362.     pop    ax
  363.     cmp    ah, 0        ;Read in any chars?
  364.     jne    loce1
  365.     mov    dx, offset erms26 ;Illegal (blank) filename
  366.     call    tcrmsg
  367.      jmp    rskp
  368. loce1:    call    erautl        ;Erase utility (in KERUTL)
  369.      jmp    rskp        ;On error a message has already been issued
  370.     jmp    rskp
  371.  
  372.  
  373. ; TYPE local files
  374.  
  375. loctyp:    mov    ah, cmifi    ;Parse an input filename
  376.     mov    dx, offset fcb
  377.     call    comnd
  378.      jmp    r
  379.     push    ax        ;Save length of filename
  380.     mov    ah, cmcfm    ;Confirm it
  381.     call    comnd
  382.      jmp    r
  383.     pop    ax
  384.     cmp    ah, 0        ;Read in any chars?
  385.     jne    loct1
  386.     mov    dx, offset erms26 ;Illegal (blank) filename
  387.     call    tcrmsg
  388.      jmp    rskp
  389. loct1:    call    typutl        ;Type utility (in KERUTL)
  390.      jmp    rskp        ;On error a message has already been issued
  391.     jmp    rskp
  392.  
  393.  
  394. ; SPACE remaining on disk
  395.  
  396. locsiz:    mov    ah, cmifi    ;Parse an input filename
  397.     mov    dx, offset fcb
  398.     call    comnd
  399.      jmp    r
  400.     push    ax        ;Save length of filename
  401.     mov    ah, cmcfm    ;Confirm it
  402.     call    comnd
  403.      jmp    r
  404.     pop    ax
  405.     cmp    ah, 0        ;Read in any chars?
  406.     je    locs1
  407.     mov    dx, offset erms24 ;At most only a drive code should be entered
  408.     call    tcrmsg
  409.      jmp    rskp
  410. locs1:    cmp    fcb,0
  411.     jne    locs2
  412.     mov    al,defdrv
  413.     inc    al
  414.     mov    fcb,al
  415. locs2:    call    spcutl        ;Space utility (in KERUTL)
  416.      jmp    rskp        ;On error a message has already been issued
  417.     jmp    rskp
  418.  
  419.  
  420. ; Fill a file control block filename with ?'s
  421.  
  422. wldfcb:    mov    ax,ds        ;Fill filename with ?'s.
  423.     mov    es,ax
  424.     mov    cx,11
  425.     mov    al,'?'
  426.     rep stosb
  427.     mov    wldflg,0FFh    ;Set wildcard flag
  428.     ret
  429.  
  430.  
  431. ; REMOTE - parse and perform remote command
  432. ;    (not yet implemented)
  433.  
  434. remcmd:    mov    ah,cmtxt    ;Parse arbitrary text up to a CR
  435.     mov    bx, offset data
  436.     call    comnd
  437.      jmp    r
  438.     mov    dx, offset infms6 ;Tell the user that it's not yet implemented.
  439.     call    tcrmsg
  440.     jmp    rskp
  441.  
  442. ;    mov    dx, offset remtab ;Parse a keyword from the remote table.
  443. ;    mov    bx, offset remhlp
  444. ;    mov    ah,cmkey
  445. ;    call    comnd
  446. ;     jmp    r
  447. ;    call    bx        ;Call the specific remote routine
  448. ;     jmp    r        ;We got an error
  449. ;    jmp    rskp                        ;[31b] end
  450.  
  451.  
  452. ; FINISH - tell remote KERSRV to exit.
  453.  
  454. finish:    mov    ah,cmcfm    ;Parse a confirm.
  455.     call    comnd
  456.      jmp    r
  457.     mov    ah, 'F'
  458.     call    gensen        ;Send the finish command.
  459.     jmp    rskp
  460.  
  461. ; BYE - tell remote KERSRV to logout and then exit to CP/M.
  462.  
  463. bye:    mov    ah,cmcfm    ;Parse a confirm.
  464.     call    comnd
  465.      jmp    r
  466.     mov    ah, 'L'
  467.     call    gensen        ;Send the logout command.
  468.     mov    extflg,1    ;Set exit flag.
  469.     jmp    rskp
  470.  
  471. ; LOGOUT- tell remote KERSRV to logout.
  472.  
  473. logout:    mov    ah,cmcfm    ;Parse a confirm.
  474.     call    comnd
  475.      jmp    r
  476.     mov    ah, 'L'
  477.     call    gensen        ;Send the logout command.
  478.     jmp    rskp
  479.  
  480. ; RECEIVE - Receive a file or files from the remote Kermit.    ;[32c] begin
  481. ; A filespec can optionally be specified to rename the received file.
  482.  
  483. rec:    mov    ah, cmofi    ;Parse an output filename
  484.     mov    dx, offset fcb2
  485.     call    comnd
  486.      jmp    r
  487.     push    ax        ;Save length of filename
  488.     mov    ah, cmcfm    ;Confirm it
  489.     call    comnd
  490.      jmp    r
  491.     pop    ax
  492.     cmp    ah, 0        ;Read in any chars?
  493.     jne    rec1
  494.     mov    di, offset fcb2+1
  495.     call    wldfcb        ;If not, set filename to all wild
  496. rec1:    cmp    byte ptr fcb2,0    ;Also make default drive a ?.
  497.     jne    rec2
  498.     mov    byte ptr fcb2,'?'
  499. rec2:    call    read        ;Do the actual protocol work.
  500.     jmp    rskp                        ;[32c] end
  501.  
  502. ; GET - Get a file or files from the remote server Kermit.
  503.  
  504. get:    mov    di, offset fcb2
  505.     mov    byte ptr [di],'?'
  506.     inc    di
  507.     call    wldfcb        ;Receive any filename as is    ;[32c]
  508.     mov    ah, cmtxt    ;Parse an arbitrary text string.
  509.     mov    bx, offset data    ;Where to put the parsed text.
  510.     call    comnd
  511.      jmp    r
  512.     cmp    ah, 0        ;Read in any chars?
  513.     jne    get1        ;If not give an error.
  514.     mov    dx, offset ermes5
  515.     call    tcrmsg
  516.     jmp    rskp
  517. get1:    mov    al, ah
  518.     mov    ah, 0
  519.     mov    argbk1, ax    ;Remember number of chars we read.
  520.     mov    ah, '$'        ;Used for printing.
  521.     mov    [bx], ah
  522.     call    init        ;Paint screen and initialize file buffers.
  523.     call    cfibf        ;Clear any stacked NAKs.
  524.     call    clrfln        ;Prepare to print filename.
  525.     mov    dx, offset data    ;Print file name.
  526.     call    tmsg
  527.     mov    argblk, 0    ;Start at packet zero.
  528.     mov    ah, 'R'        ;Receive init packet.
  529.     call    spack        ;Send the packet.
  530.      jmp    r
  531.     call    read1        ;Join the read code.
  532.     jmp    rskp
  533.  
  534. ; SEND - Send a file or files to the remote Kermit.
  535.  
  536. sencom:    mov    ah, cmifi    ;Parse an input file spec.
  537.     mov    dx, offset fcb    ;Give the address for the FCB.
  538.     call    comnd
  539.      jmp    r        ;Give up on bad parse.
  540.     cmp    ah,0        ;Check for null filename    ;[32c] begin
  541.     jne    $+5
  542.      jmp    r                        ;[32c] end
  543.     cmp    wldflg,0FFh
  544.     jne    sen7
  545.     mov    ah, cmifi    ;Parse first file to send    ;[34c] begin
  546.     mov    dx, offset fcb2
  547.     call    comnd
  548.      nop
  549.      nop
  550.      nop
  551.     mov    bx,offset fcb2+1
  552.     mov    cx,11
  553. sen4:    cmp    byte ptr [bx],'?' ;Replace wildcards with spaces 
  554.     jne    sen5          ;   in starting filename
  555.     mov    byte ptr [bx],' '
  556. sen5:    inc    bx
  557.     loop    sen4
  558.     mov    wldflg,0FFh    ;Show original filename as wild
  559. sen7:    mov    ah, cmcfm
  560.     call    comnd        ;Get a confirm.
  561.      jmp    r        ;Didn't get a confirm.
  562.     call    send
  563.     jmp    rskp
  564.  
  565. ; SET - Set some Kermit parameter.
  566.  
  567. setcom:    mov    dx, offset settab ;Parse a keyword from the set table.
  568.     mov    bx, offset sethlp
  569.     mov    ah,cmkey
  570.     call    comnd
  571.      jmp    r
  572.     call    bx        ;Call the specific set routine in KERSYS.
  573.      jmp    r        ;We got an error
  574.     jmp    rskp
  575.  
  576.  
  577. ; STATUS - Give some statistics on the connection.
  578.  
  579. status:    jmp    show        ;Make STATUS and SHOW synonymous for now ;[32b]
  580.  
  581. ; TAKE - Specify file which will supply command input.        ;[29b] begin
  582.  
  583. take:    mov    ah, cmifi    ;Parse an input file spec.
  584.     mov    dx, offset tkfcb ;Give the address for the FCB.
  585.     call    comnd
  586.      jmp    r        ;Give up on bad parse.
  587.     cmp    ah,0        ;Check for null filename    ;[32c] begin
  588.     jne    $+5
  589.      jmp    r                        ;[32c] end
  590.     mov    ah, cmcfm
  591.     call    comnd        ;Get a confirm.
  592.      jmp    r        ;Didn't get a confirm.
  593.     mov    tkflg, 1    ;Turn on command file input
  594.     mov    tkptr, 0    ;Indicate file not yet open
  595.     jmp    rskp                        ;[29b] end
  596.  
  597. ; TRANSMIT file(s) with no protocol                ;[32e] begin
  598.  
  599. txmit:    mov    ah,cmtxt    ;Parse arbitrary text up to a CR
  600.     mov    bx, offset data
  601.     call    comnd
  602.      jmp    r
  603.     mov    dx, offset infms6 ;Tell the user that it's not yet implemented.
  604.     call    tcrmsg
  605.     jmp    rskp                        ;[32e] end
  606.  
  607. ; Set parity for character in Register AL.
  608.  
  609. dopar:    cmp    parflg, parnon    ;No parity?
  610.     je    parret        ;Just return
  611.     cmp    parflg, parevn    ;Even parity?
  612.     jne    dopar0
  613.     and    al, 7FH        ;Strip parity.
  614.     jpe    parret        ;Already even, leave it.
  615.     or    al, 80H        ;Make it even parity.
  616.     jmp    parret
  617. dopar0:    cmp    parflg, parmrk    ;Mark parity?
  618.     jne    dopar1
  619.     or    al, 80H        ;Turn on the parity bit.
  620.     jmp    parret
  621. dopar1:    cmp    parflg, parodd    ;Odd parity?
  622.     jne    dopar2
  623.     and    al, 7FH        ;Strip parity.
  624.     jpo    parret        ;Already odd, leave it.
  625.     or    al, 80H        ;Make it odd parity.
  626.     jmp    parret
  627. dopar2:    and    al, 7FH        ;Space parity - turn off parity bit.
  628. parret:    ret
  629.  
  630.  
  631.  
  632. ; The following are the SET command subroutines        ;[21c] begin
  633. ;    except for Baud rate and Port selection, which are
  634. ;    isolated in the system dependent modules.
  635.  
  636. ; Sets debugging mode on and off.
  637.  
  638. debset:    mov    dx, offset ontab
  639.     mov    bx, offset onhlp
  640.     mov    ah, cmkey
  641.     call    comnd
  642.      jmp    r
  643.     mov    temp1, bx
  644.     mov    ah, cmcfm
  645.     call    comnd        ;Get a confirm.
  646.      jmp    r        ;Didn't get a confirm.
  647.     mov    bx, temp1
  648.     mov    debug, bl    ;Set the debug flag.
  649.     jmp    rskp
  650.  
  651. ; Sets the default disk and user number for file operations    ;[32a] begin
  652. ; Entry must be in one of the following forms:
  653. ;    d:    = go to drive d (A through P)
  654. ;    u:    = go to user u (0 through 15)
  655. ;    du:    = go to drive d and user u
  656. ;    :    = go to the defaults when Kermit was loaded
  657. ; Whenever a drive is specified, even if it is the same as the current
  658. ; default drive, the drive is logged in so that disks can be swapped
  659. ; without exiting Kermit to type control-C.
  660.  
  661. defset:    mov    ah,cmtxt    ;Get the du: specification
  662.     mov    bx, offset data
  663.     call    comnd
  664.      jmp    r
  665.     mov    byte ptr [bx],0    ;Mark the end of input
  666.     mov    ah,cmcfm    ;Confirm the input
  667.     call    comnd
  668.      jmp    r
  669.     mov    newdrv,0FFh    ;set inputs to show no entry
  670.     mov    newusr,0FFh
  671.     mov    bx, offset data    ;analyze the input
  672.     mov    al,[bx]
  673.     cmp    al,'a'        ;check for lower case drive specification
  674.     jb    defs10
  675.     cmp    al,'p'
  676.     jbe    defs05
  677.     jmp    deferr
  678. defs05:    sub    al,'a'
  679.     jmps    defs15
  680. defs10:    cmp    al,'A'        ;check for upper case drive specification
  681.     jb    defs25
  682.     cmp    al,'P'
  683.     ja    deferr
  684.     sub    al,'A'
  685. defs15:    mov    newdrv,al    ;save the new drive specification
  686. defs20:    inc    bx
  687.     mov    al,[bx]
  688. defs25:    cmp    al,':'        ;input must terminate with required colon
  689.     je    defs50
  690.     cmp    al,'0'        ;check for user number digit
  691.     jb    deferr
  692.     cmp    al,'9'
  693.     ja    deferr
  694.     sub    al,'0'
  695.     mov    dl,al
  696.     cmp    newusr,0FFh    ;is this the first digit?
  697.     jne    defs30
  698.     mov    newusr,dl    ; yes, just store the digit
  699.     jmps    defs20
  700. defs30:    mov    al,newusr    ; otherwise append digit to current value
  701.     mov    dh,10
  702.     mul    dh
  703.     add    al,dl
  704.     mov    newusr,al
  705.     jmps    defs20
  706. defs50:    inc    bx        ;we've seen a colon, it must be followed
  707.     cmp    byte ptr [bx],0    ; by the null we stored earlier
  708.     jne    deferr
  709.     mov    al,newusr    ;are we setting a new user number?
  710.     cmp    al,0FFh
  711.     jne    defs60        ; yes, check its value
  712.     cmp    al,newdrv    ; otherwise if neither drive nor user
  713.     jne    defs70        ;  was specified and yet we saw the colon,
  714.     mov    al,cpmdrv    ;  then return to the initial CP/M defaults.
  715.     mov    newdrv,al
  716.     mov    al,cpmusr
  717. defs60:    cmp    al,15        ;make sure user is in range
  718.     ja    deferr
  719.     mov    defusr,al    ;save new user value
  720.     mov    dl,al
  721.     call    setusr
  722. defs70:    mov    al,newdrv    ;are we setting a new drive?
  723.     cmp    al,0FFh
  724.     je    defs90
  725.     mov    defdrv,al    ;save new drive value
  726.     call    rstdsk        ;reset disk system to log in drive
  727.     mov    dl,defdrv    ; then select new default
  728.     call    setdrv
  729. defs90:    jmp    rskp
  730. deferr:    mov    dx, offset erms23
  731.     call    tcrmsg
  732.     jmp    rskp                        ;[32a] end
  733.  
  734. ; Set end-of-line character
  735.  
  736. eolset:                            ;[25] begin
  737.     mov    dx, 01FH    ;maximum value of number allowed. (31)
  738.     mov    bx, offset eolhlp ;help string for parser
  739.     mov    ah, cmnum    ;look for a decimal number
  740.     call    comnd        ;call the parser
  741.      jmp    r
  742.     mov    seol, bl    ;set the eol character
  743.     jmp    rskp
  744.  
  745. escape:
  746.     mov    bx, offset eschlp ;help string for parser
  747.     mov    ah, cmcha    ;parser code for single character
  748.     call    comnd        ;call parser
  749.      jmp    r
  750.     mov    escchr, bl    ;set the character
  751.     jmp    rskp
  752.                                 ;[25] end
  753.  
  754. ;    This is the SET file-type (ASCII or BINARY) command    ;[16] begin
  755.  
  756. fmset:    mov    dx, offset fmtab
  757.     mov    bx, offset fmhlp
  758.     mov    ah, cmkey
  759.     call    comnd
  760.      jmp    r
  761.     mov    temp1, bx
  762.     mov    ah, cmcfm
  763.     call     comnd        ;Get a confirm.
  764.      jmp    r        ;Didn't get a confirm.
  765.     mov    bx, temp1
  766.     mov    binflg, bl    ;Set the file-type flag.
  767.     jmp    rskp                        ;[16] end
  768.  
  769. ;    This is the SET Warning command.
  770.  
  771. filwar:    mov    dx, offset ontab
  772.     mov    bx, offset onhlp
  773.     mov    ah, cmkey
  774.     call    comnd
  775.      jmp    r
  776.     mov    temp1, bx
  777.     mov    ah, cmcfm
  778.     call    comnd        ;Get a confirm.
  779.      jmp    r        ;Didn't get a confirm.
  780.     mov    bx, temp1
  781.     mov    flwflg, bl    ;Set the file warning flag.
  782.     jmp    rskp
  783.  
  784. ;        Set flow-control flag            [19a] Begin
  785.  
  786. setflo:    mov    dx, offset flotab ;set up ON/OFF response
  787.     mov    bx, offset flohlp
  788.     mov    ah, cmkey
  789.     call    comnd        ;get response
  790.     jmp    r
  791.     mov    temp1, bx    ;save response
  792.     mov    ah, cmcfm
  793.     call    comnd        ;get confirm
  794.     jmp    r
  795.     mov    bx, temp1
  796.     mov    floctl, bl    ;set flag
  797.     jmp    rskp                        ;[19a] end
  798.  
  799. ;    This is the SET IBM command.
  800.  
  801. ibmset:    mov    dx, offset ontab
  802.     mov    bx, offset onhlp
  803.     mov    ah, cmkey
  804.     call    comnd
  805.      jmp    r
  806.     mov    temp1, bx
  807.     mov    ah, cmcfm
  808.     call    comnd        ;Get a confirm.
  809.      jmp    r        ;Didn't get a confirm.
  810.     mov    bx, temp1
  811.     mov    ibmflg, bl    ;Set the IBM flag.
  812.     cmp    bl, 0        ;Turning on or off?
  813.     je    ibmst1        ;If off, set parity & local echo to defaults.
  814.     mov    parflg, ibmpar    ;Set IBM parity.        ;[21a] begin
  815.     mov    ecoflg, 1    ;Set local echo on.
  816.     mov    tmrflg, 1    ;Set timer on.
  817.     jmps    ibmst2
  818. ibmst1:    mov    parflg, defpar    ;Set default parity.
  819.     mov    ecoflg, defeco    ;Set local echo to default.
  820.     mov    tmrflg, deftmr    ;Set timer to default.
  821. ibmst2:    jmp    rskp                            ;[21a] end
  822.  
  823.  
  824. ;    This is the LOCAL echo SET subcommand.
  825.  
  826. local:    mov    dx, offset ontab
  827.     mov    bx, offset onhlp
  828.     mov    ah, cmkey
  829.     call    comnd
  830.      jmp    r
  831.     mov    temp1, bx    ;Save the parsed value.
  832.     mov    ah, cmcfm
  833.     call    comnd        ;Get a confirm.
  834.      jmp    r        ;Didn't get a confirm.
  835.     mov    bx, temp1
  836.     mov    ecoflg, bl    ;Set the local echo flag.
  837.     jmp    rskp
  838.  
  839.  
  840. ;    This is the LOG filename SET command
  841.  
  842. log:    mov    ah, cmofi    ;Get an output filename
  843.     mov    dx, offset lfcb    ;For a log file
  844.     call    comnd
  845.      jmp    r
  846.     cmp    ah,0        ;Check for null filename    ;[32c] begin
  847.     jne    $+5
  848.      jmp    r                        ;[32c] end
  849.     mov    ah, cmcfm    ;Confirm it
  850.     call    comnd
  851.      jmp    r
  852.     mov    logflg, 0FFh    ;Turn logging on
  853.     jmp    rskp
  854.  
  855.  
  856. ;    This is the SET Parity command.
  857.  
  858. setpar:    mov    dx, offset partab
  859.     mov    bx, offset parhlp
  860.     mov    ah, cmkey
  861.     call    comnd
  862.      jmp    r
  863.     mov    temp1, bx
  864.     mov    ah, cmcfm
  865.     call    comnd        ;Get a confirm.
  866.      jmp    r        ;Didn't get a confirm.
  867.     mov    bx, temp1
  868.     mov    parflg, bl    ;Set the parity flag.
  869.     jmp    rskp
  870.  
  871. ;    This is the SET Timer command.            ;[21a] begin
  872.  
  873. tmrset:    mov    dx, offset ontab
  874.     mov    bx, offset onhlp
  875.     mov    ah, cmkey
  876.     call    comnd
  877.      jmp    r
  878.     mov    temp1, bx
  879.     mov    ah, cmcfm
  880.     call    comnd        ;Get a confirm.
  881.      jmp    r        ;Didn't get a confirm.
  882.     mov    bx, temp1
  883.     mov    tmrflg, bl    ;Set the timer flag.
  884.     jmp    rskp                    ;[21a] end
  885.                             ;[21c] end
  886.  
  887. ;    The following are display subroutines used primarily    ;[21c] begin
  888. ;    in the SHOW command.
  889.  
  890.                                 ;[10] begin
  891. ;    This routine matches a table value and prints the corresponding
  892. ;    keyword.  On entry:
  893. ;            al = value to match
  894. ;            bx = beginning address of table
  895.  
  896. tabprt:    mov    ah, 0        ;make it a word comparison
  897.     mov    ch, [bx]    ;get the table size
  898.     inc    bx
  899. tabp1:    mov    dl, [bx]    ;get the offset to the value
  900.     inc    bx        ;point to beginning of the keyword
  901.     mov    dh, 0
  902.     mov    si, dx
  903.     cmp    ax, 1[bx+si]    ;does the value match?
  904.     je    tabp2        ;yes, go print the keyword at [bx].
  905.     add    bx, dx        ;otherwise go to next entry
  906.     add    bx, 3
  907.     dec    ch        ;any more entries
  908.     jnz    tabp1        ;if so, go check the next
  909.     mov    bx, offset erms20 ;else say value was not found
  910. tabp2:    mov    dx, bx
  911.     call    tmsg        ;display the keyword
  912.     ret
  913.                                 ;[10] end
  914.  
  915. ; This routine prints out the escape character in readable format.
  916. ;    Call CTLPRT with any char in DL for similar output.
  917.  
  918. escprt:    mov    dl, escchr
  919. ctlprt:    cmp    dl, ' '
  920.     jge    escpr2
  921.     push    dx
  922.     mov    dx, offset esctl ;Print "Control-"
  923.     call    tmsg
  924.     pop    dx
  925.     add    dl, 040H    ;Make it printable.
  926. escpr2:    call    bout
  927.     ret
  928.  
  929. ;    This routine prints "is on" if prior comparison was nonzero
  930. ;    and otherwise prints "is off"
  931.  
  932. ponoff:    jz    ponof2        ;If not say so.
  933.     mov    dx, offset onstr ;Say on.
  934.     jmp    ponof3
  935. ponof2:    mov    dx, offset offstr ;Say off.
  936. ponof3:    call    tmsg
  937.     ret
  938.  
  939. ; SHOW - Show the state of the parameters available from the SET command.
  940.  
  941. show:    mov    ah,cmcfm    ;Parse a confirm.
  942.     call    comnd
  943.      jmp    r
  944.     call    tcrlf
  945.  
  946.     call    shobd        ;Display baud rate (system dependent)
  947.  
  948.     mov    dx, offset debst ;Debugging string.
  949.     call    tcrmsg
  950.     cmp    debug, 0    ;Is the debugging flag on?
  951.     call    ponoff
  952.  
  953.     mov    dx, offset eolst ;End of line string.        ;[10] begin
  954.     call    tcrmsg
  955.     mov    dl, seol
  956.     call    ctlprt                        ;[10] end
  957.  
  958.     mov    dx, offset escst ;Escape string.
  959.     call    tcrmsg
  960.     call    escprt        ;Print the escape char.
  961.  
  962.     mov    dx, offset fmst    ;File type string. [22d]    ;[16] begin
  963.     call    tcrmsg
  964.     mov    al, binflg    ;Print the keyword corresponding to the
  965.     mov    bx, offset fmtab ;current value of binflg
  966.     call    tabprt                        ;[16] end
  967.  
  968.     mov    dx, offset flostr                ;[19a] start
  969.     call    tcrmsg        ;
  970.     mov    al, floctl    ;show the current
  971.     mov    bx, offset flotab ;setting for flow-control
  972.     call    tabprt                        ;[19a] end
  973.  
  974.     mov    dx, offset ibmst ;IBM string.
  975.     call    tcrmsg
  976.     cmp    ibmflg, 0    ;Is the IBM flag on?
  977.     call    ponoff
  978.  
  979.     mov    dx, offset locst ;Get the address of the local echo string.
  980.     call    tcrmsg
  981.     cmp    ecoflg, 0    ;Is the local echo flag on?
  982.     call    ponoff        ;Print on or off.
  983.  
  984.     mov    dx, offset logst ;Logging string.
  985.     call    tcrmsg
  986.     mov    dx, offset lfcb    ;Print the log filename.
  987.     call    tfile
  988.     cmp    logflg, 0    ;Is the logging flag on?
  989.     call    ponoff
  990.  
  991.     mov    dx, offset parst ;Parity string.
  992.     call    tcrmsg
  993.     mov    al, parflg    ;Print the keyword corresponding ;[10] begin
  994.     mov    bx, offset partab ;to the current value of parflg
  995.     call    tabprt
  996.  
  997.     call    shoprt        ;Port selection (system dependent) ;[30d]
  998.  
  999.     mov    dx, offset tmrst ;Timer on/off string        ;[21a] begin
  1000.     call    tcrmsg
  1001.     cmp    tmrflg, 0    ;Is the timer on?
  1002.     call    ponoff        ;Print on or off.        ;[21a] end
  1003.  
  1004.     mov    dx, offset filst ;File warning string.
  1005.     call    tcrmsg
  1006.     cmp    flwflg, 0    ;Is the file warning flag on?
  1007.     call    ponoff
  1008.  
  1009.     call    tcrlf        ;Print a crlf
  1010.     jmp    rskp                        ;[21c] end
  1011.  
  1012.  
  1013. dspver:    call    clrscr        ;Home cursor and clear the screen ;[30c] begin
  1014.     mov    dx, offset scrhdr ;Position to the version line.
  1015.     call    poscur
  1016.     call    bldon        ;Turn on bold (highlighted) display
  1017.     mov    dx, offset system ;Print the system identification
  1018.     call    tmsg
  1019.     mov    dx, offset versio ;Print the Kermit version header.
  1020.     call    tmsg
  1021.     call    bldoff        ;Turn off the highlight    ;[30c] end
  1022.     ret
  1023.  
  1024.  
  1025.     DSEG            ;Data segment.
  1026.  
  1027.     ORG    100H        ;Leave room for system page.
  1028.  
  1029.     RW    100        ;hundred word or so stack.
  1030. stack    RW    2
  1031.  
  1032.     ; COMND tables
  1033.  
  1034. comtab    db    22
  1035.     db    3,'BYE$'
  1036.     dw    bye
  1037.     db    7,'CONNECT$'
  1038.     dw    telnet
  1039.     db    6,'DELETE$'                    ;[32d] begin
  1040.     dw    locera
  1041.     db    9,'DIRECTORY$'
  1042.     dw    locdir
  1043.     db    5,'ERASE$'
  1044.     dw    locera                        ;[32d] end
  1045.     db    4,'EXIT$'
  1046.     dw    exit
  1047.     db    6,'FINISH$'
  1048.     dw    finish
  1049.     db    3,'GET$'
  1050.     dw    get
  1051.     db    4,'HELP$'
  1052.     dw    help
  1053.     db    5,'LOCAL$'                    ;[32d]
  1054.     dw    loccmd                        ;[32d]
  1055.     db    6,'LOGOUT$'
  1056.     dw    logout
  1057.     db    4,'QUIT$'                    ;[29f]
  1058.     dw    exit                        ;[29f]
  1059.     db    7,'RECEIVE$'
  1060.     dw    rec
  1061.     db    6,'REMOTE$'                    ;[32d]
  1062.     dw    remcmd                        ;[32d]
  1063.     db    4,'SEND$'
  1064.     dw    sencom
  1065.     db    3,'SET$'
  1066.     dw    setcom
  1067.     db    4,'SHOW$'
  1068.     dw    show
  1069.     db    5,'SPACE$'                    ;[32d]
  1070.     dw    locsiz                        ;[32d]
  1071.     db    6,'STATUS$'
  1072.     dw    status
  1073.     db    4,'TAKE$'                    ;[29b]
  1074.     dw    take                        ;[29b]
  1075.     db    8,'TRANSMIT$'                    ;[32e]
  1076.     dw    txmit                        ;[32e]
  1077.     db    4,'TYPE$'                    ;[34b]
  1078.     dw    loctyp                        ;[34b]
  1079.  
  1080. settab    db    14
  1081.     db    4,'BAUD$'
  1082.     dw    bdset                        ;[6] end
  1083.     db    9,'DEBUGGING$'
  1084.     dw    debset
  1085.     db    12,'DEFAULT-DISK$'                ;[32a] begin
  1086.     dw    defset                        ;[32a] end
  1087.     db    11,'END-OF-LINE$'
  1088.     dw    eolset
  1089.     db    6,'ESCAPE$'
  1090.     dw    escape
  1091.     db    9,'FILE-TYPE$'            ;[16] begin [21b]
  1092.     dw    fmset                    ;[16] end
  1093.     db    13,'FLOW-CONTROL$'                ;[19a]
  1094.     dw    setflo                        ;[19a]
  1095.     db    3,'IBM$'
  1096.     dw    ibmset
  1097.     db    10,'LOCAL-ECHO$'
  1098.     dw    local
  1099.     db    3,'LOG$'                    ;[24a]
  1100.     dw    log                        ;[24a]
  1101.     db    6,'PARITY$'
  1102.     dw    setpar
  1103.     db    4,'PORT$'                    ;[30d]
  1104.     dw    prtset
  1105.     db    5,'TIMER$'                    ;[21a]
  1106.     dw    tmrset                        ;[21a]
  1107.     db    7,'WARNING$'
  1108.     dw    filwar
  1109.  
  1110. loctab    db    5                        ;[32d] begin
  1111.     db    6,'DELETE$'
  1112.     dw    locera
  1113.     db    9,'DIRECTORY$'
  1114.     dw    locdir
  1115.     db    5,'ERASE$'
  1116.     dw    locera
  1117.     db    5,'SPACE$'
  1118.     dw    locsiz                        ;[32d] end
  1119.     db    4,'TYPE$'                    ;[34b]
  1120.     dw    loctyp                        ;[34b]
  1121.  
  1122. ontab    db    2        ;Two entries.
  1123.     db    3,'OFF$'                    ;[5] begin
  1124.     dw    0000H
  1125.     db    2,'ON$'
  1126.     dw    0001H                        ;[5] end
  1127.  
  1128. yestab    db    2        ;Two entries.
  1129.     db    2,'NO$'
  1130.     dw    0000H
  1131.     db    3,'YES$'
  1132.     dw    0001H
  1133.  
  1134. flotab    db    2        ;[19a] start
  1135.     db    4,'NONE$'
  1136.     dw    flonon
  1137.     db    8,'XON/XOFF$'
  1138.     dw    floxon        ;[19a] end
  1139.  
  1140. partab    db    5        ;Five entries.
  1141.     db    4,'EVEN$'
  1142.     dw    parevn
  1143.     db    4,'MARK$'
  1144.     dw    parmrk
  1145.     db    4,'NONE$'
  1146.     dw    parnon
  1147.     db    3,'ODD$'
  1148.     dw    parodd
  1149.     db    5,'SPACE$'
  1150.     dw    parspc
  1151.  
  1152. fmtab    db    2        ;Two entries.            ;[16] begin
  1153.     db    5,'ASCII$'
  1154.     dw    00H
  1155.     db    6,'BINARY$'
  1156.     dw    01H                        ;[16] end
  1157.  
  1158. hlpmsg    db    cr,lf,'Type ? at any point for help$'
  1159. cfrmes    db    ' Confirm with carriage return $'
  1160. filhlp    db    ' Input file spec (possibly wild) $'
  1161.  
  1162. tophlp    db    cr,lf,'      Basic Commands                            Other Commands'
  1163.     db    cr,lf,'CONNECT to host as a terminal             DELETE local files'
  1164.     db    cr,lf,'RECEIVE file(s) from host                 DIRECTORY of local files'
  1165.     db    cr,lf,'SEND file(s) to host                      HELP by giving this message'
  1166.     db    cr,lf,'SET a Kermit parameter                    LOCAL generic command'
  1167.     db    cr,lf,'SHOW the parameter values                 QUIT (same as EXIT)'
  1168.     db    cr,lf,'EXIT to CP/M                              SPACE remaining on disk'
  1169.     db    cr,lf,'                                          STATUS of Kermit'
  1170.     db    cr,lf,'      Server Commands                     TAKE command input from file'
  1171.     db    cr,lf,'GET file(s) from host                     TYPE local file on screen'
  1172.     db    cr,lf,'SEND file(s) to host'
  1173.     db    cr,lf,'REMOTE generic command'
  1174.     db    cr,lf,'FINISH running Kermit on the host'
  1175.     db    cr,lf,'LOGOUT the host'
  1176.     db    cr,lf,'BYE to host (LOGOUT, then EXIT)'
  1177.     db    '$'
  1178.  
  1179. sethlp    db    cr,lf,'BAUD rate'                ;[6]
  1180.     db    cr,lf,'DEBUGGING displays of transferred packets'
  1181.     db    cr,lf,'DEFAULT-DISK for file operations'    ;[32a]
  1182.     db    cr,lf,'END-OF-LINE character in packets'
  1183.     db    cr,lf,'ESCAPE character from terminal mode'
  1184.     db    cr,lf,'FILE-TYPE (ASCII or BINARY)'        ;[16][21b]
  1185.     db    cr,lf,'FLOW-CONTROL (NONE or XON/XOFF)'        ;[19a]
  1186.     db    cr,lf,'IBM mainframe communications mode'
  1187.     db    cr,lf,'LOCAL-ECHO echoing (half-duplex)'
  1188.     db    cr,lf,'LOG filename for terminal session logging' ;[24a]
  1189.     db    cr,lf,'PARITY type'
  1190.     db    cr,lf,'PORT to communicate on'            ;[30d]
  1191.     db    cr,lf,'TIMER for packet retransmission'        ;[21a]
  1192.     db    cr,lf,'WARNING for received filename conflicts'
  1193.     db    '$'
  1194.  
  1195. lochlp    db    cr,lf,'DELETE local files'            ;[32d] begin
  1196.     db    cr,lf,'DIRECTORY of local files'
  1197.     db    cr,lf,'SPACE remaining on disk'
  1198.     db    cr,lf,'TYPE local files on screen'        ;[34b]
  1199.     db    '$'                        ;[32d] end
  1200.  
  1201. flohlp    db    cr,lf,'NONE    XON/XOFF$'
  1202. onhlp    db    cr,lf,'OFF    ON$'
  1203. yeshlp    db    cr,lf,'NO    YES$'
  1204. parhlp    db    cr,lf,'NONE   MARK   ODD   EVEN   SPACE$'
  1205. fmhlp    db    cr,lf,'ASCII    BINARY$'            ;[16]
  1206. eolhlp    db    cr,lf,'Decimal digit between 0 and 31$'
  1207. eolerr    db    cr,lf,'Illegal end-of-line character$'
  1208. timhlp    db    cr,lf,'Decimal digit between 1 and 94$'
  1209. timerr    db    cr,lf,'Illegal timeout value$'
  1210. esctl    db    'Control-$'
  1211. eschlp    db    cr,lf,'Enter literal value (ex: Ctrl ])  $'
  1212. inthlp    db    'Kermit-86: Interrupt - type'        ;[27]
  1213.     db    cr,lf,'    ?   to display this message'    ;[20c] begin
  1214.     db    cr,lf,'    B   to send a Break signal to the port'
  1215.     db    cr,lf,'    C   to return to the Kermit-86> prompt'
  1216.     db    cr,lf,'    L   to toggle terminal session logging'    ;[24a]
  1217.     db    cr,lf,'    Q   to quit terminal session logging'    ;[29e]
  1218.     db    cr,lf,'    R   to resume terminal session logging'    ;[29e]
  1219.     db    cr,lf,'    $'
  1220. inthl2    db    '   to send a $'
  1221. inthl3    db    ' character to the port$'            ;[20c] end
  1222. onstr    db    ' is on$'
  1223. offstr    db    ' is off$'
  1224. flostr    db    'Flow control: $'                ;[19a]
  1225. bdst    db    'Baud rate: $'
  1226. debst    db    'Debug mode$'
  1227. eolst    db    'End-of-line character: $'
  1228. escst    db    'Escape char: $'
  1229. fmst    db    'File type is $'                ;[16][21b]
  1230. ibmst    db    'IBM flag$'
  1231. locst    db    'Local echo$'
  1232. logst    db    'Logging to $'                    ;[24a]
  1233. parst    db    'Parity: $'
  1234. tmrst    db    'Timer$'                    ;[21a]
  1235. timmes    db    'Timeout is $'
  1236. filst    db    'Warning$'
  1237.  
  1238. clrspc    db    ' ',10O,'$'        ;Clear space.
  1239.  
  1240. versio    db    ' CP/M-86 Kermit-86 - V2.9'
  1241.     db    cr,lf,lf,'$'
  1242. kerm    db    'Kermit-86 $'                    ;[32a]
  1243. pktlin    db    cr,'Number of packets:   '
  1244.     db    cr,lf,'Number of retries:   '
  1245.     db    cr,lf,'File name:  $'
  1246. spmes    db    'Spack:  $'
  1247. rpmes     db    'Rpack:  $'
  1248. hibit    db    'Warning - Non-ASCII char$'
  1249. ender    db    bell,bell,'$'
  1250. inms01    db    cr,lf,'[Kermit-86: Connecting to host...' ;[27][fdc]
  1251.     db    cr,lf,'  Type $'            ;[fdc]
  1252. inms02    db    ' C to return to PC, $'            ;[fdc]
  1253. inms25    db    ' ? for help]$'                ;[fdc]
  1254. inms03    db    '[Kermit-86: Back at PC]$'            ;[27]
  1255. infms3    db    'Completed    $'
  1256. infms4    db    'Failed       $'
  1257. infms5    db    'Renaming file to $'
  1258. infms6    db    '%Function not implemented$'
  1259. infms7    db    'Interrupted  $'                ;[19f]
  1260. infms8    db    'File interrupt (^X)  $'            ;[19f]
  1261. infms9    db    'File group interrupt (^Z)  $'            ;[19f]
  1262. infm10    db    ' Type: ^X to interrupt file,  ^Z to '        ;[19f][30c]
  1263.     db    'interrupt group,  ^C to "abort".$'        ;[19g][30c]
  1264. infm11    db    '[Kermit-86: Logging to $'            ;[24a][27]
  1265. infm12    db    ']$'                        ;[24a]
  1266. infm13    db    '[Kermit-86: Logging terminated]$'        ;[24a][27]
  1267. timoms    db    bell,'Timeout$'
  1268. ermes1    db    bell,'?Unrecognized command$'
  1269. ermes2    db    bell,'?Illegal character$'
  1270. ermes3    db    bell,'?Unrecognized command option$'
  1271. ermes4    db    bell,'?Unable to rename file$'
  1272. ermes5    db    bell,'?No receive file specification given$'
  1273. ermes7    db    bell,'?Unable to receive initiate$'
  1274. ermes8    db    bell,'?Unable to receive file name$'
  1275. ermes9    db    bell,'?Unable to receive end of file$'
  1276. erms10    db    bell,'?Unable to receive data$'
  1277. erms11    db    bell,'?Disk directory area full$'            ;[28c]
  1278. erms14    db    bell,'?Unable to receive an acknowledgement from the host$'
  1279. erms15    db    bell,'?Unable to find file $'            ;[28b]
  1280. erms17    db    bell,'?Disk data area full$'                ;[28c]
  1281. erms18    db    bell,'?Unable to tell host that session is finished$'
  1282. erms19    db    bell,'?Unable to tell host to logout$'
  1283. erms20    db    bell,'?Illegal value$'                ;[10]
  1284. erms21    db    '* Aborted *$'                    ;[12]
  1285. erms22    db    bell,'?Cannot open log file $'            ;[24a]
  1286. erms23    db    bell,'?Specify new default drive and (optional) user number as DU:$' ;[32a]
  1287. erms24    db    bell,'?Specify drive as D:$'            ;[32d]
  1288. erms25    db    bell,'?Not enough memory for sort buffer:'    ;[34c]
  1289.     db    cr,lf,'   Local DIRECTORY, DELETE, and TYPE operations'
  1290.     db    cr,lf,'   and wildcard SENDs will not be supported.$'
  1291. erms26    db    bell,'?Illegal filename$'
  1292. erms27    db    bell,'?Memory buffer overflow$'
  1293. erms28    db    bell,'?No filenames above specified starting name$'    ;[34c]
  1294.  
  1295. ; Cursor addressing items (row,col)            ;[19b],[30c] begin
  1296.  
  1297. scrhdr    db    3,1        ;Place for version header
  1298. scrnp    db    5,22        ;Place for number of packets.
  1299. scrnrt    db    6,22        ;Place for number of retries.
  1300. scrfln    db    7,12        ;Place for file name.
  1301. screrr    db    13,1        ;Place for error messages.
  1302. scrst    db    5,53        ;Place for "Complete".
  1303. scrrpr    db    14,1        ;Place for prompt.
  1304. scrhi    db    7,53        ;8th bit on in character.
  1305. scrfr    db    8,1        ;Rename file.            ;[31]
  1306. scrsp    db    9,1        ;Send packet
  1307. scrrp    db    11,1        ;Receive
  1308. scrint    db    6,53        ;[19f] interrupt acknowledge
  1309. scrhlp    db    24,1        ;[19f] help line
  1310.  
  1311.     ; Impure storage
  1312.  
  1313. extflg    db    0        ;Exit flag;non zero to exit.
  1314. ecoflg    db    defeco        ;Echo flag; non zero for local echoing.
  1315. escchr    db    defesc        ;Escape character for the connect command.
  1316. debug    db    diasw        ;Are we in debug mode?
  1317. tmrflg    db    deftmr        ;Is the timer enabled?
  1318. cpmdrv    db    0        ;Initial drive and user        ;[32a] begin
  1319. cpmusr    db    0
  1320. defdrv    db    0        ;Current default drive and user
  1321. defusr    db    0
  1322. newdrv    db    0        ;Storage for resetting drive and user
  1323. newusr    db    0                        ;[32a] end
  1324.  
  1325.  
  1326.     ESEG            ;Extra segment.
  1327.  
  1328.     INCLUDE C86CMD.A86    ;Get the COMND routines.
  1329.     INCLUDE C86FIL.A86    ;Get the file routines.
  1330.  
  1331. ;Note, the following file does not exist.  You have to copy one of the system
  1332. ;dependent files like C86XRB.A86 to a file of this name.
  1333.     INCLUDE C86XXX.A86    ;Get the I/O routines
  1334.  
  1335.     INCLUDE C86PRO.A86    ;Get the protocol routines.
  1336.     INCLUDE C86TRM.A86    ;Get terminal emulation [26]
  1337.     INCLUDE C86UTL.A86    ;Get the utility routines.
  1338.  
  1339.     DSEG $            ;Resume data segment.
  1340.  
  1341.     DB    0        ;Is this really necessary?
  1342.                 ;No, but without it you need to specify
  1343.                 ;link options to GENCMD so as to make the
  1344.                 ;load address allow for uninitialized storage.
  1345.                 ;This bypasses that necessity by including
  1346.                 ;all uninitialized storage in the load
  1347.                 ;module. - RonB
  1348.  
  1349.     END
  1350.  
  1351.