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

  1. ; File QBLAZER.SCR (MSMQBLAZ.SCR)
  2. ;
  3. ; An MS-DOS Kermit script program for dialing Telebit QBlazer modems.
  4. ; Set up QBlazer for compression, error correction, all types of fallback,
  5. ; RTS/CTS flow control, fixed interface speed of 38400.
  6. ;
  7. ; Requires MS-DOS Kermit 3.12 or later
  8. ;
  9. ; Authors: Christine M. Gianone, Frank da Cruz; Columbia U, June 1993
  10. def errfail echo \%1, hangup, goto fail ; Macro to handle failures.
  11. if < VERSION 312 errfail {MS-DOS Kermit 3.12 or later required.}
  12. if eq "\v(system)" "UNIX" if = \v(local) 0 stop 1 Please SET LINE first.
  13.  
  14. define chkerr if fail stop 1 \%1
  15. define chkok input 3 OK, if fail stop 1 \%1
  16.  
  17. define max_speed 38400    ; Change these two if necessary
  18. define s51 6        ; ...
  19.  
  20. ; Macro to try to get attention of modem's command processor
  21. ; at the given speed, or if no speed given, at the current speed.
  22. ;
  23. define atok -
  24.  if not def \%1 assign \%1 \v(speed), -
  25.  set speed \%1, -
  26.  echo Trying \%1..., -
  27.  output \B, -
  28.  output \17, -
  29.  output ATQ0\13, -
  30.  input 3 OK, -
  31.  if success goto gotok
  32.  
  33. set input echo on        ; So we can watch what happens.
  34. set input timeout proceed       ; Allow IF SUCCESS, IF FAILURE.
  35. set input case ignore        ; Use caseless string comparisons
  36.  
  37. set parity none        ; Avoid parity foulups
  38. set flow none        ; Avoid flow control deadlocks
  39. hangup            ; Begin by dropping DTR
  40. pause 1            ; for one second
  41.  
  42. echo Configuring Telebit QBlazer on \v(line).
  43.  
  44. if > \v(speed) \m(max_speed) set speed \m(max_speed)
  45.  
  46. atok            ; Try to connect at current speed, whatever it is.
  47. atok 9600         ; Try to connect at 9600.
  48. atok 19200        ; 19200...
  49. atok 2400        ; etc...
  50. atok 38400        ; Last resort because no autobaud at this speed(?)
  51. stop 1 Can't get modem's attention
  52.  
  53. ; QBlazer modem setup, should apply to all connections:
  54. ;
  55. ; X4           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 X4\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 QBlazer 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...               ; Message for 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 QBLAZER.SCR
  196.