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