home *** CD-ROM | disk | FTP | other *** search
/ Simtel MSDOS 1993 May / SIMTEL_0593.ISO / msdos / kermit / msmpenrl.scr < prev    next >
Text File  |  1992-12-30  |  6KB  |  143 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 (modified from HAYES.SCR by 
  29. ;     Christine M. Gianone (July 1991).  Requires MS-DOS Kermit 3.11 or later.
  30. ;
  31. ; The normal DTE <-> DCE speed of this modem is 38.4 Kbps, regardless of
  32. ; the line or character speed.  Set that number here, regardless of what
  33. ; the DIALUPS file says.  However, this may exceed the speed at which 
  34. ; MSDOS computers can deal with characters and should be reduced if necessary.
  35. ;
  36. echo Using Penril Alliance V.32 modem\13\10 ; comforting in multimodem environ
  37. set speed 38400                  ;****
  38. ;
  39. set flow rts                          ; Nothing else works.
  40. def errfail echo \%1,hangup,goto fail ; Macro to handle failures.
  41.  
  42. if < VERSION 310 errfail {MS-DOS Kermit 3.10 or later required.}
  43.  
  44. set input timeout proceed       ; Allow IF SUCCESS, IF FAILURE
  45. set input echo off              ; Don't echo the modem test/init
  46. output A            ; Send AT, use word result codes.
  47. output T            ; Initialization chars have to be dribbled
  48. output {\38}            ; at this modem
  49. output F
  50. output \13            ; at least through end of first command.
  51. input 2 OK                      ; Modem should say "OK"
  52. if fail errfail {Turn on or connect your modem!}
  53. pause                ; Continue initializing
  54. output AT            ; Very loud speaker, turn it down
  55. output L1
  56. output \13
  57. input 2 OK
  58. pause
  59. output AT
  60. output {\92}            ; RTS/CTS, bidirectional
  61. output Q1
  62. output {\44}1            ;  => \Q,1,1
  63. output \13
  64. input 2 OK
  65. if fail errfail {Unable to initialize modem}
  66. clear                ; Clear input buffer
  67. ;
  68. if not equ {\%1} {=} goto dialnow   ; This provides for initialization only
  69. echo Modem initialization complete, no number to dial
  70. end 0
  71.  
  72. :DIALNOW
  73. set count 5                     ; Set up dialing retry counter
  74. set input echo on               ; From now on, show what happens
  75. echo Dialing \%1, wait...
  76. pause 1
  77. goto dial                       ; 1st time, skip Redialing message
  78.  
  79. :REDIAL
  80. pause 30            ; Wait 30 seconds before redialing.
  81. echo Redialing...               ; Message for redialing.
  82. pause 1
  83.  
  84. :DIAL
  85. output ATD\%1\13                ; Dial the number (ATDT or ATDP)
  86. input 10 \10            ; ignore the immediate LF
  87.  
  88. :GETMSG
  89. set alarm 130            ; Detect keyboard interruptions.
  90. input 60 \10                    ; Wait for the linefeeds...
  91. input 40 \10            ; that surround response message.
  92. if success goto gotmsg        ; Got a message.
  93. if alarm errfail {No response from modem.} ; No response in a long time
  94.  
  95. hangup                ; User interrupted from keyboard,
  96. if count goto redial        ; so try again right away
  97. goto fail            ; die here if over count
  98.  
  99. ; Warning: At least in terms of what the test machine sees, the Penril
  100. ; is a little arbitrary about how many line feeds appear between CONNECT NNN
  101. ; and the protocol stuff.  So the logic below deals with it by time, rather
  102. ; than really expecting the V42/MNP/BUFFER stuff to be executed.
  103.  
  104. :GOTMSG
  105. reinput 0 CONNECT               ; Got message, was it CONNECT?
  106. if success goto cspeed          ; Yes, wait for BUFFER, MNP, or V.42
  107. reinput 0 ERROR            ; No, check for command error.
  108. if success errfail {Modem command error.}
  109. reinput 0 NO CARRIER        ; NO CARRIER?
  110. if success goto busy        ; Treat like BUSY.
  111. reinput 0 BUSY                  ; BUSY?
  112. if success goto busy         ; Go wait a bit, then dial again.
  113. reinput 0 V42            ; Protocol stuff (V.42/V.42bis)
  114. if success goto speed        ; modem ready, set speed
  115. reinput 0 MNP            ; MNP, ignore
  116. if success goto speed        ; modem ready, set speed
  117. reinput 0 BUFFER        ; remaining case in auto-reliable
  118. if success goto speed        ; modem ready, set speed
  119. errfail {No dialtone or no answer.  Try again later.}
  120.  
  121. :BUSY
  122. if < \v(count) 2 goto quit    ; Don't wait 60 seconds if tries used up.
  123. Echo Busy or No Carrier, will dial again in 30 seconds...
  124. hangup                          ; Hang up.
  125. :AGAIN
  126. if count goto redial            ; Then go redial.
  127. :QUIT
  128. errfail {It never answers!  I give up.} ; Too many tries.
  129.  
  130. ; The following block is retained for compatibility for HAYES.SCR.  Since
  131. ; this modem buffers (always retains the same DCE<->DTE speed), the computer
  132. ; should not speed-match and the next section is a no-op.
  133. :CSPEED
  134. pause 2                ; wait for protocol announcement
  135. :SPEED                          ; Connected!
  136. echo \7                         ; Celebrate with a beep.
  137. define errfail            ; Erase ERRFAIL definition
  138. end 0                ; Finished, return success code.
  139.  
  140. :FAIL                ; Failed, return failure code.
  141. define errfail            ; Erase ERRFAIL definition
  142. end 1
  143.