home *** CD-ROM | disk | FTP | other *** search
/ kermit.columbia.edu / kermit.columbia.edu.tar / kermit.columbia.edu / test / pdp11 / krtst0.mac < prev    next >
Text File  |  1996-10-17  |  40KB  |  1,301 lines

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