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

  1. ; FILE DYNA1414.SCR (MSMDYNA.SCR)
  2. ;
  3. ; An MS-DOS Kermit script program for dialing the Dynalink 1414 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, maximum
  6. ; interface speed of 57600.
  7. ; The Dynalink 1414(VE) is a V.32bis FAX/DATA modem with the Rockwell 144
  8. ; CLASS 1/2 chipset.
  9. ;
  10. ; Authors: Christine M. Gianone, Frank da Cruz; Columbia U, June 1993
  11. ; Modified from ULTRA144.SCR and other scripts by Xander Jansen, SURFnet bv,
  12. ;          October 1994
  13. ;
  14. def errfail echo \%1, hangup, goto fail ; Macro to handle failures.
  15. if < VERSION 312 errfail {MS-DOS Kermit 3.12 or later required.}
  16.  
  17. define chkerr if fail stop 1 \%1
  18. define chkok input 5 OK, if fail stop 1 \%1
  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. ; Q0 = Enable result codes, V1 = display result codes as words.
  23. ; The dynalink modem sometimes is a bit slow with the OK so input
  24. ; will wait 5 seconds for it.
  25. ;
  26. define atok -
  27.  if not def \%1 assign \%1 \v(speed), -
  28.  set speed \%1, -
  29.  echo Trying \%1..., -
  30.  output ATQ0V1\13, -
  31.  input 5 OK, -
  32.  end \v(status)
  33.  
  34. set input echo on               ; So we can watch what happens.
  35. set input timeout proceed       ; Allow IF SUCCESS, IF FAILURE.
  36. set input case ignore           ; Use caseless string comparisons
  37.  
  38. set parity none                 ; Avoid parity foulups
  39. set flow none                   ; Avoid flow control deadlocks
  40. hangup                          ; Begin by dropping DTR
  41. pause 1                         ; for one second
  42.  
  43. ; Speed.  Don't worry about modem, it autobauds up to 57600 bps.
  44. ;
  45. set speed 57600                 ; If computer can be set to 57600 bps, use it.
  46. if fail set speed 38400         ; If not, use 38400.
  47.  
  48. echo Configuring Dynalink 1414 on \v(line).
  49.  
  50. atok                            ; Autobaud at current speed
  51. if fail atok 38400
  52. if fail atok 19200
  53. if fail atok 9600
  54. if fail atok 2400
  55. if fail stop 1 Can't get modem's attention.
  56.  
  57. :OK
  58. ;
  59. ; Initialize the modem.
  60. ;
  61. ; &C1    Use actual state of carrier for DCD
  62. ; &D2    Hangup if DTR drops, so Kermit's HANGUP command will work
  63. ; E1     Commands are to be echoed
  64. ; W1     Enable dialing progress messages
  65. ; X4     Enable full range of result codes
  66. ;
  67. output AT &C1 &D2 E1 W1 X4 S95=46\13  ; Init string
  68. chkok {Can't initialize modem}
  69. ;
  70. ; S37=11 Begin modulation negotiations at V.32bis = 14400 bps
  71. ; N1     Negotiate highest common modulation
  72. ;
  73. echo Enabling modulation negotiation...
  74. output AT S37=11 N1\13          ; Start modulation speed negotiation at 14400
  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\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 ignore BREAK...
  89. output AT \92K5\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. ; S36=7     LAPM (V.42) => MNP => ASB (automatic speed buffering)
  96. ; S38=1     When DTR from PC goes off, hang up after 1 second
  97. ; S46=138   Enable compression (%C1)
  98. ; S48=7     EC and compression negotiation enabled
  99. ;
  100. echo Enabling error correction and data compression...
  101. output AT &Q5 S36=7 S38=1 S46=138 S48=7\13
  102. chkok {Can't enable compression and EC}
  103.  
  104. ; The Dynalink modem is very noisy with the default volume set to L2.
  105. ; The volume can be set to low (L1) but the difference is minimal.
  106. ; Add M0 to the output statement below if L1 is still too loud.
  107. ;
  108. ; L1       Low volume
  109. ; M0       Speaker off
  110. echo Silencing modem...
  111. output AT L1\13         ; Add M0 to shut down the speaker
  112. ;; chkok {Can't silence the modem}
  113.  
  114. if def \%1 if not equal "\%1" "=" goto BEGIN
  115. ;
  116. ; User only wanted to initialize the modem.
  117. ; Display configuration. The settings take up a whole 24 rows screen.
  118. ;
  119. echo Dynalink 1414 initialized OK:
  120. output AT&V\13
  121. input 10 OK
  122. end 0
  123.  
  124. :BEGIN
  125. ;
  126. ; User wants to dial.
  127. ;
  128. clear                           ; Clear INPUT buffer.
  129. set count 5                     ; Dialing retry counter, 5 tries allowed.
  130. echo Dialing \%1 on \v(line) at \v(speed) bps, wait...
  131. echo
  132. pause 1
  133. goto dial                       ; 1st time, skip pause and Redialing message
  134.  
  135. :REDIAL
  136. set alarm 30
  137. pause 30                        ; Wait 30 seconds before redialing.
  138. if not alarm errfail {Dialing canceled.}
  139. echo Redialing...               ; Message for redialing.
  140. pause 1
  141.  
  142. :DIAL
  143. output ATD\%1\13                ; Dial the number.
  144. set alarm 90                    ; (For detecting keyboard interruptions.)
  145. if > VERSION 312 clear input    ; Clear echo from INPUT buffer.
  146. if < VERSION 313 clear
  147.  
  148. :GETMSG
  149. input 90 \10                    ; Wait for linefeed
  150. if success goto gotmsg          ; Got a message.
  151. if alarm errfail {No response from modem.} ; No response in 90 seconds.
  152. hangup                          ; User interrupted from keyboard,
  153. output \13                      ; cancel dialing by sending carriage return,
  154. echo Dialing interrupted, will dial again in 30 seconds.
  155. echo Press any key to cancel...
  156. goto again                      ; and go try again right away.
  157.  
  158. :GOTMSG
  159. reinput 1 CONNECT               ; Got a message, was it CONNECT?
  160. if success goto done            ; If so, we're done.
  161. reinput 1 BUSY                  ; Line is busy.
  162. if success goto busy            ; Go wait a while and then dial again.
  163. reinput 1 ERROR                 ; Command syntax error.
  164. if success errfail {Dialing command error}
  165. reinput 1 CARRIER               ; Connection rate (DCE-DCE)
  166. if success goto getmsg          ; no action
  167. reinput 1 PROTOCOL              ; Error correction type (NONE/LAP-M/ALT)
  168. if success goto getmsg          ; no action
  169. reinput 1 COMPRESSION           ; Compression type (CLASS 5/V.42BIS/NONE)
  170. if success goto getmsg          ; no action
  171. reinput 1 NO ANSWER             ; No answer
  172. if success errfail {No answer, please try again later}
  173. reinput 1 NO CARRIER            ; Phone didn't answer or no carrier.
  174. if success goto nocarrier
  175. reinput 1 NO DIALTONE           ; No dialtone when phone taken off hook.
  176. if success errfail {No dialtone - Is your modem connected to the phone line\63}
  177. reinput 1 RING                  ; Phone is ringing
  178. if success errfail {Somebody is calling this number}
  179. goto getmsg                     ; None of the above, get another message.
  180.  
  181. :BUSY
  182. if < \v(count) 2 goto quit      ; Don't wait 30 seconds if tries are used up.
  183. echo Line is busy, will dial again in 30 seconds.
  184. echo Press any key to cancel...
  185. :AGAIN
  186. if count goto redial            ; Then go redial.
  187. :QUIT
  188. errfail {It never answers!  I give up.} ; Too many tries.
  189.  
  190. :DONE                           ; Connected.
  191. echo \7                         ; Celebrate with a beep.
  192. define errfail                  ; Erase local macro definitions...
  193. define chkerr
  194. define ckok
  195. define atok
  196. end 0                           ; Finished, return success code.
  197.  
  198. :NOCARRIER
  199. echo
  200. echo Connection failed, S86 contains the reason code:
  201. echo
  202. output ATS86\63\13
  203. input 2 \10
  204. input 2 \10
  205.  
  206. :FAIL                           ; Dialing failed, no beep.
  207. define errfail                  ; Erase local macro definitions...
  208. define chkerr
  209. define ckok
  210. define atok
  211. end 1                           ; Return failure code.
  212.  
  213. ; End of DYNA1414.SCR
  214.