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

  1. ; FILE ULTRA144.SCR (MSMULTRA.SCR)
  2. ;
  3. ; An MS-DOS Kermit script program for dialing the Hayes ULTRA 144 modem, to be
  4. ; used with MS-DOS Kermit 3.12 or later.  The modem is set up for compression,
  5. ; error correction, all types of fallback, RTS/CTS flow control, fixed
  6. ; interface speed of 38400, which is the highest support by this modem.
  7. ;
  8. ; Authors: Christine M. Gianone, Frank da Cruz; Columbia U, June 1993
  9. ;
  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 You must 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        ; Maximum interface speed
  18.  
  19. ; Macro to try to get attention of modem's command processor
  20. ; at the given speed, or if no speed given, at the current speed.
  21. ; Q0 = Enable result codes, V1 = display result codes as words.
  22. ;
  23. define atok -
  24.  if def \%1 set speed \%1, -
  25.  echo Trying \%1..., -
  26.  output ATQ0V1\13, -
  27.  input 3 OK, -
  28.  if success goto gotok
  29.  
  30. set input echo on        ; So we can watch what happens.
  31. set input timeout proceed       ; Allow IF SUCCESS, IF FAILURE.
  32. set input case ignore        ; Use caseless string comparisons
  33.  
  34. set parity none            ; Avoid parity foulups
  35. set flow none            ; Avoid flow control deadlocks
  36. hangup                ; Begin by dropping DTR
  37. pause 1                ; for one second
  38.  
  39. echo Configuring Hayes ULTRA 144 on \v(line).
  40.  
  41. atok            ; Try to connect at current speed, whatever it is.
  42. atok 9600         ; Try to connect at 9600.
  43. atok 19200        ; 19200...
  44. atok 2400        ; 2400...
  45. atok 38400        ; Highest speed permitted.
  46. stop 1 Can't get modem's attention
  47.  
  48. :GOTOK
  49. ;
  50. ; Now change interface speed to the maximum
  51. ;
  52. echo Locking interface speed at \m(max_speed)...
  53. output ATS87=28\13
  54. chkok {Can't set modem's speed to \m(max_speed)}
  55. set speed \m(max_speed)
  56.  
  57. ; Try 3 times to get OK response to AT command at new speed.
  58. ;
  59. set count 3
  60. :LOOP
  61. pause
  62. output AT\13
  63. input 3 OK
  64. if success goto ok
  65. if count goto loop
  66. Stop 1 Can't communicate with modem at \m(max_speed)
  67.  
  68. :OK
  69. ;
  70. ; Initialize the modem.
  71. ;
  72. ; &D2    Hangup if DTR drops, so Kermit's HANGUP command will work
  73. ; E1     Commands are to be echoed
  74. ; W1     Enable dialing progress messages
  75. ; X4     Enable full range of result codes
  76. ; S95=46 Enables reporting of error control, compression, and protocol
  77. ;
  78. output AT &D2 E1 W1 X4 S95=46\13
  79. chkok {Can't initialize modem}
  80.  
  81. ; S37=11 Begin modulation negotiations at V.32bis = 14400 bps
  82. ; N1     Negotiate highest common modulation
  83. ;
  84. echo Enabling modulation negotiation...
  85. output AT S37=11 N1\13        ; Start modulation speed negotiation at 14400
  86. chkok {Can't enable modulation speed negotiation}
  87.  
  88. ; Enable hardware flow control
  89. ;
  90. echo Enabling hardware flow control...
  91. output AT &K1 &K3\13        ; Enable RTS/CTS hardware flow control
  92. chkok {Can't enable RTS/CTS}    ; On modem
  93. wait 5 cts
  94. if fail errfail {Modem is not asserting CTS!}
  95. set flow rts/cts        ; And in Kermit too, but only now
  96.  
  97. ; Specify treatment of BREAK signal
  98. ;
  99. echo Configuring modem to ignore BREAK...
  100. output AT S82=128\13        ; Make modem pass BREAK transparently
  101. chkok {Can't become transparent to BREAK}
  102.  
  103. ; Enable error correction and compression
  104. ;
  105. ; &Q5       Enable error correction
  106. ; S36=7     LAPM (V.42) => MNP => ASB (automatic speed buffering)
  107. ; S38=1     When DTR from PC goes off, hang up after 1 second
  108. ; S46=2     Enable compression
  109. ; S48=7     EC and compression negotiation enabled
  110. ;
  111. echo Enabling error correction and data compression...
  112. output AT &Q5 S36=7 S38=1 S46=2 S48=7\13
  113. chkok {Can't enable compression and EC}
  114.  
  115. if def \%1 if not equal "\%1" "=" goto BEGIN
  116. ;
  117. ; User only wanted to initialize the modem.
  118. ; Display configuration.
  119. ;
  120. echo Hayes ULTRA 144 initialized OK:
  121. output AT&V\13
  122. input 10 OK
  123. echo
  124. echo Product code:
  125. output ATI0\13
  126. input 4 OK
  127. end 0
  128.  
  129. :BEGIN
  130. ;
  131. ; User wants to dial.
  132. ;
  133. clear                ; Clear INPUT buffer.
  134. set count 5                     ; Dialing retry counter, 5 tries allowed.
  135. echo Dialing \%1 on \v(line) at \v(speed) bps, wait...
  136. echo
  137. pause 1
  138. goto dial                       ; 1st time, skip pause and Redialing message
  139.  
  140. :REDIAL
  141. set alarm 30
  142. pause 30            ; Wait 30 seconds before redialing.
  143. if not alarm errfail {Dialing canceled.}
  144. echo Redialing...               ; Message for redialing.
  145. pause 1
  146.  
  147. :DIAL
  148. output ATD\%1\13                ; Dial the number.
  149. set alarm 90            ; (For detecting keyboard interruptions.)
  150. if > VERSION 312 clear input    ; Clear echo from INPUT buffer.
  151. if < VERSION 313 clear
  152. input 30 \10                    ; Wait for the linefeeds...
  153.  
  154. :GETMSG
  155. input 60 \10            ; ...that surround the response message.
  156. if success goto gotmsg        ; Got a message.
  157. if alarm errfail {No response from modem.} ; No response in 90 seconds.
  158. hangup                ; User interrupted from keyboard,
  159. output \13            ; cancel dialing by sending carriage return,
  160. goto again            ; and go try again right away.
  161.  
  162. :GOTMSG
  163. reinput 1 CONNECT               ; Got a message, was it CONNECT?
  164. if success goto done            ; If so, we're done.
  165. reinput 1 BUSY            ; Line is busy.
  166. if success goto busy        ; Go wait a while and then dial again.
  167. reinput 1 ERROR            ; Command syntax error.
  168. if success errfail {Dialing command error}
  169. reinput 1 NO ANSWER        ; No answer
  170. if success errfail {No answer, please try again later}
  171. reinput 1 NO CARRIER        ; Phone didn't answer or no carrier.
  172. if success goto nocarrier
  173. reinput 1 NO DIALTONE        ; No dialtone when phone taken off hook.
  174. if success errfail {No dialtone - Is your modem connected to the phone line\63}
  175. reinput 1 RING            ; Phone is ringing
  176. if success errfail {Somebody is calling this number}
  177. goto getmsg            ; None of the above, get another message.
  178.  
  179. :BUSY
  180. if < \v(count) 2 goto quit    ; Don't wait 30 seconds if tries are used up.
  181. echo Line is busy, will dial again in 30 seconds.
  182. echo Press any key to cancel...
  183. :AGAIN
  184. if count goto redial            ; Then go redial.
  185. :QUIT
  186. errfail {It never answers!  I give up.} ; Too many tries.
  187.  
  188. :DONE                           ; Connected.
  189. echo \7                         ; Celebrate with a beep.
  190. define errfail            ; Erase local macro definitions...
  191. define max_speed
  192. end 0                ; Finished, return success code.
  193.  
  194. :NOCARRIER
  195. echo
  196. echo Connection failed, S86 contains the reason code:
  197. echo
  198. output ATS86\63\13
  199. input 2 \10
  200. input 2 \10
  201.  
  202. :FAIL                ; Dialing failed, no beep.
  203. define errfail            ; Erase local macro definitions...
  204. define max_speed
  205. end 1                ; Return failure code.
  206.  
  207. ; End of ULTRA144.SCR
  208.