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

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