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

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