home *** CD-ROM | disk | FTP | other *** search
/ Columbia Kermit / kermit.zip / mskermit / msmpp14400.scr < prev    next >
Text File  |  2020-01-01  |  6KB  |  171 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. atok 38400            ; Look for OK response at 38400 bps
  41. if fail atok 9600        ; Fall back to 9600 bps
  42. if fail stop 1 Can't get modem's attention
  43.  
  44. output AT E1 W1 S95=47 &D2 X4\13 ; Set up echoing, result codes, etc.
  45. chkok {Can't initialize modem}
  46.  
  47. ; Now see which Practical Peripherals model we have.
  48. ;
  49. output ATI3\13                ; Issue model query
  50. input 5 OK
  51. if fail stop 1 Can't get modem model info!
  52. reinput 0 PM9600FXMT            ; PM9600FXMT
  53.   if success goto PP9600FX
  54. reinput 0 PM9600            ; PM9600 or PM9600SA
  55.   if success goto PP9600SA
  56. reinput 0 PM14400            ; PM14400FXSA or PM14400FXMT
  57.   if success goto PP14400
  58. stop 1 Unknown Practical Peripherals Modem model.
  59.  
  60. ; Model-specific items...
  61.  
  62. :PP9600SA
  63. atok 38400            ; Highest interface speed is 38400
  64. if fail stop 1 No response at 38400 bps!
  65. echo Configuring PP9600 or PP9600SA...
  66. define _modcmd S37=9 N1        ; Highest modulation speed is V.32 = 9600
  67. goto config
  68.  
  69. :PP9600FX
  70. atok 57600            ; Highest interface speed is 57600
  71. if fail stop 1 No response at 57600 bps!
  72. echo Configuring PP9600FXMT...
  73. define _modcmd S37=9 N1        ; Highest modulation speed is V.32 = 9600
  74. goto config
  75.  
  76. :PP14400
  77. atok 57600            ; Highest interface speed is 57600
  78. if fail stop 1 No response at 57600 bps!
  79. echo Configuring PP14400FXMT or SA...
  80. define _modcmd S37=11 N1    ; Highest modulation speed is V.32bis = 14400
  81.  
  82. :CONFIG
  83. echo Enabling modulation negotiation...
  84. output AT \m(_modcmd)\13    ; Issue the modulation setup command
  85. chkok {Can't enable modulation speed negotiation}
  86. define _modcmd
  87. echo Enabling hardware flow control...
  88. output AT &K3\13        ; Enable RTS/CTS hardware flow control
  89. chkok {Can't enable RTS/CTS}    ; On modem
  90. wait 5 cts
  91. if fail errfail {Modem is not asserting CTS!}
  92. set flow rts/cts        ; And in Kermit too, but only now
  93. echo Configuring modem to ignore BREAK...
  94. output AT S82=128\13        ; Make modem ignore BREAK
  95. chkok {Can't become transparent to BREAK}
  96. echo Enabling error correction and data compression...
  97. output AT &Q5 S36=7 S46=2\13    ; Enable error correction & compression
  98.                 ; with automatic speed buffering 
  99. chkok {Can't enable compression EC and fallback}
  100.  
  101. if def \%1 if not equal "\%1" "=" goto BEGIN
  102. echo Modem initialization complete, no number to dial
  103. end 0
  104.  
  105. :BEGIN                ; Now DIAL.
  106. clear                ; Clear INPUT buffer.
  107. set count 5                     ; Dialing retry counter, 5 tries allowed.
  108. echo Dialing \%1 on \v(line) at \v(speed) bps, wait...
  109. echo
  110. pause 1
  111. goto dial                       ; 1st time, skip pause and Redialing message
  112.  
  113. :REDIAL
  114. set alarm 30
  115. pause 30            ; Wait 30 seconds before redialing.
  116. if not alarm errfail {Dialing canceled.}
  117. echo Redialing...               ; Message for redialing.
  118. pause 1
  119.  
  120. :DIAL
  121. output ATD\%1\13                ; Dial the number.
  122. set alarm 90            ; (For detecting keyboard interruptions.)
  123. if > VERSION 312 clear input    ; Clear echo from INPUT buffer.
  124. if < VERSION 313 clear
  125. input 30 \10                    ; Wait for the linefeeds...
  126.  
  127. :GETMSG
  128. input 60 \10            ; ...that surround the response message.
  129. if success goto gotmsg        ; Got a message.
  130. if alarm errfail {No response from modem.} ; No response in 90 seconds.
  131. hangup                ; User interrupted from keyboard,
  132. output \13            ; cancel dialing by sending carriage return,
  133. goto again            ; and go try again right away.
  134.  
  135. :GOTMSG
  136. reinput 1 CONNECT               ; Got a message, was it CONNECT?
  137. if success goto done            ; If so, we're done.
  138. reinput 1 BUSY            ; Line is busy.
  139. if success goto busy        ; Go wait a while and then dial again.
  140. reinput 1 ERROR            ; Command syntax error.
  141. if success errfail {Dialing command error}
  142. reinput 1 NO CARRIER        ; Phone didn't answer or no carrier.
  143. if success errfail {No answer or no carrier}
  144. reinput 1 NO DIALTONE        ; No dialtone when phone taken off hook.
  145. if success errfail {No dialtone - Is your modem connected to the phone line\63}
  146. goto getmsg            ; None of the above, get another message.
  147.  
  148. :BUSY
  149. if < \v(count) 2 goto quit    ; Don't wait 30 seconds if tries are used up.
  150. Echo Line is busy, will dial again in 30 seconds
  151. echo Press any key to cancel...
  152. output \13            ; CR cancels dialing
  153. hangup                          ; Hang up.
  154. :AGAIN
  155. if count goto redial            ; Then go redial.
  156. :QUIT
  157. errfail {It never answers!  I give up.} ; Too many tries.
  158.  
  159. :DONE                           ; Connected.
  160. echo \7                         ; Celebrate with a beep.
  161. define errfail            ; Erase local macro definitions...
  162. define _modcmd
  163. end 0                ; Finished, return success code.
  164.  
  165. :FAIL                ; Dialing failed, no beep.
  166. define errfail            ; Erase local macro definitions...
  167. define _modcmd
  168. end 1                ; Return failure code.
  169.  
  170. ; End of PP14400.SCR
  171.