home *** CD-ROM | disk | FTP | other *** search
/ Columbia Kermit / kermit.zip / b / krtst0.mac < prev    next >
Text File  |  2020-01-01  |  37KB  |  1,205 lines

  1.     .title    KRTST0    SET command overlay zero
  2.     .ident    "V03.63"
  3.  
  4. ; /63/    27-Sep-97  Billy Youdelman  V03.63
  5. ;
  6. ;    add SET CONTROL-CHARACTER
  7. ;    consolidate local data..
  8. ;    add file name to when logging to LP so later OS versions are happy
  9.  
  10. ; /62/    27-Jul-93  Billy Youdelman  V03.62
  11. ;
  12. ;    add support for call back modems, SET DIAL/PHONE [NO]ANSWER
  13. ;
  14. ;    report file size (blocks free) when opening a log file
  15. ;    simply set binary flag instead of close/reopen file for raw I/O debug
  16. ;    fix typo causing a new logfile of same name not to get opened
  17. ;    combine FILE, STATE and PACKET into one DEBUG mode (ON)
  18. ;    redo SET DIAL ECHO and INIT-ONCE as [NO]ECHO and [NO]INIT-ONCE
  19. ;    SET SETTLE-TIME is now SET DIAL SETTLE-TIME
  20. ;    drop SET HAND XON, as RT-11 and TSX eat same..
  21. ;    drop SET DIAL INFO, as any undefined message defaults to it
  22. ;
  23. ;    rename SET DIAL PROMPT to WAKE-ACK, add BLIND, PULSE, TONE, DIAL-ACK,
  24. ;    INITIATE-PROMPT, CONFIRM-ACK, [NO]BINARY-RESPONSE (were missing)..
  25.  
  26. ; /BBS/     1-Dec-91  Billy Youdelman  V03.61
  27. ;
  28. ;    set$pa - fixed display bug with "?" arg
  29. ;    enhanced set$speed error handling
  30. ;    added SET PHONE XMODE for Hayes extended response modes
  31. ;    cleaned up all debug code, allowing debug to TT w/o a disk file
  32. ;    moved set$line to KRTDSP, so it can call c$idle in adjacent overlay
  33. ;    make SET DEBUG NONE off ALL debugging, including TT
  34. ;    add separate parameter for retrying initial-connection ala VMS Kermit
  35. ;    add SET INCOMPLETE-FILE-DISPOSITION
  36. ;    add SET SL
  37. ;    move [SET] LOGFILE here, integrate with SET DEBUG..
  38. ;    make logfile default type .LOG
  39. ;    allow LP as the log file, please SPOOL this in the op system!
  40. ;
  41. ;    added SET DIAL RINGING, CONnnnn for supported speeds, ABORT,
  42. ;    COMMENT, IDLE, PROMPT and INIT.ONCE for user-defined modem
  43.  
  44. ;    Copyright 1984  Change Software, Inc.
  45. ;
  46. ;    31-Jan-84  15:13:45  Brian Nelson
  47.  
  48.  
  49.     .include "IN:KRTMAC.MAC"
  50.     .iif ndf  KRTINC  .error    <; .include for IN:KRTMAC.MAC failed>
  51.     .include "IN:KRTCDF.MAC"
  52.     .iif ndf  KRTCDF  .error    <; .include for IN:KRTCDF.MAC failed>
  53.  
  54.     .mcall    .PURGE    ,.SPFUN        ; /63/
  55.  
  56.  
  57.     .macro    malloc    size        ; /62/ moved this here
  58.     mov    size    ,r0
  59.     call    malloc
  60.     .endm    malloc
  61.  
  62.  
  63.     .sbttl    Local data
  64.  
  65.     .psect    $rwdata    ,rw,d,lcl,rel,con
  66. savpnt:    .word    0            ; save pointer to next arg here
  67.  
  68.     .psect    $pdata            ; /63/ consolidate all data here..
  69. log2lp:    .asciz    "KRTLOG.OUT"        ; /63/ need a name for later os vers
  70. logext:    .asciz    ".LOG"
  71. prefix:    .asciz    "Logfile "
  72. closit:    .asciz    " is open - Close it? "
  73. ovrwrt:    .asciz    " exists - Overwrite? "
  74. st0.01:    .asciz    "Number: "
  75. st0.02:    .asciz    "Seconds: "
  76. st0.03:    .asciz    "Abort dialing string: "
  77. st0.04:    .asciz    "Enable auto-answer string: "
  78. st0.05:    .asciz    "Blind dialing string: "
  79. st0.06:    .asciz    "Modem description: "
  80. st0.07:    .asciz    "Connect at 300 message: "
  81. st0.08:    .asciz    "Connect at 1200 message: "
  82. st0.09:    .asciz    "Connect at 2400 message: "
  83. st0.10:    .asciz    "Connect at 4800 message: "
  84. st0.11:    .asciz    "Connect at 9600 message: "
  85. st0.12:    .asciz    "Connect at 19.2k message: "
  86. st0.13:    .asciz    "Connect at 38.4k message: "
  87. st0.14:    .asciz    "String: "
  88. st0.15:    .asciz    "Character(s): "
  89. st0.16:    .asciz    "Ticks: "
  90. st0.17:    .asciz    "Failed call message: "
  91. st0.18:    .asciz    "Dial format string: "
  92. st0.19:    .asciz    "Modem reset string: "
  93. st0.20:    .asciz    "Initiate dialing string: "
  94. st0.21:    .asciz    "Initiate dialing prompt string: "
  95. st0.22:    .asciz    "Disable auto-answer string: "
  96. st0.23:    .asciz    "Pulse dial string: "
  97. st0.24:    .asciz    "Ringing message: "
  98. st0.25:    .asciz    "Connect (speed locked) message: "
  99. st0.26:    .asciz    "Seconds: "
  100. st0.27:    .asciz    "Tone dial string: "
  101. st0.28:    .asciz    "Response to wake-up: "
  102. st0.29:    .asciz    "Init modem to dial string: "
  103. st0.30:    .asciz    "Name Phone-Number: "
  104. st0.31:    .asciz    "Extended Mode: "
  105. st0.32:    .asciz    "Numbers or ALL: "
  106. st0.33:    .asciz    "No LOGFILE is open"<cr><lf>
  107. st0.34:    .asciz    " opened, "
  108. st0.35:    .asciz    " block"
  109. st0.36:    .asciz    "s"
  110. st0.37:    .asciz    "BINARY-MODE (fixed 512, no carriage control) enabled"<cr><lf>
  111. st0.38:    .asciz    " closed"<cr><lf>
  112. st0.39:    .asciz    " is already open"<cr><lf>
  113. st0.40:    .asciz    "?SET$DEBUG-W-Bad option"<cr><lf>
  114. st0.41:    .asciz    "You must SET DEBUG as desired to write to this file"<cr><lf>
  115. st0.42:    .asciz    "Caution: Binary files will require 8-bit prefixing"<cr><lf>
  116. st0.43:    .asciz    " requires hardware flow control"
  117. st0.44:    .asciz    " must always be quoted"
  118. st0.45:    .asciz    " is not a control character"
  119.     .even
  120.  
  121.  
  122.     .psect    $code
  123.     .sbttl    LOGFILE, SET LOGFILE    ; /BBS/ heavily modified..
  124.     .enabl    lsb
  125.  
  126.     CVTARG    = C.CRLF ! C.LSPA ! C.SSPA ! C.LCUC ! C.TSPA ; arg processing
  127.  
  128. c$logf::call    set$log            ; try to open the logfile
  129.     tst    r0            ; did that work?
  130.     beq    10$            ; ya
  131.     direrr    r0            ; no, display any error
  132.     call    incsts            ; set global error flag
  133. 10$:    return
  134.  
  135. set$lo::tstb    @argbuf            ; any arg(s) supplied?
  136.     bne    40$            ; ya
  137.     bit    #log$op    ,trace        ; no, is there a logfile open?
  138.     bne    20$            ; no
  139.     wrtall    #st0.33            ; /63/ "No LOGFILE is open"
  140.     clr    r0            ; return no error
  141.     br    30$
  142. 20$:    call    sd$off            ; ya, close the current logfile
  143. 30$:    return
  144.  
  145. 40$:    bit    #log$op    ,trace        ; is there a logfile open?
  146.     beq    90$            ; no
  147.  
  148.     ; /BBS/ if a logfile is already open, query before closing it
  149.     wrtall    #prefix            ; ya, build prompt, "Logfile " first
  150.     wrtall    #logfil            ; append the file name, say it's open
  151.     wrtall    #closit            ; and ask if it can be closed
  152.     calls    kbread    ,<#spare1>    ; get the answer, sans SL processing
  153.     tst    r0            ; successful terminal read?
  154.     beq    50$            ; ya
  155.     .newline            ; no, after ^C, ensure a new line..
  156.     br    60$
  157. 50$:    calls    cvt$$    ,<#spare1,r1,#cvtarg> ; remove garbage, upper case
  158.     tst    r0            ; anything left?
  159.     beq    70$            ; no, exit please
  160.     cmpb    spare1    ,#'Y&137    ; does string begin with a "Y" ?
  161.     beq    80$            ; ya, it does, meaning zap this file
  162. 60$:    clr    r0            ; success, either way a file is open
  163. 70$:    return
  164.  
  165. 80$:    call    sd$off            ; close the current logfile
  166.  
  167. 90$:    clr    savpnt            ; init to say no second arg parsed yet
  168.     mov    argbuf    ,r0        ; set to recover next arg in buffer
  169. 100$:    tstb    (r0)            ; find EOS yet?
  170.     beq    110$            ; yes, exit without changing anything
  171.     cmpb    (r0)+    ,#space        ; found a delimiter yet?
  172.     bne    100$            ; no, keep looking
  173.     clrb    -1(r0)            ; replace space delimiter with a null
  174.     mov    r0    ,savpnt        ; save address of second argument
  175.  
  176. 110$:    call    L1$            ; call shared open the logfile code
  177.     bcs    70$            ; /63/ file open failed, error's in r0
  178.     mov    savpnt    ,argpnt        ; pass debug mode argument to set$deb
  179.     beq    120$            ; nothing there, so skip the call..
  180.     call    set$debug        ; process next arg as debug mode
  181.     tst    r0            ; /62/ did it work?
  182.     beq    120$            ; /62/ ya
  183.     wrtall    #st0.40            ; /63/ "SET$DEBUG-W-Bad option"
  184.     call    incsts            ; /62/ flag error
  185. 120$:    clr    savpnt            ; re-init this right away..
  186.     mov    trace    ,r0        ; copy of log status word
  187.     bic    #<log$rp!log$de!log$op>,r0 ; /62/ hose non-relevant bits
  188.     bne    60$            ; /63/ some disk mode is already set
  189.     wrtall    #st0.41            ; /63/ "You must SET DEBUG .."
  190.     br    60$            ; /63/ done
  191.  
  192.     ; /BBS/ shared code, so set$debug can call this much of it too..
  193. L1$:    bic    #log$al!log$io,trace    ; /62/ clear all disk debug bits now
  194.     upcase    argpnt            ; ensure file name is upper case
  195.     calls    fparse    ,<argpnt,#spare1> ; /63/ parse the file name please
  196.     tst    r0            ; did the $parse work?
  197.     beq    130$            ; /63/ ya
  198.     jmp    190$            ; /63/ no, return error in r0
  199. 130$:    mov    #spare1    ,r2        ; pointer to possible "LP:"
  200.     cmpb    #'L&137    ,(r2)+        ; is first byte an "L" ?
  201.     bne    140$            ; nope..
  202.     cmpb    #'P&137    ,(r2)+        ; is second byte a "P" ?
  203.     bne    140$            ; nope..
  204.     cmpb    #':    ,(r2)+        ; is "LP" followed by a colon?
  205.     bne    140$            ; no
  206.     tstb    (r2)            ; ya, but is that null terminated?
  207.     bne    200$            ; /63/ no, user supplied a file name
  208.     strcat    #spare1    ,#log2lp    ; /63/ ya, a name is required here
  209.     br    200$            ; /63/ go do the file open
  210.  
  211. 140$:    scan    #'.    ,#spare1    ; look for a dot in the name
  212.     tst    r0            ; find one?
  213.     bne    160$            ; ya..
  214.     clrb    errtxt            ; /63/ init buffer for possible [size]
  215.     scan    #'[    ,#spare1    ; /63/ did the user specify a size?
  216.     tst    r0            ; /63/ well?
  217.     beq    150$            ; /63/ no
  218.     add    #spare1    ,r0        ; /63/ ya, get pointer to the "["
  219.     dec    r0            ; /63/ it's really here
  220.     copyz    r0    ,#errtxt    ; /63/ now save a copy of size data
  221.     clrb    @r0            ; /63/ then mark end of file name
  222. 150$:    strcat    #spare1    ,#logext    ; add .LOG to it
  223.     tstb    errtxt            ; /63/ need to restore the size?
  224.     beq    160$            ; /63/ no
  225.     strcat    #spare1    ,#errtxt    ; /63/ ya, put it back after extent
  226.  
  227. 160$:    calls    iswild    ,<#spare1>    ; wildcarded file spec??
  228.     tst    r0            ; no support for it yet here..
  229.     bne    190$            ; disallow wildcarded file name
  230.  
  231.     ; /BBS/ if logfile already exists, query before overwriting it
  232.     clr    index            ; /62/ clear lookup's file counter
  233.     calls    lookup,<#spare1,#errtxt> ; /62/ does file already exist?
  234.     tst    r0            ; /62/ find it?
  235.     bne    200$            ; /62/ no
  236.     .purge    #lun.sr            ; /62/ ya, hose dir search channel
  237.     wrtall    #spare1            ; ya, build prompt, file name first
  238.     wrtall    #ovrwrt            ; append some informative text
  239.     calls    kbread    ,<argbuf>    ; get the answer, sans SL processing
  240.     tst    r0            ; successful terminal read?
  241.     beq    170$            ; ya
  242.     .newline            ; no, after ^C, ensure a new line..
  243.     bne    180$            ; go set carry and exit
  244. 170$:    calls    cvt$$    ,<argbuf,r1,#cvtarg> ; remove garbage, upper case
  245.     tst    r0            ; anything left?
  246.     beq    190$            ; no, exit please
  247.     cmpb    @argbuf    ,#'Y&137    ; does string begin with a "Y" ?
  248.     beq    200$            ; /62/ ya, all is well
  249. 180$:    clr    r0            ; no, don't pass back this error
  250. 190$:    sec                ; flag in case called by set$debug
  251.     return                ; error is in r0
  252.  
  253. 200$:    calls    create    ,<#spare1,#lun.lo,#text> ; open the file
  254.     tst    r0            ; did it work?
  255.     bne    190$            ; /BBS/ no
  256.     bis    #log$op    ,trace        ; yes, say it's open please
  257.     copyz    #spare1    ,#logfil ,#26    ; save the debug file name for show
  258.     tst    infomsg            ; /41/ verbose today?
  259.     beq    220$            ; /BBS/ no
  260.     wrtall    #prefix            ; /BBS/ a prefix, "Logfile "
  261.     wrtall    #logfil            ; confirm the logfile name
  262.     wrtall    #st0.34            ; /62/ " opened, "
  263.     mov    #lun.lo    ,r0        ; /62/ logfile lun
  264.     asl    r0            ; /62/ word indexing
  265.     mov    sizof(r0),r0        ; /62/ recover size
  266.     mov    r0    ,r1        ; /62/ copy to test for plurality
  267.     call    L10266            ; /62/ dump it to TT
  268.     wrtall    #st0.35            ; /62/ say it's block(s)
  269.     dec    r1            ; /62/ just one?
  270.     beq    210$            ; /62/ ya, don't make it plural
  271.     wrtall    #st0.36            ; /63/ no, toss in an "s"
  272. 210$:    .newline            ; /62/
  273. 220$:    clr    r0            ; success, also clears carry
  274.     return
  275.  
  276.     .dsabl    lsb
  277.  
  278.  
  279.     .sbttl    SET DEBUG
  280.     .enabl    lsb            ; /63/
  281.  
  282. set$de::upcase    argpnt            ; /BBS/ upper case all args
  283.     calls    getcm0    ,<argpnt,#dbglst> ; find out which option was given
  284.     tst    r0            ; find one?
  285.     bmi    30$            ; /63/ no
  286.     tst    wasnul            ; /BBS/ were commands listed via "?"
  287.     bne    30$            ; /63/ ya
  288.     jmp    @r1            ; /63/ dispatch now
  289.  
  290.     command    dbglst    ,ALL    ,1    ,sd$on
  291.     command    dbglst    ,CONNECT,2    ,sd$con
  292.     command    dbglst    ,CONSOLE,2    ,sd$con
  293.     command    dbglst    ,NONE    ,3    ,sd$none
  294.     command    dbglst    ,NORPACK,3    ,sd$nrp
  295.     command    dbglst    ,NOTERMINAL,3    ,sd$not
  296.     command    dbglst    ,NOTT:    ,3    ,sd$not
  297.     command    dbglst    ,OFF    ,2    ,sd$off
  298.     command    dbglst    ,ON    ,2    ,sd$on
  299.     command    dbglst    ,PACKET    ,1    ,sd$pak
  300.     command    dbglst    ,RAW    ,2    ,sd$raw
  301.     command    dbglst    ,RPACK    ,2    ,sd$rpa
  302.     command    dbglst    ,TERMINAL,2    ,sd$ter
  303.     command    dbglst    ,TT:    ,2    ,sd$ter
  304.     command    dbglst
  305.  
  306. sd$con:    call    sdopen            ; logfile open?
  307.     bcs    30$            ; no
  308.     call    rawchk            ; disallow other logging
  309.     bcs    30$            ; if raw is on
  310.     bic    #log$al    ,trace        ; /BBS/ clear all disk debug bits now
  311.     bis    #log$co    ,trace        ; enable connect mode logging
  312.     br    20$            ; /63/ success
  313.  
  314. sd$none:call    sd$off            ; /BBS/ do this first
  315.     clr    trace            ; /BBS/ dump everything
  316.     br    20$            ; /63/ success
  317.  
  318. sd$not:    bic    #log$de    ,trace        ; /62/ turn off terminal debugging
  319.     br    20$            ; /63/ success
  320.  
  321. sd$nrp:    bic    #log$rp    ,trace        ; /BBS/ off just RPACK debugging
  322.     br    20$            ; /63/ success
  323.  
  324. sd$off::bit    #log$op    ,trace        ; is there a logfile open?
  325.     beq    10$            ; no
  326.     calls    close    ,<#lun.lo>    ; close it
  327.     bic    #log$op    ,trace        ; say it's closed please
  328.     tst    infomsg            ; /41/ inform the user?
  329.     beq    10$            ; /41/ no
  330.     wrtall    #prefix            ; /41/ call it Logfile now
  331.     wrtall    #logfil            ; /BBS/ include the actual file name
  332.     wrtall    #st0.38            ; /63/ " closed"<cr><lf>
  333. 10$:    bic    #log$al!log$io,trace    ; /BBS/ clear all disk debug bits now
  334. 20$:    clr    r0            ; success
  335. 30$:    return
  336.  
  337. sd$on:    call    rawchk            ; disallow other logging
  338.     bcs    30$            ; if raw is on
  339.     call    sdopen            ; a debug file already open?
  340.     bcs    30$            ; no
  341.     bis    #log$al    ,trace        ; set debug on turns on the world
  342.     br    20$            ; /63/ success
  343.  
  344. sd$pak:    call    sdopen            ; logfile open?
  345.     bcs    30$            ; no
  346.     call    rawchk            ; disallow other logging
  347.     bcs    30$            ; if raw is on
  348.     bic    #log$al    ,trace        ; /BBS/ clear all disk debug bits now
  349.     bis    #log$pa    ,trace        ; enable packet logging
  350.     br    20$            ; /63/ success
  351.  
  352. sd$rpa:    bis    #log$rp    ,trace        ; enable RPACK debugging
  353.     br    20$            ; /63/ success
  354.  
  355. sd$ter:    bis    #log$de    ,trace        ; /62/ I/O to the local terminal
  356.     br    20$            ; /63/ success
  357.  
  358. sdopen:    bit    #log$op    ,trace        ; a logfile open?
  359.     beq    50$            ; no
  360.     tst    savpnt            ; /BBS/ come here from file opener?
  361.     bne    40$            ; /BBS/ ya, skip this message..
  362.     wrtall    #prefix            ; /BBS/ no, say it's already there
  363.     wrtall    #logfil            ; /BBS/ including what it is
  364.     wrtall    #st0.39            ; /63/ " is already open"<cr><lf>
  365. 40$:    br    20$            ; /63/ no error, clr r0 clears carry
  366.  
  367. 50$:    mov    argbuf    ,r0        ; /BBS/ bump argpnt to the next arg..
  368. 60$:    tstb    @r0            ; /63/ find EOS yet?
  369.     beq    70$            ; /BBS/ yes, exit with an error
  370.     cmpb    (r0)+    ,#space        ; /BBS/ found a delimiter yet?
  371.     bne    60$            ; /63/ no, keep looking
  372.     mov    r0    ,argpnt        ; /BBS/ pass name to logfile opener
  373.     call    L1$            ; /BBS/ jump in at appropriate place
  374.     bcc    30$            ; /BBS/ carry clear = logfile open
  375. 70$:    mov    #er$lgf    ,r0        ; /BBS/ please opn a LOGFILE first
  376. 80$:    sec                ; /63/ error exit
  377.     return
  378.  
  379. rawchk:    bit    #log$io    ,trace        ; raw I/O debugging?  (clears carry)
  380.     beq    30$            ; /63/ no
  381.     mov    #er$rax    ,r0        ; /BBS/ can't with raw I/O logging on
  382.     br    80$            ; /63/ failure
  383.  
  384. sd$raw:    call    sdopen            ; logfile open?
  385.     bcs    30$            ; no
  386.     mov    trace    ,r0        ; copy of debugging status word
  387.     bic    #<log$rp!log$op>,r0    ; hose RPACK and disk file open bits
  388.     beq    90$            ; no other disk_based option is on
  389.     mov    #er$raw    ,r0        ; /BBS/ can't do raw I/O w/other opts
  390.     br    30$
  391. 90$:    bis    #log$io    ,trace        ; enable raw I/O logging
  392.     mov    #lun.lo    ,r0        ; /62/ copy of lun
  393.     asl    r0            ; /62/ word indexing
  394.     mov    sp    ,filtyp(r0)    ; /62/ flag to use binary mode
  395.     tst    infomsg            ; SET TT QUIET?
  396.     beq    20$            ; /63/ ya, skip info message
  397.     wrtall    #prefix            ; /62/ "Logfile "
  398.     wrtall    #st0.37            ; /62/ say binary mode is enabled
  399.     br    20$            ; /63/ success
  400.  
  401.     .dsabl    lsb
  402.  
  403.  
  404.     .sbttl    SET PARITY
  405.     .enabl    lsb            ; /63/
  406.  
  407. set$pa::upcase    argbuf            ; /BBS/ upper case all args
  408.     calls    getcm0    ,<argbuf,#parlst> ; find out which option was given
  409.     tst    r0            ; did we find one
  410.     bmi    30$            ; no
  411.     tst    wasnul            ; /BBS/ were commands listed via "?"
  412.     bne    20$            ; /BBS/ ya
  413.     jmp    @r1            ; /63/ dispatch
  414.  
  415.     command    parlst    ,EVEN    ,1    ,spa$ev
  416.     command    parlst    ,MARK    ,1    ,spa$ma
  417.     command    parlst    ,NONE    ,1    ,spa$no
  418.     command    parlst    ,ODD    ,1    ,spa$od
  419.     command    parlst    ,SPACE    ,1    ,spa$sp
  420.     command    parlst
  421.  
  422. spa$ev:    mov    #par$ev    ,r0        ; even
  423.     br    10$            ; /63/
  424.  
  425. spa$od:    mov    #par$od    ,r0        ; odd
  426.     br    10$            ; /63/
  427.  
  428. spa$ma:    mov    #par$ma    ,r0        ; mark
  429.     br    10$            ; /63/
  430.  
  431. spa$sp:    mov    #par$sp    ,r0        ; space
  432.     br    10$            ; /63/
  433.  
  434. spa$no:    clr    r0            ; /BBS/ none
  435. 10$:    mov    r0    ,parity        ; /63/ save returned value
  436.     beq    20$            ; /BBS/ skip msg if parity is set none
  437.     tst    infomsg            ; SET TT QUIET?
  438.     beq    20$            ; ya
  439.     wrtall    #st0.42            ; /63/ "Binary files will be prefixed"
  440. 20$:    clr    r0            ; no error
  441. 30$:    return
  442.  
  443.     .dsabl    lsb
  444.  
  445.  
  446.     .sbttl    SET HANDSHAKE
  447.     .enabl    lsb            ; /63/
  448.  
  449.     SQUOTE    = 47    ; '
  450.     DQUOTE    = 42    ; "
  451.  
  452. set$ha::upcase    argbuf            ; /BBS/ leaves r0 pointing to argbuf
  453.     cmpb    @r0    ,#squote    ; a literal ' quoted character?
  454.     beq    10$            ; yes, use next char as the handshake
  455.     cmpb    @r0    ,#dquote    ; look for " also
  456.     bne    20$            ; not there
  457. 10$:    movb    1(r0)    ,r0        ; get the handshake character please
  458.     br    30$            ; and copy it please
  459. 20$:    calls    getcm0    ,<r0,#hanlst>    ; which option was given?
  460.     tst    r0            ; find one?
  461.     bmi    50$            ; no
  462.     tst    wasnul            ; /BBS/ were commands listed via "?"
  463.     bne    40$            ; /BBS/ ya
  464.     jmp    @r1            ; /63/ dispatch now
  465.  
  466.     command    hanlst    ,CR    ,1    ,sha$cr
  467.     command    hanlst    ,NONE    ,1    ,sha$no
  468.     command    hanlst
  469.  
  470. sha$no:    clrb    r0            ; no handshake (the default)
  471.     br    30$            ; /63/
  472.  
  473. sha$cr:    movb    #cr    ,r0        ; wait for a carriage return
  474. 30$:    movb    r0    ,handch        ; save the result
  475. 40$:    clr    r0            ; success
  476. 50$:    return
  477.  
  478.     .dsabl    lsb
  479.  
  480.  
  481.     .sbttl    SET DUPLEX, SET LOCAL-ECHO    ; /BBS/ add _ECHO to LOCAL
  482.     .enabl    lsb            ; /63/
  483.  
  484. ;    Provide both SET DUPLEX FULL/HALF and SET LOCAL-ECHO ON/OFF
  485. ;    to provide users with compatibility with the different ways
  486. ;    other Kermits do this.
  487.  
  488. set$lc::mov    #lcelst    ,r5        ; load pointer to LOCAL commands
  489.     br    dulc            ; share common code
  490.  
  491. set$du::mov    #duplst    ,r5        ; load pointer to DUPLEX commands
  492. dulc:    upcase    argbuf            ; /BBS/ upper case all args
  493.     calls    getcm0    ,<argbuf,r5>    ; find out which option was given
  494.     tst    r0            ; did we find one
  495.     bmi    20$            ; no
  496.     tst    wasnul            ; /BBS/ were commands listed via "?"
  497.     bne    10$            ; /BBS/ ya
  498.     jmp    @r1            ; /63/ dispatch
  499.  
  500.     command    duplst    ,FULL    ,1    ,sdu$fu
  501.     command    duplst    ,HALF    ,1    ,sdu$ha
  502.     command    duplst
  503.  
  504.     command    lcelst    ,OFF    ,2    ,sdu$fu
  505.     command    lcelst    ,ON    ,2    ,sdu$ha
  506.     command    lcelst
  507.  
  508. sdu$ha:    mov    sp    ,duplex        ; force local echo on
  509.     br    10$            ; /63/
  510.  
  511. sdu$fu:    clr    duplex            ; no local echo, the default
  512. 10$:    clr    r0            ; no error
  513. 20$:    return
  514.  
  515.     .dsabl    lsb
  516.  
  517.  
  518.     .sbttl    SET UPDATE
  519.  
  520. set$nu::clr    blip            ; SET NOUPDATE
  521.     clr    r0            ; no error
  522.     return
  523.  
  524. set$up::calls    l$val    ,<argbuf>    ; get the interval into decimal
  525.     tst    r0            ; ok?
  526.     bne    10$            ; /63/ er$bad stuffed in r0 by l$val
  527.     mov    r1    ,blip        ; yes, set it up please (r0 is clear)
  528. 10$:    return
  529.  
  530.  
  531.     .sbttl    SET RETRY        ; /BBS/ enhanced..
  532.     .enabl    lsb            ; /63/
  533.  
  534. set$re::upcase    argbuf            ; /BBS/ upper case argument buffer
  535.     calls    getcm0    ,<argbuf,#trylst> ; try to parse the first arg
  536.     tst    r0            ; did it work?
  537.     bmi    20$            ; /63/ nope
  538.     tst    wasnul            ; were commands listed via "?"
  539.     bne    20$            ; /63/ ya
  540.     calls    getcm1    ,<argbuf,#trylst,r0> ; /63/ check for possible arg
  541.     tst    r0            ; /63/ well?
  542.     bmi    20$            ; /63/ bad arg..
  543.     jmp    @r1            ; /63/ dispatch
  544.  
  545.     command    trylst    ,INITIAL-CONNECTION,1    ,stry$i    ,st0.01
  546.     command    trylst    ,PACKET           ,1    ,stry$p    ,st0.01
  547.     command    trylst
  548.  
  549. stry$i:    call    stry$$            ; initial-connection retries
  550.     tst    r0            ; did it work?
  551.     bne    20$            ; /63/ no
  552.     mov    r1    ,initry        ; ya, save value
  553.     return
  554.  
  555. stry$p:    call    stry$$            ; data packet retries
  556.     tst    r0            ; did it work?
  557.     bne    20$            ; /63/ no
  558.     mov    r1    ,maxtry        ; ya, save value
  559.     return
  560.  
  561. stry$$:    call    nextarg            ; get the next argument
  562.     tstb    @r1            ; well?
  563.     beq    10$            ; not there
  564.     calls    l$val    ,<r1>        ; SET RETRY decimal-number
  565.     tst    r0            ; well?
  566.     bne    10$            ; no, bad value
  567.     cmp    r1    ,#3.        ; a reasonable minimum?
  568.     blo    10$            ; nope..
  569.     cmp    r1    ,#30.        ; a reasonable maximum?
  570.     blos    20$            ; ya
  571. 10$:    mov    #er$try    ,r0        ; no, must be between 3. and 30.
  572. 20$:    return
  573.  
  574.     .dsabl    lsb            ; /63/
  575.  
  576.  
  577.     .sbttl    SET SERVER
  578.     .enabl    lsb            ; /63/
  579.  
  580. set$sv::upcase    argbuf            ; /BBS/ upper case all args
  581.     calls    getcm0    ,<argbuf,#svlst> ; find out which option was given
  582.     tst    r0            ; did we find the option?
  583.     bmi    20$            ; /63/ no
  584.     tst    wasnul            ; /BBS/ were commands listed via "?"
  585.     bne    20$            ; /63/ ya
  586.     calls    getcm1    ,<argbuf,#svlst,r0> ; yes, look for value clause now
  587.     tst    r0            ; find it (or read it?)
  588.     bmi    20$            ; /63/ no
  589.     jmp    @r1            ; /63/ getcm1 always returns in argbuf
  590.  
  591.     command svlst    ,NOTIME-OUT    ,1    ,srv$nt
  592.     command svlst    ,TIME-OUT    ,1    ,srv$ti    ,st0.02
  593.     command svlst
  594.  
  595. srv$ti:    calls    l$val    ,<argbuf>    ; convert ascii number to integer
  596.     tst    r0            ; did it work?
  597.     bne    20$            ; /63/ no, l$val loads er$bad into r0
  598.     cmp    r1    ,#1092.        ; /62/ too big?  note r0 is clear here
  599.     bhi    10$            ; /62/ ya, don't set it
  600.     mov    r1    ,serwait    ; it's ok, save desired time out
  601.     br    20$
  602. 10$:    mov    #er$bad    ,r0        ; error, a bad value was given
  603. 20$:    return
  604.  
  605. srv$nt:    mov    #1092.    ,serwait    ; /62/ wait the max, 18.2 mins @ 60Hz
  606.     clr    r0            ; no error possible here
  607.     return
  608.  
  609.     .dsabl    lsb
  610.  
  611.  
  612.     .sbttl    SET EOF [NO]EXIT
  613.     .enabl    lsb            ; /63/
  614.  
  615. set$ef::upcase    argbuf            ; /BBS/ upper case all args
  616.     calls    getcm0    ,<argbuf,#eflist> ; parse the first arg
  617.     tst    r0            ; did it work?
  618.     bmi    20$            ; no
  619.     tst    wasnul            ; /BBS/ were commands listed via "?"
  620.     bne    20$            ; /BBS/ ya
  621.     jmp    @r1            ; /63/ dispatch
  622.  
  623.     command    eflist    ,EXIT    ,1    ,sef$ex
  624.     command    eflist    ,NOEXIT    ,1    ,sef$ne
  625.     command    eflist
  626.  
  627. sef$ne:    clr    exieof            ; don't exit at end of TAKE file
  628.     br    10$            ; /63/
  629.  
  630. sef$ex:    mov    sp    ,exieof        ; exit to monitor at end of TAKE file
  631. 10$:    clr    r0            ; no error
  632. 20$:    return
  633.  
  634.     .dsabl    lsb
  635.  
  636.  
  637.     .sbttl    SET INCOMPLETE-FILE-DISPOSITION    ; /BBS/ all new..
  638.     .enabl    lsb            ; /63/
  639.  
  640. set$in::upcase    argbuf            ; upper case all args
  641.     calls    getcm0    ,<argbuf,#inclist> ; try to parse the first arg
  642.     tst    r0            ; well?
  643.     bmi    20$            ; didn't work
  644.     tst    wasnul            ; was arg a question mark?
  645.     bne    20$            ; ya, don't dispatch on that
  646.     jmp    @r1            ; /63/ dispatch the command
  647.  
  648.     command    inclist    ,DISCARD,1    ,sin$ds
  649.     command    inclist    ,KEEP    ,1    ,sin$kp
  650.     command    inclist
  651.  
  652. sin$kp:    clr    incfile            ; keep incomplete files
  653.     br    10$            ; /63/
  654.  
  655. sin$ds:    mov    sp    ,incfile    ; dump incomplete files
  656. 10$:    clr    r0            ; no error
  657. 20$:    return
  658.  
  659.     .dsabl    lsb
  660.  
  661.  
  662.     .sbttl    SET DIAL        ; /BBS/ substantially enhanced
  663.     .enabl    lsb            ; /63/
  664.  
  665. set$di::mov    #dialst    ,r3        ; pointer to command dispatch table
  666.     mov    #spare1    ,r4        ; /63/ pointer to a temp buffer
  667.     upone    argbuf            ; upcase just next arg only..
  668.     calls    getcm0    ,<argbuf,r3>    ; parse the first arg
  669.     tst    r0            ; did it work?
  670.     bmi    60$            ; /63/ no, bad option
  671.     tst    wasnul            ; were commands listed via "?"
  672.     bne    60$            ; /63/ ya
  673.     calls    getcm1    ,<argbuf,r3,r0>    ; no, look for next arg
  674.     tst    r0            ; get one?
  675.     bmi    60$            ; /63/ no
  676.     jmp    @r1            ; /63/ dispatch
  677.  
  678.     command dialst ,ABORT        ,2    ,ss$abo    ,st0.03
  679.     command dialst ,ANSWER        ,2    ,ss$ans    ,st0.04
  680.     command dialst ,BINARY-RESPONSE    ,2    ,ss$bin
  681.     command dialst ,BLIND        ,2    ,ss$bli    ,st0.05
  682.     command dialst ,COMMENT        ,3    ,ss$com    ,st0.06
  683.     command dialst ,CON300        ,5    ,ss$300    ,st0.06
  684.     command dialst ,CON1200        ,5    ,ss$120    ,st0.08
  685.     command dialst ,CON2400        ,4    ,ss$240    ,st0.09
  686.     command dialst ,CON4800        ,4    ,ss$480    ,st0.10
  687.     command dialst ,CON9600        ,4    ,ss$960    ,st0.11
  688.     command dialst ,CON19200    ,5    ,ss$192    ,st0.12
  689.     command dialst ,CON38400    ,5    ,ss$384    ,st0.13
  690.     command dialst ,CONFIRM        ,4    ,ss$con    ,st0.14
  691.     command dialst ,CONFIRM-ACKNOWLEDGE,8.    ,ss$cak    ,st0.14
  692.     command dialst ,DIAL-ACKNOWLEDGE,6    ,ss$dak    ,st0.14
  693.     command dialst ,DIAL-PAUSE    ,6    ,ss$pau    ,st0.15
  694.     command dialst ,DIAL-RATE    ,6    ,ss$dra    ,st0.16
  695.     command dialst ,ECHO        ,1    ,ss$eko
  696.     command dialst ,FAILURE        ,2    ,ss$fai    ,st0.17
  697.     command dialst ,FORMAT        ,2    ,ss$for    ,st0.18
  698.     command dialst ,IDLE        ,2    ,ss$idl    ,st0.19
  699.     command dialst ,INITIATE    ,5    ,ss$ini    ,st0.20
  700.     command dialst ,INITIATE-PROMPT    ,9.    ,ss$inp    ,st0.21
  701.     command dialst ,INIT-ONCE    ,5    ,ss$one
  702.     command dialst ,NOANSWER    ,3    ,ss$anx    ,st0.22
  703.     command dialst ,NOBINARY-RESPONSE,3    ,ss$bix
  704.     command dialst ,NOECHO        ,3    ,ss$ekx
  705.     command dialst ,NOINIT-ONCE    ,3    ,ss$onx
  706.     command dialst ,PULSE        ,1    ,ss$pul    ,st0.23
  707.     command dialst ,RINGING        ,1    ,ss$rin    ,st0.24
  708.     command dialst ,SETTLE-TIME    ,2    ,sst$st    ,st0.16
  709.     command dialst ,SUCCESS        ,2    ,ss$suc    ,st0.25
  710.     command dialst ,TIME-OUT    ,2    ,ss$tmo    ,st0.26
  711.     command dialst ,TONE        ,2    ,ss$ton    ,st0.27
  712.     command dialst ,WAKE-ACKNOWLEDGE,6    ,ss$pro    ,st0.28
  713.     command dialst ,WAKE-RATE    ,6    ,ss$wra    ,st0.16
  714.     command dialst ,WAKE-STRING    ,6    ,ss$wak    ,st0.29
  715.     command dialst
  716.  
  717. ss$300:    mov    #300.    ,r3        ; connect at 300
  718.     br    sd.res
  719.  
  720. ss$120:    mov    #1200.    ,r3        ; 1200
  721.     br    sd.res
  722.  
  723. ss$240:    mov    #2400.    ,r3        ; 2400
  724.     br    sd.res
  725.  
  726. ss$480:    mov    #4800.    ,r3        ; 4800
  727.     br    sd.res
  728.  
  729. ss$960:    mov    #9600.    ,r3        ; 9600
  730.     br    sd.res
  731.  
  732. ss$192:    mov    #19200.    ,r3        ; 19.2k
  733.     br    sd.res
  734.  
  735. ss$384:    mov    #38400.    ,r3        ; /62/ 38.4k
  736.     br    sd.res
  737.  
  738. ss$suc:    mov    #2    ,r3        ; connect without speed change
  739.     br    sd.res
  740.  
  741. ss$rin:    mov    #1    ,r3        ; ring, or rring if Telebit modem
  742.     br    sd.res
  743.  
  744. ss$fai:    mov    #-1    ,r3        ; call failed
  745.     .br    sd.res            ; /63/
  746.  
  747. sd.res:    prsbuf    r4            ; expand and copy string to workbuffer
  748.     tst    r0            ; successful?
  749.     bne    60$            ; no
  750.     strlen    r4            ; get the length of the result
  751.     add    #2    ,r0        ; plus one for the null terminator
  752.     bic    #1    ,r0        ; ensure on a word boundary
  753.     add    #4    ,r0        ; space for link and status
  754.     mov    #usermd    ,r5        ; /BBS/ get base address of structure
  755.     add    #res.hea,r5        ; link to first entry
  756. 20$:    tst    (r5)            ; end of the chain yet?
  757.     beq    30$            ; yes
  758.     mov    (r5)    ,r5        ; no, get the next one please
  759.     br    20$            ; and recheck
  760. 30$:    malloc    r0            ; ask for an allocation
  761.     mov    r0    ,(r5)        ; /63/ get it?
  762.     beq    40$            ; no, exit
  763.     mov    (r5)    ,r5        ; point directly to new area
  764.     clr    (r5)+            ; no link to next
  765.     mov    r3    ,(r5)+        ; message class type
  766.     strcpy    r5    ,r4        ; insert the string
  767.     br    50$
  768. 40$:    mov    #er$mal    ,r0        ; /BBS/ no space left for string
  769.     return
  770. 50$:    clr    r0            ; /BBS/ no error
  771. 60$:    return
  772.  
  773. ss$abo:    mov    #dial.xabort,r5        ; abort call from modem
  774.     br    sd.chk
  775.  
  776. ss$ans:    mov    #ph.answer,r5        ; /62/ enable auto-answer mode
  777.     br    sd.chk
  778.  
  779. ss$anx:    mov    #ph.noanswer,r5        ; /62/ disable auto-answer mode
  780.     br    sd.chk
  781.  
  782. ss$com:    mov    #mod.comment,r5        ; brief modem description
  783.     br    sd.chk
  784.  
  785. ss$dak:    mov    #dial.ack,r5        ; /62/ modem response to confirm
  786.     br    sd.chk            ; /62/ number is dialing (optional)
  787.  
  788. ss$idl:    mov    #dial.idle,r5        ; place modem in idle state
  789.     br    sd.chk
  790.  
  791. ss$pau:    mov    #dial.wait,r5        ; pause string
  792.     br    sd.chk
  793.  
  794. ss$wak:    mov    #wake.string,r5        ; init string
  795.     br    sd.chk
  796.  
  797. ss$for:    mov    #dial.string,r5        ; formatting for dialing
  798.     br    sd.chk
  799.  
  800. ss$pro:    mov    #wake.prompt,r5        ; string modem returns for wakeup
  801.     br    sd.chk
  802.  
  803. ss$ini:    mov    #dmod.string,r5        ; SET DIAL INITIATE string
  804.     br    sd.chk
  805.  
  806. ss$inp:    mov    #dmod.prompt,r5        ; /62/ possible prompt returned after
  807.     br    sd.chk            ; /62/ INITIATE string is sent
  808.  
  809. ss$con:    mov    #dial.confirm,r5    ; to confirm number is correct
  810.     br    sd.chk
  811.  
  812. ss$cak:    mov    #dial.go,r5        ; /62/ to confirm the confirmation
  813.     br    sd.chk            ; /62/ is correct (!)
  814.  
  815. ss$bli:    mov    #dial.blind,r5        ; /62/ BLIND dialing string
  816.     br    sd.chk            ; /62/
  817.  
  818. ss$pul:    mov    #dial.pulse,r5        ; /62/ PULSE dialing string
  819.     br    sd.chk            ; /62/
  820.  
  821. ss$ton:    mov    #dial.nopulse,r5    ; /62/ TONE dialing string
  822.     .br    sd.chk            ; /63/
  823.  
  824. sd.chk:    prsbuf    r4            ; expand and copy string to workbuffer
  825.     tst    r0            ; successful?
  826.     bne    60$            ; no
  827.     strlen    r4            ; get the length of the result
  828.     inc    r0            ; plus one for the null terminator
  829.     inc    r0            ; ensure next allocation begins
  830.     bic    #1    ,r0        ; on an even address boundary
  831.     malloc    r0            ; ask for the allocation
  832.     tst    r0            ; /BBS/ did we get it?
  833.     beq    40$            ; /BBS/ no, exit
  834.     add    #usermd    ,r5        ; /BBS/ ya, point to next free address
  835.     mov    r0    ,(r5)        ; insert the new buffer address
  836.     strcpy    (r5)    ,r4        ; copy the string
  837.     br    50$            ; /BBS/ share exit code
  838.  
  839. ss$eko:    mov    #dial.echo,r5
  840.     br    ss$$1            ; /63/ modem echoes dial commands
  841.  
  842. ss$ekx:    mov    #dial.echo,r5
  843.     br    ss$$0            ; /63/ modem doesn't echo commands
  844.  
  845. ss$one:    mov    #init.once,r5
  846.     br    ss$$1            ; /63/ modem stays init'd
  847.  
  848. ss$onx:    mov    #init.once,r5
  849.     br    ss$$0            ; /63/ modem does not stay init'd
  850.  
  851. ss$bin:    mov    #res.bin,r5
  852. ss$$1:    movb    #'1    ,r1        ; /62/ modem does single char response
  853.     br    ss$$$
  854.  
  855. ss$bix:    mov    #res.bin,r5
  856. ss$$0:    movb    #'0    ,r1        ; /62/ modem responds normally
  857.     .br    ss$$$            ; /63/
  858.  
  859. ss$$$:    mov    argbuf    ,r0        ; /62/ where to pass l$val's argument
  860.     movb    r1    ,(r0)+        ; /62/ do it
  861.     clrb    (r0)            ; /62/ null terminate
  862.     br    sd.val            ; /62/ and off to common code..
  863.  
  864. ss$dra:    mov    #dial.rate,r5        ; in ticks
  865.     br    sd.val
  866.  
  867. ss$wra:    mov    #wake.rate,r5        ; in ticks
  868.     .br    sd.val            ; /63/
  869.  
  870. sd.val:    calls    l$val    ,<argbuf>    ; convert ascii number to integer
  871.     tst    r0            ; success?
  872.     bne    80$            ; no
  873. 70$:    mov    r1    ,usermd(r5)    ; yes, insert the value
  874. 80$:    return                ; /62/ done
  875.  
  876. sst$st:    calls    l$val    ,<argbuf>    ; /62/ convert to an integer
  877.     tst    r0            ; /62/ ok?
  878.     bne    80$            ; /62/ nope
  879.     mov    r1    ,settle        ; /62/ ya, save it
  880.     mov    #time.settle,r5        ; /62/ prep to stuff into USER-DEFINED
  881.     br    70$            ; /62/ go do it
  882.  
  883. ss$tmo:    calls    l$val    ,<argbuf>    ; convert ascii number to integer
  884.     tst    r0            ; success?
  885.     bne    80$            ; no
  886.     mov    r1    ,diatmo        ; number is ok
  887.     mov    #dial.time,r5        ; /62/ prep to stuff into USER-DEFINED
  888.     br    70$            ; /62/ go do it
  889.  
  890.     .dsabl    lsb
  891.  
  892.  
  893.     .sbttl    SET PHONE        ; /45/ added
  894.  
  895. set$ph::upone    argbuf            ; /BBS/ upper case just next arg
  896.     calls    getcm0    ,<argbuf,#pholst> ; which option was given?
  897.     tst    r0            ; find one?
  898.     bmi    sph$zz            ; /63/ no, bad option
  899.     tst    wasnul            ; /BBS/ were commands listed via "?"
  900.     bne    sph$zz            ; /63/ ya
  901.     calls    getcm1    ,<argbuf,#pholst,r0> ; look for next argument
  902.     tst    r0            ; find one?
  903.     bmi    sph$zz            ; /63/ no
  904.     jmp    @r1            ; /63/ ya, dispatch
  905.  
  906.     command pholst    ,ANSWER    ,1    ,sph$an
  907.     command pholst    ,BLIND    ,1    ,sph$bl
  908.     command pholst    ,NOANSWER,2    ,sph$no
  909.     command pholst    ,NUMBER    ,2    ,sph$nu    ,st0.30
  910.     command pholst    ,PULSE    ,1    ,sph$pu
  911.     command pholst    ,TONE    ,1    ,sph$to
  912.     command pholst    ,XMODE    ,1    ,sph$xm    ,st0.31
  913.     command pholst
  914.  
  915. sph$an:    mov    sp    ,answer        ; /62/ modem not enabled until dialing
  916.     br    sph$xx            ; /62/ thus nothing special here..
  917.  
  918. sph$no:    clr    answer            ; /62/ don't enable next time dialing
  919.     tst    mready            ; /62/ is a modem currently on-line?
  920.     beq    sph$xx            ; /62/ no
  921.     tst    (sp)+            ; /62/ pop local dispatch return addr
  922.     jmp    set$dtr            ; /62/ reinit modem so no answer works
  923.  
  924. sph$to:    mov    #1    ,pulse        ; make it tone dialing
  925.     br    sph$xx            ; /62/
  926.  
  927. sph$pu:    mov    #-1    ,pulse        ; make it pulse dialing
  928.     br    sph$xx            ; /62/
  929.  
  930. sph$bl:    mov    #1    ,blind        ; dial blindly
  931.     br    sph$xx            ; /62/
  932.  
  933. sph$nu:    mov    #pnhead    ,r5        ; get listhead for phone numbers
  934. 10$:    tst    (r5)            ; found the last entry yet?
  935.     beq    20$            ; yes, insert new element here
  936.     mov    (r5)    ,r5        ; no, check the next one
  937.     br    10$            ; keep looking
  938. 20$:    call    skipit            ; /BBS/ ignore comma in argument
  939.     strlen    argbuf            ; get total length of data
  940.     add    #4    ,r0        ; add in space for nulls and ensure
  941.     bic    #1    ,r0        ; even length, also link next field
  942.     malloc    r0            ; ask for the space please
  943.     mov    r0    ,(r5)        ; insert the address
  944.     bne    30$            ; space is available
  945.     mov    #er$mal    ,r0        ; /BBS/ no space left for string
  946.     return
  947. 30$:    clr    (r0)+            ; this is now the tail
  948.     strcpy    r0    ,argbuf        ; stuff the data in
  949. sph$xx:    clr    r0            ; Indicate success
  950. sph$zz:    return                ; /63/
  951.  
  952. sph$xm::upcase    argbuf            ; /BBS/ global for SET CL LIN *
  953.     calls    getcm0    ,<argbuf,#xmlist> ; check the table for type
  954.     tst    r0            ; did it work?
  955.     bmi    40$            ; no
  956.     tst    wasnul            ; were commands listed via "?"
  957.     bne    sph$xx            ; /62/ ya
  958.     jsr    pc    ,@r1        ; yes, dispatch on it please
  959.     br    sph$xx            ; /62/
  960. 40$:    mov    #er$bad    ,r0        ; bad value or option error
  961.     return
  962.  
  963.     command    xmlist    ,0    ,1    ,sxm$st
  964.     command    xmlist    ,1    ,1    ,sxm$st
  965.     command    xmlist    ,2    ,1    ,sxm$st
  966.     command    xmlist    ,3    ,1    ,sxm$st
  967.     command    xmlist    ,4    ,1    ,sxm$st
  968.     command    xmlist    ,5    ,1    ,sxm$st
  969.     command    xmlist    ,6    ,1    ,sxm$st
  970.     command    xmlist    ,10    ,2    ,sxm$st
  971.     command    xmlist    ,11    ,2    ,sxm$st
  972.     command    xmlist    ,12    ,2    ,sxm$st
  973.     command    xmlist    ,13    ,2    ,sxm$st
  974.     command    xmlist    ,14    ,2    ,sxm$st
  975.     command    xmlist    ,OFF    ,1    ,sxm$of
  976.     command    xmlist
  977.  
  978. sxm$of:    clrb    xresult            ; the default, no xmode selected
  979.     mov    #-1    ,r1        ; /62/ update USER-DEFINED modem data
  980.     br    sxm$$$            ; /62/ common code
  981.  
  982. sxm$st:    strcpy    #xresult,argbuf        ; /62/ move argument into buffer
  983.     calls    l$val    ,<argbuf>    ; /62/ convert ascii number to integer
  984. sxm$$$:    mov    #usermd    ,r0        ; /62/ top of USER-DEFINED modem data
  985.     mov    r1    ,x.result(r0)    ; /62/ update it too..
  986.     return
  987.  
  988.  
  989.     .sbttl    SET SL            ; /BBS/ added..
  990.     .enabl    lsb            ; /63/
  991.  
  992. set$sl::upcase    argbuf            ; upper case all args
  993.     calls    getcm0    ,<argbuf,#sl.lst> ; which option was given?
  994.     tst    r0            ; well?
  995.     bmi    20$            ; bad option
  996.     tst    wasnul            ; were commands listed via "?"
  997.     bne    20$            ; ya
  998.     call    kp.clr            ; reset the keypad
  999.     jmp    @r1            ; /63/ dispatch
  1000.  
  1001.     command sl.lst    ,KED    ,1    ,ssl$ke
  1002.     command sl.lst    ,NOKED    ,1    ,ssl$no
  1003.     command sl.lst    ,OFF    ,2    ,ssl$of
  1004.     command sl.lst    ,ON    ,2    ,ssl$on
  1005.     command sl.lst
  1006.  
  1007. ssl$ke:    mov    sp    ,sl.ked        ; put SL into KED mode
  1008.     br    10$            ; /63/
  1009.  
  1010. ssl$no:    clr    sl.ked            ; put SL in normal mode
  1011.     br    10$            ; /63/
  1012.  
  1013. ssl$of:    clr    sl.on            ; turn SL off
  1014.     br    10$            ; /63/
  1015.  
  1016. ssl$on:    mov    sp    ,sl.on        ; turn SL on
  1017. 10$:    clr    r0            ; no error
  1018. 20$:    return
  1019.  
  1020.     .dsabl    lsb
  1021.  
  1022.  
  1023.     .sbttl    SET CONTROL-CHARACTER    ; /63/ all new..
  1024.     .enabl    lsb
  1025.  
  1026. ; Control character quoting may be disabled for each byte individually 
  1027. ; by making its corresponding flag byte in CLTFLGS <> 0.
  1028. ;
  1029. ;    flags offset    character controlled
  1030. ;    ------------    --------------------
  1031. ;    CTLFLGS+  0  =  ascii 377  <200!DEL>
  1032. ;           +  1  =  ascii   0  <NUL>
  1033. ;            ...
  1034. ;           + 40  =  ascii  37  <US>
  1035. ;           + 41  =  ascii 177  <DEL>
  1036. ;           + 42  =  ascii 200  <200!NUL>
  1037. ;            ...
  1038. ;           +101  =  ascii 237  <200!US>
  1039.  
  1040. ;    r2  =   buffer pointer for register indexing
  1041. ;    r3  =    loop counter for sct$all
  1042. ;    r4  =    command mode flag byte: 0 = unprefixed, 1 = prefixed
  1043. ;    r5  =   error message text address
  1044.  
  1045.     CL.FLOW    = 40            ; CLSTAT spfun flow control type bit
  1046.     CT.WID    = 4            ; pad numbers in err msgs this wide
  1047.  
  1048. set$ct::upcase    argbuf            ; upper case the whole argument buffer
  1049.     calls    getcm0    ,<argbuf,#ctset> ; try to parse the first arg
  1050.     tst    r0            ; did it work?
  1051.     bmi    ct.done            ; nope
  1052.     tst    wasnul            ; were commands listed via "?"
  1053.     bne    ct.done            ; ya
  1054.     calls    getcm1    ,<argbuf,#ctset,r0> ; get required second arg(s)
  1055.     tst    r0            ; well?
  1056.     bmi    ct.done            ; bad arg..
  1057.     jmp    @r1            ; dispatch
  1058.  
  1059.     command    ctset    ,PREFIXED   ,1    ,sct$pr    ,st0.32
  1060.     command    ctset    ,UNPREFIXED ,1    ,sct$un    ,st0.32
  1061.     command    ctset
  1062.  
  1063. sct$pr:    mov    #1    ,r4        ; command was PREFIXED
  1064.     br    sct$$
  1065. sct$un:    clr    r4            ; or UNPREFIXED
  1066.  
  1067. sct$$:    calls    getcm0    ,<argbuf,#ctlst> ; look for "ALL"
  1068.     tst    wasnul            ; check this first here..
  1069.     bne    ct.exit            ; commands were listed via "?"
  1070.     tst    r0            ; did getcm0 work?
  1071.     bne    10$            ; no
  1072.     jsr    pc    ,@r1        ; yes, dispatch on it please
  1073.     br    ct.loop            ; then loop for more input
  1074. 10$:    cmp    r0    ,#cmd$bad    ; a ^C or ^Z abort?
  1075.     blos    ct.num            ; it may be a number
  1076. ct.exit:clr    r0            ; no error here is fatal
  1077. ct.done:return
  1078.  
  1079. ct.num:    mov    #spare1    ,r0        ; handy buffer for current arg
  1080.     mov    argbuf    ,r1        ; pointer to the arg to process
  1081. 20$:    movb    (r1)+    ,(r0)        ; is this char a null?
  1082.     beq    30$            ; ya, done
  1083.     cmpb    (r0)+    ,#space        ; no, but is it a delimiter?
  1084.     bne    20$            ; no, loop for more chars
  1085.     clrb    -(r0)            ; ya, null terminate copy in spare1
  1086.  
  1087. 30$:    calls    l$val    ,<#spare1>    ; try to recover a number
  1088.     tst    r0            ; well?
  1089.     bne    ct.bad            ; no, bad value
  1090.     bit    #^c<377>,r1        ; if > 377
  1091.     bne    ct.bad            ; it's a bad number
  1092.     incb    r1            ; wrap 377 to 0, others ch=ch+1
  1093.     cmp    r1    ,#41        ; was char 37..0,377 (now 40..0)?
  1094.     blo    ct.all            ; yes, it's a control char
  1095.     sub    #137    ,r1        ; bump 240..200 down to 101..41
  1096.     cmp    r1    ,#41        ; if now < 41 then it's
  1097.     blo    ct.bad            ; not a control char
  1098.     cmp    r1    ,#101        ; if now <= 101 then
  1099.     blos    ct.all            ; it's a control char
  1100.  
  1101. ct.bad:    tst    infomsg            ; report the bad number?
  1102.     beq    ct.loop            ; no, info messages are disabled
  1103.     strlen    #spare1            ; get length of the offending string
  1104.     sub    #ct.wid    ,r0        ; subtract total width allowed here
  1105.     neg    r0            ; how much do we need to pad?
  1106.     ble    50$            ; it's already there or overflowed..
  1107.     mov    r0    ,r1        ; copy number of blanks needed
  1108.     mov    #space    ,r0        ; load a blank into the output reg
  1109. 40$:    call    writ1char        ; write it to the terminal
  1110.     sob    r1    ,40$        ; repeat until done
  1111. 50$:    wrtall    #spare1            ; now write the number itself to tt
  1112.     mov    #st0.45    ,r5        ; load message tag text location
  1113.     br    110$            ; go print it
  1114.  
  1115. ct.all:    tst    r4            ; allow anything
  1116.     bne    70$            ; to be set prefixed
  1117.     cmp    r1    ,#1        ; unprefixing, is this a NULL?
  1118.     blo    70$            ; no but it is ascii 377
  1119.     beq    90$            ; ya
  1120.     cmp    r1    ,#22        ; an XON?
  1121.     beq    60$            ; ya
  1122.     cmp    r1    ,#24        ; an XOFF?
  1123.     beq    60$            ; ya
  1124.     cmp    r1    ,#63        ; maybe it's <200!XON>
  1125.     beq    60$            ; ya
  1126.     cmp    r1    ,#65        ; how about <200!XOFF>
  1127.     bne    70$            ; nope..
  1128. 60$:    tst    km.lock            ; hardware flow control here is
  1129.     beq    80$            ; only supported on the KM handler
  1130.     clr    -(sp)            ; a one word buffer
  1131.     mov    sp    ,r2        ; pointer to it
  1132.     .spfun    #rtwork,#xc.control,#clstat,r2,#0,#1 ; get the status
  1133.     bit    #cl.flow,(sp)+        ; if <> it's done in hardware
  1134.     beq    80$            ; it's software flow control
  1135. 70$:    movb    r4    ,ctlflgs(r1)    ; set or clear as req'd ..
  1136.  
  1137. ct.loop:call    nextarg            ; look for another arg
  1138.     tstb    (r1)            ; find one?
  1139.     beq    ct.exit            ; nothing left to do
  1140.     copyz    r1 ,argbuf ,#ln$max-4    ; pull it up to top of argument buffer
  1141.     jmp    sct$$            ; loop back and give it a go..
  1142.  
  1143. 80$:    mov    #st0.43    ,r5        ; enter here for XOFF warning
  1144.     movb    #1    ,ctlflgs(r1)    ; ensure char gets quoted
  1145.     br    ct.err
  1146. 90$:    mov    #st0.44    ,r5        ; enter here for NULL warning
  1147. ct.err:    tst    infomsg            ; info messages on?
  1148.     beq    ct.loop            ; no, skip this stuff
  1149.     cmp    r1    ,#41        ; is this a shifted down char?
  1150.     blo    100$            ; no
  1151.     add    #137    ,r1        ; ya, bump 101..41 back to 240..200
  1152. 100$:    decb    r1            ; now back to where we started
  1153.     mov    #errtxt    ,r2        ; a handy buffer
  1154.     deccvt    r1 ,r2 ,#ct.wid        ; integer > ascii, right justify
  1155.     clrb    ct.wid(r2)        ; null terminate the ascii string
  1156.     wrtall    r2            ; display it then
  1157. 110$:    wrtall    r5            ; add the appropriate tag line
  1158.     .newline
  1159.     br    ct.loop
  1160.  
  1161.     command    ctlst    ,ALL    ,1    ,sct$al
  1162.     command    ctlst
  1163.  
  1164. sct$al:    clr    r3            ; start off at offset = zero
  1165. 120$:    mov    r3    ,r1        ; do this character position in table
  1166.     call    ct.all            ; ..one by one
  1167.     inc    r3            ; next time do next char
  1168.     cmp    r3    ,#101        ; there are 65. total control chars
  1169.     blos    120$            ; loop until they've all been done
  1170.     return
  1171.  
  1172.     .dsabl    lsb
  1173.  
  1174.  
  1175.     .sbttl    Get the next argument
  1176.  
  1177. nextarg:mov    argbuf    ,r1        ; pointer to top of args buffer
  1178. 10$:    tstb    @r1            ; is this char a null?
  1179.     beq    20$            ; ya, done
  1180.     cmpb    (r1)+    ,#space        ; no, but is it a delimiter?
  1181.     bne    10$            ; no, try the next char..
  1182. 20$:    return
  1183.  
  1184.  
  1185.     .sbttl    Memory allocation    ; /62/ moved this here
  1186.  
  1187. ;    input:   r0    Amount of memory needed
  1188.  
  1189. malloc:    inc    r0            ; ensure r0 is pointing
  1190.     bic    #1    ,r0        ; to an even word boundary
  1191.     mov    r0    ,-(sp)        ; save a copy of this address
  1192.     add    @albuff    ,(sp)        ; add used part of buffer to it
  1193.     cmp    (sp)    ,#alsize    ; is there any room left?
  1194.     bhis    10$            ; no
  1195.     mov    albuff    ,r0        ; ya, compute pointer to this
  1196.     add    #2    ,r0        ; new allocation
  1197.     add    @albuff    ,r0        ; it begins here..
  1198.     mov    (sp)+    ,@albuff    ; this is the new start of free memory
  1199.     return
  1200. 10$:    clr    r0            ; indicate failure
  1201.     tst    (sp)+            ; dump needed memory buffer
  1202.     return
  1203.  
  1204.     .end
  1205.