home *** CD-ROM | disk | FTP | other *** search
/ Columbia Kermit / kermit.zip / archives / msr313src.zip / msmpp14400.scr < prev    next >
Text File  |  1993-12-30  |  6KB  |  174 lines

  1. ; FILE PP14400.SCR (MSMPP144.SCR)
  2. ;
  3. ; An MS-DOS Kermit script program for dialing the Practical Peripherals 14400
  4. ; FXMT or FXSA, PM9600FXMT, PM9600SA, or PM9600 modem, to be used with MS-DOS
  5. ; Kermit 3.12 or later.  The modem is set up for compression, error
  6. ; correction, all types of fallback.  RTS/CTS flow control, fixed interface
  7. ; speed of 57600 or 38400, depending on the modem model.
  8. ;
  9. ; Authors: Christine M. Gianone, Frank da Cruz; Columbia U, June 1993
  10. ; Revised: December 1993 to accommodate the 9600bps models;
  11. ;   Acknowledgements to David Zakai of SUNY-Health Science Center
  12. ;   at Brooklyn for info about them and debugging help.
  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 3 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. ;
  23. define atok -
  24.  if not def \%1 assign \%1 \v(speed), -
  25.  set speed \%1, -
  26.  echo Trying \%1..., -
  27.  output ATQ0V1\13, -
  28.  input 3 OK, -
  29.  end \v(status)
  30.  
  31. set input echo on        ; So we can watch what happens.
  32. set input timeout proceed       ; Allow IF SUCCESS, IF FAILURE.
  33. set input case ignore        ; Use caseless string comparisons
  34.  
  35. set parity none            ; Avoid parity foulups
  36. set flow none            ; Avoid flow control deadlocks
  37. hangup                ; Begin by dropping DTR
  38. pause 1                ; for one second
  39.  
  40. wait 0 DSR            ; Check modem signals that should be on
  41. chkerr {No DSR signal - check your modem and cable}
  42. wait 0 CTS
  43. chkerr {No CTS signal - check your modem and cable}
  44.  
  45. atok 38400            ; Look for OK response at 38400 bps
  46. if fail atok 9600        ; Fall back to 9600 bps
  47. if fail stop 1 Can't get modem's attention
  48.  
  49. output AT E1 W1 S95=47 &D2 X4\13 ; Set up echoing, result codes, etc.
  50. chkok {Can't initialize modem}
  51.  
  52. ; Now see which Practical Peripherals model we have.
  53. ;
  54. output ATI3\13                ; Issue model query
  55. input 5 OK
  56. if fail stop 1 Can't get modem model info!
  57. reinput 0 PM9600FXMT            ; PM9600FXMT
  58.   if success goto PP9600FX
  59. reinput 0 PM9600            ; PM9600 or PM9600SA
  60.   if success goto PP9600SA
  61. reinput 0 PM14400            ; PM14400FXSA or PM14400FXMT
  62.   if success goto PP14400
  63. stop 1 Unknown Practical Peripherals Modem model.
  64.  
  65. ; Model-specific items...
  66.  
  67. :PP9600SA
  68. atok 38400            ; Highest interface speed is 38400
  69. if fail stop 1 No response at 38400 bps!
  70. echo Configuring PP9600 or PP9600SA...
  71. define _modcmd S37=9 N1        ; Highest modulation speed is V.32 = 9600
  72. goto config
  73.  
  74. :PP9600FX
  75. atok 57600            ; Highest interface speed is 57600
  76. if fail stop 1 No response at 57600 bps!
  77. echo Configuring PP9600FXMT...
  78. define _modcmd S37=9 N1        ; Highest modulation speed is V.32 = 9600
  79. goto config
  80.  
  81. :PP14400
  82. atok 57600            ; Highest interface speed is 57600
  83. if fail stop 1 No response at 57600 bps!
  84. echo Configuring PP14400FXMT or SA...
  85. define _modcmd S37=11 N1    ; Highest modulation speed is V.32bis = 14400
  86.  
  87. :CONFIG
  88. echo Enabling modulation negotiation...
  89. output AT \m(_modcmd)\13    ; Issue the modulation setup command
  90. chkok {Can't enable modulation speed negotiation}
  91. define _modcmd
  92. echo Enabling hardware flow control...
  93. output AT &K3\13        ; Enable RTS/CTS hardware flow control
  94. chkok {Can't enable RTS/CTS}    ; On modem
  95. set flow rts/cts        ; And in Kermit too, but only now
  96. echo Configuring modem to ignore BREAK...
  97. output AT S82=128\13        ; Make modem ignore BREAK
  98. chkok {Can't become transparent to BREAK}
  99. echo Enabling error correction and data compression...
  100. output AT &Q5 S36=7 S46=2\13    ; Enable error correction & compression
  101.                 ; with automatic speed buffering 
  102. chkok {Can't enable compression EC and fallback}
  103.  
  104. if def \%1 if not equal "\%1" "=" goto BEGIN
  105. echo Modem initialization complete, no number to dial
  106. end 0
  107.  
  108. :BEGIN                ; Now DIAL.
  109. clear                ; Clear INPUT buffer.
  110. set count 5                     ; Dialing retry counter, 5 tries allowed.
  111. echo Dialing \%1 on \v(line) at \v(speed) bps, wait...
  112. echo
  113. pause 1
  114. goto dial                       ; 1st time, skip pause and Redialing message
  115.  
  116. :REDIAL
  117. set alarm 30
  118. pause 30            ; Wait 30 seconds before redialing.
  119. if not alarm errfail {Dialing canceled.}
  120. echo Redialing...               ; Message for redialing.
  121. pause 1
  122.  
  123. :DIAL
  124. output ATD\%1\13                ; Dial the number.
  125. set alarm 90            ; (For detecting keyboard interruptions.)
  126. if > VERSION 312 clear input    ; Clear echo from INPUT buffer.
  127. if < VERSION 313 clear
  128. input 30 \10                    ; Wait for the linefeeds...
  129.  
  130. :GETMSG
  131. input 60 \10            ; ...that surround the response message.
  132. if success goto gotmsg        ; Got a message.
  133. if alarm errfail {No response from modem.} ; No response in 90 seconds.
  134. hangup                ; User interrupted from keyboard,
  135. output \13            ; cancel dialing by sending carriage return,
  136. goto again            ; and go try again right away.
  137.  
  138. :GOTMSG
  139. reinput 1 CONNECT               ; Got a message, was it CONNECT?
  140. if success goto done            ; If so, we're done.
  141. reinput 1 BUSY            ; Line is busy.
  142. if success goto busy        ; Go wait a while and then dial again.
  143. reinput 1 ERROR            ; Command syntax error.
  144. if success errfail {Dialing command error}
  145. reinput 1 NO CARRIER        ; Phone didn't answer or no carrier.
  146. if success errfail {No answer or no carrier}
  147. reinput 1 NO DIALTONE        ; No dialtone when phone taken off hook.
  148. if success errfail {No dialtone - Is your modem connected to the phone line\63}
  149. goto getmsg            ; None of the above, get another message.
  150.  
  151. :BUSY
  152. if < \v(count) 2 goto quit    ; Don't wait 30 seconds if tries are used up.
  153. Echo Line is busy, will dial again in 30 seconds
  154. echo Press any key to cancel...
  155. output \13            ; CR cancels dialing
  156. hangup                          ; Hang up.
  157. :AGAIN
  158. if count goto redial            ; Then go redial.
  159. :QUIT
  160. errfail {It never answers!  I give up.} ; Too many tries.
  161.  
  162. :DONE                           ; Connected.
  163. echo \7                         ; Celebrate with a beep.
  164. define errfail            ; Erase local macro definitions...
  165. define _modcmd
  166. end 0                ; Finished, return success code.
  167.  
  168. :FAIL                ; Dialing failed, no beep.
  169. define errfail            ; Erase local macro definitions...
  170. define _modcmd
  171. end 1                ; Return failure code.
  172.  
  173. ; End of PP14400.SCR
  174.