home *** CD-ROM | disk | FTP | other *** search
/ World of Shareware - Software Farm 2 / wosw_2.zip / wosw_2 / QBAS / MYMODEM.ZIP / MYMODEM.BAS
BASIC Source File  |  1993-06-06  |  7KB  |  225 lines

  1. 'Note: in this text, ignore the apostrophes. They are a BASIC requirement.
  2. 'This program is a good example of how to communicate with your modem from
  3. 'BASIC. It is simple in comparison to commercial programs. If you would
  4. 'like to use it for your modem communications, you will need 2 things:
  5. '
  6. '1) The public domain program PCZ.
  7. '2) A basic understanding of your modem's AT commands.
  8. '
  9. '#1 isn't really required but if you want to do file transfers you'll need
  10. 'some kind of external protocol. This program is set up to use PCZ but you
  11. 'can edit it if you want to use a different one.
  12. 'This program is distributed as Shareware. The shareware concept allows you
  13. 'to test the program before you actually buy it. It is not free software.
  14. 'If you find it useful, you are expected to pay a $5 fee. Send a check or
  15. 'money order made out to Tim Hurley to this address:
  16. '
  17. '       Tim Hurley
  18. '       RR1 Box 168P
  19. '       Bay City, TX
  20. '              77414
  21. '
  22. 'Any comments or suggestions can be sent to me at either the address above
  23. 'or you can send Email to me on )(evious BBS (1-508-875-3618). Just send it
  24. 'to TIM HURLEY. You won't find me anywhere else.
  25. '
  26. 'Registered users will get a thouroughly commented version IF they also send
  27. '$2 postage.
  28. 'You are allowed to make copies of my routines for your personal use. However,
  29. 'if you market programs that incluse my routines you must include my name and
  30. 'a shareware notice in my name. You are allowed to distribute this entire
  31. 'program to your friends with minor modifications if you keep my name on it.
  32. 'Shareware companies are allowed to put this program in their catalog and
  33. 'they may charge a reasonable duplication fee.
  34. 'ALL OTHER RIGHTS RESERVED.
  35. DECLARE SUB center (l!, text$)
  36.    SCREEN 0, , 0, 0
  37.    CLS
  38.    KEY OFF
  39.    SCREEN 0, , 1, 1
  40.    CLOSE
  41.    CLS
  42.    center 1, "MyModem"
  43.    center 2, "by Tim Hurley"
  44.    PRINT : INPUT "What is the desired baud rate"; baud$
  45.     INPUT "Do you want local echo"; le$
  46.     IF le$ = "y" OR le$ = "Y" THEN le = 1
  47.     PRINT "Parity is assumed to be N."
  48.     PRINT "Stop bits are assumed to be 1."
  49.     PRINT "Data bits are set at 8."
  50.     PRINT "Port COM2 will be used."
  51.     PRINT "F1 during the transmission will bring up the transmission menu."
  52.     PRINT "The public domain program PCZ is used for all file transfers."
  53.     openstring$ = "COM2: " + baud$ + ", N, 8, 1"
  54.     KEY 1, "■"
  55.     OPEN openstring$ FOR RANDOM AS #1
  56.     IF le = 1 THEN PRINT #1, "ATE0"; CHR$(13)
  57.     WHILE NOT EOF(1): e$ = INPUT$(1, #1): WEND
  58.     PRINT "You are now connected to your modem."
  59. 220 SCREEN 0, , 1, 1
  60.     oc = CSRLIN: op = POS(0)
  61.     IF oc = 24 THEN LOCATE 24: PRINT : oc = 23
  62.     COLOR 7, 1: LOCATE 25, 1: PRINT SPACE$(26); : PRINT "F1 Calls Communications Menu"; : PRINT SPACE$(26); : COLOR 7, 0
  63.     LOCATE 24, 1: PRINT SPACE$(79);
  64.     LOCATE oc, op
  65.     IF NOT EOF(1) THEN
  66.     ms$ = INPUT$(1, #1)
  67.     IF ms$ = CHR$(13) THEN
  68.     LOCATE CSRLIN, 1
  69.     ELSE
  70.     IF ms$ = CHR$(8) THEN
  71.     IF POS(t) = 1 THEN
  72.     LOCATE CSRLIN - 1, 80
  73.     ELSE
  74.     LOCATE CSRLIN, POS(t) - 1
  75.     END IF
  76.     ELSE
  77.     IF le = 1 THEN COLOR 12
  78.     PRINT ms$; : COLOR 7
  79.     END IF
  80.     END IF
  81.     END IF
  82.     b$ = INKEY$
  83.     IF b$ = CHR$(254) THEN
  84.     GOTO 600
  85.     ELSE
  86.     PRINT #1, b$;
  87.     IF le = 1 AND b$ = CHR$(8) THEN
  88.     IF POS(t) = 1 THEN
  89.     LOCATE CSRLIN - 1, 80
  90.     ELSE
  91.     LOCATE CSRLIN, POS(t) - 1
  92.     END IF
  93.     ELSE
  94.     IF le = 1 THEN PRINT b$;
  95.     END IF
  96.     END IF
  97.     GOTO 220
  98. 600 SCREEN 0, , 2, 2
  99.     CLS
  100.     WHILE INKEY$ <> "": mgm$ = INKEY$: WEND
  101.     center 1, "Communications Menu"
  102.     PRINT : PRINT : PRINT "        1) Send a file"
  103.     PRINT : PRINT : PRINT "        2) Receive a file"
  104.     PRINT : PRINT : PRINT "        3) Quit (Make sure you disconnect!)"
  105.     PRINT : PRINT : PRINT "        4) Go back to communications"
  106.     PRINT : PRINT : PRINT : PRINT "    Enter choice: "
  107. 690 c$ = INKEY$: IF c$ = "" THEN GOTO 690
  108.     IF VAL(c$) < 1 OR VAL(c$) > 4 THEN BEEP: GOTO 690
  109.     IF c$ = "1" THEN
  110.     CLS
  111.     center 1, "File send"
  112.     PRINT : PRINT : PRINT "Avaliable protocols:"
  113.     PRINT "1) Zmodem"
  114.     PRINT "2) Ymodem"
  115.     PRINT "3) Xmodem"
  116.     PRINT "4) Xmodem 1K"
  117.     PRINT "5) SEALink"
  118.     PRINT "Enter choice: "
  119. 810 p$ = INKEY$: IF p$ = "" THEN GOTO 810
  120.     IF VAL(p$) > 5 OR VAL(p$) < 1 THEN BEEP: GOTO 810
  121.     LOCATE CSRLIN + 1, 1: PRINT "This is the complete pathname and name of the file you wish to send.";
  122.     LOCATE CSRLIN - 1, 1
  123.     INPUT "What is the file name"; f$
  124.     SCREEN 0, , 0, 0
  125.     IF p$ = "1" THEN
  126.     ss$ = "pcz 2 " + baud$ + " d sz " + f$
  127.     SHELL ss$
  128.     PRINT "Press any key...": WHILE INKEY$ = "": WEND
  129.     CLS
  130.     GOTO 220
  131.     END IF
  132.     IF p$ = "2" THEN
  133.     ss$ = "pcz 2 " + baud$ + " d sy " + f$
  134.     SHELL ss$
  135.     PRINT "Press any key...": WHILE INKEY$ = "": WEND
  136.     CLS
  137.     GOTO 220
  138.     END IF
  139.     IF p$ = "3" THEN
  140.      ss$ = "pcz 2 " + baud$ + " d sx " + f$
  141. SHELL ss$
  142. PRINT "Press any key...": WHILE INKEY$ = "": WEND
  143. CLS
  144. GOTO 220
  145. END IF
  146. IF p$ = "4" THEN
  147. ss$ = "pcz 2 " + baud$ + " d s1 " + f$
  148. SHELL ss$
  149. PRINT "Press any key...": WHILE INKEY$ = "": WEND
  150. CLS
  151. GOTO 220
  152. END IF
  153. IF p$ = "5" THEN
  154. ss$ = "pcz 2 " + baud$ + " d ss " + f$
  155. SHELL ss$
  156. PRINT "Press any key...": WHILE INKEY$ = "": WEND
  157. CLS
  158. GOTO 220
  159. END IF
  160. END IF
  161.  
  162.  
  163. IF c$ = "2" THEN
  164. CLS
  165. center 1, "File receive"
  166. PRINT : PRINT : PRINT "Avaliable protocols:"
  167. PRINT "1) Zmodem"
  168. PRINT "2) Ymodem"
  169. PRINT "3) Xmodem"
  170. PRINT "4) Xmodem 1K"
  171. PRINT "5) SEALink"
  172. PRINT "Enter choice: "
  173. 4 p$ = INKEY$: IF p$ = "" THEN GOTO 4
  174. IF VAL(p$) > 5 OR VAL(p$) < 1 THEN BEEP: GOTO 810
  175. IF p$ = "1" THEN
  176. SCREEN 0, , 0, 0
  177. ss$ = "pcz 2 " + baud$ + " d k rz r"
  178. SHELL ss$
  179. PRINT "Press any key...": WHILE INKEY$ = "": WEND
  180. END IF
  181. IF p$ = "2" THEN
  182. SCREEN 0, , 0, 0
  183. ss$ = "pcz 2 " + baud$ + " d k ry"
  184. SHELL ss$
  185. PRINT "Press any key...": WHILE INKEY$ = "": WEND
  186. END IF
  187. IF p$ = "3" THEN
  188. LOCATE CSRLIN + 1, 1: PRINT "This is what you would like to call the file. Default directory is C:\DOWNLOAD.";
  189. LOCATE CSRLIN - 1, 1
  190. INPUT "What is the file name"; f$
  191. SCREEN 0, , 0, 0
  192. ss$ = "pcz 2 " + baud$ + " d k rz " + f$
  193. SHELL ss$
  194. PRINT "Press any key...": WHILE INKEY$ = "": WEND
  195. END IF
  196. IF p$ = "4" THEN
  197. LOCATE CSRLIN + 1, 1: PRINT "This is what you would like to call the file. Default directory is C:\DOWNLOAD.";
  198. LOCATE CSRLIN - 1, 1
  199. INPUT "What is the file name"; f$
  200. SCREEN 0, , 0, 0
  201. ss$ = "pcz 2 " + baud$ + " d k r1 " + f$
  202. SHELL ss$
  203. PRINT "Press any key...": WHILE INKEY$ = "": WEND
  204. END IF
  205. IF p$ = "5" THEN
  206. ss$ = "pcz 2 " + baud$ + " d k rs"
  207. SHELL ss$
  208. PRINT "Press any key...": WHILE INKEY$ = "": WEND
  209. CLS
  210. END IF
  211. CLS
  212. GOTO 220
  213. END IF
  214. IF c$ = "3" THEN
  215. CLOSE
  216. SYSTEM
  217. END IF
  218. IF c$ = "4" THEN CLS : GOTO 220
  219.  
  220. SUB center (l, text$)
  221. LOCATE l, 40 - INT(LEN(text$) / 2)
  222. PRINT text$;
  223. END SUB
  224.  
  225.