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

  1. ; FILE WANG14.SCR (MSMWANG14.SCR)
  2. ;
  3. ; MS-DOS Kermit dialing script for the Wang 14/14i (internal) or
  4. ; 14/14e (external).
  5. ;
  6. ; Modified from da Cruz and Gianone's ULTRA144.SCR (MSMULTRA.SCR)
  7. ;  by John Pritchard (jdp10@columbia.edu), 2/94
  8. ; Many notes taken from "User Manual", second edition, January 1993,
  9. ;  Copyright (C) Wang Laboratories, Inc., 1992.
  10. ; Original Authors: Christine M. Gianone, Frank da Cruz; Columbia U, June 1993.
  11. ;
  12. ; Some defaults with their AT commands (* = changed here)
  13. ;   E1 command echo
  14. ;   L2 medium speaker volume
  15. ;   N1 permit handshaking at any speed supported by communicating modems
  16. ;   Q0 allow result codes sent to DTE (interface (to system bus) to Kermit)
  17. ;   V1 verbose result codes
  18. ;*  W0 error-correction negotiation progress NOT reported
  19. ;   X4 extended result codes for "BUSY", "NO DIAL TONE", and "CARRIER xxxx"
  20. ;   &C0 RLSD (DCD -- Hayes default) is ON regardless of the state of the
  21. ;     data carrier from the remote modem
  22. ;*  &D0 modem ignores DTR (Hayes default setting; prevents HANGUP from working)
  23. ;   &K3 enable RTS/CTS - DTE<->DCE flow control
  24. ;   &Q5 enable error-correction negotiation with fallback per register S36
  25. ;   &R0 CTS tracks RTS (&R1 ignores RTS and CTS is locked ON) see S26
  26. ;   &S0 DSR is constantly ON
  27. ;   \A1 MNP block size of 128; 0:64; 2:192; 3:256
  28. ;   \L0 MNP block transfer control in stream mode (1:block mode)
  29. ;   %C1 data compression enabled
  30. ;*  %E0 auto-retrain disabled
  31. ;   %M3 two-way compression
  32. ;   %S32 maximum string length for compresion [6,250]
  33. ;   S25=5 delay to DTR. async mode meaning: time=n*0.01 seconds; change
  34. ;     in DTR less than n/100 seconds has no effect on modem.  [0,255]
  35. ;   S26=1 CTS tracking delay: time=n*0.01 seconds [0,255]
  36. ;   S36=7 negotiation failure (of LAPM) condition: fallback to MNP,
  37. ;     and then fallback to ASB (automatic speed buffering) -- "normal",
  38. ;     asynchronous connection.
  39. ;*  S40=57 (0011 0111) MNP:
  40. ;     (bit number:binary:identical AT code:interpreted command parameter);
  41. ;     0,1:00:\N:0; 2,3,4:110:\K:6 (which should be invalid, want \K5);
  42. ;     5,6:11:\A:3; 7:1:\G:1
  43. ;*  S41=1 (none==0000 0001) MNP:
  44. ;     (bit number:binary:identical AT code:interpreted command parameter);
  45. ;     0:0:%C:0; 1:0:%E:0; 2:0:\L:0; bits 3-7 not used.
  46. ;*  S46= none - controls selection of compression; 136 - error correction
  47. ;     without compression; 138 - EC with compression.
  48. ;   S48=7 enable V.42 negotiation
  49.  
  50. ; Check Kermit version
  51. if < VERSION 312 errfail {MS-DOS Kermit 3.12 or later required.}
  52.  
  53. define max_speed 57600    
  54. define errfail echo \%1,-
  55.   echo,-
  56.   hangup,-
  57.   goto fail
  58. define chkerr if fail echo \%1 -
  59.   echo -
  60.   stop        
  61. define chkok input 3 OK,-
  62.   if fail echo %1-
  63.   echo -
  64.   stop
  65. define atok -
  66.  if def \%1 set speed \%1, -
  67.  echo Trying \%1..., -
  68.  output ATQ0V1\13, -
  69.  input 3 OK, -
  70.  if success goto gotok
  71.  
  72. set speed \m(max_speed)        ; 
  73. set input echo on        ; So we can watch what happens.
  74. set input timeout proceed       ; Allow IF SUCCESS, IF FAILURE.
  75. set input case ignore        ; Use caseless string comparisons
  76. set parity none            ; Avoid parity foulups
  77. set flow RTS/CTS
  78. hangup                ; Begin by dropping DTR
  79. pause 1                ; for one second
  80.  
  81. ; Check if modem has been initialized with this script during this instance 
  82. ; of Kermit, and assume modem DSR & CTS are on.  Might want to either
  83. ; reorder script or put some brief modem checking after RUN to make the
  84. ; script bullet-proof.  INIT can be defined in MSCUSTOM.INI to zero.  This
  85. ; process can be expanded for Kermit use with multiple modems, ports, 
  86. ; network, etc, by including this piece of code in each initialization 
  87. ; script.
  88. ;
  89. if def init if equal \m(init) wang14 goto run
  90. define init zero
  91. echo { Modem initialization variable set to \%i}
  92. echo
  93.  
  94. echo { Configuring Wang 14 on \v(line) }
  95.  
  96. ; Check modem signals that should be on
  97. wait 0 DSR
  98. chkerr { No DSR signal - check your modem! }
  99. wait 0 CTS
  100. chkerr { No CTS signal - check your modem! }
  101. echo
  102. echo { Checking modem command set at data speeds...}
  103. atok            ; Try to connect at current speed, whatever it is.
  104. atok 300
  105. atok 2400
  106. atok 9600
  107. atok \m(max_speed)    ; Highest speed permitted.
  108. stop 1 Can't get modem's attention
  109.  
  110. :GOTOK
  111. ; Check modem command mode
  112. set count 3         ; three tries to get response to AT command
  113. ;
  114. :LOOP            ; called only from "if count" below
  115. echo trying modem... 
  116. if = \v(count) 3 echo  once
  117. if = \v(count) 2 echo  twice
  118. if = \v(count) 1 echo  three times, we're out!
  119. echo
  120. pause
  121. output AT\13
  122. input 3 OK
  123. echo
  124. if success goto init
  125. if count goto loop    ; subtract one from "\v(count)" and goto :LOOP
  126. Stop 1 { Can't communicate with modem at \v(speed) }
  127.  
  128. :INIT            ; Initialize the modem.
  129. echo { Initializing modem options... }
  130. echo
  131. ; &D2    hangup if DTR drops, so Kermit's HANGUP command will work
  132. ; L1     low speaker volume
  133. ; W1     enable error correction call progress messages
  134. ; X4     enable full range of result codes
  135. ; S40= 234 (1110 1010) - 0,1:\N3 (select auto-reliable link-mode), 
  136. ;    2,3,4:\K5 (conditional break control), 
  137. ;    5,6:\A1 (select maximum MNP block size to 128 chars), 
  138. ;    7:\G0 (disable XON/XOFF flow control)
  139. ; S41= 224 (1110 0000) - 0:%C1 (enable data compression), 
  140. ;    1:%E1 (enable auto-retrain), 
  141. ;    2:%L0 (report received signal level), 
  142. ;    bits 3-7 not used
  143. ; S95= 116 (0111 0100 - bits 0,1,2,3,5 on)
  144. ;       Enables CARRIER xxxx (with DTE speed & /ARQ), 
  145. ;    PROTOCOL xxxx, and COMPRESSION result codes
  146. ;
  147. ; (limit command line to less than 40 chars including spaces)
  148. ;
  149. output AT &D2 L1 W1 X4\13
  150. chkok { Can't initialize modem (1) }
  151. echo
  152. output AT S40=234 S41=224 S95=116\13
  153. chkok { Can't initialize modem (2) }
  154. echo
  155. ; Specify treatment of BREAK signal
  156. ;
  157. echo { Configuring modem to ignore BREAK... }
  158. output AT S82=128\13        ; Make modem pass BREAK transparently
  159. chkok { Can't become transparent to BREAK }
  160. echo
  161. ;
  162. ; negotiate error correction and compression: V.42 negotiation with LAPM 
  163. ; else MNP5 negotiation with MNP4 protocol.
  164. ; S38=1     pause: When DTR from PC goes off, hang up after 1 second
  165. ; S46=138   execute error correction protocol with compression (In addition 
  166. ;        to V.42/bis the modem implements MNP5 data compression. V.42 is
  167. ;        used only with LAPM, and MNP5 only with MNP4.
  168. ;
  169. echo { Enabling error correction and data compression... }
  170. output AT S38=1 S46=138\13
  171. chkok { Can't enable compression and EC }
  172. echo
  173. ;
  174. ; NVRAM User Profile Zero is start-up configuration, important for 
  175. ; Kermie's signal checking which drops DTR in "hangup", see default AT&D
  176. ; &W0  save settings in profile zero
  177. ; &Y0  designate profile zero start-up configuration
  178. ;
  179. echo { Saving configuration as User Profile Zero in NVRAM... }
  180. output AT&W0&Y0\13
  181. chkok { Failed to save configuration in NVRAM }
  182. echo
  183. ; define initialization complete for this instance of Kermit
  184. define \%i wang14
  185. ;
  186. :RUN
  187. if def \%1 if not equal "\%1" "=" goto BEGIN
  188. ;
  189. ; else... 
  190. ; user only wanted to initialize the modem...
  191. ; display configuration
  192. ;
  193. define \%i wang14
  194. echo { Wang 14 initialized OK: }
  195. echo
  196. end 0
  197.  
  198. :BEGIN            ; User wants to dial.
  199. clear            ; Clear INPUT buffer.
  200. set count 5             ; Dialing retry counter, 5 tries allowed.
  201. echo Dialing \%1 on \v(line) at \v(speed) bps, wait...
  202. echo
  203. pause 1
  204. goto dial               ; 1st time, skip pause and Redialing message
  205.  
  206. :REDIAL
  207. ; called from again
  208. set alarm 30
  209. pause 30            ; Wait 30 seconds before redialing.
  210. if not alarm errfail { redial: dialing cancelled }
  211. echo Redialing...               ; Message for redialing.
  212. pause 1
  213. ;
  214. :DIAL
  215. output ATD\%1\13                ; Dial the number.
  216. set alarm 90            ; (For detecting keyboard interruptions.)
  217. if > VERSION 312 clear input    ; Clear echo from INPUT buffer.
  218. if < VERSION 313 clear
  219. input 30 \10                    ; Wait for the linefeeds
  220. ;                  .
  221. :GETMSG                ; .
  222. ; called from GOTMSG and AGAIN  ; .
  223. input 60 \10            ; that surround the response message.
  224. if success goto gotmsg        ; Got a message.
  225. if alarm errfail { No response from modem } ; No response in 90 seconds, fail.
  226. hangup                ; User interrupted from keyboard,
  227. output \13            ; cancel dialing by sending carriage return,
  228. goto again            ; and go try againw right away.
  229.  
  230. :GOTMSG
  231. ; called from GETMSG
  232. echo
  233. reinput 1 CONNECT        ; Success
  234. if success goto done
  235. reinput 1 BUSY            ; Line is busy.
  236. if success goto busy        ; Go wait a while and then dial again.
  237. reinput 1 ERROR            ; Command syntax error.
  238. if success errfail { Dialing command error }
  239. reinput 1 NO ANSWER        ; No answer
  240. if success errfail { No answer, please try again later }
  241. reinput 1 NO CARRIER        ; Phone didn't answer or no carrier.
  242. if success goto nocarrier
  243. reinput 1 NO DIALTONE        ; No dialtone when phone taken off hook.
  244. if success errfail { No dialtone - Is modem connected to phone line\63 }
  245. reinput 1 RING            ; Phone is ringing
  246. if success errfail { Somebody is calling this number }
  247. goto getmsg            ; None of the above, get another message.
  248. ;
  249. :BUSY                ; \v(count) set in BEGIN
  250. if < \v(count) 2 goto quit    ; Don't wait 30 seconds if tries are used up.
  251. echo Line is busy, will dial again in 30 seconds.
  252. echo Press any key to cancel...
  253. ;
  254. :AGAIN
  255. ; called from getmsg
  256. if count goto redial            ; Then go redial.
  257.  
  258. :QUIT
  259. errfail { It never answers!  I give up. } ; Too many tries.
  260.  
  261. :FAIL                ; Dialing failed, no beep.
  262. define errfail            ; Erase local macro definitions...
  263. define max_speed
  264. ;
  265. :NOCARRIER
  266. ; called from GOTMSG and fall-off from FAIL
  267. echo Connection failed, the first event contributing to the loss of carrier...
  268. echo
  269. output ATS86?\13
  270. reinput 1 000
  271. if success echo { Normal Disconnect }
  272. reinput 0 004
  273. if success echo { Loss of Carrier }
  274. reinput 0 005
  275. if success echo { -
  276. V.42 negotiation failed to detect an error-correcting modem at the other end}
  277. reinput 0 009
  278. if success echo { The modems could not find a common protocol }
  279. reinput 0 012
  280. if success echo { -
  281. Remote modem does not respond after ten re-transmissions of the same message}
  282. reinput 0 013
  283. if success echo { Apparently no dialtone }
  284. reinput 0 014
  285. if success echo { Protocol violation }
  286. end 1                ; Return failure code.
  287.  
  288. :DONE                           ; Connected.
  289. echo \7\7                       ; Celebrate with a beep. 
  290. define errfail            ; Erase local macro definitions...
  291. define max_speed
  292. end 0                ; Finished, RETURN success code.
  293.  
  294. ; End of File WANG14.SCR
  295.