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

  1. ; File PENRIL.SCR -- minor modification of Christine's HAYES.SCR.
  2. ; To be used with MS-DOS Kermit 3.11 or later.
  3. ;
  4. ; Stored in Kermit Distribution as MSMPENRIL.SCR; rename to PENRIL.SCR
  5. ; if necessary so the DIAL macro can find it.  Place this file in your
  6. ; current directory or in any directory in your DOS PATH, and then set the
  7. ; DOS environment variable, MODEM, to be PENRIL.  Give the following command
  8. ; at the DOS prompt before starting Kermit, or add it to your AUTOEXEC.BAT
  9. ; file:
  10. ;
  11. ;   SET MODEM=PENRIL
  12. ;
  13. ; This MS-DOS Kermit script program is for dialing Penril Alliance V.32
  14. ; modems and compatibles.  It will probably work with the V.32bis version of
  15. ; this modem, but this has not been tested.  The Penril, like most V.32
  16. ; modems, is Hayes-compatible up to the point that one starts dealing with
  17. ; buffering, error-correction, and compression modes.  Expects variable %\1
  18. ; to contain the phone number; this is done by the DIAL macro defined in
  19. ; MSKERMIT.INI.  Items marked by "***" might need editing.
  20. ;
  21. ; Uses ATD (modem's default dialing method) to dial the number.
  22. ; Force tone dialing by including T as first character of phone
  23. ; number, or pulse dialing by including P as first character.
  24. ;
  25. ; Sets SUCCESS flag if dialing succeeds, sets FAILURE flag 
  26. ; if it fails.
  27. ;
  28. ;  Author: John C. Klensin, August 1992
  29. ;  Adapted from HAYES.SCR by Christine M. Gianone (July 1991).
  30. ;  Requires MS-DOS Kermit 3.11 or later.
  31. ;
  32. ; The normal DTE <-> DCE speed of this modem is 38.4 Kbps, regardless of
  33. ; the line or character speed.  Set that number here, regardless of what
  34. ; the DIALUPS file says.  However, this may exceed the speed at which 
  35. ; MSDOS computers can deal with characters and should be reduced if necessary.
  36. ;
  37. echo Using Penril Alliance V.32 modem\13\10 ; comforting in multimodem environ
  38. set speed 38400                  ;****
  39. ;
  40. set flow rts                          ; Nothing else works.
  41. def errfail echo \%1,hangup,goto fail ; Macro to handle failures.
  42.  
  43. if < VERSION 310 errfail {MS-DOS Kermit 3.10 or later required.}
  44.  
  45. set input timeout proceed       ; Allow IF SUCCESS, IF FAILURE
  46. set input echo off              ; Don't echo the modem test/init
  47. output A            ; Send AT, use word result codes.
  48. output T            ; Initialization chars have to be dribbled
  49. output {\38}            ; at this modem
  50. output F
  51. output \13            ; at least through end of first command.
  52. input 2 OK                      ; Modem should say "OK"
  53. if fail errfail {Turn on or connect your modem!}
  54. pause                ; Continue initializing
  55. output AT            ; Very loud speaker, turn it down
  56. output L1
  57. output \13
  58. input 2 OK
  59. pause
  60. output AT
  61. output {\92}            ; RTS/CTS, bidirectional
  62. output Q1
  63. output {\44}1            ;  => \Q,1,1
  64. output \13
  65. input 2 OK
  66. if fail errfail {Unable to initialize modem}
  67. clear                ; Clear input buffer
  68. ;
  69. if not equ {\%1} {=} goto dialnow   ; This provides for initialization only
  70. echo Modem initialization complete, no number to dial
  71. end 0
  72.  
  73. :DIALNOW
  74. set count 5                     ; Set up dialing retry counter
  75. set input echo on               ; From now on, show what happens
  76. echo Dialing \%1, wait...
  77. pause 1
  78. goto dial                       ; 1st time, skip Redialing message
  79.  
  80. :REDIAL
  81. set alarm 30
  82. pause 30            ; Wait 30 seconds before redialing.
  83. if not alarm errfail {Dialing canceled.}
  84. echo Redialing...               ; Message for redialing.
  85. pause 1
  86.  
  87. :DIAL
  88. output ATD\%1\13                ; Dial the number (ATDT or ATDP)
  89. input 10 \10            ; ignore the immediate LF
  90.  
  91. :GETMSG
  92. set alarm 130            ; Detect keyboard interruptions.
  93. input 60 \10                    ; Wait for the linefeeds...
  94. input 40 \10            ; that surround response message.
  95. if success goto gotmsg        ; Got a message.
  96. if alarm errfail {No response from modem.} ; No response in a long time
  97.  
  98. hangup                ; User interrupted from keyboard,
  99. if count goto redial        ; so try again right away
  100. goto fail            ; die here if over count
  101.  
  102. ; Warning: At least in terms of what the test machine sees, the Penril
  103. ; is a little arbitrary about how many line feeds appear between CONNECT NNN
  104. ; and the protocol stuff.  So the logic below deals with it by time, rather
  105. ; than really expecting the V42/MNP/BUFFER stuff to be executed.
  106.  
  107. :GOTMSG
  108. reinput 0 CONNECT               ; Got message, was it CONNECT?
  109. if success goto cspeed          ; Yes, wait for BUFFER, MNP, or V.42
  110. reinput 0 ERROR            ; No, check for command error.
  111. if success errfail {Modem command error.}
  112. reinput 0 NO CARRIER        ; NO CARRIER?
  113. if success goto busy        ; Treat like BUSY.
  114. reinput 0 BUSY                  ; BUSY?
  115. if success goto busy         ; Go wait a bit, then dial again.
  116. reinput 0 V42            ; Protocol stuff (V.42/V.42bis)
  117. if success goto speed        ; modem ready, set speed
  118. reinput 0 MNP            ; MNP, ignore
  119. if success goto speed        ; modem ready, set speed
  120. reinput 0 BUFFER        ; remaining case in auto-reliable
  121. if success goto speed        ; modem ready, set speed
  122. errfail {No dialtone or no answer.  Try again later.}
  123.  
  124. :BUSY
  125. if < \v(count) 2 goto quit    ; Don't wait 60 seconds if tries used up.
  126. Echo Busy or No Carrier, will dial again in 30 seconds...
  127. echo Press any key to cancel...
  128. hangup                          ; Hang up.
  129. :AGAIN
  130. if count goto redial            ; Then go redial.
  131. :QUIT
  132. errfail {It never answers!  I give up.} ; Too many tries.
  133.  
  134. ; The following block is retained for compatibility for HAYES.SCR.  Since
  135. ; this modem buffers (always retains the same DCE<->DTE speed), the computer
  136. ; should not speed-match and the next section is a no-op.
  137. :CSPEED
  138. pause 2                ; wait for protocol announcement
  139. :SPEED                          ; Connected!
  140. echo \7                         ; Celebrate with a beep.
  141. define errfail            ; Erase ERRFAIL definition
  142. end 0                ; Finished, return success code.
  143.  
  144. :FAIL                ; Failed, return failure code.
  145. define errfail            ; Erase ERRFAIL definition
  146. end 1
  147.