home *** CD-ROM | disk | FTP | other *** search
/ Columbia Kermit / kermit.zip / b / krtcm1.mac < prev    next >
Text File  |  2020-01-01  |  29KB  |  881 lines

  1.     .title    KRTCM1    Misc commands overlay
  2.     .ident    "V03.63"
  3.  
  4. ; /63/    27-Sep-97  Billy Youdelman  V03.63
  5. ;
  6. ;    moved sph$xmode after set$modem so it will prevail..
  7. ;    fixed problem caused by using errtxt buffer to store desired xmode
  8. ;    where a "?" in a error message acted like SET PHONE XMODE ?
  9.  
  10. ; /62/    27-Jul-93  Billy Youdelman  V03.62
  11. ;
  12. ;    make type append a LF to CR if CR not followed by one
  13. ;    hose hi bit and type anyway for VT100 and below in c$type
  14.  
  15. ; /BBS/     1-Dec-91  Billy Youdelman  V03.61
  16. ;
  17. ;    c$type defaults to .LST, error handling improved, does wildcards
  18. ;    also sped up, types any size record, binary file filtering added
  19. ;
  20. ;    c$set - error handling fixed
  21. ;    c$pwd, c$cls, c$clx, c$xmodem added..
  22. ;    c$take parses file name, checks for/disallows wildcards, etc.
  23. ;    c$conn - disallow connect to TT (since one is there already..)
  24. ;    mount/dismount logical disks command interface, calls TSX emts
  25. ;    added RT-11 style assign default device, for DK only
  26. ;    remote disk_usage passes optional device argument
  27. ;    reinit modem when exiting if DTR dropped during CONNECT
  28. ;    added SET CLn LINE x support for TSX-Plus
  29. ;    added search path for take files
  30. ;    move sho$line here, added modem type, TSX line # and DCD status
  31. ;    added call to c$idle in c$exit to reset modem on exit to monitor
  32. ;    c$set now does multiple args, separated by commas
  33.  
  34. ;    Copyright 1983,1984 Change Software, Inc.
  35. ;
  36. ;    Creation: 16-Oct-84  15:38:44  Brian Nelson
  37. ;
  38. ;    This software is furnished under a license and may
  39. ;    be  used  and  copied  only in accordance with the
  40. ;    terms of such license and with  the  inclusion  of
  41. ;    the  above copyright notice.  This software or any
  42. ;    other copies thereof may not be provided or other-
  43. ;    wise made available to any other person.  No title
  44. ;    to and ownership of the software is hereby  trans-
  45. ;    ferred.
  46. ;
  47. ;    The information in this  software  is  subject  to
  48. ;    change  without notice and should not be construed
  49. ;    as a commitment by the author.
  50. ;
  51. ;    12-Sep-86  10:39:27 BDN Convert for I/D space
  52.  
  53.  
  54.     .include "IN:KRTMAC.MAC"
  55.     .iif ndf  KRTINC  .error    <; .include for IN:KRTMAC.MAC failed>
  56.  
  57.     .mcall    .PURGE    ,.SPFUN        ; /62/
  58.  
  59.  
  60.     .sbttl    Local data        ; /63/ consolidated here..
  61.  
  62.     .psect    $rwdata    ,rw,d,lcl,rel,con
  63. crflag:    .word    0            ; /62/ TYPE uses to add LF to lone CR
  64. itsmine:.word    0            ; device is already allocated flag
  65. tk.0:    .word    T10$ ,T30$ ,T50$ ,T70$ ,0    ; addresses of names to try
  66. tk.1:    .word    T20$ ,T40$ ,T60$ ,T80$ ,0    ; put actual file name here
  67.  T10$:    .ascii    "TAK:"                ; this is the take file
  68.  T20$:    .asciz    "            "            ; search path..
  69.  T30$:    .ascii    "KRT:"
  70.  T40$:    .asciz    "            "
  71.  T50$:    .ascii    "DK:"
  72.  T60$:    .asciz    "            "
  73.  T70$:    .ascii    "SY:"
  74.  T80$:    .asciz    "            "
  75. cl.nam:    .asciz    "CLn:"            ; ascii copy of CL name with unit #
  76.     .even
  77.  
  78.     .psect    $pdata
  79. parlst:    .word    P00$ ,P10$ ,P20$ ,P30$ ,P40$    ; parity display in SHOW LINE
  80.  P00$:    .asciz    "NONE"
  81.  P10$:    .asciz    "ODD"
  82.  P20$:    .asciz    "EVEN"
  83.  P30$:    .asciz    "MARK"
  84.  P40$:    .asciz    "SPACE"
  85. cm1.01:    .asciz    " closed"<cr><lf>    ; shared string: TAKE, defterm
  86. cm1.02:    .asciz    " opened"<cr><lf>
  87. cm1.03:    .asciz    " Files copied:"<cr><lf>
  88. cm1.04:    .asciz    "?TYPE-W-Binary file filter enabled"<cr><lf>
  89. cm1.05:    .asciz    " to TT:"<cr><lf>
  90. cm1.06:    .asciz    "Link device is "
  91. cm1.07:    .asciz    "TT:   "
  92. cm1.08:    .asciz    " via Line #"
  93. cm1.09:    .asciz    "   Priority: "
  94. cm1.10:    .asciz    "   Speed: "
  95. cm1.11:    .asciz    "N/A"
  96. cm1.12:    .asciz    "/"
  97. cm1.13:    .asciz    " modem is on-line   "
  98. cm1.14:    .asciz    "DTR: "
  99. cm1.15:    .asciz    "   DCD: "
  100. cm1.16:    .asciz    "   RTS: "
  101. cm1.17:    .asciz    "   CTS: "
  102. cm1.18:    .asciz    "Flow-Control: "
  103. cm1.19:    .asciz    "XOFF/XON   "
  104. cm1.20:    .asciz    "RTS/CTS    "
  105. cm1.21:    .asciz    "S/W Parity: "
  106. li.lo:    .asciz    "low"
  107. li.hi:    .asciz    "HIGH"
  108. takdef::.asciz    ".COM"            ; default take file extent, patchable
  109. typdef:    .asciz    ".LST"            ; default extent for type
  110.     .even
  111.  
  112.  
  113.     .psect    $code
  114.     .sbttl    The SET command        ; /BBS/ just about all new..
  115.  
  116. c$set::    upone    argbuf            ; upper case just next arg
  117.     call    loaset            ; load the set commands overlay
  118.     calls    getcm0    ,<argbuf,r0>    ; lookup address of desired command
  119.     mov    r0    ,r2        ; save a copy of it
  120.     bmi    60$            ; some sort of error occurred
  121.     tst    wasnul            ; were commands listed via "?"
  122.     bne    110$            ; ya
  123.     call    loaset            ; reload set commands overlay
  124.     calls    getcm1    ,<argbuf,r0,r2>    ; check possible argument to command
  125.     tst    r0            ; well?
  126.     bmi    60$            ; bad arg..
  127.  
  128. 10$:    scan    #comma    ,argbuf        ; look for a comma indicating
  129.     mov    r0    ,restof        ; stash pointer to remaining arg(s)
  130.     beq    20$            ; no comma found
  131.     add    argbuf    ,restof        ; convert offset to address
  132.     mov    restof    ,r0        ; get pointer to put a null..
  133.     clrb    -(r0)            ; ..where the comma was
  134.     mov    r1    ,lastcmd    ; save to dispatch when looping back
  135.  
  136. 20$:    jsr    pc    ,@r1        ; dispatch to command starting address
  137.     tst    r0            ; did that succeed?
  138.     bne    40$            ; nope..
  139.     mov    restof    ,r0        ; ya, any more arguments to process?
  140.     beq    110$            ; nope..  note r0 is clear here too
  141. 30$:    cmpb    (r0)+    ,#space        ; is first byte a blank?
  142.     beq    30$            ; ya, skip past it
  143.     dec    r0            ; back up to first non-blank char
  144.     copyz    r0  ,argbuf  ,#ln$max    ; restore remaining as yet unused args
  145.     mov    lastcmd    ,r1        ; recover dispatch address pointer
  146.     br    10$            ; loop back for more
  147.  
  148. 40$:    cmp    r0    ,#cmd$un    ; /62/ which kind of error occurred?
  149.     blt    80$            ; it's not a cmd$.. error
  150.     bgt    50$            ; not ambiguous either
  151.     mov    #er$aop    ,r0        ; it was an ambiguous option or value
  152.     br    80$
  153. 50$:    cmp    r0    ,#cmd$bad    ; bad option or value?
  154.     bne    60$            ; no, it's some other cmd$.. error
  155.     mov    #er$bad    ,r0        ; ya, say so
  156.     br    80$
  157.  
  158. 60$:    cmp    r0    ,#cmd$ab    ; ^C typed?
  159.     beq    100$            ; /62/ ya
  160.     cmp    r0    ,#cmd$nx    ; /62/ ^Z but keep program running?
  161.     beq    100$            ; /62/ ya
  162.     cmp    r0    ,#cmd$ex    ; a real ^Z?
  163.     beq    100$            ; /62/ ya
  164.     cmp    r0    ,#cmd$un    ; ambiguous?
  165.     bne    70$            ; nope
  166.     mov    #er$sam    ,r0        ; ya, make it an ambiguous SET command
  167.     br    90$
  168. 70$:    cmp    r0    ,#cmd$bad    ; bad command?
  169.     bne    80$            ; no
  170.     mov    #er$sun    ,r0        ; it's an unrecognizable SET command
  171.  
  172. 80$:
  173.     call    isitcl            ; check for possible SET CLn
  174.     tst    r0            ; was that it?
  175.     beq    110$            ; ya
  176. 90$:    direrr    r0            ; no.. _ALL_ KRTST0/1 errors come here
  177. 100$:    call    incsts            ; set the global error flag
  178. 110$:    return
  179.  
  180. skipit::tst    restof            ; was a comma in the arg string?
  181.     beq    120$            ; no
  182.     strlen    argbuf            ; ya, get length of part-one
  183.     add    argbuf    ,r0        ; point to its end
  184.     movb    #comma    ,(r0)+        ; stuff the comma back in !!
  185.     copyz    restof    ,r0  ,#ln$max    ; add in rest of original line and
  186.     clr    restof            ; indicate it has been used here
  187. 120$:    return
  188.  
  189.  
  190.     .sbttl    SET CLn LINE x        ; /BBS/ this is all new..
  191.  
  192. ;    input:    entire command argbuf, .asciz
  193.  
  194. isitcl:    mov    r0    ,r4        ; save incoming error
  195.     cmp    r0    ,#er$pri    ; error from SET CL PRIORITY?
  196.     beq    60$            ; /BBS/ ya, bail out
  197.     upcase    argbuf            ; make sure the whole buffer is ok
  198.  
  199. 10$:    scan    #'=    ,argbuf        ; /62/ look for an equals sign
  200.     tst    r0            ; /62/ well?
  201.     beq    20$            ; /62/ not there
  202.     add    argbuf    ,r0        ; /62/ found one, get pointer
  203.     movb    #space    ,-(r0)        ; /62/ and swap in a space for it
  204.     br    10$            ; /62/ check for another "="
  205.  
  206. 20$:    mov    argbuf    ,r2        ; pointer to CLn:
  207.     beq    60$            ; not there..
  208.     cmpb    #'C    ,(r2)+        ; is first byte a "C" ?
  209.     bne    60$            ; nope..
  210.     cmpb    #'L    ,(r2)+        ; is second byte an "L" ?
  211.     bne    60$            ; nope..
  212.  
  213.     cmpb    (r2)    ,#':        ; is there a colon after CL?
  214.     beq    30$            ; ya
  215.     cmpb    (r2)    ,#space        ; is there a space delimiter?
  216.     beq    30$            ; ya
  217.  
  218.     movb    (r2)+    ,r0        ; get unit #, sign bit should be zero
  219.     sub    #'7+1    ,r0        ; check unit is 0 - 7 only, and..
  220.     add    #7+1    ,r0        ; ..turn ascii into integer
  221.     bcs    40$            ; good number crosses 0
  222.     br    60$            ; bad number, bail out
  223.  
  224. 30$:    clr    r0            ; set CL unit number to 0
  225. 40$:    mov    r0    ,cl.unit    ; save CL unit number
  226.  
  227.     mov    #^rCL0    ,cl.r50        ; rad50 name of "base" CL device
  228.     add    r0    ,cl.r50        ; make it the device at hand..
  229.  
  230.     add    #'0    ,r0        ; now bump it up into an ascii digit
  231.     movb    r0    ,cl.nam+2    ; and stick that into "CLn:"
  232.  
  233.     cmpb    (r2)    ,#':        ; is there a colon after CLn ?
  234.     bne    50$            ; no
  235.     inc    r2            ; ya, bump past it..
  236. 50$:    cmpb    (r2)+    ,#space        ; is there a space delimiter?
  237.     beq    70$            ; ya
  238.  
  239. 60$:    mov    r4    ,r0        ; no, revert to incoming err
  240.     br    100$
  241.  
  242. 70$:    cmpb    (r2)+    ,#'L        ; must be an "L"
  243.     bne    90$            ; nope..
  244.     cmpb    (r2)    ,#'I        ; /62/ is this an "I" ?
  245.     bne    80$            ; /62/ no
  246.     inc    r2            ; /62/ ya, bump to next char
  247.     cmpb    (r2)    ,#'N        ; /62/ an "N" ?
  248.     bne    80$            ; /62/ no
  249.     inc    r2            ; /62/ ya, bump to next char
  250.     cmpb    (r2)    ,#'E        ; /62/ an "E" ?
  251.     bne    80$            ; /62/ no
  252.     inc    r2            ; /62/ ya, bump to next char
  253. 80$:    cmpb    (r2)+    ,#space        ; /62/ a space?
  254.     bne    90$            ; /62/ no, command is no good
  255.     tstb    @r2            ; anything left?
  256.     beq    90$            ; no, command is no good
  257.     tst    tsxsave            ; running under TSX?
  258.     bne    110$            ; ya
  259.     mov    #er$tsx    ,r0        ; no, load appropriate error
  260.     br    100$            ; exit
  261.  
  262. 90$:    mov    #er$bad    ,r0        ; "bad option or value"
  263. 100$:    jmp    260$            ; goto the end, currently just return
  264.  
  265. 110$:    cmpb    (r2)    ,#'*        ; auto-assign?
  266.     bne    120$            ; no
  267.     jmp    cl.wild            ; ya
  268.  
  269. 120$:    clr    r3            ; init a reg to hold line number
  270. 130$:    movb    (r2)+    ,r0        ; next char
  271.     sub    #'9+1    ,r0        ; convert decimal ascii to integer
  272.     add    #9.+1    ,r0        ; whilst ensuring it's a valid digit
  273.     bcc    140$            ; not a number, thus at end of digits
  274.     mul    #10.    ,r3        ; bump accumulator by 10s
  275.     add    r0    ,r3        ; add current digit to the answer
  276.     br    130$            ; try for another numeric byte
  277.  
  278. 140$:    clr    itsmine            ; init already allocated device flag
  279.     tst    r3            ; assign or deassign?
  280.     bne    160$            ; it's an assign
  281.     cmp    cl.r50    ,r50dev        ; dump it, if program owns it, that is
  282.     beq    150$            ; only allow this on current dev
  283.     mov    cl.r50    ,r0        ; if .ne.
  284.     sub    #36    ,r0        ; try making possible "0" unit a space
  285.     cmp    r0    ,r50dev        ; and check it again
  286.     bne    220$            ; /63/ not the same
  287. 150$:    mov    argbuf    ,r0        ; copy pointer
  288.     movb    #'T&137    ,(r0)+        ; load argument to
  289.     movb    #'T&137    ,(r0)+        ; drop the CL
  290.     clrb    (r0)            ; assign via
  291.     call    set$line        ; "SET LINE TT"
  292.     br    200$            ; no error possible here
  293.  
  294. 160$:    tst    r50dev            ; is a link now in use?
  295.     bne    210$            ; ya
  296.     mov    #alloerr,r1        ; no, preser error allocate mapping
  297.     movb    #2    ,d.allo        ; prep to
  298.     mov    #d.allo    ,r0        ; check device
  299.     emt    375            ; for activity
  300.     bcs    240$            ; someone else has it
  301.     tst    r0            ; or, perhaps you do on another line
  302.     beq    180$            ; nope..
  303.     cmp    r0    ,tsxsav        ; check against current job # too
  304.     beq    170$            ; ok  (same line #)
  305.     mov    #er$137    ,r0        ; not ok, in use by you on another job
  306.     br    260$            ; bail out
  307.  
  308. 170$:    mov    sp    ,itsmine    ; allocate, except if already owned..
  309. 180$:    mov    #atterr    ,r1        ; "attach" error mapping
  310.     mov    r3    ,cl.line    ; save the desired line number
  311.     mov    #attcl    ,r0        ; try to
  312.     emt    375            ; attach it
  313.     bcs    240$            ; didn't work
  314.     mov    sp    ,z.atch        ; ok, flag it was done from this pgm
  315.     tst    itsmine            ; need to allocate the device?
  316.     bne    190$            ; no, you already have it
  317.     mov    #alloerr,r1        ; error mapping for allocate
  318.     clrb    d.allo            ; make it ALLOCATE
  319.     mov    #d.allo    ,r0        ; try to
  320.     emt    375            ; allocate the device
  321.     bcs    230$            ; didn't work
  322.  
  323. 190$:    strcpy    argbuf    ,#cl.nam    ; /62/ give SET LINE CL unit's name
  324.     call    set$line        ; same as "Kermit-11>SET LINE CLn"
  325.     bcc    200$            ; it worked
  326.     call    cl.dump            ; didn't work, clean up..
  327.     br    260$            ; exit with error in r0
  328.  
  329. 200$:    clr    r0            ; success
  330.     br    260$
  331. 210$:    mov    #er$140    ,r0        ; must drop current assign first
  332.     br    260$
  333. 220$:    mov    #er$own    ,r0        ; CL line not owned by this job
  334.     br    260$
  335. 230$:    movb    @#errbyt,r2        ; ya, save error
  336.     clr    cl.line            ; prep to
  337.     mov    #attcl    ,r0        ; dump lingering
  338.     emt    375            ; CL to term assign
  339.     movb    r2    ,@#errbyt    ; recover error
  340. 240$:    movb    @#errbyt,r0        ; get the error code
  341.     bpl    250$            ; normal error
  342.     com    r0            ; hard error code
  343.     mov    #faterr    ,r1        ; map into the hard errors
  344. 250$:    asl    r0            ; word addressing
  345.     add    r0    ,r1        ; map the error
  346.     mov    (r1)    ,r0        ; and return its address to caller
  347. 260$:    return
  348.  
  349.  
  350.     .sbttl    SET CL LINE * processor
  351.  
  352. cl.wild:tst    r50dev            ; is there now a link device?
  353.     bne    80$            ; ya, it has to go first..
  354.     tstb    ports            ; any ports data supplied?
  355.     beq    90$            ; no, can't do this
  356.     tstb    units            ; any CL units specified?
  357.     beq    90$            ; no, can't do this
  358.     mov    #units    ,r2        ; pointer to string of CL units
  359.     br    20$
  360.  
  361. 10$:    cmpb    (r2)+    ,#space        ; must be a space delimiter
  362.     bne    100$            ; wasn't, no specified CL unit is free
  363.  
  364. 20$:    movb    (r2)+    ,r0        ; get unit #
  365.     sub    #'7+1    ,r0        ; check unit is 0 - 7 only, and..
  366.     add    #7+1    ,r0        ; ..turn ascii into integer
  367.     bcc    100$            ; not a number
  368.     mov    r0    ,cl.unit    ; save CL unit number
  369.     mov    #^rCL0    ,cl.r50        ; rad50 name of "base" CL device
  370.     add    r0    ,cl.r50        ; make it the device at hand..
  371.     add    #'0    ,r0        ; now bump it up into an ascii digit
  372.     movb    r0    ,cl.nam+2    ; and stick that into "CLn:"
  373.  
  374.     clr    itsmine            ; init already allocated device flag
  375.     movb    #2    ,d.allo        ; prep to
  376.     mov    #d.allo    ,r0        ; check device
  377.     emt    375            ; for activity
  378.     bcs    10$            ; someone else has it
  379.     tst    r0            ; or, perhaps you do on another line?
  380.     beq    30$            ; nope..
  381.     cmp    r0    ,tsxsav        ; check against current job # too
  382.     bne    10$            ; it's not this job..
  383.     mov    sp    ,itsmine    ; allocate, except if already owned..
  384.  
  385. 30$:    mov    #ports    ,r4        ; pointer to ports data
  386.     br    50$            ; skip test for end on first pass thru
  387.  
  388. 40$:    tstb    (r4)            ; anything left?
  389.     beq    110$            ; nope..
  390.     cmpb    (r4)+    ,#space        ; is this a space delimiter?
  391.     bne    40$            ; no, keep looking for one
  392.  
  393. 50$:    call    220$            ; extract a number to try
  394.     tst    r3            ; /62/ check for valid number
  395.     beq    90$            ; /62/ line 0 doesn't exist
  396.     cmp    r3    ,#40.        ; max possible TSX line number
  397.     bhi    90$            ; /62/ bad number
  398.     mov    r3    ,cl.line    ; good number, save it for attcl
  399.     mov    #attcl    ,r0        ; try to
  400.     emt    375            ; attach it
  401.     bcc    60$            ; it worked
  402.     movb    @#errbyt,r0        ; it didn't work, find out why
  403.     cmpb    r0    ,#3        ; what to do?
  404.     bgt    40$            ; something's busy, try next one
  405.     beq    90$            ; errbyt=3, bad line
  406.     cmpb    r0    ,#2        ; is it 1 or 2?
  407.     beq    90$            ; errbyt=2, bad unit
  408.     mov    #er$124    ,r0        ; terminal privilege is required
  409.     jmp    180$            ; this is a fatal error..
  410.  
  411. 60$:    mov    sp    ,z.atch        ; flag TSX line was attached by Kermit
  412.     tst    itsmine            ; need to allocate the device?
  413.     bne    120$            ; no, you already have it
  414.     clrb    d.allo            ; make it ALLOCATE
  415.     mov    #d.allo    ,r0        ; try to
  416.     emt    375            ; allocate the device
  417.     bcc    120$            ; ok
  418.     movb    @#errbyt,r0        ; it didn't work, find out why
  419.     cmpb    r0    ,#2        ; what to do?
  420.     blt    40$            ; device in use, try next one
  421.     beq    90$            ; errbyt=2, bad device
  422.     cmpb    r0    ,#4        ; is it 3, 4 or 5?
  423.     beq    40$            ; errbyt=4, in use by another job
  424.     bgt    70$            ; needs allocate privilege
  425.     mov    #er$122    ,r0        ; TSX allocation table is full
  426.     br    180$            ; which is a fatal error..
  427.  
  428. 70$:    mov    #er$123    ,r0        ; allocate privilege is required
  429.     br    180$            ; fatal error..
  430. 80$:    mov    #er$140    ,r0        ; must drop current assign first
  431.     br    180$
  432. 90$:    mov    #er$141    ,r0        ; bad ports and/or units
  433.     br    180$
  434. 100$:    mov    #er$142    ,r0        ; no specified CL unit is free
  435.     br    180$
  436. 110$:    mov    #er$143    ,r0        ; no specified TSX line is free
  437.     br    180$
  438.  
  439. 120$:    strcpy    argbuf    ,#cl.nam    ; /62/ give SET LINE CL unit's name
  440.     mov    infomsg    ,-(sp)        ; save current state of SET TT [NO]QU
  441.     clr    infomsg            ; suppress implicit sho$line in set$li
  442.     call    set$line        ; same as "Kermit-11>SET LINE CLn"
  443.     mov    (sp)+    ,infomsg    ; restore SET TT [NO]QUIET state
  444.     bcc    130$            ; the set$line worked
  445.     call    cl.dump            ; it didn't work, clean up..
  446.     br    180$
  447.  
  448. 130$:    tstb    (r4)            ; anything left in "PORTS" buffer?
  449.     beq    190$            ; no, done
  450.     cmpb    (r4)    ,#space        ; is next byte a space?
  451.     beq    190$            ; ya, thus no parameters given..
  452.     cmpb    (r4)+    ,#'/        ; is next byte a slash?
  453.     bne    160$            ; no, it's an error
  454.     call    220$            ; extract a speed value
  455.     calls    setspd    ,<r3>        ; give it a try
  456.     tst    r0            ; well?
  457.     bne    170$            ; it failed
  458.     clr    b4speed            ; reset this if above succeeds..
  459.     cmpb    (r4)    ,#space        ; anything left in "PORTS" buffer?
  460.     ble    190$            ; no
  461.     cmpb    (r4)+    ,#'/        ; is next byte a slash?
  462.     bne    160$            ; no, it's an error
  463.     clrb    spare0            ; /63/ init xmode buffer just in case
  464.     mov    argbuf    ,r0        ; /63/ save modem name here
  465.     call    250$            ; copy modem name into spare buff
  466.     cmpb    (r4)    ,#space        ; anything left in "PORTS" buffer?
  467.     ble    140$            ; no, try what was there
  468.     cmpb    (r4)+    ,#'/        ; is next byte a slash?
  469.     bne    160$            ; no, it's an error
  470.     mov    #spare0    ,r0        ; /63/ pointer for 250$
  471.     call    250$            ; copy xmode into a handy spare buffer
  472.  
  473. 140$:    mov    infomsg    ,-(sp)        ; save status of SET TT [NO]QUIET
  474.     clr    infomsg            ; suppress display
  475.     call    set$modem        ; try to SET to supplied string
  476.     mov    (sp)+    ,infomsg    ; restore SET TT [NO]QUIET
  477.     tst    r0            ; did set$modem work?
  478.     bne    150$            ; /63/ no
  479.     tstb    spare0            ; /63/ was an xmode value saved?
  480.     beq    190$            ; /63/ no, done
  481.     strcpy    argbuf    ,#spare0    ; /63/ put xmode where sph$xm needs it
  482.     call    sph$xm            ; /63/ try to SET PHONE XMODE..
  483.     tst    r0            ; did it work?
  484.     beq    190$            ; /63/ ys
  485.     mov    #er$147    ,r0        ; SET PHONE XMODE failed
  486.     br    180$
  487.  
  488. 150$:    mov    #er$146    ,r0        ; no, bad ports string
  489.     br    180$
  490. 160$:    mov    #er$144    ,r0        ; bad delimiter before speed or modem
  491.     br    180$
  492. 170$:    mov    #er$145    ,r0        ; SET SPEED failed, bad ports string
  493. 180$:    call    incsts            ; set the global error flag
  494.     br    210$
  495. 190$:    tst    infomsg            ; time to say what's up?
  496.     beq    200$            ; no
  497.     call    sho$line        ; ya, display what was just done
  498. 200$:    clr    r0            ; flag success
  499. 210$:    return
  500.  
  501. 220$:    clr    r3            ; init an accumulator for the integer
  502. 230$:    movb    (r4)+    ,r0        ; next char
  503.     sub    #'9+1    ,r0        ; convert ascii byte to integer value
  504.     add    #9.+1    ,r0        ; but use it only if a 0..9 digit
  505.     bcc    240$            ; not a number
  506.     mul    #10.    ,r3        ; bump previous integer by 10s
  507.     add    r0    ,r3        ; then add in the current value
  508.     br    230$            ; is next byte part of number?
  509. 240$:    tstb    -(r4)            ; park on first non-numeric byte
  510.     return
  511.  
  512. 250$:    cmpb    (r4)    ,#space        ; is next byte a space or less?
  513.     blos    260$            ; /63/ ya, time to see if it will SET
  514.     cmpb    (r4)    ,#'/        ; no, but is it a slash?
  515.     beq    260$            ; ya, try to SET..
  516.     movb    (r4)+    ,(r0)+        ; no, it's part of the modem name
  517.     br    250$            ; check the next byte
  518. 260$:    clrb    (r0)            ; terminate
  519.     return
  520.  
  521.  
  522.     .sbttl    The CONNECT command    ; /BBS/ heavily modified
  523.  
  524. c$conn::tstb    ttname            ; anything to connect ??
  525.     bne    10$            ; ya
  526.     mov    #er$tt    ,r0        ; /62/ can't connect TT to TT
  527.     br    20$
  528.  
  529. 10$:    mov    mready    ,-(sp)        ; save modem's init status
  530.     call    doconn            ; run the terminal emulator
  531.     tst    (sp)+            ; was modem ever initialized?
  532.     beq    40$            ; no
  533.     tst    mready            ; ya, still initialized?
  534.     bne    40$            ; ya
  535.     call    reinit            ; no, go re-init it
  536.     tst    r0            ; /62/ did it work?
  537.     beq    30$            ; /62/ ya
  538. 20$:    direrr    r0            ; /62/ dump error message
  539.     call    incsts            ; /62/ flag error so r0 can be cleared
  540.     br    40$
  541. 30$:    .newline            ; ensure prompt comes up in the clear
  542. 40$:    clr    r0            ; /62/ only do error message once
  543.     return
  544.  
  545.  
  546.     .sbttl    The TAKE command    ; /BBS/ heavily hacked ..
  547.  
  548. c$take::tst    cmdlun            ; indirect file already open?
  549.     beq    30$            ; no
  550.     tst    sy.ini            ; here during init from KRT.INI?
  551.     beq    10$            ; no
  552.     call    defterm            ; ya, do end of init file stuff
  553.     br    20$            ; continue
  554.  
  555. 10$:    tst    infomsg            ; /41/ how verbose are we today?
  556.     beq    20$            ; Not very
  557.     wrtall    #indnam            ; dump file name
  558.     wrtall    #cm1.01            ; /63/ " closed",cr
  559. 20$:    calls    close    ,<#lun.ta>    ; close the file
  560.     clr    cmdlun            ; clear the it's open flag for it
  561.  
  562. 30$:    clr    r4            ; init try the path flag
  563.     upcase    argbuf            ; upper case all args
  564.     scan    #'.    ,argbuf        ; look for a dot in the name
  565.     tst    r0            ; find one?
  566.     bne    40$            ; ya..
  567.     strcat    argbuf    ,#takdef    ; no, add .COM to it
  568.  
  569. 40$:    scan    #':    ,argbuf        ; look for device delimiter
  570.     tst    r0            ; find one?
  571.     beq    50$            ; no
  572.     copyz    argbuf    ,#indnam,#16+1    ; /62/ ya, try this file name
  573.     br    100$
  574.  
  575. 50$:    mov    #tk.1    ,r3        ; prep to build a list
  576.     mov    sp    ,r4        ; flag to try the path
  577. 60$:    tst    @r3            ; any more to open up?
  578.     beq    70$            ; no
  579.     copyz    argbuf    ,(r3)+    ,#11.    ; insert name in path stuff
  580.     br    60$            ; try for a possible next one..
  581.  
  582. 70$:    mov    #tk.0    ,r3        ; the top of the list of stuff to try
  583. 80$:    tst    @r3            ; anything left?
  584.     bne    90$            ; ya
  585.     mov    #er$fnf    ,r0        ; no, can't find it
  586.     br    140$            ; bail out
  587.  
  588. 90$:    copyz    (r3)+    ,#indnam,#16+1    ; /62/ current name in list to opener
  589. 100$:    calls    fparse    ,<#indnam,#srcnam> ; parse the file name please
  590.     tst    r0            ; did the $parse work?
  591.     bne    140$            ; /62/ no
  592.     calls    iswild    ,<#srcnam>    ; wildcarded file spec?
  593.     tst    r0            ; no support for it yet here..
  594.     bne    140$            ; /62/ disallow wildcarded file name
  595.  
  596. ;    calls    chkext    ,<#srcnam>    ; check for binary file type
  597. ;    tst    r0            ; iz it binary?
  598. ;    beq    110$            ; nope
  599. ;    mov    #er$fnm    ,r0        ; ya, bad file name
  600. ;    br    130$            ; bail out
  601.  
  602. 110$:    calls    open,<#srcnam,#lun.ta,#text> ; open file for input
  603.     tst    r0            ; did the open for command file work?
  604.     bne    130$            ; no, print error and exit
  605.     mov    #lun.ta    ,cmdlun        ; yes, stuff the unit number in
  606.     copyz    #srcnam    ,#indnam ,#16+1    ; /62/ stash a copy of the file name
  607.     tst    infomsg            ; status of SET TT [NO]QUIET
  608.     beq    120$            ; it's QUIET
  609.     wrtall    #indnam            ; it's NOQUIET, display file name
  610.     wrtall    #cm1.02            ; /63/ " opened",cr  r0 remains 0 here
  611. 120$:    clr    exstal            ; init take file line number pointer
  612.     br    150$            ; take file will be read by readcmd..
  613.  
  614. 130$:    tst    r4            ; if using the path list of names
  615.     bne    80$            ; be sure they all get tried..
  616. 140$:    direrr    r0            ; print a error message and
  617.     call    incsts            ; /62/ ensure global error flag is set
  618.     clrb    indnam            ; zero out take file name buffer
  619. 150$:    return
  620.  
  621.  
  622.     .sbttl    Local DIRECTORY and SPACE commands  ; /BBS/ modified a bit
  623.  
  624. c$spac::mov    sp    ,summary    ; flag for summary only
  625. c$dir::    upcase    argbuf            ; upper case all command args
  626.     calls    fixwild    ,<argbuf>    ; convert "?" to "%"
  627.     calls    dodir    ,<argbuf>    ; /62/ do the directory
  628.     tst    r0            ; did it work?
  629.     beq    10$            ; yes
  630.     direrr    r0            ; no, print the error
  631. 10$:    return
  632.  
  633.  
  634.     .sbttl    MOUNT, DISMOUNT a logical disk  (TSX+ only)  ; /BBS/ all new
  635.  
  636. c$dismou::mov    sp    ,r1        ; set dismount flag
  637.     br    c.mnt            ; and use common code
  638.  
  639. c$mount::clr    r1            ; flag to mount
  640. c.mnt:    tst    tsxsav            ; /63/ running under TSX?
  641.     bne    10$            ; ya
  642.     mov    #er$tsx    ,r0        ; no, load error
  643.     br    30$            ; that's all
  644.  
  645. 10$:    cmp    tsxver    ,#620.        ; is this V6.20 or above?
  646.     bhis    20$            ; ya
  647.     mov    #er$v62    ,r0        ; no
  648.     br    30$
  649.  
  650. 20$:    call    mount            ; do the mount now
  651.     tst    r0            ; did it work?
  652.     beq    40$            ; yes
  653. 30$:    direrr    r0            ; no, print error message
  654. 40$:    return
  655.  
  656.  
  657.     .sbttl    The local TYPE command    ; /BBS/ heavily hacked..
  658.  
  659.     .save
  660.     .psect    $pdata
  661. less:    .asciz    <cr><lf>        ; only type these for a binary file
  662. more:    .asciz    <bell><bs><tab><cr><ff><lf><ctrl$n><ctrl$o><esc> ; ok in text
  663.     .even
  664.     .restore
  665.  
  666. c$type::upcase    argbuf            ; upper case all args
  667.     calls    fparse    ,<argbuf,#srcnam> ; parse the file name please
  668.     tst    r0            ; did the $parse work?
  669.     beq    10$            ; ya
  670.     jmp    170$            ; no
  671.  
  672. 10$:    clr    index            ; init getnxt directory index
  673.     scan    #'.    ,#srcnam    ; look for a dot in the name
  674.     tst    r0            ; find one?
  675.     bne    20$            ; ya..
  676.     strcat    #srcnam    ,#typdef    ; no, add ".LST" to it
  677.  
  678. 20$:    calls    iswild    ,<#srcnam>    ; wildcarded?
  679.     mov    r0    ,r4        ; save copy of answer
  680. 30$:    calls    lookup    ,<#srcnam,#filnam> ; /62/
  681.     tst    r0            ; did it work?
  682.     beq    70$            ; yes
  683.     clr    r1            ; clear try for another flag..
  684.     cmp    r0    ,#er$nmf    ; no more files matching name?
  685.     beq    40$            ; yes, we are all done then
  686.     cmp    r0    ,#er$fnf    ; how about file not found?
  687.     bne    60$            ; /62/ no, print error message
  688. 40$:    tst    index            ; sent any files yet?
  689.     beq    50$            ; no
  690.     jmp    190$            ; yes, that's ok then
  691. 50$:    mov    #er$fnf    ,r0        ; no, change "no more" to "not found"
  692. 60$:    jmp    180$            ; /62/ go do error message
  693.  
  694. 70$:    mov    #more    ,r3        ; init for text file filtering
  695.     clr    r1            ; init binary/text flag
  696.     calls    chkext    ,<#filnam>    ; check for binary file type
  697.     tst    r0            ; iz it binary?
  698.     beq    80$            ; no..
  699.     mov    #less    ,r3        ; ya, get binary file filter
  700.     inc    r1            ; flag as binary
  701. 80$:    clr    r2            ; assume file not open
  702.     calls    open,<#filnam,#lun.in,r1> ; open file for input
  703.     tst    r0            ; but did the open work?
  704.     bne    170$            ; no
  705.     com    r2            ; flag it as being open please
  706.     tst    r4            ; wildcarded?
  707.     beq    90$            ; nope
  708.     cmp    index    ,#1        ; is this the first file?
  709.     bne    90$            ; nope
  710.     wrtall    #cm1.03            ; /63/ " Files copied:",cr
  711. 90$:    tst    r1            ; iz binary filter active?
  712.     beq    100$            ; nope
  713.     wrtall    #cm1.04            ; /63/ "Binary file filter enabled",cr
  714. 100$:    tst    r4            ; more than one file possibly?
  715.     beq    110$            ; no, skip naming of each one
  716.     wrtall    #filnam            ; print the expanded name out
  717.     wrtall    #cm1.05            ; /63/ " to TT:",cr
  718. 110$:    calls    open,<#0,#lun.kb,r1>    ; open (init) TT for putc output
  719.  
  720. 120$:    mov    #lun.in    ,r0        ; I/O chan to use
  721.     call    getcr0            ; get a byte
  722.     tst    r0            ; end of it all?
  723.     bne    170$            ; ya
  724.     cmp    vttype    ,#vt200        ; can term do 8-bit stuff?
  725.     bge    130$            ; ya..
  726.     bicb    #200    ,r1        ; /62/ hose hi bit for VT-100 or below
  727. 130$:    cmpb    r1    ,#space        ; a "printable" char??
  728.     bge    140$            ; ya, no problem..
  729.     scan    r1    ,r3        ; look for char in allowed list
  730.     tst    r0            ; a hit?
  731.     beq    120$            ; nope, so on to the next
  732. 140$:    asr    crflag            ; /62/ ya, was last byte a CR?
  733.     bcc    150$            ; /62/ no
  734.     cmpb    r1    ,#lf        ; /62/ is this byte a LF?
  735.     beq    150$            ; /62/ ya
  736.     calls    putc    ,<#lf,#lun.kb>    ; /62/ no, append LF to CR just typed
  737. 150$:    cmpb    r1    ,#cr        ; /62/ is this byte a CR?
  738.     bne    160$            ; /62/ no
  739.     inc    crflag            ; /62/ ya, flag it is
  740. 160$:    calls    putc    ,<r1,#lun.kb>    ; put char to TT
  741.     br    120$            ; next char please
  742.  
  743. 170$:    mov    r0    ,r1        ; save copy for wildcard loop
  744.     cmp    r0    ,#er$eof    ; end of file?
  745.     beq    190$            ; ya
  746. 180$:    direrr    r0            ; no, print the error out
  747.     clr    r1            ; clear look for another flag
  748. 190$:    calls    close    ,<#lun.kb>    ; flush TT out buffer
  749.     tst    r2            ; is the type file open?
  750.     beq    200$            ; no
  751.     calls    close    ,<#lun.in>    ; ya, close it
  752. 200$:    cmp    r1    ,#er$eof    ; try for another match?
  753.     bne    210$            ; nope, done
  754.     .newline            ; ya, put possible next file in clear
  755.     jmp    30$            ; then go try to type it out
  756. 210$:    .purge    #lun.sr            ; /62/ hose dir search channel
  757.     clr    r0            ; /62/ any error was already handled
  758.     return
  759.  
  760.  
  761.     .sbttl    SHOW LINE        ; /BBS/ moved here, added defterm
  762.  
  763. defterm::tst    infomsg            ; SET TT NOQ during init?
  764.     beq    10$            ; no
  765.     wrtall    #indnam            ; ya, say
  766.     wrtall    #cm1.01            ; /63/ " closed",cr
  767. 10$:    tst    signon            ; need to do this?
  768.     bne    20$            ; no
  769.     call    sho$line        ; ya, SHOW LINE as part of pgm sign-on
  770. 20$:    mov    qu.ini    ,infomsg    ; make the SET permanent
  771.     clr    sy.ini            ; done with this now
  772.     return
  773.  
  774. sho$li::wrtall    #cm1.06            ; /63/ "Link device is "
  775.     tstb    ttname            ; something besides TT?
  776.     bne    10$            ; ya
  777.     wrtall    #cm1.07            ; /63/ "TT:   "
  778.     jmp    170$            ; skip speed, DTR, etc for TT
  779.  
  780. 10$:    wrtall    #ttname            ; display link device name
  781.     mov    cl$line    ,r0        ; using a TSX port with it?
  782.     beq    20$            ; not this time
  783.     wrtall    #cm1.08            ; /63/ " via Line #"
  784.     call    L10266            ; dump line # to TT
  785. 20$:    tst    tsxsav            ; running under TSX?
  786.     beq    30$            ; no
  787.     wrtall    #cm1.09            ; /63/ "   Priority: "
  788.     mov    cl.pri    ,r0        ; pass priority value to L10266
  789.     call    L10266            ; dump priority to TT
  790. 30$:    wrtall    #cm1.10            ; /63/ "   Speed: "
  791.     call    ttspeed            ; is current
  792.     tst    r0            ; speed available?
  793.     bne    40$            ; /62/ yes
  794.     wrtall    #cm1.11            ; /63/ "N/A"
  795.     br    50$
  796. 40$:    call    L10266            ; print the speed
  797.     mov    b4speed    ,r0        ; did last call alter speed?
  798.     beq    50$            ; nope
  799.     wrtall    #cm1.12            ; /63/ "/"
  800.     call    L10266            ; display the "SET" speed too
  801.  
  802. 50$:    .newline
  803.     tst    mready            ; a modem on-line?
  804.     beq    60$            ; /62/ no
  805.     wrtall    #modem            ; ya
  806.     wrtall    #cm1.13            ; /63/ " modem is on-line   "
  807. 60$:    tst    sy.ini            ; here for program initialization?
  808.     bne    170$            ; ya, skip past DTR/DCD stuff
  809.     wrtall    #cm1.14            ; /63/ "DTR: "
  810.     call    inqdtr            ; see if DTR is up
  811.     tst    r0            ; if < it's not supported
  812.     bmi    70$            ; no good
  813.     bgt    80$            ; DTR's up
  814.     wrtall    #li.lo            ; /62/ "low"
  815.     br    90$
  816. 70$:    wrtall    #cm1.11            ; /63/ "N/A"
  817.     br    90$
  818. 80$:    wrtall    #li.hi            ; /62/ "HIGH"
  819. 90$:    wrtall    #cm1.15            ; /63/ "   DCD: "
  820.     call    inqcd            ; see if DCD is up
  821.     tst    r0            ; if > DCD is asserted
  822.     bgt    100$            ; it's up
  823.     wrtall    #li.lo            ; /62/ "low"
  824.     br    110$
  825. 100$:    wrtall    #li.hi            ; /62/ "HIGH"
  826. 110$:    clr    r1            ; /62/ preset to XOFF flow control
  827.     tst    km.lock            ; /62/ only do these next two
  828.     beq    150$            ; /62/ for the KM handler
  829.     clr    -(sp)            ; /62/ a one word buffer
  830.     mov    sp    ,r1        ; /62/ pointer to it
  831.     .spfun    #rtwork,#xc.control,#clstat,r1,#0,#1 ; get the status
  832.     mov    (sp)+    ,r1        ; /62/ pop buffer, save a copy
  833.     wrtall    #cm1.16            ; /63/ "   RTS: "
  834.     bit    #10    ,r1        ; /62/ is RTS asserted?
  835.     bne    120$            ; /62/ ya
  836.     wrtall    #li.lo            ; /62/ "low"
  837.     br    130$
  838. 120$:    wrtall    #li.hi            ; /62/ "HIGH"
  839. 130$:    wrtall    #cm1.17            ; /63/ "   CTS: "
  840.     bit    #20    ,r1        ; /62/ is CTS asserted?
  841.     bne    140$            ; /62/ ya
  842.     wrtall    #li.lo            ; /62/ "low"
  843.     br    150$
  844. 140$:    wrtall    #li.hi            ; /62/ "HIGH"
  845.  
  846. 150$:    .newline
  847.     wrtall    #cm1.18            ; /63/ "Flow-Control: "
  848.     bit    #40    ,r1        ; /62/ if <> it's done in hardware
  849.     bne    160$
  850.     wrtall    #cm1.19            ; /63/ "XOFF/XON   "
  851.     br    170$
  852. 160$:    wrtall    #cm1.20            ; /63/ RTS/CTS   "
  853. 170$:    mov    parity    ,r0        ; display what's set in Kermit itself
  854.     wrtall    #cm1.21            ; /63/ "S/W Parity: "
  855.     asl    r0            ; word indexing into list
  856.     wrtall    parlst(r0)        ; write appropriate word to TT
  857.     .newline            ; format display
  858.     mov    sp    ,signon        ; sign-on has been done
  859.     clr    r0            ; no error possible
  860.     return
  861.  
  862.  
  863.     .sbttl    Cleanup before exiting to monitor    ; /BBS/ enhanced
  864.  
  865. c$exit::call    sd$off            ; close possibly open debug file
  866.     tst    outopn            ; is an output file open?
  867.     beq    10$            ; no
  868.     calls    close    ,<#lun.ou>    ; ya, close it
  869. 10$:    mov    mready    ,-(sp)        ; save modem status
  870.     call    c$idle            ; reset modem, if need be..
  871.     tst    (sp)+            ; was there a modem?
  872.     beq    20$            ; nope
  873.     calls    suspend    ,<#0,settle>    ; ya, let it settle
  874. 20$:    call    xl.dump            ; drop DTR, handler interrupts
  875.     tst    tsxcl            ; using a CL line?
  876.     beq    30$            ; no
  877.     call    cl.dump            ; dump it
  878. 30$:    jmp    exit            ; goto hardware reset in KRTRMS
  879.  
  880.     .end
  881.