home *** CD-ROM | disk | FTP | other *** search
/ Columbia Kermit / kermit.zip / a / cpscom.asm < prev    next >
Assembly Source File  |  2020-01-01  |  43KB  |  1,372 lines

  1. ; CPSCOM.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,1985
  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. ;       This file contains some of the main loop commands, all SET xxx and
  20. ;    status routines.  File split from CPSMIT.ASM as that file 
  21. ;    was getting too big.
  22. ;
  23. ; revision history:
  24. ;
  25. ;edit 13, 25-Mar-1991 by MF. Require confirmation if a STAY command
  26. ;    (code at "noexit") is given and a question-mark is entered.
  27. ;edit 12, 21-Mar-1991 by MF.  Change SET COLLISSION REPLACE to
  28. ;    SET COLLISION OVERWRITE to conform with C-Kermit. Modify SET COLLISION
  29. ;    help text slightly.
  30.  
  31. ;edit 11, 27-Feb-1991 by MF. Show Kermit version in VERSION command
  32. ;    ("shover").
  33. ;edit 10, 12-Feb-1991 by MF. Modified OUTPUT command to get a "confirm"
  34. ;    after accepting the string to be output so that the OUTPUT command
  35. ;    doesn't immediately execute if a terminator other than <cr> is typed
  36. ;    (immediate execution confuses some users new to Kermit). This
  37. ;    situation should seldom, if ever, occur, as the OUTPUT command
  38. ;    is most likely to be executed in a TAKE-file but one should
  39. ;    protect oneself, shouldn't one?
  40. ;    Also commented out case-sensivity code as it is unlikely to be used.
  41. ;edit 9, 4-Dec-1990 by MF. Add "stautr" routine to display Autoreceive
  42. ;    status in SHOW/STATUS/<ESC>S commands.
  43. ;edit 8, 30-Nov-1990 by MF. Modify routine "statvt" (terminal status) to
  44. ;    display setting of "quiet" switch. Although I presume that Mr.
  45. ;    Schou thought the code would accommodate display of QUIET or
  46. ;    REGULAR, the code does not in fact allow this since the emulation
  47. ;    flag is not involved in the "quiet" setting.
  48. ;    Also fix SET TERMINAL's help text a bit.
  49. ;edit 7, 8-Nov-1990 by MF.  In SET {RECEIVE/SEND} PACKET-LENGTH routines,
  50. ;    call utility routine subbc from CPSUTL.ASM to do 16-bit subtraction
  51. ;    rather than doing it in-line to save a few bytes.  Eliminate
  52. ;    commented-out instructions.
  53. ;edit 6, 1-Nov-1990 by MF.  Changed SET BAUD-RATE to SET SPEED in the quest
  54. ;    for uniformity of nomenclature (per request of FDC).
  55. ;edit 5, 17-Oct-1990 by MF.  Change SET {RECEIVE SEND} PACKET-SIZE to
  56. ;    SET {RECEIVE SEND} PACKET-LENGTH to conform with the nomenclature
  57. ;    suggested in Chapter 10 of the 6th edition of the Kermit Protocol
  58. ;    Manual.
  59. ;edit 4, 14-Sep-1990 by MF.  Implemented SET FILE-COLLISION (SET COLLISION)
  60. ;    command (except for SET COLLISION ASK and SET COLLISION APPEND).
  61. ;    How one APPENDs to a CP/M file depends upon whether it's ASCII or
  62. ;    BINARY -- something we may not know.
  63. ;    Also implemented SET INCOMPLETE-FILE command.
  64. ;    Let's also restore SET FILE-MODE DEFAULT:  I never use it but if
  65. ;    we leave the DEFAULT code, as Version 4.09 does, the user is entitled
  66. ;    to be able to select it if he/she wishes (I'd favor getting rid
  67. ;    of it altogether but as soon as I did that, someone'd come out
  68. ;    of the woodwork and complain vehemently that he/she **likes** 
  69. ;    SET FILE-MODE DEFAULT and would the so-and-so who took it out
  70. ;    please put it back in.  Such is life.  In any case, the user can
  71. ;    always set the file-mode from a take-file.
  72. ;edit 3, 9-Sep-1990 by MF.  Implemented setting of packet sizes for
  73. ;    packets up thru length 94 characters for SEND and RECEIVE.  Even
  74. ;    for standard-length packets, variable sizes are useful.
  75. ;    Correct 16-bit subtraction in stspks/strpks to set carry if needed
  76. ;    Also corrected bug in routine getnp wherein a JMP KERMIT
  77. ;    instruction was left out after trying to parse a confirm, thus
  78. ;    skipping loading of number into HL.
  79. ;    Fixed bug in PRTSTR wherein BC/HL were not saved under certain
  80. ;    conditions, thus causing garbage to appear when PRTSTR was
  81. ;    called with QUIETD set.
  82. ; edit 2, September 10, 1987, by OBSchou.  Changed SET IBM to reset the 
  83. ;    flow control flag.  IBMs use 13h as a turnaround character (so they
  84. ;    say) so no flow control.  Anybody willing to add comments etsc, as I 
  85. ;    have NO IDEA what IBMs do or need.
  86. ;    Also removed the SET FILE-MODE DEFAULT option, as it always causes
  87. ;    so much trouble.  Assume the default mode to be ASCII.  Moved a test
  88. ;    for key pressed from the status routine to the CPSUTL file.
  89. ;
  90. ; edit 1, April 8th, 1987.
  91. ;    Hived off the SET command etc from CPSMIT.ASM to 
  92. ;    make a more manageable file
  93.  
  94.  
  95. comver:    db    'CPSCOM.ASM (13) 25-Mar-1991$'    ;name, edit no. and date
  96. ;
  97. ;
  98. ; This is the SET command.
  99.  
  100. setcom:    lxi    d,settab    ;Parse a keyword from the set table.
  101.     lxi    h,sethlp
  102.     call    keycmd
  103.     xchg        ; Get result (dispatch address) into HL
  104.     pchl        ; Dispatch.
  105.  
  106. settab:    db    26        ;[pcc013] 16 entries [Toad Hall] [9], now 17
  107.                 ;[11] removed XMIT and added CASE and FLOW-CTL
  108.                 ; Value is address of processing routine.
  109.                 ;[14] removed SET CASE-SENSITIVE for now
  110.                 ;[DRJ] Added SET USER. settab = 22
  111.                 ;[OBS] Added SET AUTORECEIVE. 
  112.                 ; and SET NO-EXIT.  settab = 24
  113.                 ;[MF]Added SET COLLISION, settab=25
  114.                 ;[MF]Added Set Incomplete settab=26
  115.     db    11,    'AUTORECEIVE$'
  116.         dw setaut
  117.     db    16,    'BLOCK-CHECK-TYPE$'
  118.         dw blkset
  119.     db    11,    'BUFFER-SIZE$'
  120.         dw setbuf
  121. ;       db      14,    'CASE-SENSITIVE$'   ;[10]
  122. ;               dw setcase              ;[10]
  123.     db    9,'COLLISION$'    ;[MF]
  124.     dw    setcol        ;[MF]
  125.     db    5,    'DEBUG$'
  126.         dw setdbg
  127.     db    12,    'DEFAULT-DISK$'
  128.         dw setdisk
  129.     db    19,    'DIRECTORY-FILE-SIZE$'
  130.         dw hidef
  131.     db    6,    'ESCAPE$'
  132.         dw escape
  133.     db    9,    'FILE-MODE$'
  134.         dw setcpm
  135.     db    12,    'FLOW-CONTROL$'    ;[10]
  136.         dw setflo        ;[10]
  137.     db    3,    'IBM$'
  138.         dw ibmset
  139.     db    16,'INCOMPLETE-FILES$'
  140.     dw    setinc        ;[MF]Set Incomplete
  141.     db    10,    'LOCAL-ECHO$'
  142.         dw locall
  143.     db    7,    'LOGGING$'        ;[pcc013]
  144.         dw setlog        ;[pcc013]
  145.     db    7,    'NO-EXIT$'
  146.         dw noexit
  147.     db    6,    'PARITY$'
  148.         dw parset
  149.     db    4,    'PORT$'
  150.         dw prtset
  151.     db    7,    'PRINTER$'
  152.         dw setprn
  153.     db    7,    'RECEIVE$'        ;[gnn]
  154.         dw setrec        ;[gnn]
  155.     db    4,    'SEND$'        ;[gnn]
  156.         dw setsnd        ;[gnn]
  157.     db    5,    'SPEED$';[MF]
  158.         dw baud
  159.     db    7,    'TACTRAP$'
  160.         dw settac
  161.     db    8,    'TERMINAL$'
  162.         dw vt52em
  163.     db    5,    'TIMER$'
  164.         dw settim
  165.     db    4,    'USER$'        ;[DJR]
  166.         dw user        ;[DJR]
  167.     db    7,    'WARNING$'
  168.         dw filwar
  169.  
  170. ; help message for SET command. Caps indicate keywords
  171.  
  172. sethlp:    db    cr,lf,'AUTORECEIVE to automatically re-receive files'
  173.     db    cr,lf,'BLOCK-CHECK-TYPE for error detection'
  174.     db    cr,lf,'BUFFER-SIZE for multi-sector buffering'
  175. ;       db      cr,lf,'CASE-SENSITIVE to equate lower and upper case'   ;[10]
  176.     db    cr,lf,'COLLISION to specify action for filename conflicts'
  177.     db    cr,lf,'DEBUG message control'
  178.     db    cr,lf,'DEFAULT-DISK to receive data'
  179.     db    cr,lf,'DIRECTORY-FILE-SIZE when displaying directories'
  180.     db    cr,lf,'ESCAPE character during CONNECT'
  181.     db    cr,lf,'FILE-MODE for outgoing files'
  182.     db    cr,lf,'FLOW-CONTROL to set XON/XOFF flow control'    ;[10]
  183.     db    cr,lf,'IBM mode: parity and turn around handling'
  184.     db    cr,lf,'INCOMPLETE-FILE disposition'
  185.     db    cr,lf,'LOCAL-ECHO (half-duplex)'
  186.     db    cr,lf,'LOGGING of terminal sessions'    ;[pcc013]
  187.     db    cr,lf,'NO-EXIT to prevent exit to CP/M after a command tail'
  188.     db    cr,lf,'PARITY for communication line'
  189.     db    cr,lf,'PORT to communicate on'
  190.     db    cr,lf,'PRINTER copy control'
  191.     db    cr,lf,'RECEIVE parameters'    ;not all currently implemented
  192.     db    cr,lf,'SEND parameters'        ;Ditto
  193.     db    cr,lf,'SPEED of communication line'
  194.     db    cr,lf,'TAC interface support'
  195.     db    cr,lf,'TERMINAL to set a terminal type'
  196.     db    cr,lf,'TIMER control'
  197.     db    cr,lf,'USER to set a user number'        ;[DJR]
  198.     db    cr,lf,'WARNING for filename conflicts'
  199.     db    '$'
  200.  
  201. ;
  202. ; SET AUTORECEIVE on/off command
  203. setaut:    call    onoff        ; set it either on or off
  204.     sta    autorc        ; and save the flag
  205.     jmp    kermit        ; and do next command
  206.  
  207. ;SET BLOCK-CHECK-TYPE command.
  208.  
  209. blkset:    lxi    d,blktab    ;Get the address of the block-check table
  210.     lxi    h,blkhlp    ;And the address of the help text
  211.     call    chkkey        ;Go check input (val returns in A).
  212.     sta    chktyp        ;Save desired checksum type
  213.     jmp    kermit        ;Go get another command
  214.  
  215. blktab:    db    3        ;Three entries.
  216.     db    20,    '1-CHARACTER-CHECKSUM$',    '1','1'
  217.     db    20,    '2-CHARACTER-CHECKSUM$',    '2','2'
  218.     db    21,    '3-CHARACTER-CRC-CCITT$',    '3','3'
  219.  
  220. blkhlp:    db    cr,lf,'1-CHARACTER-CHECKSUM'
  221.     db    cr,lf,'2-CHARACTER-CHECKSUM'
  222.     db    cr,lf,'3-CHARACTER-CRC-CCITT$'
  223.  
  224. ;
  225. ;       This is the SET BUFFER-SIZE command.  
  226. ;       Sets to maximum number of sectors to use for multiple sector 
  227. ;       buffering.  Sorts a lot f problems on some slow disc-access machines..
  228. setbuf:    mvi    a,cmnum        ; get a number from the user 
  229.     call    comnd
  230.     jmp    kermit        ; error if nothing
  231.     lhld    number        ; get the value
  232.     mov    a,h
  233.     ana    a
  234.     jnz    setbu1        ; if number greater than 255 then error
  235.     lda    maxbsc        ; get maximum no sectors allowed by system
  236.     cmp    l        ; set flags from a-l
  237.     jm    setbu1        ; if l > a then error
  238.     mov    a,l        ; only ls bits used
  239.     sta    bufsec
  240.     jmp    kermit
  241.  
  242. setbu1:    lxi    d,erms25
  243.     call    prtstr
  244.     jmp    kermit
  245.  
  246.  
  247. ;SET DEFAULT DISK command
  248.  
  249. setdisk:lxi    d,fcb
  250.     mvi    a,cmifin    ;get "file-spec" silently
  251.     call    comnd
  252.     jmp    setdi1
  253. setdi1:    lda    fcb
  254.     ora    a        ;Was a drive specified? (if zero, no)
  255.     jnz    setdi2        ;he typed a drive-spec
  256.     lda    curdsk        ;he didn't - give him default
  257. setdi2:    sta    curdsk
  258.     mvi    c,inbdos    ;reset disks
  259.     call    bdos
  260.     lda    curdsk
  261.     dcr    a        ;LOGDSK is relative 0
  262.     mov    e,a
  263.     mvi    c,logdsk
  264.     call    bdos        ;and "LOG" it
  265.     jmp    kermit        ;all done
  266. ;
  267. ;SET SEND command.  Sort of supported
  268.  
  269. setsnd:    lxi    d,stsntb    ;Parse a keyword from the set send table.
  270.     lxi    h,stshlp
  271.     call    keycmd
  272.     xchg        ; Get dispatch address into HL
  273.     pchl        ; Go for it.
  274.  
  275. stsntb:    db    4        ;Two entries.  four entries
  276.     db    8, 'PAD-CHAR$'
  277.         dw stspac
  278.     db    7, 'PADDING$'
  279.         dw stspad
  280.     db    15, 'START-OF-PACKET$'    ;[gnn]
  281.         dw stssop        ;[gnn]
  282.     db    13,'PACKET-LENGTH$'    ;
  283.         dw stspks        ;
  284. ;    db    9,'CHECKTYPE$'        ;
  285. ;        dw stsckt        ;
  286.  
  287. stshlp:    db    cr,lf,'PAD-CHAR to define the pad character to use'
  288.     db    cr,lf,'PADDING to define the number of PAD-CHAR to use'
  289.     db    cr,lf,'START-OF-PACKET to define the start of packet character'    ;[gnn]
  290.     db    cr,lf,'PACKET-LENGTH for the length of transmitted packet';
  291. ;    db    cr,lf,'CHECKTYPE to define the check-type to use';[21]
  292.     db    '$'        ;[gnn]
  293.  
  294. ; SET SEND START-OF-PACKET   [gnn]
  295. stssop:    call    cfmcmd
  296.     lxi    d,sopmes
  297.     call    prtstr
  298.     mvi    c,conin
  299.     call    bdos
  300.     sta    sndsop
  301.     jmp    kermit
  302.  
  303. ; SET SEND PADDING command. does nothing.  get value to dspad
  304. stspad:    call    getnp        ; get the number of padding characters
  305.     sta    dspad        ; save ad default send no. pad characters
  306.     jmp    kermit
  307.  
  308. ; SET SEND PAD-CHAR command. does nothing.  gets char to dspadc
  309. stspac:    call    getpad        ; get the character to use
  310.     sta    dspadc        ; save as default send pad character
  311.     jmp    kermit
  312.  
  313. ; SET SEND PACKET-LENGTH command.  Max 95, but could be more for long pkts...
  314. stspks:    call    getnp        ; get number into hl
  315.     lxi    b,(maxpkt-1)    ;[MF] One below upper limit of packet-size
  316.     push    h        ;[MF] Save number
  317.     call    subbc        ;[MF] Do 16-bit subtraction, even though
  318.                 ;[MF] getnp puts low-order bits in a,
  319.                 ;[MF] in case long packets are
  320.                 ;[MF] implemented
  321.     pop    h        ;[MF] Restore number
  322.     lxi    d,erms26    ; packet length to long error
  323.     jnc    stspk1
  324.     mov    a,l
  325.     sta    spsiz        ;[MF] Save as default send packet length
  326.     jmp    kermit
  327. stspk1:    call    prtstr
  328.     jmp    kermit        ; error exit
  329.  
  330. ; SET SEND CHECKTYPE command. Accepts 1,2 or 3
  331. stsckt:    call    getnp        ; get a number
  332.     cpi    4        ; if more than 3 then error
  333.     jnz    stsck1
  334. stsck2:    lxi    d,erms27    ; checktype wrong
  335.     jmp    kermit
  336. stsck1:    cpi    0        ; error also for null
  337.     jz    stsck2
  338.     adi    30h        ; make it printable
  339.     sta    sdckt        ; save as default send checktype
  340.     jmp    kermit
  341.  
  342.  
  343. ;SET RECEIVE command.   [gnn]
  344. setrec:    lxi    d,strctb    ;Parse a keyword from the set rec table.
  345.     lxi    h,stshlp    ; use same help for send and receive
  346.     call    keycmd
  347.     xchg        ; Get dispatch address into HL
  348.     pchl        ; Go for it.
  349.  
  350. strctb:    db    4        ;  Three entries.  four entries
  351.     db    8, 'PAD-CHAR$'
  352.         dw strpac    ; use dummy entry of set send
  353.     db    7, 'PADDING$'
  354.         dw strpad    ; use dummy entry of set send
  355.     db    15,'START-OF-PACKET$'
  356.         dw strsop
  357.     db    13,'PACKET-LENGTH$'        ;
  358.         dw strpks        ;
  359. ;    db    9,'CHECKTYPE$'        ;
  360. ;        dw strckt        ;
  361.  
  362. ; SET RECEIVE START-OF-PACKET  
  363. strsop:    call    cfmcmd
  364.     lxi    d,sopmes
  365.     call    prtstr
  366.     mvi    c,conin
  367.     call    bdos
  368.     sta    rcvsop
  369.     jmp    kermit
  370.  
  371. ; SET RECEIVE PADDING
  372. strpad:    mvi    a,cmnum        ; go parse a number
  373.     call    comnd        ; get it
  374.     jmp    kermit        ; duff entry, so die
  375.     mvi    a,cmcfm        ; ask to confirm
  376.     call    comnd
  377.     lhld    number        ; get the number of padding charaters
  378.     mov    a,l        ; assume 255 or less
  379.     sta    dspad        ; save ad default send no. pad characters
  380.  
  381. ; SET SEND RECEIVE routines
  382. getpad:    call    cfmcmd
  383.     lxi    d,padcms    ; tell user we want the pad character
  384.     call    prtstr
  385.     mvi    c,conin        ; get it verbatum
  386.     call    bdos
  387.     ret
  388.  
  389. ; SET RECEIVE PAD-CHAR routine
  390. strpac:    call    getpad        ; get the character to use
  391.     sta    drpadc        ; save it
  392.     jmp    kermit
  393.  
  394. ; SET RECEIVE PACKET-LENGTH.  Max 95, but could be more for long pkts...
  395. strpks:    call    getnp        ; get number into hl
  396.     lxi    b,(maxpkt-1)    ;[MF] One below upper limit of packet-size
  397.     push    h        ;[MF] Save number
  398.     call    subbc        ;[MF] Do 16-bit subtraction, even though
  399.                 ;[MF] getnp puts low-order bits in a,
  400.                 ;[MF] in case long packets are
  401.                 ;[MF] implemented
  402.     pop    h        ;[MF] Restore number
  403.     lxi    d,erms26    ; packet length to long error
  404.     jnc    strpk1
  405.     mov    a,l
  406.     sta    rpsiz        ;[MF] Save as default receive packet-length
  407.     jmp    kermit
  408. strpk1:    call    prtstr
  409.     jmp    kermit        ; error exit
  410.  
  411.  
  412. ; SET RECEIVE CHECKTYPE
  413. strckt:    call    getnp        ; get a number
  414.     cpi    4        ; if more than 3 then error
  415.     jnz    strck1
  416. strck2:    lxi    d,erms27    ; checktype wrong
  417.     jmp    kermit
  418. strck1:    cpi    0        ; error also for null
  419.     jz    strck2
  420.     adi    30h        ; make it printable
  421.     sta    rdckt        ; save as default receive checktype
  422.     jmp    kermit
  423.  
  424. getnp:    mvi    a,cmnum        ; go parse a number
  425.     call    comnd        ; get it
  426.     jmp    kermit        ; duff entry, so die
  427.     mvi    a,cmcfm        ; ask to confirm
  428.     call    comnd
  429.       jmp    kermit        ;[MF] Die!
  430.     lhld    number        ; get the number of padding charaters
  431.     mov    a,l        ; assume 255 or less
  432.     ret        ; return to caller
  433.  
  434.  
  435. ; SET NO-EXIT on/off.  Sets a flag to prevent automatically dropping 
  436. ;    back to CPM after a command tail has been "done".  No other use.
  437. noexit:    call    cfmcmd        ;[MF]Get a "confirm" in case here via STAY
  438.     xra    a
  439.     sta    nexitf        ; no exit to CP/M
  440.     jmp    kermit
  441.  
  442. ;[pcc013]
  443. ;       This is the SET LOGGING ON/OFF subcommand
  444.  
  445. setlog:    call    onoff        ;[pcc013] Get on/off
  446.     sta    logflg        ;[pcc013] Store flag
  447.     jmp    kermit
  448. ;
  449. ;       This is the SET ESCAPE character subcommand.
  450.  
  451. escape:    call    cfmcmd
  452.     lxi    d,escmes    ;Get the address of the escape message.
  453.     call    prtstr
  454.     mvi    c,conin        ;Get the char.
  455.     call    bdos
  456.     sta    escchr        ;Store the new escape character.
  457.     jmp    kermit
  458.  
  459. ;       This is the SET LOCAL-ECHO subcommand.
  460.  
  461. locall:    call    onoff        ;Get on/off setting [Toad Hall]
  462.     sta    ecoflg        ;Store local echo flag.
  463.     jmp    kermit
  464.  
  465. ;       This is the SET PRINTER ON/OFF subcommand
  466.  
  467. setprn:    call    onoff        ;Get on/off setting [Toad Hall]
  468.     sta    prnflg        ;Store printer flag
  469.     jmp    kermit
  470.  
  471. ;       This is the SET DEBUG ON/OFF subcommand
  472.  
  473. setdbg:    call    onoff        ;Get on/off setting [Toad Hall]
  474.     sta    dbgflg        ;Store debug flag
  475.     jmp    kermit
  476.  
  477. ;[jd] this is the SET TIMER subcommand
  478.  
  479. settim:    call    onoff        ;Get on/off setting [Toad Hall]
  480.     sta    timflg        ;Store timer flag value
  481.     jmp    kermit
  482.  
  483. ;This is the SET FILE-WARNING subcommand
  484.  
  485. filwar:    call    onoff        ;Get on/off setting [Toad Hall]
  486.     sta    flwflg        ;Store file-warning flag.
  487.     jmp    kermit
  488.  
  489. ;[MF]This is the SET COLLISION subcommand
  490. ;[MF]First, the requisite tables:
  491. ;
  492. coltab:    db    4        ;[MF]4 entries
  493.     db    6,'BACKUP$',02h,02h
  494.     db    7,'DISCARD$',03h,03h
  495.     db    9,'OVERWRITE$',00h,00h
  496.     db    6,'RENAME$',01h,01h
  497. ;
  498. colhlp:    db    cr,lf,'BACKUP (rename) existing files'
  499.     db    cr,lf,'DISCARD new versions of existing files'
  500.     db    cr,lf,'OVERWRITE existing files'
  501.     db    cr,lf,'RENAME new versions of existing files'
  502.     db    '$'
  503. ;
  504. ;[MF]Now the routine proper
  505. ;
  506. setcol:    lxi    d,coltab    ;[MF]Table address
  507.     lxi    h,colhlp    ;[MF]Help address
  508.     call    chkkey        ;[MF]Get user's answer
  509.     sta    flwflg        ;[MF]and remember it
  510.     jmp    kermit        ;[MF]Back to main loop
  511.  
  512. ;[10] This is the SET FLOW-CONTROL subcommand.
  513. setflo:    call    onoff        ;is it on or off
  514.     sta    floctl        ; store flow contol flag
  515.     jmp    kermit
  516.  
  517. ;[10] SET CASE-SENSITIVE on or off
  518. ;setcase:    
  519. ;    call    onoff        ; set it on or off
  520. ;    sta    casens        ; save it
  521. ;    jmp    kermit
  522.  
  523. ; SET FILE-SIZE on or off.  If on, then show file size during DIR
  524. ;
  525. hidef:    call    onoff        ; see if on or off
  526.     sta    hidefs
  527.     jmp    kermit
  528.  
  529. ;
  530. ;       This is the SET IBM command.
  531. ;
  532. ;    If SET IBM ON, we should do
  533. ;        1)  Flow Control = off
  534. ;        2)  Parity = mark
  535. ;        3)  Local echo = on
  536. ;        4)  Timer = on
  537. ;
  538. ;    If SET IBM OF, we should assume (& do)
  539. ;        1)  Flow control = off (default)
  540. ;        2)  Parity = none
  541. ;        3)  Local Echo = off
  542. ;        4)  Timer = off
  543.  
  544.  
  545. ibmset:    call    onoff        ;Get on/off setting [Toad Hall]
  546.     sta    ibmflg        ;Store IBM flag.
  547.     ora    a        ;Is it turned on?
  548.     jz    ibmst1        ;If not, set parity to the default.
  549. ;
  550. ; SET IBM ON code
  551.     mvi    a,ibmpar    ;Get the IBM parity.
  552.     sta    parity
  553.     mvi    a,1        ;Set local echo on.
  554.     sta    ecoflg
  555.     sta    timflg        ; also set timer on
  556.     xra    a        ; no flow control
  557.     sta    floctl
  558.     jmp    ibmst2        ; exit
  559. ;
  560. ; SET IBM OFF code
  561.  
  562. ibmst1:    mvi    a,defpar    ; set default parity (none)
  563.     sta    parity
  564.     xra    a        ;Set local echo off.
  565.     sta    ecoflg
  566.     sta    timflg        ;[jd] timer is same as local echo
  567.     sta    floctl        ;[obs] set flow control off
  568. ibmst2:    jmp    kermit        ; exit from here
  569.  
  570. ;
  571. ;       SET FILE-MODE command.
  572. ;[OBS] assume only ascii and binary, no default.
  573.  
  574. setcpm:    lxi    d,typtab
  575.     lxi    h,typhlp
  576.     call    chkkey        ;Get and confirm keyword, or die trying
  577.     sta    cpmflg        ;Set the CPM flag.
  578.     jmp    kermit
  579.  
  580. typtab:    db    3        ;Three entries, now two entries
  581.                 ;[MF]Now 3 again!
  582.     db    5, 'ASCII$',    01H,01H
  583.     db    6, 'BINARY$',    02H,02H
  584.     db    7, 'DEFAULT$',    00H,00H    ; Default
  585.  
  586. typhlp:    db    cr,lf,'ASCII    BINARY    DEFAULT'
  587.     db    '$'
  588. ;
  589. ;setinc - Set Incomplete-file [MF]
  590. ;
  591. setinc:    lxi    d,inctab    ;[MF]Point to tables
  592.     lxi    h,inchlp    ;[MF]...
  593.     call    chkkey        ;[MF]Get user's answer or croak
  594.     sta    incflg        ;[MF]Remember the answer
  595.     jmp    kermit        ;[MF]We are done.
  596. ;
  597. inctab:    db    2        ;two entries
  598.     db    7,'DISCARD$'
  599.     db    00h,00h        ;Discard incomplete files
  600.     db    4,'KEEP$'
  601.     db    01h,01h        ;Keep incomplete files
  602. ;
  603. inchlp:    db    cr,lf,'DISCARD    KEEP'
  604.     db    '$'
  605.  
  606. ;       This is the SET PARITY subcommand.
  607.  
  608. parset:    lxi    d,partab
  609.     lxi    h,parhlp
  610.     call    chkkey        ;Get and confirm keyword, or die trying
  611.     sta    parity        ;Set the parity flag.
  612.     jmp    kermit
  613.  
  614. partab:    db    5        ;Five entries.
  615.     db    4, 'EVEN$',    parevn,parevn
  616.     db    4, 'MARK$',    parmrk,parmrk
  617.     db    4, 'NONE$',    parnon,parnon
  618.     db    3, 'ODD$',    parodd,parodd
  619.     db    5, 'SPACE$',    parspc,parspc
  620.  
  621. parhlp:    db    cr,lf,'EVEN    MARK    NONE    ODD    SPACE$'
  622.  
  623. ;       This is the SET TACTRAP subcommand.
  624. ;       options are ON, OFF, or CHARACTER.  (for CHARACTER, we request the
  625. ;       new TAC Intercept character, and turn the TACtrap on)
  626.  
  627. settac:    lxi    d,tactab
  628.     lxi    h,tachlp
  629.     call    chkkey        ;Get and confirm keyword
  630.     ora    a        ;Was it "OFF" (zero)?
  631.     jz    settc2        ;If so, go disable TACtrap.
  632.     cpi    1        ;Was it "ON"?
  633.     jz    settc1        ;If so, go enable TACtrap.
  634.     lxi    d,tacmes    ;"CHARACTER". request new TAC Intercept char.
  635.     call    prtstr
  636.     mvi    c,conin        ;Get the char.
  637.     call    bdos
  638.     sta    tacchr        ;Store the new TAC Intercept character.
  639. settc1:    lda    tacchr        ;Copy tacchr to tacflg to enable TACtrap.
  640. settc2:    sta    tacflg        ;Enable/disable TACtrap
  641.     jmp    kermit
  642.  
  643. tactab:    db    3        ;Three entries.
  644.     db    9,    'CHARACTER$',    02H,02H
  645.     db    3,    'OFF$',        00H,00H
  646.     db    2,    'ON$',        01H,01H
  647.  
  648. tachlp:    db    cr,lf,'ON to enable TAC trap'
  649.     db    cr,lf,'OFF to disable TAC trap'
  650.     db    cr,lf,'CHARACTER to enable TAC trap and'
  651.     db    ' specify intercept character$'
  652.  
  653. ;       This is the SET VT52-EMULATION subcommand.
  654. ; Now SET TERMINAL xxx
  655. ;vt52em:    lda    vtflg        ;get the flag value
  656. ;    cpi    0ffH        ;0ffH means not allowed -
  657. ;    jz    notimp        ; say it's not implemented.
  658. ;    call    onoff        ;Get keyword (ON or OFF)
  659. ;    sta    vtflg        ;Set the VT52 emulation flag.
  660. ;    jmp    kermit
  661. vt52em:    lxi    d,sttert    ; set terminal type
  662.     lxi    h,stterh    ; help table
  663.     call    chkkey        ; get it
  664.     mov    a,d        ; value returned in DE
  665.     cpi    vtdefe        ; was it selecting an external terminal?
  666.     jnz    vt52e1        ; no, so save new value
  667.     lhld    extern+1    ; if external, lets see if one is in place
  668.     mov    a,h
  669.     ora    l
  670.     mvi    a,vtdefe    ; restore external flag
  671.     jnz    vt52e1        ; we have one, so we can save value
  672.     call    prcrlf
  673.     lxi    d,inms11    ; load up sorry message
  674.     call    prtstr
  675.     jmp    kermit
  676.  
  677. vt52e1:    cpi    40h        ; are we to have a quiet display?
  678.     jnz    vt52e2
  679.     sta    quietd        ; store it
  680.     jmp    kermit
  681.  
  682. vt52e2:    cpi    80h        ; are we to be a noisy display?
  683.     jnz    vt52e3
  684.     xra    a
  685.     sta    quietd
  686.     jmp    kermit
  687.  
  688. vt52e3:    sta    vtflg        ; else save new set parameter..
  689.     jmp    kermit        ; and exit
  690.  
  691. ; tabe with string entry, and the returned value as two identical bytes.
  692. sttert:    db    6        ; six types
  693.     db    4,'DUMB$',vtdefd,vtdefd        ; assume our terminal is thick
  694.     db    8,'EXTERNAL$',vtdefe,vtdefe    ; assume off, but terminal is in dep. code
  695.     db    5,'QUIET$',40h,40h        ; display quiet
  696.     db    7,'REGULAR$',80h,80h        ; display loud
  697.     db    3,'OFF$',vtdefo,vtdefo        ; assume our terminal does everything
  698.     db    4,'VT52$',vtdefv,vtdefv        ; VT52 as before
  699.  
  700. stterh:    db    cr,lf,'DUMB - only printable characters passed to terminal'
  701.     db    cr,lf,'EXTERNAL - with emulation code system specific'
  702.     db    cr,lf,'OFF - all characters passed to terminal'
  703.     db    cr,lf,'QUIET - display nothing during transfers'
  704.     db    cr,lf,'REGULAR - normal display for transfers'
  705.     db    cr,lf,'VT52 - assume Kermit can emulate a VT52'
  706.     db    '$'
  707.  
  708. ;
  709. ;       Note:  For the SET BAUD and SET PORT commands, which might not be
  710. ;       supported for the current system, the command tables are stored in
  711. ;       the overlay.  We locate them through pointers in the linkage area:
  712. ;       spdtab for SET BAUD, prttab for SET PORT.  The contents of spdtab
  713. ;       (or prttab) is the address of the beginning of the table (the table
  714. ;       does NOT begin at spdtab).  If the address is zero, the command is
  715. ;       not supported.  If the table address is nonzero, then there is a
  716. ;       corresponding help message pointed to by (NOT starting at) spdhlp
  717. ;       or prthlp.
  718.  
  719. ;       This is the SET BAUD command
  720.  
  721. baud:    lhld    spdtab        ; get pointer to speed table
  722.     mov    a,h
  723.     ora    l        ; test for NULL (zero)
  724.     jz    notimp        ; if so, say it's not implemented
  725.     xchg        ; move speed table address to DE
  726.     lhld    spdhlp        ; get pointer to speed help text
  727.     call    keycmd
  728.     push    d        ; save selected speed
  729.     call    cfmcmd        ; confirm...
  730.     pop    h        ; restore speed to HL
  731.     shld    speed        ; save all 16 bits of speed value
  732.     xchg        ; move speed to DE
  733.     call    sysspd        ; do system-dependent speed setting.
  734.     jmp    kermit        ; return to command level
  735.  
  736. ;       This is the SET PORT command
  737.  
  738. prtset:    lhld    prttab        ; get pointer to port table
  739.     mov    a,h
  740.     ora    l        ; test for NULL
  741.     jz    notimp        ; not supported if pointer was null.
  742.     xchg        ; move port table address to DE
  743.     lhld    prthlp        ; get pointer to port help text
  744.     call    keycmd
  745.     push    d        ; save selected port entry
  746.     call    cfmcmd        ; confirm...
  747.     pop    h        ; restore table address to HL
  748.     shld    port        ;[hh] save all 16 bits of port value
  749.     call    sysprt        ; go do port stuff
  750.     jmp    kermit
  751. ;
  752. ;       Subroutines for SET subcommands
  753.  
  754. ;       ontab - command table for onoff.
  755. ;       onhlp - help text for onoff.
  756. ;       onoff - accept "ON" or "OFF" keyword.
  757. ;       returns:
  758. ;          success: value in A (non-zero = ON)
  759. ;          error: no return to caller. print error message and return to
  760. ;               main loop.
  761. ontab:    db    2        ;Two entries.
  762.     db    3, 'OFF$',    00H,00H
  763.     db    2, 'ON$',    01H,01H
  764.  
  765. onhlp:    db    cr,lf,'OFF    ON$'
  766.  
  767. onoff:    lxi    d,ontab
  768.     lxi    h,onhlp
  769.     ;Fall through to check input.  [Toad Hall]
  770.  
  771. ;       chkkey - parse and confirm keyword.
  772. ;       called with:
  773. ;          DE/ address of keyword table
  774. ;          HL/ address of help text
  775. ;       returns:
  776. ;          success: low byte of keyword value (from table) in A.
  777. ;          error: no return to caller.  print error message and return to
  778. ;               main loop.  (Since the main loop reloads the stack pointer,
  779. ;               we don't have to attempt to clean up the stack here)
  780.  
  781. chkkey:    call    keycmd        ; Parse a keyword (might not return)
  782.     sta    temp1        ; Save the parsed value
  783.     call    cfmcmd        ; Request confirmation (might not return)
  784.     lda    temp1        ; Get saved value
  785.     ret        ; Return
  786.  
  787. ;[hh]   fndkyw - find a keyword string from a table using 
  788. ;               it's associated value
  789. ;       called with:
  790. ;          HL/ address of keyword table
  791. ;           A/ value associated with keyword string
  792. ;       returns:
  793. ;          success: HL points to first byte of keyword string
  794. ;                   CY flag is cleared
  795. ;          error:   HL points to error string (?Not found)
  796. ;                   CY flag is set
  797.  
  798. fndkyw:    mov    d,m        ;get count of entries
  799.     inx    h        ;advance over count value
  800. fndkw1:    mov    b,m        ;get string length
  801.     inr    b        ;account for $
  802.     inx    h        ;advance over length value
  803.     shld    temp1        ;save string pointer
  804. fndkw2:    inx    h        ;loop over string
  805.     dcr    b
  806.     jnz    fndkw2
  807.     mov    c,m        ;get keyword value from table
  808.     cmp    c        ;do they match?
  809.     jz    fndkw3        ;Yup
  810.     inx    h        ;bump to next keyword
  811.     inx    h        ;
  812.     dcr    d        ;decrement entry count
  813.     jnz    fndkw1        ;check the remaining keywords
  814.     lxi    h,kywdnf    ;point to not found message
  815.     stc        ;give calling routine a not found flag
  816.     ret
  817. fndkw3:    ora    a        ;clear CY to tell caller we succeeded
  818.     lhld    temp1        ;restore the saved string pointer
  819.     ret
  820.  
  821. kywdnf:    db    cr,lf,'?Not found$'    ;not found message
  822.  
  823. ;
  824. ;       This is the SHOW command.
  825.  
  826. show:    call    cfmcmd
  827. ;* Reconcile this and status.
  828.     call    clrtop        ;[hh] Clear screen first
  829.     call    stat01        ;For now just cop out.
  830.     jmp    kermit
  831.  
  832. ;       This is the STATUS command.
  833.  
  834. status:    call    cfmcmd
  835.     call    clrtop        ;[hh] Clear screen first
  836.     call    stat01
  837.     jmp    kermit
  838.  
  839. ;       processor for SHOW, STATUS and <escape>S commands
  840. ;       called by: show, status, intchr
  841.  
  842. stat01:    lda    fileio        ;Are we in transmit?
  843.     ora    a
  844.     jz    sta01b        ;No
  845.     lxi    d,xmtst        ;Yes,say so
  846.     call    prtstr
  847.  
  848. ;       The following block of code - down to RET - re-ordered by  [DJR]
  849. ;       DJR January 1987 to get SHOW/STATUS output in the same     [DJR]
  850. ;       (alphabetical) order as SET's HELP.                        [DJR]
  851. sta01b:
  852.     call    stautr        ;[MF]Show AUTORECEIVE state
  853.         call    stabcc          ; Tell current block check type
  854.         call    stabsz          ; Tell user about multi-sector buffers
  855.     call    stacol        ;[MF]COLLISION state
  856.         call    stadbg          ; [DJR] Debug mode
  857.         call    stacurd         ; [DJR] Current disk
  858.         call    stahfs          ; Tell user if file sizez are hidden during DIR
  859.         call    staesc          ; Tell current escape character
  860.         call    stafil          ; Tell about file type
  861.         call    staflo          ;[10] Tell about flow control
  862.         call    staibm          ; Tell about IBM flag
  863.     call    stainc        ;[MF]Tell about incomplete file disposition
  864. ;
  865. ; Ask user to press a key before continuing
  866. ;
  867.     call    pausit        ; wait for a while till user presses a key
  868. ;
  869.         call    staeco          ; Tell about local echo flag
  870.         call    stalog          ; [pcc003] Tell about log file status
  871.     call    stapar          ; Tell about parity
  872.         lhld    prttab          ;[hh] Got a port table? (is pointer nonzero?)
  873.         mov     a,h             ;[hh]
  874.         ora     l               ;[hh]
  875.         cnz     stapor          ;[hh] If so, tell which port we're using
  876.         call    stalpt          ; Tell about printer copy flag
  877.     call    starps        ;[MF]Show receive packet length
  878.         call    starsp          ;[gnn] tell rec. start-of-pkt char
  879.     call    stasps        ;[MF]Show send packet length
  880.         call    stassp          ;[gnn] tell send start-of-pkt char
  881.         lhld    spdtab          ; Got a speed table? (is pointer nonzero?)
  882.         mov     a,h
  883.         ora     l
  884.         cnz     staspd          ; If so, tell what speed we're running.
  885.         call    statac          ; Tell about TAC flag/intercept character.
  886.         call    statim        ; Tell about timer flag
  887.         call    stusr        ;[7] Tell about user
  888.         call    statvt        ; Tell about what emulation we are doing
  889.         call    stawrn          ; Tell about file-warning flag
  890.         ret
  891.  
  892. ;    stautr - Show Autoreceive setting [MF]
  893. ;
  894. stautr:    lxi    d,autrst    ;[MF]Point to "Autoreceive" string
  895.     call    prtstr        ;[MF]and print it
  896.     lda    autorc        ;[MF]Get Autoreceive flag
  897.     jmp    staton        ;[MF]Say "on" or "off" and return
  898.  
  899. ;       Show the value of the LOCAL-ECHO flag (On or Off).
  900.  
  901. staeco:    lxi    d,locst        ;Get the address of the local echo string.
  902.     call    prtstr
  903.     lda    ecoflg        ;Get the local echo flag.
  904.     jmp    staton        ;Say ON or OFF, and return
  905.  
  906. ;       Show the value of the VT52-EMULATION flag (On, Off, or Not Supported).
  907. ;    Also show terminal display mode (regular, quiet)
  908.  
  909. statvt:    lxi    d,vtdpst    ;[MF]Get address of terminal display string
  910.     call    prtstr        ;[MF]Print it
  911.     lxi    d,vtdpsr    ;[MF]Assume a regular (loud) display
  912.     lda    quietd        ;[MF]Get "quiet" flag
  913.     ora    a        ;[MF]a quiet display?
  914.     jz    statva        ;[MF]No, print "regular" message
  915.     lxi    d,vtdpsq    ;[MF]Yes, point to "quiet" string
  916. statva:    call    prtstr        ;[MF]and print it
  917.     lxi    d,vtemst    ; Get the address of the VT52 emulation string.
  918.     call    prtstr
  919.     lda    vtflg        ; Get the VT52 emulation flag.
  920.     cpi    0ffh        ; isterminal emulation possible?
  921.     jnz    statv0        ; yes, maybe
  922.     lxi    h,inms11    ; ... no, load up not implemented message ...
  923.     jmp    prvtv        ; so tell user
  924.  
  925.  
  926. statv0:    mov    c,a        ; save it to C
  927.     lxi    h,sttert    ; get table listing what we can do
  928.     mov    b,m        ; get number of terminal types to b
  929. statv1:    inx    h        ; point to first entry
  930.     mov    e,m        ; get length of entry
  931.     mvi    d,0
  932.     inx    h        ; point to text part of entry
  933.     xchg        ; save address in de
  934.     dad    d        ; start + length
  935.     inx    h        ;... + 1 for the dollar...
  936.     inx    h        ; plus point to seconcd copy of ter. type value
  937.     cmp    m        ; is it the one we want?
  938.     jz    prvtv        ; yes, then print the terminal type value
  939.     dcr    b        ; have we completed?
  940.     rz        ; yes, then just exit back to status
  941.     jmp    statv1        ; else try next entry.  HL points to next -1
  942.  
  943. prvtv:    jmp    prtstr        ; print string from DE
  944.                 ;[MF]and return
  945.  
  946. ;       Show the value of the FILE-MODE flag (ASCII, Binary, or Default).
  947.  
  948. stafil:    lxi    d,cpmst        ; Get the address of the file mode message.
  949.     call    prtstr
  950.     lda    cpmflg        ; Get the file mode flag.
  951.     lxi    d,defstr    ; Assume Default (0).
  952.     ora    a        ; Is it?
  953.     jz    prtstr        ; If so, say so, and return.
  954.     lxi    d,ascstr    ; Not default, assume ASCII
  955.     cpi    1        ; Is it ASCII?
  956.     jz    prtstr        ; Say ASCII, and return
  957.     lxi    d,binstr    ; Not default or ASCII, must be binary
  958.     jmp    prtstr        ; Print type, and return.
  959. ;
  960. ;Show current disposition for incomplete files [MF]
  961. ;
  962. stainc:    lxi    d,incst        ;[MF]Announce what's to be shown
  963.     call    prtstr        ;[MF]...
  964.     lxi    d,dscstr    ;[MF]Assume "discard"
  965.     lda    incflg        ;[MF]Get flag
  966.     ora    a        ;[MF]Really discarding incomplete files?
  967.     jz    prtstr        ;[MF]Yes, say so and return
  968.     lxi    d,kepstr    ;[MF]No, say we're keeping incomplete files
  969.     jmp    prtstr        ;[MF]and return
  970.  
  971. ;       show if file sizes are hidden during DIR (Would have thought this
  972. ;       obvious, but its in for completeness
  973. stahfs:    lxi    d,hfsod        ; get hide file size on dir
  974.     call    prtstr
  975.     lda    hidefs
  976.     jmp    staton        ; say if on or off
  977.  
  978. ;       Show the value of the IBM-MODE flag (On or Off).
  979.  
  980. staibm:    lxi    d,ibmst        ;IBM string.
  981.     call    prtstr
  982.     lda    ibmflg        ; Get IBM flag.
  983.     jmp    staton        ; Print its value and return
  984.  
  985. ;       Show the value of the FILE-WARNING flag (On or Off).
  986.  
  987. stawrn:    lxi    d,filst        ; File warning string.
  988.     call    prtstr
  989.     lda    flwflg        ; File warning flag.
  990.     jmp    staton        ; Say ON or OFF
  991.  
  992. ;       Show the value of the PRINTER flag (On or Off).
  993.  
  994. stalpt:    lxi    d,prst        ;Printer copy string
  995.     call    prtstr
  996.     lda    prnflg        ;Printer ON/OFF flag
  997.     jmp    staton        ; Say ON or OFF
  998.  
  999.  
  1000. ;       Show status of log file
  1001. stalog: lxi     d,logst         ;[pcc003] Logging lead-in message
  1002.         call    prtstr          ;[pcc003]
  1003. ;       name of logging file
  1004. ;   Code derived from [JD's] code for GET, and uses his FNBUF  [DJR]
  1005.         lxi    d,fnbuf         ;[DJR] point to destination
  1006.         lxi    h,lognam        ;[DJR] source of filespec
  1007.         mov    a,m             ;[DJR] get drive byte
  1008.         ora    a               ;[DJR] zero = default disc
  1009.         jnz    stalg1          ;[DJR] if drive has been specified
  1010.         lda    curdsk          ;[DJR]  otherwise get the default
  1011. stalg1: adi    'A'-1           ;[DJR] make it printable
  1012.         stax   d               ;[DJR] into dest block
  1013.         inx    d               ;[DJR]
  1014.         mvi    a,':'           ;[DJR] colon after drive
  1015.         stax   d               ;[DJR] 
  1016.         inx    d               ;[DJR] 
  1017.  
  1018.         mvi    c,8             ;[DJR] length of name part
  1019.         lxi    h,lognam+1      ;[DJR] start of name
  1020.         mvi    b,0             ;[DJR] first-time-thru flag
  1021. stalga: mov    a,m             ;[DJR] get a char from the name
  1022.         inx    h               ;[DJR] pass it
  1023.         cpi    ' '             ;[DJR] end of this part of name?
  1024.         jz     stalgb          ;[DJR] yes, skip rest...
  1025.         stax   d               ;[DJR] else drop char into dest
  1026.         inx    d               ;[DJR] increment dest ptr
  1027.         dcr    c               ;[DJR] decrement count
  1028.         jnz    stalga          ;[DJR] and continue if more to go
  1029.  
  1030. stalgb: mov    a,b             ;[DJR]
  1031.         ora    a               ;[DJR] first time thru?
  1032.         jnz    stalgc          ;[DJR] no, no period
  1033.         mvi    a,'.'           ;[DJR] period between parts
  1034.         stax   d               ;[DJR] 
  1035.         inx    d               ;[DJR] 
  1036.         mvi    b,0ffh          ;[DJR] not first time thru anymore
  1037.         mvi    c,3             ;[DJR] length of ext part
  1038.         lxi    h,lognam+9      ;[DJR] start of extension
  1039.         jmp    stalga          ;[DJR] keep copying
  1040.  
  1041. stalgc: mvi    a,'$'
  1042.         stax   d               ;[DJR] end the name string
  1043.         lxi    d,fnbuf         ;[DJR] Print the file name
  1044.         call   prtstr          ;[DJR]
  1045.  
  1046.     lxi    d,logst2        ;[DJR] second part of message
  1047.         call   prtstr          ;[DJR]
  1048.  
  1049. ;    Show status of logging
  1050.     lda    logflg        ;[pcc003] get the flag
  1051.     ani    7FH        ;[pcc003] ignore open flag
  1052.     cpi    2        ;[pcc003] is it suspended?
  1053.     jnz    staton        ;[pcc003] no, must be on or off
  1054.     lxi    d,susstr    ;[pcc003] suspended
  1055.     jp    prtstr        ;[pcc003] print and return
  1056.  
  1057. ;       Show the value of the PARITY flag (Odd, Even, Mark, Space, or None).
  1058.  
  1059. stapar:    lxi    d,parst        ;Parity string.
  1060.     call    prtstr
  1061.     lda    parity        ;Get the parity setting.
  1062.     lxi    d,pnonst    ;Assume parity is NONE
  1063.     cpi    parnon        ;Were we right?
  1064.     jz    prtstr        ;Yep, go say None, and return
  1065.     lxi    d,pmrkst    ;Get ready to say Mark
  1066.     cpi    parmrk        ;Is it mark?
  1067.     jz    prtstr        ;Yep, go say Mark, and return
  1068.     lxi    d,pspcst    ;Get ready to say Space
  1069.     cpi    parspc        ;Is it space?
  1070.     jz    prtstr        ;Yep, go say Space, and return
  1071.     lxi    d,poddst    ;Get ready to say Odd
  1072.     cpi    parodd        ;Is it odd?
  1073.     jz    prtstr        ;Yep, go say Odd, and return
  1074.     lxi    d,pevnst    ;Must be Even.
  1075.     jmp    prtstr        ;Say Even, and return.
  1076.  
  1077. ; [gnn] Show start of packet characters
  1078. stassp:    lxi    d,sspmsg    ;message of send s-o-p
  1079.     call    prtstr
  1080.     lda    sndsop
  1081.     adi    'A'-1        ;convert to printable character
  1082.     mov    e,a
  1083.     mvi    c,conout
  1084.     jmp    bdos        ;and print it
  1085. starsp:    lxi    d,rspmsg    ;rec. s-o-p message
  1086.     call    prtstr
  1087.     lda    rcvsop
  1088.     adi    'A'-1        ;convert to printable character
  1089.     mov    e,a
  1090.     mvi    c,conout
  1091.     jmp    bdos        ;and print it
  1092. ;
  1093. ;[MF]Show receive packet length
  1094. ;
  1095. starps:    lxi    d,rpsmsg    ;[MF]Point to message
  1096.     call    prtstr        ;[MF]and print it
  1097.     lda    rpsiz        ;[MF]Get receive packet length
  1098.     mov    l,a        ;[MF]Put in HL
  1099.     mvi    h,0        ;[MF]...
  1100.     jmp    nout        ;[MF]Print receive packet length in decimal
  1101. ;
  1102. ;[MF]stasps - Print send packet length
  1103. ;
  1104. stasps:    lxi    d,spsmsg    ;[MF]Point to message
  1105.     call    prtstr        ;[MF]and print it
  1106.     lda    spsiz        ;[MF]Get send packet length
  1107.     mov    l,a        ;[MF]into HL
  1108.     mvi    h,0        ;[MF]...
  1109.     jmp    nout        ;[MF]and print in decimal
  1110.  
  1111. ;[hh]   Show the current port (if known).
  1112.  
  1113. stapor:    lxi    d,porst        ;[hh]
  1114.     call    prtstr        ;[hh]
  1115.     lda    port        ;[hh] Get current port value
  1116.     lxi    h,spdust    ;[hh] Assume undefined (this error msg is fine)
  1117.     cpi    0FFH        ;[hh] Is it?
  1118.     jz    stat73        ;[hh] Yup. Say so
  1119.     lhld    prttab        ;[hh] Address of port keyword table
  1120.     call    fndkyw        ;[hh] Look for correct keyword string
  1121.     jnc    stpr1        ;[hh] Found a match
  1122.     lxi    h,spdust    ;[hh] No match found - say it's undefined
  1123. stpr1:    jmp    stat73        ;[hh] Print it and return
  1124.  
  1125. ;       Show the current line speed (if known).
  1126.  
  1127. staspd:    lxi    d,spdst
  1128.     call    prtstr
  1129.     lda    speed        ;Get current speed.
  1130.     lxi    h,spdust    ;Assume undefined.
  1131.     cpi    0FFH        ;Is it?
  1132.     jz    stat73        ;Yes.
  1133.     lhld    spdtab        ;Start scanning keyword table.
  1134.     mov    d,m        ; get count of entries
  1135.     inx    h        ; advance over it.
  1136. stat70:    mov    b,m        ;Get string length.
  1137.     inr    b        ;Account for $.
  1138.     inx    h
  1139.     shld    temp1        ;Save string pointer.
  1140. stat71:    inx    h        ;Loop over string.
  1141.     dcr    b
  1142.     jnz    stat71
  1143.     mov    c,m        ;Get speed value
  1144.     cmp    c        ;Match?
  1145.     jz    stat72        ;Yes.
  1146.     inx    h        ;Bump to next keyword.
  1147.     inx    h
  1148.     dcr    d        ; decrement entry count
  1149.     jnz    stat70        ; if more left, check them.
  1150.     lxi    h,spdust    ; can't find it. say it's undefined.
  1151.     jmp    stat73        ; print the message.
  1152.  
  1153. stat72:    lhld    temp1        ;Restore saved string pointer.
  1154.     xchg        ;[MF] Set into DE for display
  1155.     call    prtstr        ;[MF] Print speed
  1156.     lxi    h,spdst2    ;[MF] Point to "bps" message
  1157. stat73:    xchg        ;Set into DE for display.
  1158.     jmp    prtstr        ; print it, and return.
  1159.  
  1160. ;       Show the current BLOCK-CHECK-TYPE (1-, 2-, or 3-character).
  1161.  
  1162. stabcc:    lxi    d,bckst        ;Get the string
  1163.     call    prtstr        ;Print "Block check type: "
  1164.     lda    chktyp        ;Get the type (character 1, 2, or 3)
  1165.     mov    e,a        ;Put into E
  1166.     mvi    c,conout    ;Want to print it
  1167.     call    BDOS        ;Do so
  1168.     lxi    d,bckst1    ;Get rest of text ("-character")
  1169.     jmp    prtstr        ;Print it and return
  1170. ;
  1171. ;[MF]stacol - Print "SET COLLISION" state
  1172. ;
  1173. stacol:    lxi    d,collst    ;[MF]Get message
  1174.     call    prtstr        ;[MF]Print it
  1175.     lxi    h,coltab    ;[MF]Point to COLLISION keywords
  1176.     lda    flwflg        ;[MF]Get COLLISION state
  1177.     call    fndkyw        ;[MF]Get COLLISION state
  1178.                 ;[MF](Since user doesn't control flwflg
  1179.                 ;[MF]directly, no need to check for errors
  1180.     xchg        ;[MF]Prepare for printing
  1181.     jmp    prtstr        ;[MF]Print COLLISION state and return
  1182.  
  1183. ;       Print the current escape character
  1184.  
  1185. staesc:    lxi    d,escst        ;Escape string.
  1186.     call    prtstr
  1187.     call    escpr        ;Print the escape char.
  1188. ;    jmp    prcrlf        ;removed [DJR] Print CR/LF and return  [Toad Hall]
  1189.     ret        ;[DJR] added
  1190.  
  1191. ;       Show number proportion of buffers used in multiple sector buffering
  1192. stabsz:    lxi    d,bufsz1
  1193.     call    prtstr        ; do first bit of string
  1194.     lxi    h,0
  1195.     lda    bufsec
  1196.     mov    l,a        ; get size used...
  1197.     call    nout        ;... to screen
  1198.     lxi    d,bufsz2    ; and then say max value
  1199.     call    prtstr
  1200.     lxi    h,0
  1201.     lda    maxbsc        ; get max for this system
  1202.     mov    l,a
  1203.     call    nout        ;.. thence to screen
  1204. ;    jmp    prcrlf        ; removed [DJR] cr lf and out
  1205.     ret        ;[DJR]
  1206.  
  1207. ;
  1208. ;       Show the value of the TIMER flag
  1209. statim:    lxi    d,timmsg    ;[jd] 
  1210.     call    prtstr        ;[jd] 
  1211.     lda    timflg
  1212.     jmp    staton        ;Tell whether it's on or off.
  1213.  
  1214. ;       Show internal versions (edit strings)
  1215. shover:    call    cfmcmd
  1216.     call    prcrlf
  1217.     lxi    d,version    ;[MF]Point to Kermit version
  1218.     call    prtstr        ;[MF]and show it
  1219.     lxi    d,modmsg    ;[MF]Continue the message
  1220.     call    prtstr        ;[MF]...
  1221.     call    prcrlf        ;[MF]End the line
  1222.     lxi    h,vertab    ; Get address of version list
  1223. shovr1:    mov    e,m        ; Get next word from list
  1224.     inx    h
  1225.     mov    d,m        ; Next version string is in DE
  1226.     inx    h
  1227.     mov    a,d        ; Test for zero (end of list)
  1228.     ora    e
  1229.     jz    shovr2        ; Done with list if zero
  1230.     push    h        ; Save position in list
  1231.     call    prtstr        ; Not zero.  Print it.
  1232.     call    prcrlf        ; Follow with crlf
  1233.     pop    h        ; Restore position in list
  1234.     jmp    shovr1        ;  and go see if there are any more.
  1235.  
  1236. shovr2:    lhld    ovlver        ; Get overlay version string
  1237.     xchg        ;  into DE
  1238.     call    prtstr        ; Print it
  1239.     call    prcrlf        ; Output crlf
  1240.     lhld    family        ;[11] New entry in overlay.  Get string of 
  1241.     xchg        ;[11]  family of machines (eg apple) and  print
  1242.     call    prtstr        ;[11]  it.  For "common" m/c do a $ only.
  1243.     jmp    kermit        ; Return to main loop.
  1244.  
  1245. ; table of pointers to version strings.
  1246. vertab:    dw    mitver        ; CPSMIT
  1247.     dw    comver        ; CPSCOM
  1248.     dw    pk1ver        ; CPSPK1
  1249.     dw    pk2ver        ; CPSPK2
  1250.     dw    remver        ; CPSREM
  1251.     dw    server        ; CPSSER
  1252.     dw    ttver        ; CPSTT
  1253.     dw    cpmver        ; CPSCPM
  1254.     dw    wldver        ; CPSWLD
  1255.     dw    cmdver        ; CPSCMD
  1256.     dw    utlver        ; CPSUTL
  1257.     dw    datver        ; CPSDAT
  1258.     dw    0        ; end of list
  1259.  
  1260. ;       Show TACTrap status (On or Off, and intercept character)
  1261. statac:    lxi    d,tacst        ;"Current TACTrap status/char: "
  1262.     call    prtstr
  1263.     lxi    d,offstr    ;Assume set off
  1264.     lda    tacflg        ;Get the TACTrap char/flag
  1265.     ora    a        ;Is it off?
  1266.     jz    prtstr        ;Yep, go print OFF...
  1267.     mvi    c,conout    ;Display...
  1268.     mov    e,a        ;...the current intercept char
  1269.     call    bdos
  1270.     jmp    prcrlf
  1271.  
  1272. ;       Show if flow control is set on or off
  1273. staflo:    lxi    d,flost        ; Flow control string
  1274.     call    prtstr
  1275.     lda    floctl        ; get the flag
  1276.     jmp    staton
  1277.  
  1278. ;       Show if Case sensitvity is on or off
  1279. ;stasens:
  1280. ;    lxi    d,senst        ; case sensitivity string
  1281. ;    call    prtstr        ;
  1282. ;    lda    casens
  1283. ;    jmp    staton        ; say if its on or off
  1284.  
  1285.  
  1286. ;       Show the current user. (Should do this under directory...)
  1287. stusr:
  1288.     mvi    c,usrcod
  1289.     mvi    e,0ffh        ;[9] get the current user
  1290.     call    bdos
  1291.     mov    l,a        ;[9] print hl as a number...
  1292.     mvi    h,0
  1293.     push    h        ;[9] got the user number
  1294.     lxi    d,usrst        ;[9] tell the user number
  1295.     call    prtstr
  1296.     pop    h        ;[9] now do number
  1297.     call    nout        ;[6] using routine for writing packet nos.
  1298.     ret
  1299.  
  1300. ;
  1301. ;
  1302. ;       [DJR] Show debug mode
  1303. stadbg:
  1304.         lxi     d,dbgst         ;[DJR] Display string
  1305.         call    prtstr          ;[DJR]
  1306.         lda     dbgflg          ;[DJR] load flag
  1307.         jmp     staton          ;[DJR]
  1308.  
  1309.  
  1310. ;       [DJR] Show default disk
  1311. stacurd:
  1312.         lxi     d,curdst        ;[DJR]
  1313.         call    prtstr          ;[DJR]
  1314.         lda     curdsk          ;[DJR]
  1315.         adi     'A'-1           ;[DJR]
  1316.         mov     e,a             ;[DJR]
  1317.         mvi     c,conout        ;[DJR]
  1318.         jmp     bdos            ;[DJR]
  1319.  
  1320. ;
  1321. ;       Display current state of a boolean flag.
  1322. ;       called with A/ value (zero = Off, non-zero = On)
  1323.  
  1324. staton:    lxi    d,onstr        ; Assume it's on.
  1325.     ora    a        ; Is it on?
  1326.     jnz    prtstr        ; If so, say so, then return.
  1327.     lxi    d,offstr    ; No, say off.
  1328.     jmp    prtstr        ; Print the string, then return.
  1329.  
  1330. ;       STRING command
  1331. ;       get a string from the user and send it to the host.
  1332. string:    mvi    a,cmtxt        ; get the text
  1333.     lxi    d,stbuff    ; where to put it
  1334.     call    comnd
  1335.     jmp    kermit        ; if we cannot do it, then back to command level
  1336.     sta    strcnt        ; save the string count
  1337.     ana    a        ; if it is zero, then do nowt
  1338.     jz    kermit
  1339.     call    cfmcmd        ;[MF]Otherwise, get a "confirm"
  1340.     call    selmdm        ; then select the modem
  1341.     lxi    d,stbuff    ; where to get the string
  1342. stlop:    ldax    d        ; get byte
  1343.     inx    d        ; pointer plus one
  1344.     push    d        ; update pointer, and save de, and the character
  1345.     call    setpar        ; set whatever parity
  1346.     mov    e,a        ; outmdm wants character in e
  1347.     call    outmdm        ; send character in a to line
  1348.     pop    d
  1349.     lda    strcnt        ; get the count
  1350.     dcr    a
  1351.     sta    strcnt        ; less one
  1352.     jnz    stlop        ; else still looping
  1353.     call    selcon        ; re-select the console
  1354.     jmp    kermit
  1355.  
  1356. ;       Print "(not implemented)".
  1357. ;       here from vt52em, baud, prtset, stavt
  1358.  
  1359. notimp:    lxi    d,inms12    ; Say it's not implemented.
  1360.     call    prtstr
  1361.     jmp    kermit        ; Return to main loop.
  1362.  
  1363. ; Little code to allow some expansion of code without changing
  1364. ;  every futher address, only up to the end of this file.
  1365. ;   TO BE REMOVED FRO RELEASE!
  1366.  
  1367. ;    org ($+100h) AND 0FF00H
  1368.  
  1369. IF lasm                ; If using LASM, chain to the next file.
  1370.     LINK    CPSPK1        ;[obs] break down them big files...
  1371. ENDIF;lasm
  1372.