home *** CD-ROM | disk | FTP | other *** search
/ Columbia Kermit / kermit.zip / archives / msk314.pkz / MODEMS / BESTDATA.SCR next >
Text File  |  1995-06-12  |  6KB  |  138 lines

  1. ; FILE BESTDATA.SCR
  2. ;
  3. ; An MS-DOS Kermit script program for dialing the BEST DATA 1442xxx (V.32bis)
  4. ; Faxmodem, to be used with MS-DOS Kermit 3.13 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.
  7. ;
  8. ; Authors: Christine M. Gianone, Frank da Cruz; Columbia U, 8 June 1995.
  9. ; Adapted from BOCA.SCR.
  10. ;
  11. ; FIRST DRAFT - NOT YET TESTED
  12. ;
  13. def errfail echo \%1, hangup, goto fail ; Macro to handle failures.
  14. if < VERSION 313 errfail {MS-DOS Kermit 3.13 or later required.}
  15.  
  16. define chkerr if fail stop 1 \%1
  17. define chkok input 3 OK, if fail stop 1 \%1
  18.  
  19. ; For sending BREAK, since evidently the modem does not pass it through.
  20.  
  21. define sbreak pause 1, output +++, pause 1, output AT\{92}B3\13, -
  22.   pause 1, output ATO\13, connect
  23. set key \2352 {\Ksbreak}        ; Assign BREAK to Alt-b.
  24.  
  25. set input echo on               ; So we can watch what happens.
  26. set input timeout proceed       ; Allow IF SUCCESS, IF FAILURE.
  27. set input case ignore           ; Use caseless string comparisons
  28.  
  29. set parity none                 ; Avoid parity foulups
  30. set flow none                   ; Avoid flow control deadlocks
  31. hangup                          ; Begin by dropping DTR
  32. pause 1                         ; for one second
  33.  
  34. ; Speed.  Modem autobauds up to 57600.
  35.  
  36. set speed 57600                 ; Use high interface speed.
  37.  
  38. echo Configuring BEST DATA 1442 Faxmodem on \v(line) at \v(speed) bps...
  39.  
  40. :INIT
  41. output ATQ0V1\13                ; Enable word result codes
  42. chkok {Can't get modem's attention}
  43.  
  44. output AT E1 W1 Y0 &C1 &D2 X4\13 ; Echoing, result codes, etc.
  45. chkok {Can't initialize modem}
  46.  
  47. echo Enabling modulation negotiation...
  48. output AT F1 S37=11 N1\13       ; Start modulation speed negotiation at V32bis
  49. chkok {Can't enable modulation speed negotiation}
  50. echo Enabling hardware flow control...
  51. output AT &K3\{92}G1\13         ; RTS/CTS hardware flow control
  52. chkok {Can't enable RTS/CTS}    ; On modem
  53. wait 5 cts
  54. if fail errfail {Modem is not asserting CTS!}
  55. set flow rts/cts                ; And in Kermit too, but only now
  56. echo Configuring modem to ignore BREAK...
  57. output AT S82=128\13            ; Make modem ignore BREAK
  58. chkok {Can't become transparent to BREAK}
  59. echo Enabling error correction and data compression...
  60. output AT &Q6\{92}N3%C3\13      ; Enable error correction & compression
  61.                                 ; with automatic speed buffering
  62. input 3 OK
  63. if success goto ECOK
  64. echo
  65. echo WARNING - Trouble enabling compression EC and fallback.
  66. echo This must be a "Class I" RPI model, which means you don't get
  67. echo error correction or compression.  Sorry.
  68. echo
  69. :ECOK
  70. if def \%1 if not equal "\%1" "=" goto BEGIN
  71. echo Modem initialization complete, no number to dial
  72. end 0
  73.  
  74. :BEGIN                          ; Now DIAL.
  75. clear                           ; Clear INPUT buffer.
  76. set count 5                     ; Dialing retry counter, 5 tries allowed.
  77. echo Dialing \%1 on \v(line) at \v(speed) bps, wait...
  78. echo
  79. pause 1
  80. goto dial                       ; 1st time, skip pause and Redialing message
  81.  
  82. :REDIAL
  83. set alarm 30
  84. pause 30                        ; Wait 30 seconds before redialing.
  85. if not alarm errfail {Dialing canceled.}
  86. echo Redialing...               ; Message for redialing.
  87. pause 1
  88.  
  89. :DIAL
  90. output ATD\%1\13                ; Dial the number.
  91. set alarm 90                    ; (For detecting keyboard interruptions.)
  92. if > VERSION 312 clear input    ; Clear echo from INPUT buffer.
  93. if < VERSION 313 clear
  94. input 30 \10                    ; Wait for the linefeeds...
  95.  
  96. :GETMSG
  97. input 60 \10                    ; ...that surround the response message.
  98. if success goto gotmsg          ; Got a message.
  99. if alarm errfail {No response from modem.} ; No response in 90 seconds.
  100. hangup                          ; User interrupted from keyboard,
  101. output \13                      ; cancel dialing by sending carriage return,
  102. goto again                      ; and go try again right away.
  103.  
  104. :GOTMSG
  105. reinput 1 CONNECT               ; Got a message, was it CONNECT?
  106. if success goto done            ; If so, we're done.
  107. reinput 1 BUSY                  ; Line is busy.
  108. if success goto busy            ; Go wait a while and then dial again.
  109. reinput 1 ERROR                 ; Command syntax error.
  110. if success errfail {Dialing command error}
  111. reinput 1 NO CARRIER            ; Phone didn't answer or no carrier.
  112. if success errfail {No answer or no carrier}
  113. reinput 1 NO DIALTONE           ; No dialtone when phone taken off hook.
  114. if success errfail {No dialtone - Is your modem connected to the phone line\63}
  115. goto getmsg                     ; None of the above, get another message.
  116.  
  117. :BUSY
  118. if < \v(count) 2 goto quit      ; Don't wait 30 seconds if tries are used up.
  119. Echo Line is busy, will dial again in 30 seconds
  120. echo Press any key to cancel...
  121. output \13                      ; CR cancels dialing
  122. hangup                          ; Hang up.
  123. :AGAIN
  124. if count goto redial            ; Then go redial.
  125. :QUIT
  126. errfail {It never answers!  I give up.} ; Too many tries.
  127.  
  128. :DONE                           ; Connected.
  129. echo \7                         ; Celebrate with a beep.
  130. define errfail                  ; Erase local macro definitions...
  131. end 0                           ; Finished, return success code.
  132.  
  133. :FAIL                           ; Dialing failed, no beep.
  134. define errfail                  ; Erase local macro definitions...
  135. end 1                           ; Return failure code.
  136.  
  137. ; End of BESTDATA.SCR
  138.