home *** CD-ROM | disk | FTP | other *** search
/ Columbia Kermit / kermit.zip / archives / msr313src.zip / msmzyxel.scr < prev    next >
Text File  |  1994-06-16  |  6KB  |  141 lines

  1. ; FILE ZYXEL.SCR
  2. ;
  3. ; An MS-DOS Kermit script program for dialing the ZyXEL 1496
  4. ; modem, to be used with MS-DOS Kermit 3.11 or later.  The modem is set
  5. ; up for compression, error correction, all types of fallback.
  6. ; RTS/CTS flow control, fixed interface speed of 57600 or 38400.
  7. ;
  8. ; Authors: Christine M. Gianone, Frank da Cruz; Columbia U, June 1993.
  9. ;   PP14400.SCR adapted for Zoom modem by:
  10. ;   Phillip Feldman <feldman@wiener.pstat.ucsb.edu>, Sept 1993.
  11. ;   Further modified for ZyXEL modem by:
  12. ;   Richard Stanton <stanton@haas.berkeley.edu>
  13. ;
  14. ;   This script is almost identical to ZOOM.SCR.  Changes:
  15. ;
  16. ;   W1 means nothing to ZyXEL.
  17. ;   S95 register doesn't exist.
  18. ;   X5 gives more information than X4.
  19. ;   &N0 tells modem to negotiate highest rate possible.
  20. ;   &H3 gives RTS/CTS flow control, rather than &K3.
  21. ;   &Y1 tells modem to send nondestructive, expedited breaks.
  22. ;   &K4 tells modem to try V42/V42bis, then work down (through MNP etc.)
  23. ;   No forced hangup settings.
  24.  
  25. def errfail echo \%1, hangup, goto fail ; Macro to handle failures.
  26. if < VERSION 312 errfail {MS-DOS Kermit 3.12 or later required.}
  27. if eq "\v(system)" "UNIX" if = \v(local) 0 stop 1 You must SET LINE first
  28.  
  29. define chkerr if fail stop 1 \%1
  30. define chkok input 3 OK, if fail stop 1 \%1
  31.  
  32. set input echo on               ; So we can watch what happens.
  33. set input timeout proceed       ; Allow IF SUCCESS, IF FAILURE.
  34. set input case ignore           ; Use caseless string comparisons
  35.  
  36. ;set parity none                ; Avoid parity foulups
  37. set flow none                   ; Avoid flow control deadlocks
  38. hangup                          ; Begin by dropping DTR
  39. pause 1                         ; for one second
  40.  
  41. set speed 57600                 ; Modem autobauds up to 57600
  42.  
  43. echo Configuring ZyXEL U-1496E modem on \v(line)...
  44.  
  45. wait 0 DSR                      ; Check modem signals that should be on
  46. chkerr {No DSR signal - check your modem and cable}
  47. wait 0 CTS
  48. chkerr {No CTS signal - check your modem and cable}
  49.  
  50. :INIT
  51. output ATQ0V1\13                ; Enable word result codes
  52. chkok {Can't get modem's attention}
  53.  
  54. echo Enabling verbose result codes...
  55. output AT E1 &D2 X5\13 ; Echoing, result codes, etc.
  56. chkok {Can't initialize modem}
  57.  
  58. echo Enabling modulation negotiation...
  59. output AT &N0 N1\13             ; Start modulation speed negotiation at V32bis
  60. chkok {Can't enable modulation speed negotiation}
  61. echo Enabling hardware flow control...
  62. output AT &H3\13                ; RTS/CTS hardware flow control
  63. chkok {Can't enable RTS/CTS}    ; On modem
  64. set flow rts/cts                ; And in Kermit too, but only now
  65. echo Configuring modem to ignore BREAK...
  66. output AT &Y1\13            ; Make modem ignore BREAK
  67. chkok {Can't become transparent to BREAK}
  68. echo Enabling error correction and data compression...
  69. output AT &K4\13  ; Enable error correction & compression
  70.                                 ; with automatic speed buffering
  71. chkok {Can't enable compression EC and fallback}
  72.  
  73. if def \%1 if not equal "\%1" "=" goto BEGIN
  74. echo Modem initialization complete, no number to dial
  75. end 0
  76.  
  77. :BEGIN                          ; Now DIAL.
  78. clear                           ; Clear INPUT buffer.
  79. set count 100                     ; Dialing retry counter, 5 tries allowed.
  80. echo Dialing \%1 on \v(line) at \v(speed) bps, wait...
  81. echo
  82. pause 1
  83. goto dial                       ; 1st time, skip pause and Redialing message
  84.  
  85. :REDIAL
  86. set alarm 30
  87. pause 30                        ; Wait 30 seconds before redialing.
  88. if not alarm errfail {Dialing canceled.}
  89. echo Redialing...               ; Message for redialing.
  90. pause 1
  91.  
  92. :DIAL
  93. output ATD\%1\13                ; Dial the number.
  94. set alarm 200                   ; (For detecting keyboard interruptions.)
  95. if > VERSION 312 clear input    ; Clear echo from INPUT buffer.
  96. if < VERSION 313 clear
  97. input 100 \10                    ; Wait for the linefeeds...
  98.  
  99. :GETMSG
  100. input 100 \10                    ; ...that surround the response message.
  101. if success goto gotmsg          ; Got a message.
  102. if alarm errfail {No response from modem.} ; No response in 90 seconds.
  103. hangup                          ; User interrupted from keyboard,
  104. output \13                      ; cancel dialing by sending carriage return,
  105. goto again                      ; and go try again right away.
  106.  
  107. :GOTMSG
  108. reinput 1 CONNECT               ; Got a message, was it CONNECT?
  109. if success goto done            ; If so, we're done.
  110. reinput 1 BUSY                  ; Line is busy.
  111. if success goto busy            ; Go wait a while and then dial again.
  112. reinput 1 ERROR                 ; Command syntax error.
  113. if success errfail {Dialing command error}
  114. reinput 1 NO CARRIER            ; Phone didn't answer or no carrier.
  115. if success errfail {No answer or no carrier}
  116. reinput 1 NO DIALTONE           ; No dialtone when phone taken off hook.
  117. if success errfail {No dialtone - Is your modem connected to the phone line\63}
  118. goto getmsg                     ; None of the above, get another message.
  119.  
  120. :BUSY
  121. if < \v(count) 2 goto quit      ; Don't wait 30 seconds if tries are used up.
  122. Echo Line is busy, will dial again in 30 seconds
  123. echo Press any key to cancel...
  124. output \13                      ; CR cancels dialing
  125. hangup                          ; Hang up.
  126. :AGAIN
  127. if count goto redial            ; Then go redial.
  128. :QUIT
  129. errfail {It never answers!  I give up.} ; Too many tries.
  130.  
  131. :DONE                           ; Connected.
  132. echo \7                         ; Celebrate with a beep.
  133. define errfail                  ; Erase local macro definitions...
  134. end 0                           ; Finished, return success code.
  135.  
  136. :FAIL                           ; Dialing failed, no beep.
  137. define errfail                  ; Erase local macro definitions...
  138. end 1                           ; Return failure code.
  139.  
  140. ; End of ZYXEL.SCR
  141.