home *** CD-ROM | disk | FTP | other *** search
/ ftp.barnyard.co.uk / 2015.02.ftp.barnyard.co.uk.tar / ftp.barnyard.co.uk / cpm / walnut-creek-CDROM / JSAGE / ZSUS / SUBSCRIP / ZSUS1-08.LZH / PCP-TCJ.LBR / PCPCALL.MZX / PCPCALL.MEX
Text File  |  1990-07-15  |  5KB  |  249 lines

  1.  
  2. .. PCPCALL.MEX  (02/08/90)
  3. ..
  4. .. This script performs the steps necessary to connect to the designated city
  5. .. and remote system.
  6.  
  7. .. initialization
  8.  
  9. %m=100;.                clear menu selection
  10. %u=0;.                    flag to show initial attempt
  11.  
  12. .. let user know what we are up to
  13.  
  14. screen on
  15. cls
  16. say "/nCalling ",F,": city code ",D," at ",B,"00 bps . . . "
  17.  
  18.  
  19. .. Branch depending on whether we are presently connected to no city, the
  20. .. requested city, or a different city.
  21.  
  22. if %p=0 GOTO NEWCITY;.            no city connected presently
  23. if %a=%p GOTO LOCAL;.            already connected to desired city
  24.  
  25. .. ----------------------------------------------------------------------
  26. ..
  27. .. Disconnect from wrong city
  28. ..
  29. .. ----------------------------------------------------------------------
  30.  
  31. .. disconnect from present city
  32.  
  33. say "/n/nDisconnecting from outdial code ",A," . . . "
  34. %x=3;.                    max number of tries
  35.  
  36. LABEL DROPCITY
  37. screen off
  38. sendout "/r@/r";.            try to return to PCP command mode
  39. wait string 2 "@";.            we should get '@' prompt
  40. if value>0 GOTO DROP1;.            if we do, continue below
  41. %x=%x-1;.                else drop count
  42. if %x<1 A="Cannot quit current city";GOTO ABORT;. abort if count expired
  43. GOTO DROPCITY;.                try again
  44.  
  45. LABEL DROP1
  46. screen off
  47. sendout "D/r";.                tell PCP to disconnect from city
  48. %p=0;.                    show no city connected
  49. screen on
  50. say "OK";.                tell user that it worked
  51.  
  52. .. ----------------------------------------------------------------------
  53. ..
  54. .. Connect to new city
  55. ..
  56. .. ----------------------------------------------------------------------
  57.  
  58. LABEL NEWCITY
  59. A=" city code"
  60. screen on
  61. if %u=0;.                initial attempt to connect to city
  62.   say "/n";.                end any line of screen output
  63.   %u=1;.                show no longer first time
  64.   %d=%t;.                number of tries into variable 'd'
  65.   else;.                else trying AGAIN to connect
  66.   gosub GETD;.                gets number of times to try
  67.   say "/nCalling ",F,"/n";.        tell user whom we are trying to reach
  68.   endif
  69. say "/nDialing",A," ",D;.        report the city code we are dialing
  70.  
  71. %c=1;.                    count of tries
  72. %o=1;.                    indicate first time through
  73. LABEL CITYCODE
  74. if %c>%d goto MORETRIES
  75. sleep 1
  76. screen on;say "/n  try #",%c," of ",%d," at ",%b," bps...";screen off
  77. %c=%c+1
  78. sendout "C D//"
  79. sendout D;.                city code
  80. sendout "//"
  81. sendout B;.                baud code
  82. sendout ","
  83. sendout "userid";.            user id
  84. sendout ","
  85. sendout "password";.            user password
  86. sendout "/r"
  87.  
  88. wait string 4 "CONNECTED" "BUSY" "FAIL"
  89. if value=1 goto LOCAL
  90.  
  91. screen on
  92. if value=3 say "Failed Call";goto MORETR1
  93. if value=2 say "Busy"
  94. if value=0 say "No Response"
  95. goto CITYCODE
  96.  
  97. LABEL MORETRIES
  98. if %n=0 goto MORETR1;.            no auto step down
  99. if %o=0 goto MORETR1;.            already stepped down
  100. %o=0
  101. if %b=2400 %b=1200;B=12;%c=1;GOTO CITYCODE
  102.  
  103. LABEL MORETR1
  104. gosub ASKMORE
  105. if value=1 goto NEWCITY
  106.  
  107. %a=0
  108. D=" "
  109. read PCPMENU;.                chain back to main menu
  110.  
  111. .. ----------------------------------------------------------------------
  112. ..
  113. .. In right city; try connecting to specified system
  114. ..
  115. .. ----------------------------------------------------------------------
  116.  
  117. LABEL LOCAL
  118. screen on
  119. say "/n/nCONNECTED to city code ",D
  120.  
  121. .. initialize destination modem
  122.  
  123. if %z=2;.                if in Vadic mode
  124.   sendout "I/r";.            exit from it
  125.   %z=0;.                show initialized modem
  126.   sleep 1
  127.   endif
  128.  
  129. LABEL REINIT
  130. %x=3;.                    max attempts to initialize modem
  131. LABEL REINIT1
  132. if %x<1 A="Remote modem failure";goto ABORT
  133. %x=%x-1
  134. screen on;say "/n  initialize remote modem... ";screen off
  135. sleep 1
  136. sendout "ATZ/r"
  137. wait string 3 "OK"
  138. if value=0 goto REINIT1
  139.  
  140. ;.. Call destination system
  141.  
  142. LABEL LOCALAGAIN
  143. A=" local number"
  144. screen on
  145. if %z=0
  146.   say "/n"
  147.   %z=1
  148.   %d=%s
  149.   else
  150.   GOSUB GETD
  151.   endif
  152.  
  153. say "/nDialing ",F,"/n";screen off
  154. %c=1
  155.  
  156. if %z=2 goto DIAL1;.            already in Vadic mode
  157.  
  158. LABEL DIAL
  159.  
  160. sendout "^E/r";.            enter Vadic mode
  161. wait string 3 "*"
  162. screen on
  163. if value=0 say "/nVadic Mode Failed/n";goto REINIT
  164.  
  165. say "/nRemote modem now in Vadic Mode"
  166. %z=2;.                    show Vadic mode
  167.  
  168. LABEL DIAL1
  169.  
  170. %r=0
  171. screen on;say "/n/nTry #",%c," of ",%d," (at ",%b," bps)/n"
  172. sendout "D";sendout E;sendout "/r"
  173.  
  174. LABEL DIAL2
  175. screen on
  176. wait string 25 "ANSWER" "BUSY" "DIAL TONE" "RINGING..."
  177. if value=1 goto SUCCESS
  178. if value=2 goto BUSY
  179. if value=3 goto DIALTONE
  180. if value<>4 goto BADCODE
  181.  
  182. %r=%r+1;.                count of rings
  183. if %r<3 say "/n";goto DIAL2
  184. say "  No answer/n"
  185. sendout "I/r"
  186. goto NOANSWER
  187.  
  188. LABEL BADCODE
  189. say "  Failed call/n"
  190. goto NOANSWER
  191.  
  192. LABEL BUSY
  193. %c=%c+1
  194. if %c>%d goto NOANSWER
  195. goto DIAL1
  196.  
  197. LABEL DIALTONE
  198. say "  No dial tone/n"
  199.  
  200. LABEL NOANSWER
  201. gosub ASKMORE
  202. if value=1 goto LOCALAGAIN
  203.  
  204. read PCPMENU
  205.  
  206. LABEL SUCCESS
  207. screen on
  208. say "^G/n/nCONNECTED TO HOST SYSTEM/n/n"
  209. read PCPCONN
  210.  
  211.  
  212. .. ---------- Subroutines
  213.  
  214. PROC GETD
  215. say "/nTry how many times to connect to",A,"? "
  216. input
  217. %d=value
  218. if %d<1 %d=1
  219. ENDP
  220.  
  221. PROC ASKMORE
  222. LABEL ASKAGAIN
  223. screen on
  224. say "/n/nTry",A," some more (Y//N)? "
  225. bell 1
  226. accept C,1
  227. screen off
  228. comp C "Y"
  229. if value=1 ENDP
  230. comp C "N"
  231. if value=1 value=0;ENDP
  232. bell 1
  233. goto ASKAGAIN
  234.  
  235. LABEL ABORT
  236. screen on
  237. cls
  238. @ 5 0 say A,"; session ended."
  239. @ 10 0 say "Will disconnect in 5 seconds . . . "
  240. bell 5
  241. %x=3
  242. LABEL ABORT1
  243. %x=%x-1
  244. if %x<1 dsc;cpm
  245. sendout "/r@/r"
  246. wait string 1 "@"
  247. if value=1 sendout "hangup/r";cpm
  248. goto ABORT1
  249.