home *** CD-ROM | disk | FTP | other *** search
/ Columbia Kermit / kermit.zip / mskermit / msmt3000.scr < prev    next >
Text File  |  2020-01-01  |  6KB  |  197 lines

  1. ; FILE T3000.SCR (MSMT3000.SCR)
  2. ;
  3. ; An MS-DOS Kermit script program for dialing Telebit T3000 and similar
  4. ; modems (T1600 and QBlazer, possibly WorldBlazer), to be used with MS-DOS
  5. ; Kermit 3.11 or later.  See T3000.DOC (MSMT3000.DOC) for documentation.
  6. ;
  7. ; Authors: Christine M. Gianone, Frank da Cruz; Columbia U, June 1993
  8. def errfail echo \%1, hangup, goto fail ; Macro to handle failures.
  9. if < VERSION 312 errfail {MS-DOS Kermit 3.12 or later required.}
  10. if eq "\v(system)" "UNIX" if = \v(local) 0 stop 1 Please SET LINE first.
  11.  
  12. define chkerr if fail stop 1 \%1
  13. define chkok input 3 OK, if fail stop 1 \%1
  14.  
  15. define max_speed 57600        ; T3000 interface speed
  16. define s51 7            ; T3000 S51 register setting for this speed
  17.  
  18. ; Macro to try to get attention of modem's command processor
  19. ; at the given speed, or if no speed given, at the current speed.
  20. ;
  21. define atok -
  22.  if not def \%1 assign \%1 \v(speed), -
  23.  set speed \%1, -
  24.  echo Trying \%1..., -
  25.  output \B, -
  26.  output \17, -
  27.  output ATQ0\13, -
  28.  input 3 OK, -
  29.  if success goto gotok
  30.  
  31. set input echo on        ; So we can watch what happens.
  32. set input timeout proceed       ; Allow IF SUCCESS, IF FAILURE.
  33. set input case ignore        ; Use caseless string comparisons
  34.  
  35. set parity none        ; Avoid parity foulups
  36. set flow none        ; Avoid flow control deadlocks
  37. hangup            ; Begin by dropping DTR
  38. pause 1            ; for one second
  39.  
  40. echo Configuring Telebit T3000 on \v(line).
  41.  
  42. clear            ; Clear input buffer
  43. if > \v(speed) \m(max_speed) set speed \m(max_speed)
  44.  
  45. atok            ; Try to connect at current speed, whatever it is.
  46. atok 9600         ; Try to connect at 9600.
  47. atok 19200        ; 19200...
  48. atok 2400        ; etc...
  49. atok 38400        ; ...
  50. atok 57600        ; Last resort for T3000.
  51. stop 1 Can't get modem's attention
  52.  
  53. ; Telebit T3000 modem setup, should apply to all connections:
  54. ;
  55. ; X12          Result code selection, wait for dialtone, recognize busy signal.
  56. ; &D2          Disconnect call and return to command mode if DTR drops;
  57. ;                this allows HANGUP to work if cable properly wired.
  58. ; S50=0        Automatic modulation speed determination.
  59. ; S94=1        Allow connection at any speed and allow modulation fallback.
  60. ; S58=2S68=255 Use RTS/CTS hardware flow control.
  61. ; S60=0        Data format: 8 data bits, no parity.
  62. ; S61=0S63=0   Pass BREAK through transparently.
  63.  
  64. :GOTOK            ; Got OK from modem
  65.  
  66. ;;output AT&F\13    ; Restore factory settings (no, this changes speed!)
  67. ;;chkok {Can't restore factory settings}
  68.  
  69. output AT E1 Q0 V1 &D2 S59=15 X12\13  ; Set echo and response modes.
  70. chkok {Can't initialize modem}
  71.  
  72. echo Locking interface speed at \m(max_speed)...
  73. output ATS51=\m(s51)\13
  74. chkok {Can't set modem's speed to \m(max_speed)}
  75. set speed \m(max_speed)
  76.  
  77. ; Try 3 times to get OK response to AT at new speed.
  78. ;
  79. set count 3
  80. :LOOP
  81. pause
  82. output AT\13
  83. input 3 OK
  84. if success goto ok
  85. if count goto loop
  86. Stop 1 Can't communicate with modem at \m(max_speed)
  87.  
  88. :OK
  89. echo Enabling hardware flow control...
  90. output AT S58=2 S68=255 &R3\13    ; Tell modem to use RTS/CTS
  91. chkok {Can't enable RTS/CTS}
  92. wait 5 cts
  93. if fail errfail {Modem is not asserting CTS!}
  94. set flow rts/cts        ; Tell Kermit to use RTS/CTS
  95. echo Enabling modulation negotiation...
  96. output AT S50=0 S94=1\13    ; Enable modulation speed negotiation
  97. chkok {Can't enable modulation speed negotiation}
  98. echo Configuring modem to ignore BREAK...
  99. output AT S60=0 S61=0 S63=0\13    ; Make modem ignore break
  100. chkok {Can't be transparent to BREAK}
  101. echo Enabling error correction and data compression...
  102. output AT S180=2 S181=1 S190=1\13 ; Enable error correction & compression
  103. chkok {Can't enable compression EC and fallback}
  104.  
  105. if def \%1 if not equal "\%1" "=" goto BEGIN
  106. echo T3000 initialized OK:
  107. output AT&V\13
  108. input 10 OK
  109. echo
  110. echo Firmware version:
  111. output ATI3\13
  112. input 4 OK
  113. end 0
  114.  
  115. :BEGIN                ; Now DIAL.
  116. clear                ; Clear INPUT buffer.
  117. set count 5                     ; Dialing retry counter, 5 tries allowed.
  118. echo Dialing \%1 on \v(line) at \v(speed) bps, wait...
  119. echo
  120. pause 1
  121. goto dial                       ; 1st time, skip pause and Redialing message
  122.  
  123. :REDIAL
  124. set alarm 30
  125. pause 30            ; Wait 30 seconds before redialing.
  126. if not alarm errfail {Dialing canceled.}
  127. echo Redialing...
  128. pause 1
  129.  
  130. :DIAL
  131. output ATD\%1\13                ; Dial the number.
  132. set alarm 90            ; (For detecting keyboard interruptions.)
  133. if > VERSION 312 clear input    ; Clear echo from INPUT buffer.
  134. if < VERSION 313 clear
  135. pause 1                ; Wait a sec
  136. input 30 \10                    ; Wait for the linefeeds...
  137.  
  138. :GETMSG
  139. input 60 \10            ; ...that surround the response message.
  140. if success goto gotmsg        ; Got a message.
  141. if alarm errfail {No response from modem.} ; No response in 90 seconds.
  142. hangup                ; User interrupted from keyboard,
  143. output \13            ; cancel dialing by sending carriage return,
  144. goto again            ; and go try again right away.
  145.  
  146. :GOTMSG
  147. reinput 1 CONNECT               ; Got a message, was it CONNECT?
  148. if success goto done            ; If so, we're done.
  149.  
  150. reinput 1 DIALING        ; Modem says it's dialing...
  151. if fail goto g2
  152. if > VERSION 312 clear input    ; Clear echo from INPUT buffer.
  153. if < VERSION 313 clear
  154. goto getmsg            ; message again, then go get next message.
  155.  
  156. :G2
  157. reinput 1 RRING            ; Remote phone is ringing...
  158. if fail goto g3
  159. clear                ; Clear INPUT buffer.
  160. goto getmsg            ; Go wait for another message.
  161.  
  162. :G3
  163. reinput 1 BUSY            ; Line is busy.
  164. if success goto busy        ; Go wait a while and then dial again.
  165.  
  166. :G4
  167. reinput 1 ERROR            ; Command syntax error.
  168. if success errfail {Dialing command error}
  169. reinput 1 NO CARRIER        ; Phone didn't answer or no carrier.
  170. if success errfail {No answer or no carrier}
  171. reinput 1 NO DIALTONE        ; No dialtone when phone taken off hook.
  172. if success errfail {No dialtone - Is your modem connected to the phone line\63}
  173. goto getmsg            ; None of the above, get another message.
  174.  
  175. :BUSY
  176. if < \v(count) 2 goto quit    ; Don't wait 30 seconds if tries are used up.
  177. echo Line is busy, will dial again in 30 seconds.
  178. echo Press any key to cancel...
  179. output \13            ; CR cancels dialing
  180. hangup                          ; Hang up.
  181. :AGAIN
  182. if count goto redial            ; Then go redial.
  183. :QUIT
  184. errfail {It never answers!  I give up.} ; Too many tries.
  185.  
  186. :DONE                           ; Connected.
  187. echo \7                         ; Celebrate with a beep.
  188. define errfail            ; Erase local macro definitions...
  189. end 0                ; Finished, return success code.
  190.  
  191. :FAIL                ; Dialing failed, no beep.
  192. define errfail            ; Erase local macro definitions...
  193. end 1                ; Return failure code.
  194.  
  195. ; End of T3000.SCR
  196.