home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Simtel MSDOS 1992 December
/
simtel1292_SIMTEL_1292_Walnut_Creek.iso
/
msdos
/
packet
/
mailbox6.arc
/
MAILBOX6.BAS
< prev
next >
Wrap
BASIC Source File
|
1988-08-17
|
27KB
|
1,137 lines
DECLARE SUB GETLINE (A$)
DECLARE SUB XGETLINE (A$)
REM ********* WRITTEN FOR: MICROSOFT QUICK BASIC
REM MAIL6.0 (first version April 1987)
CLS
KEY OFF
LOCATE , , 1, 7
DEFINT P-Z
DEFDBL F
DEFDBL T
ON ERROR GOTO NODATFILE
OPEN "MAIL6.DAT" FOR INPUT AS #3
ON ERROR GOTO NODAT
GOSUB GETMAILDAT
NODAT: CLOSE #3
RESUME EXITMAIL6
EXITMAIL6: ON ERROR GOTO 0
GOTO STARTHERE
NODATFILE: RESUME YOURSTUFF
YOURSTUFF: ON ERROR GOTO 0
REM Change between here and START OF PROGRAM to suit your station
REM *****************PUT YOUR CALL HERE !!!!!!!!!!!!
YOURCALL$ = "PK232"
REM *****************PUT CALL TO CHECK FOR MAIL HERE
MAILCALL$ = "WB6CGW"
REM *********PUT YOUR COMMUNICATIONS PARAMETERS HERE
COMX$ = "COM1:1200,E,7,1,CS60000,RB15360"
COMT$ = "COM1:1200,N,8,1,CS60000,RB15360"
REM *****************PUT YOUR TNC command strings here
REM RESTARTS TNC
TRESET$ = "RESTART"
REM CHAR THAT PUTS TNC INTO CMD MODE
CMDMODE$ = CHR$(&H3)
REM CHAR THAT DISCONNECTS
DISMODE$ = "D"
REM CHAR FOR CONVERSE MODE
CONVMODE$ = "CONV"
REM CHAR FOR TRANSPARENT MODE
TMODE$ = "T"
REM Marks end of binary file and forces disconnect.
REM Change to "/EX" if disconnect not wanted
ENDBINARY$ = "*** DISCONNECTED"
REM XON & XOFF CHARS
XON$ = CHR$(&H11)
XOFF$ = CHR$(&H13)
REM *****************PUT YOUR TNC INITIALIZATION STRINGS HERE
REM ENTER # OF TNC SETUP STRINGS HERE
TNCN = 5
DIM TNC$(TNCN)
REM autobaud char
TNC$(1) = "*"
TNC$(2) = "ECHO OFF"
TNC$(3) = "MY " + YOURCALL$
TNC$(4) = "AWLEN 8"
TNC$(5) = "PARITY 0"
REM ***************** PUT BBS CALLS HERE
REM ENTER # OF BBS CALL STRINGS HERE
BBSN = 2
DIM BBS$(BBSN + 1)
REM BBS$(0) RESERVED
BBS$(1) = "Los Altos BBS "
BBS$(2) = "Mail"
REM ***************** PUT NUMERICAL POSITION of first letter of
REM call in the string which appears when your TNC connects to a station
REM i.e. When my TNC connects to a station the following message appears:
REM *** CONNECTED TO XXXXX
REM the first letter of the call appears in the eighteenth position
CALLPOS = 18
REM PUT # OF MESSAGES HERE
SNMSGN = 3
DIM SNMSG$(SNMSGN)
SNMSG$(1) = "Ready to receive mail!"
SNMSG$(2) = "For ASCII END text with /EX as the last line"
SNMSG$(3) = "For binary file send /B FILENAME.EXT now!"
SOFFMSG$ = "MAIL RECEIVED AT "
REM ****************** CHANGE FUDGE FACTOR TO SUIT YOUR COMPUTER
REM adjust FF until TNC resets after of binary file
FF = 5
REM TIMER USED WITH COM BUFFER RESET
T0 = 100
REM SHORT TIMER used when putting TNC into command mode
T1 = 100 * FF
REM MEDIUM TIMER used to enter/exit quiet mode
T2 = 500 * FF
REM LONG TIMER used to enter/exit quiet mode
T3 = 5000 * FF
REM FOUR MINUITE TIMER
T4 = 6000 * FF
REM these appear in front of all commands from the tnc
FLAG$ = "***"
REM Put your function key strings here
KEY 1, "ENTER"
KEY 2, "UP TO"
KEY 3, "15 CHARACTERS"
KEY 4, "PER KEY"
KEY 5, "FIVE"
KEY 6, "SIX"
KEY 7, "SEVEN"
KEY 8, "EIGHT"
KEY 9, "NINE"
REM ******************* START OF PROGRAM
STARTHERE:
MM1$ = "Mail Mode> Waiting for Mail for "
MM2$ = " hit Alt Q to return to menu"
COMX$ = COMT$
MC$ = LEFT$(MAILCALL$, 1)
MC = LEN(MAILCALL$)
MAILNX = 100
MRFLAG = 0
CLAR$ = STRING$(80, " ")
CRLF$ = CHR$(&HD) + CHR$(&HA)
CLS
LOCATE 7, 28: PRINT "WB6CGW MAILBOX6.BAS"
GOTO MAINMENU
STARTMENU:
y = 0
CLS
GOSUB 43211
MAINMENU:
LOCATE 9, 31: PRINT YOURCALL$ + " MAILBOX"
LOCATE 12, 13: PRINT "---------------------- MENU ----------------------"
LOCATE 14, 14: PRINT "1. Initialize TNC 6. Type File to disk"
LOCATE 16, 14: PRINT "2. Wait For Mail 7. View File"
LOCATE 18, 14: PRINT "3. Terminal Mode 8. Upload File "
LOCATE 20, 14: PRINT "4. Log File on 9. Display Files"
LOCATE 22, 14: PRINT "5. Log File off 0. Exit "
PRINT : PRINT
GOSUB 43212
MAINLOOP1: PRINT " CHOICE ";
INPUT A$
IF A$ = "" GOTO MAINLOOP1
A = VAL(A$)
IF A = 0 GOTO 64000
ON A GOSUB SETUPTNC, ENTER1, ENTER2, CLOSEIT, CHKLFN, TYPEFILE, VIEWFILE, UPLOAD, DISPFILES
GOSUB DELAY2
GOTO STARTMENU
REM ********** end of main menu
ENTER1: CLS : GOSUB CHKLFN
GOSUB WAITMAIL
MFLAG = 1: TX = T4 * .9
GOTO ENTER3
ENTER2: GOSUB MENU2: GOSUB 43250
TX = 0: MFLAG = 0: GOSUB 43212
ENTER3: A$ = "": B$ = "": VV$ = ""
OPEN COMX$ FOR RANDOM AS #1
ENTER4: GOSUB COMMLOOP
IF LEFT$(B$, 4) = "cmd:" THEN PRINT : TX = 0: GOSUB BIGLOOP
REM The following timer causes a disconnect if a disk file is open and
REM no chars are received from the TNC for about four minutes.
IF MRFLAG = 1 THEN
TX = TX + 1
IF TX > T4 THEN
GOSUB CMODE
GOSUB 31400
B$ = "*** DISCONNECTED"
GOSUB BIGLOOP
GOSUB DELAY1
CLS
GOSUB DELAY1
END IF
END IF
REM Next Line blanks screen if no communications for about 4 min
TX = TX + 1: IF TX > T4 THEN TX = 0: CLS
IF VV$ <> "" THEN
A$ = VV$
VV$ = ""
GOTO CHKCON1
END IF
CHKCON: A$ = INKEY$
CHKCON1: IF A$ = "" GOTO ENTER4
IF MRFLAG = 1 GOTO CHKCON2 ELSE IF MFLAG = 1 THEN GOSUB WAITMAIL
CHKCON2: IF A$ = CHR$(&H8) THEN A$ = "": GOSUB 43210: PRINT : GOTO ENTER4
LOCATE , , 1, 7
IF LEN(A$) > 1 THEN GOTO RTCHR
IF A$ = CHR$(&HD) THEN GOTO ASTRIN1
GOTO RTCHR1
RTCHR: A$ = RIGHT$(A$, 1)
IF A$ = CHR$(24) THEN
GOSUB DLOPEN
GOSUB 43250
OPEN COMX$ FOR RANDOM AS #1
A$ = ""'download
END IF
IF A$ = CHR$(38) THEN
GOSUB CLOSEIT
GOSUB 43250
OPEN COMX$ FOR RANDOM AS #1
A$ = "" 'log on
END IF
IF A$ = CHR$(16) THEN GOTO ASTRIN3
IF A$ = CHR$(37) THEN GOSUB CHKLFN: GOSUB 43250: A$ = "" 'log off
IF A$ = CHR$(20) THEN GOSUB TYPEFILE: GOSUB 43250: A$ = "" 'type
IF A$ = CHR$(47) THEN GOSUB VIEWFILE: GOSUB 43250: A$ = "" 'view
IF A$ = CHR$(31) THEN GOSUB SETKEYS
IF A$ = CHR$(32) THEN GOSUB DODOSSHELL
IF A$ = CHR$(22) THEN
GOSUB UPLOAD
OPEN COMX$ FOR RANDOM AS #1
A$ = ""
GOSUB CVMODE 'upload
GOSUB 43205
PRINT "UPLOAD COMPLETE: ";
GOSUB LITEON
PRINT "Converse mode - hit ^C for Com mode";
GOSUB LITEOFF
GOSUB 43212
END IF
IF A$ = CHR$(33) THEN GOSUB DISPFILES: GOSUB 43250: A$ = "" 'files
IF A$ = CHR$(35) THEN GOSUB MENU2: PRINT : GOSUB 43250: A$ = ""
RTCHR1: IF A$ = "" GOTO ENTER4
IF ASC(A$) < 27 THEN
V = ASC(A$) + 64
PRINT "^";
PRINT CHR$(V)
GOSUB LITEON
GOSUB LITEOFF
GOSUB 43205
GOTO ASTRIN
END IF
GOSUB 43205
GOSUB LITEON
PRINT A$;
GOSUB LITEOFF
V = 1
CLA$ = ""
CLB$ = ""
LOCATE , , 1, 7
CONIN: GOSUB COMMLOOP2
W$ = INKEY$
CLV = LOC(1)
IF CLV <> 0 THEN GOSUB COMMLOOP2
IF W$ = "" THEN GOTO CONIN
IF W$ = CHR$(&HD) THEN
GOSUB 43205
GOTO ASTRIN
END IF
IF W$ = CHR$(&H8) THEN
V = V - 1
GOSUB 30900
IF V = 0 THEN
GOSUB 43211
GOTO CHKCON
ELSE
A$ = LEFT$(A$, V)
GOTO CONIN
END IF
END IF
GOSUB LITEON
LOCATE 25, V + 1
PRINT W$;
GOSUB LITEOFF
A$ = A$ + W$: V = V + 1
IF V > 78 THEN GOTO ASTRIN
GOTO CONIN
ASTRIN: IF A$ = "" GOTO ASTRIN3
IF A$ = "^C" THEN A$ = CHR$(&H3)
IF ASC(A$) = 3 THEN
CLOSE #1
OPEN COMX$ FOR RANDOM AS #1
PRINT #1, A$;
GOTO ASTRIN2
END IF
ASTRIN1:
IF A$ = CHR$(&HD) THEN
PRINT #1, A$;
ELSE
PRINT #1, A$
END IF
REM ********** The following line causes everything typed on the keyboard
REM to be included in the log file. This is the difference between
REM the LOG and and the DOWNLOAD file which does not include local txt.
IF LOGFLAG = 1 THEN B$ = A$ + CRLF$
REM ********** The following lines cause echo on line #25 and may be removed
REM IF LOGFLAG = 1 AND LFLAG = 0 THEN GOSUB BIGLOOP
B$ = A$ + CRLF$: GOSUB BIGLOOP
ASTRIN2: LOCATE 24, 1: TX = 0
COM(1) OFF
GOTO ENTER4
ASTRIN3: CLOSE #1
COM(1) OFF
CLS : GOSUB 43210
RETURN
REM ********** BIGLOOP
BIGLOOP:
IF MRFLAG = 1 GOTO BIG13
IF MFLAG = 1 GOTO BIG1
IF B$ = CHR$(&HD) + CHR$(&HD) + CHR$(&HA) THEN B$ = CHR$(&HA)
IF RIGHT$(B$, 1) = CHR$(&HA) THEN
VVV = LEN(B$) - 1
PRINT LEFT$(B$, VVV);
ELSE
PRINT B$;
END IF
TX = 0: GOTO EXITBIG
BIG1: IF LEFT$(B$, 3) = FLAG$ THEN GOTO BIG5
IF LEFT$(B$, 3) = "/O " THEN GOTO BIG5
FOR Z = 1 TO BBSN
P = LEN(BBS$(Z))
IF LEFT$(B$, P) = BBS$(Z) THEN GOTO BIG2
NEXT Z
GOTO EXITBIG
BIG2: Q = LEN(B$)
FOR ZZ = 1 TO Q
IF MID$(B$, ZZ, 1) <> MC$ GOTO BIG3
IF MID$(B$, ZZ, MC) = MAILCALL$ GOTO BIG4
BIG3: NEXT ZZ
GOTO EXITBIG
BIG4: PRINT : PRINT "!!!!! Mail is waiting on "; BBS$(Z)
PRINT B$
GOSUB SAVELOG
GOTO EXITBIG
BIG5: IF LEFT$(B$, 13) = "*** CONNECTED" THEN PRINT B$: GOTO BIG7
IF LEFT$(B$, 3) <> "/O " THEN GOTO BIG6
FOR V = 1 TO CALLPOS - 4: B$ = "X" + B$: NEXT: GOTO BIG7
BIG6: GOTO EXITBIG
BIG7: BBS$(0) = MID$(B$, CALLPOS, 10)
VV = LEN(BBS$(0))
FOR V = 1 TO VV
IF MID$(BBS$(0), V, 1) < "0" THEN MID$(BBS$(0), V, 1) = "_"
NEXT
FOR V = 1 TO VV
IF MID$(BBS$(0), V, 1) > "z" THEN MID$(BBS$(0), V, 1) = "_"
NEXT
IF LFLAG = 1 THEN GOTO BIG9
BIG8: GOSUB DELAY1
PRINT #1, CRLF$
FOR V = 1 TO SNMSGN
PRINT #1, SNMSG$(V)
PRINT #1, CRLF$
NEXT
BIG9: MRFLAG = 1
BIG10: MAILNX$ = STR$(MAILNX): MAILNX$ = RIGHT$(MAILNX$, 3)
MAILNX = MAILNX + 1
ON ERROR GOTO BIGERR1
IF LEN(BBS$(0)) = 0 THEN BBS$(0) = "NOHAMCALL"
IF LEN(BBS$(0)) > 2 GOTO BIG11
IF MID$(BBS$(0), 2, 1) = ":" THEN BBS$(0) = BBS$(0) + "NONAME"
BIG11: BBS$(0) = UCASE$(BBS$(0))
BBS$(0) = LTRIM$(BBS$(0))
BBS$(0) = RTRIM$(BBS$(0))
IF RIGHT$(BBS$(0), 2) = CRLF$ THEN
V = LEN(BBS$(0))
V = V - 2
BBS$(0) = LEFT$(BBS$(0), V)
END IF
IF MID$(BBS$(0), 2, 1) = ":" THEN
BBS$(0) = LEFT$(BBS$(0), 10)
ELSE
BBS$(0) = LEFT$(BBS$(0), 8)
END IF
NAME BBS$(0) + "." + MAILNX$ AS BBS$(0) + "." + MAILNX$
BIG12: OPEN "O", #2, BBS$(0) + "." + MAILNX$
TX = 0
ON ERROR GOTO 0
GOTO EXITBIG
BIG13: IF BFLAG = 1 THEN PRINT "d"; : GOTO BIG14
TX = 0
IF RIGHT$(B$, 1) = CHR$(&HA) THEN
VVV = LEN(B$) - 1
PRINT LEFT$(B$, VVV);
ELSE
PRINT B$;
END IF
BIG14:
IF LEFT$(B$, 4) = "cmd:" GOTO EXITBIG
B$ = UCASE$(B$)
IF LEFT$(B$, 5) = "?WHAT" GOTO BIG17
IF LEFT$(B$, 16) = "*** DISCONNECTED" GOTO BIG16
IF LEFT$(B$, 3) = "/EX" GOTO BIG17
IF LEFT$(B$, 2) = "/B" GOTO BIG15
PRINT #2, B$;
GOTO EXITBIG
BIG15: PRINT #2, B$, DATE$, TIME$: CLOSE #2
BN$ = UCASE$(MID$(B$, 4, 16))
BN$ = LTRIM$(BN$)
BN$ = RTRIM$(BN$)
IF RIGHT$(BN$, 2) = CRLF$ THEN
V = LEN(BN$)
V = V - 2
BN$ = LEFT$(BN$, V)
END IF
ON ERROR GOTO BIGERR2
NAME BN$ AS BN$
OPEN "O", #2, BN$
ON ERROR GOTO 0
PRINT #1, CRLF$
PRINT #1, BN$ + " Open - ready to receive BINARY FILE" + CRLF$
GOSUB 43200
GOSUB LITEON
PRINT BN$ + " open";
GOSUB LITEOFF
PRINT
BFLAG = 1
GOSUB CMODE: PRINT #1, TMODE$ 'FORCE TRANSPARENT MODE
GOTO EXITBIG
BIG16: IF UPFLAG = 1 THEN
GOSUB 43200
GOSUB LITEON
PRINT "Disconnected " + UN$ + " CLOSED";
GOSUB LITEOFF
PRINT
UPFLAG = 0
GOTO BIG18
END IF
BIG17: IF LFN$ <> "" THEN
GOSUB 43200
GOSUB LITEON
PRINT "FILE: " + LEFT$(LFN$, 10) + ".XXX open";
GOSUB LITEOFF
PRINT
GOTO EXITBIG
END IF
BIG18: CLOSE #2: MRFLAG = 0: TX = 0: ON ERROR GOTO 0
IF BFLAG = 1 THEN
GOSUB FCMODE
PRINT #1, CRLF$
PRINT #1, BN$ + " Received" + CRLF$
PRINT #1, "Please disconnect"
GOSUB 43200
GOSUB LITEON
PRINT BN$ + " CLOSED";
GOSUB LITEOFF
PRINT
BFLAG = 0
GOTO EXITBIG
END IF
PRINT #1, CRLF$
PRINT #1, SOFFMSG$ + YOURCALL$;
PRINT #1, " FROM ";
PRINT #1, BBS$(0) + "." + RIGHT$(MAILNX$, 3)
PRINT #1, CRLF$
PRINT #1, "Please disconnect"
GOSUB 43200
PRINT "MAIL RECEIVED FROM " + BBS$(0) + "." + RIGHT$(MAILNX$, 3)
EXITBIG: B$ = "": RETURN
REM ********** BIGLOOP ERR ROUTINES
BIGERR1:
IF ERR = 58 THEN RESUME BIG10
RESUME BIG12
BIGERR2: IF ERR = 53 THEN RESUME NEXT
IF ERR = 58 THEN
PRINT #1, CHR$(&HD) + CHR$(&HA) + "File name exists! Use new name"
RESUME BIG8
END IF
PRINT #1, CRLF$
PRINT #1, "ERROR #", ERR, " BINARY TRANSFER ABORTED"
PRINT #1, CRLF$
BFLAG = 0
CLOSE #2: GOSUB FCMODE: RESUME BIG8
REM ********** ONE LINE SUBROUTINES
NUMBERS:
30900 LET CX = CSRLIN
LET CY = POS(0)
IF CY = 1 THEN
RETURN
ELSE
LOCATE CX, CY - 1
PRINT " ";
END IF
31000 PRINT CHR$(29); : RETURN
31400 PRINT #1, DISMODE$: FOR V = 1 TO T1: NEXT: RETURN
43200 PRINT : LOCATE 25, 1: PRINT CLAR$: LOCATE 25, 1: RETURN
43205 LOCATE 25, 1: PRINT CLAR$: LOCATE 25, 1: RETURN
43210 PRINT : LOCATE 24, 1: PRINT CLAR$: LOCATE 24, 1: RETURN
43211 LOCATE 25, 1: PRINT CLAR$: RETURN
43212 LOCATE 24, 1: PRINT CLAR$; : LOCATE 24, 1: RETURN
43250 GOSUB LITEON: PRINT "Com Mode>"; : GOSUB LITEOFF: PRINT : RETURN
44000 FOR VVV1 = 1 TO VVV: PRINT " "; : NEXT: RETURN
64000 GOSUB 43200: LOCATE 24, 1: ON ERROR GOTO 0: CLOSE : END
REM ********** SUBROUTINES START HERE **************************************
REM ********** Converse mode
CVMODE: PRINT #1, CONVMODE$: FOR V = 1 TO T1: NEXT: RETURN
REM ********** CMODE - send one ^C to enter command mode
CMODE: PRINT #1, CMDMODE$: RETURN
REM ********** DELAY
DELAY1: FOR V = 1 TO T3: NEXT: RETURN
DELAY2: FOR V = 1 TO T2: NEXT: RETURN
REM ********** Down load open
DLOPEN:
CLOSE #1: OPEN COMX$ FOR RANDOM AS #1: GOSUB CHKLFN: MFLAG = 1
GOSUB 43200
GOSUB LITEON
PRINT "Enter file name OR Q to quit and retrun to com mode:";
GOSUB LITEOFF
INPUT " "; LFN$
IF LFN$ = "q" THEN LFN$ = "Q"
IF LFN$ = "Q" THEN LFN$ = "": GOSUB CHKLFN: GOSUB 43200: PRINT : GOTO EXITDLO
IF LFN$ = "" THEN LFN$ = "DOWNLOAD"
B$ = "/O " + LFN$: LFLAG = 1
GOSUB BIGLOOP
GOSUB 43200
PRINT "Download file " + BBS$(0) + "." + MAILNX$ + " open"
EXITDLO: CLOSE #1: RETURN
REM ********** DOS SHELL
DODOSSHELL: CLS
LOCATE 16, 13
GOSUB LITEON
PRINT "Type exit to return from DOS"
GOSUB LITEOFF
SHELL
CLS
GOSUB 43212
IF MFLAG = 1 THEN
GOSUB 43200: PRINT MM1$ + MAILCALL$ + MM2$
ELSE
GOSUB 43250
END IF
A$ = ""
RETURN
REM ********** Force command mode
FCMODE:
FOR V = 1 TO T4: NEXT
FOR V = 1 TO T4: NEXT
FOR VV = 1 TO 3: PRINT #1, CMDMODE$;
FOR V = 1 TO T1: NEXT V:
NEXT VV
FOR V = 1 TO T4: NEXT
RETURN
LITEON: COLOR 0, 7: RETURN
LITEOFF: COLOR 7, 0: RETURN
REM ********** SETUPTNC
SETUPTNC:
CLS : LOCATE 1, 25: PRINT "ATTEMPTING TO INITIALIZE TNC"
OPEN COMX$ FOR RANDOM AS #1
X = 1: y = 1
SETTNC1: PRINT #1, TNC$(X);
FOR V = 1 TO T2: NEXT
y = y + 1: IF y < 4 GOTO SETTNC1
X = X + 1
FOR V = 1 TO T2: NEXT
SETTNC2: PRINT #1, TNC$(X)
X = X + 1
IF X > TNCN GOTO SETTNC3
FOR V = 1 TO T2: NEXT
GOTO SETTNC2
SETTNC3: PRINT #1, TRESET$
COMX$ = COMT$
CLOSE
CLS : RETURN
CHKLFN:
IF LFN$ = "" GOTO CHKLFN1
GOSUB 43210
PRINT CLAR$
LOCATE 24, 28
GOSUB LITEON
PRINT LEFT$(LFN$, 10) + "." + MAILNX$ + " closed";
GOSUB LITEOFF
GOSUB 43200
PRINT
CHKLFN1: CLOSE #2
LFN$ = "": A$ = "": LFLAG = 0: LOGFLAG = 0
MFLAG = 0: MRFLAG = 0: TX = 0
RETURN
REM ********** WAITMAIL
WAITMAIL:
GOSUB 43200: PRINT MM1$ + MAILCALL$ + MM2$
PRINT : PRINT "Monitoring:": PRINT
FOR YY = 1 TO BBSN
PRINT BBS$(YY): NEXT YY
PRINT : RETURN
REM ********** CLOSEIT
CLOSEIT:
CLOSE #1
OPEN COMX$ FOR RANDOM AS #1
GOSUB CHKLFN
MFLAG = 1: LFLAG = 1: LOGFLAG = 1
GOSUB 43200
INPUT "Enter log File Name OR Q to return to com mode: "; LFN$
IF LFN$ = "q" THEN LFN$ = "Q"
IF LFN$ = "Q" THEN
LFN$ = ""
GOSUB CHKLFN
GOSUB 43210
PRINT
GOTO CLOSEIT1
END IF
IF LFN$ = "" THEN LFN$ = "PACKETLG"
B$ = "/O " + LFN$
GOSUB BIGLOOP
GOSUB 43200: PRINT LEFT$(LFN$, 10) + "." + MAILNX$ + " open"
CLOSEIT1: CLOSE #1: LFLAG = 0: MFLAG = 0
RETURN
REM ********** TYPEFILE
TYPEFILE:
GOSUB CHKLFN
PRINT : PRINT
GOSUB 43210
PRINT "ENTER name of file to TYPE to disk"
GOSUB 43200
PRINT
INPUT V$
IF V$ = "" GOTO TFILE1
ON ERROR GOTO TFILE2
NAME V$ AS V$
OPEN "O", #2, V$
PRINT : PRINT V$ + " OPEN, end with /EX on a line by itself": PRINT
TFILE5: V = 1: A$ = ""
TFILE3: W$ = INKEY$
IF W$ = "" THEN GOTO TFILE3
IF W$ = CHR$(&HD) THEN PRINT : GOTO TFILE4
IF W$ = CHR$(&H8) AND V = 1 THEN GOTO TFILE5
IF W$ = CHR$(&H8) THEN
V = V - 1
GOSUB 30900
IF V = 0 THEN
GOTO TFILE5
ELSE
A$ = LEFT$(A$, V - 1)
GOTO TFILE3
END IF
END IF
PRINT W$;
A$ = A$ + W$: V = V + 1
GOTO TFILE3
TFILE4: PRINT #2, A$
IF LEFT$(A$, 3) = "/EX" GOTO TFILE1
IF LEFT$(A$, 3) = "/ex" GOTO TFILE1
GOTO TFILE5
TFILE2: IF ERR = 5 THEN RESUME TFILE5
IF ERR = 53 THEN RESUME NEXT
IF ERR = 58 THEN
PRINT
LOCATE 24, 30
GOSUB LITEON
PRINT V$ + " Exists, enter NEW Name";
GOSUB LITEOFF
PRINT
RESUME TYPEFILE
END IF
PRINT : LOCATE 24, 30: PRINT ERR, ERL
A$ = "": RESUME TYPEFILE
TFILE1: CLOSE #2: ON ERROR GOTO 0: GOSUB 43210: RETURN
REM ********** VIEWFILE
VIEWFILE:
GOSUB CHKLFN
GOSUB 43210
PRINT : PRINT "ENTER name of file to VIEW"
GOSUB 43200: PRINT
INPUT V$
IF V$ = "" GOTO VF1
ON ERROR GOTO VF2
OPEN "I", #2, V$
PRINT : PRINT
VF5: IF EOF(2) THEN GOSUB VFLOOP1: GOTO VF1
VV$ = INKEY$: IF VV$ = "" THEN GOTO VF3
IF VV$ = CHR$(&H13) GOTO VF4
GOSUB VFLOOP2: IF VV$ = "Y" GOTO VF1 ELSE GOTO VF3
VF4: VV$ = INKEY$
IF VV$ = "" GOTO VF4
VF3: C$ = INPUT$(1, #2)
IF C$ = CHR$(&HA) THEN GOSUB VFLOOP1
D$ = D$ + C$
IF LEN(C$) > 127 THEN GOSUB VFLOOP1
GOTO VF5
VF2: IF ERR = 53 THEN
PRINT
LOCATE 24, 30
GOSUB LITEON
PRINT "File Not On Disk";
GOSUB LITEOFF
PRINT
RESUME VIEWFILE
END IF
PRINT : LOCATE 24, 30: PRINT ERR, ERL
RESUME VIEWFILE
VF1: CLOSE #2: ON ERROR GOTO 0: IF VV$ = "Y" GOTO VFOUT
IF V$ = "" GOTO VFOUT
GOSUB 43200: PRINT "HIT any KEY to continue"
VFLP: V$ = INKEY$
IF V$ = "" GOTO VFLP
VFOUT: VV$ = "": GOSUB 43210: GOTO EXITVF
EXITVF: RETURN
VFLOOP1: PRINT D$; : C$ = "": D$ = "": RETURN
VFLOOP2: INPUT "interrupted - END ? (y/n) "; VV$
IF VV$ = "y" THEN VV$ = "Y"
RETURN
REM ********** DISPFILES
DISPFILES:
GOSUB 43205: PRINT "Enter Drive: "; : INPUT VVV$
ON ERROR GOTO DISP1
VVV$ = LEFT$(VVV$, 1)
IF VVV$ = "" GOTO DISP2 ELSE VVV$ = VVV$ + ":"
DISP2: FILES VVV$: GOSUB 43200: PRINT "HIT ANY KEY TO CONTINUE"
DISP3: V$ = INKEY$
IF V$ = "" THEN
GOTO DISP3
ELSE
A$ = ""
GOSUB 43210
ON ERROR GOTO 0
PRINT : PRINT
EXITDISP: RETURN
END IF
DISP1: IF ERR = 53 THEN
GOSUB LITEON
PRINT "No files on disk";
GOSUB LITEOFF
END IF
IF ERR = 71 THEN
GOSUB LITEON
PRINT "Drive Not Ready";
GOSUB LITEOFF
END IF
V$ = "x": RESUME DISP3
REM **********UPLOAD
UPLOAD:
CLOSE #1: CLOSE #3: C$ = "": D$ = ""
IF BFLAG = 1 THEN
PRINT : LOCATE 24, 30: PRINT "WAIT to reset TNC"
GOSUB 43205
OPEN COMX$ FOR RANDOM AS #1
GOSUB FCMODE
BFLAG = 0
CLOSE
END IF
PRINT : GOSUB 43200
PRINT "Enter B for binary upload OR hit any other key to continue"
V$ = INPUT$(1)
IF V$ = "b" THEN V$ = "B"
IF V$ <> "B" GOTO UPLD0
LOCATE 24, 30
GOSUB LITEON
PRINT "Ready for BINARY UPLOAD";
GOSUB LITEOFF
BFLAG = 1
UPLD0: GOSUB 43200
INPUT "ENTER name of file to UPLOAD: "; UN$
IF UN$ = "" THEN BFLAG = 0: GOTO UPLD5
IF BFLAG = 1 THEN GOSUB 43200: PRINT "Setting TNC to Transparent mode"
UPFLAG = 1
ON COM(1) GOSUB COMMLOOP
OPEN COMX$ FOR RANDOM AS #1
COM(1) ON
GOSUB CMODE
PRINT #1, XOFF$
IF BFLAG = 1 THEN
GOSUB CMODE
PRINT #1, TMODE$ 'force transparent mode
END IF
GOSUB 43200: PRINT "Upload in progress"
ON ERROR GOTO UPLD8
OPEN "I", #3, UN$
FL = LOF(3): FM = 1
ON ERROR GOTO UPLD7 'without this,EOF mark, (1Ah) will stop transfer
IF BFLAG <> 1 THEN GOSUB CMODE: GOSUB CVMODE 'force converse mode
UPLD1: IF UPFLAG = 0 GOTO UPLD4
IF FM >= FL THEN GOSUB UPLD2: GOTO UPLD4 'CHECK END OF FILE
VV$ = INKEY$
IF VV$ <> "" THEN GOSUB UPLD6
IF VV$ = "Y" GOTO UPLD4
C$ = INPUT$(1, #3): D$ = D$ + C$: FM = FM + 1
IF C$ = CHR$(&HA) THEN GOSUB UPLD2
IF LEN(D$) > 127 THEN GOSUB UPLD2
GOTO UPLD1
UPLD2: IF BFLAG = 1 THEN PRINT "u"; : GOTO UPLD3
IF RIGHT$(D$, 1) = CHR$(&HA) THEN
VVV = LEN(D$) - 1
PRINT LEFT$(D$, VVV);
ELSE
PRINT D$;
END IF
UPLD3:
PRINT #1, D$;
D$ = ""
RETURN
UPLD4: IF BFLAG = 1 THEN
GOSUB 43200
FM$ = STR$(FM)
PRINT UN$ + " SENT, " + FM$ + " bytes ";
GOSUB LITEON
PRINT "Wait to reset TNC";
GOSUB LITEOFF
PRINT #1, ENDBINARY$
GOSUB FCMODE
END IF
BFLAG = 0
GOSUB CMODE
PRINT #1, XON$
CLOSE #1: CLOSE #3: COM(1) OFF
UPLD5: ON ERROR GOTO 0
UPFLAG = 0
GOSUB 43211
GOSUB 43210: PRINT
EXITUPLD:
VV$ = ""
RETURN
UPLD6: INPUT "UPLOAD interrupted - END Upload ? (y/n) "; VV$
IF VV$ = "y" THEN VV$ = "Y"
RETURN
UPLD7: RESUME NEXT
UPLD8: IF ERR = 53 THEN
PRINT
LOCATE 24, 30
GOSUB LITEON
PRINT "FILE NOT ON DISK";
GOSUB LITEOFF
RESUME UPLOAD
END IF
IF ERR = 62 THEN
PRINT
LOCATE 24, 30
GOSUB LITEON
PRINT "NO DATA IN FILE";
GOSUB LITEOFF
RESUME UPLOAD
END IF
PRINT : LOCATE 24, 30: PRINT ERL, ERR: RESUME UPLOAD
REM ********** COMMLOOP
COMMLOOP:
V = LOC(1)
COML1: IF V = 0 THEN RETURN
VV$ = INKEY$: IF VV$ <> "" THEN GOSUB BIGLOOP: V = 0: GOTO COML1
A$ = INPUT$(1, #1)
B$ = B$ + A$
IF A$ = CHR$(&HA) THEN
GOSUB BIGLOOP
END IF
IF LEN(B$) > 127 THEN GOSUB BIGLOOP
GOTO COMMLOOP
REM **********COMMLOOP2
COMMLOOP2:
IF NOT EOF(1) THEN
CLA$ = INPUT$(1, #1)
CLB$ = CLB$ + CLA$
IF CLA$ = CHR$(&HA) THEN
GOSUB CL2CONPNT
ELSEIF LEN(B$) > 127 THEN
GOSUB CL2CONPNT
END IF
END IF
EXITCL2: RETURN
CL2CONPNT:
LOCATE 24, 1
IF RIGHT$(CLB$, 1) = CHR$(&HA) THEN
VVV = LEN(CLB$) - 1
PRINT LEFT$(CLB$, VVV);
ELSE
PRINT CLB$;
END IF
CLA$ = ""
CLB$ = ""
LOCATE 25, V + 1
RETURN
REM ********** MENU2
MENU2:
CLS : LOCATE 7, 10
PRINT "Help Menu for control commands while in Communications mode"
LOCATE 10, 13: PRINT "HIT THE ALT KEY ALONG WITH THE FOLLOWING KEY:"
LOCATE 12, 13: PRINT "Q Return to MAIN MENU O Open download file"
LOCATE 14, 13: PRINT "L Log file on K Log or download file off":
LOCATE 16, 13: PRINT "T Type to disk V View file": PRINT
LOCATE 18, 13: PRINT "U Upload file F Display files on disk"
LOCATE 20, 13: PRINT "S Set function keys D DOS SHELL "
LOCATE 24, 13: PRINT "Communications mode, Hit ALT H for help menu"
RETURN
REM ********** SAVELOG
SAVELOG:
VV = LEN(BBS$(Z))
FOR V = 1 TO VV
IF MID$(BBS$(Z), V, 1) < "0" THEN MID$(BBS$(Z), V, 1) = "_"
NEXT
FOR V = 1 TO VV
IF MID$(BBS$(Z), V, 1) > "z" THEN MID$(BBS$(Z), V, 1) = "_"
NEXT
OPEN "O", #2, BBS$(Z)
PRINT #2, B$, DATE$, TIME$
CLOSE #2
BBS$(Z) = BBS$(Z) + " has mail"
PRINT
ON ERROR GOTO 0: RETURN
REM ********** SET FUNCTION KEYS
SETKEYS:
CLS
LOCATE 7, 20: PRINT " ---------- FUNCTION KEY MENU ---------- "
LOCATE 10, 26: PRINT "1. View Function keys"
LOCATE 12, 26: PRINT "2. Change keys"
LOCATE 14, 26: PRINT "3. RETURN to return to com mode"
PRINT
SETKEYSLP:
PRINT " CHOICE:";
INPUT A$
SELECT CASE A$
CASE IS = ""
GOTO SETKEYSLP
CASE IS = "1"
GOSUB SETK1
CASE IS = "2"
GOSUB SETK2
CASE IS = "3"
GOTO EXITSETK
CASE ELSE
GOTO SETKEYSLP
END SELECT
GOTO SETKEYS
EXITSETK: A$ = ""
GOSUB 43212
GOSUB 43250
RETURN
SETK1: CLS
GOSUB 43212
KEY LIST
GOSUB 43200: PRINT "HIT any KEY to continue"
SKLP: V$ = INKEY$
IF V$ = "" GOTO SKLP
RETURN
SETK2: CLS
SETK22: LOCATE 15, 1
PRINT "To exit NO change hit return"
PRINT
INPUT "ENTER: Function key # "; A
IF A = 0 THEN A = 255: GOTO EXITSETK2
INPUT "ENTER: Function key string: "; A$
IF A$ = "" THEN GOTO EXITSETK2
KEY A, A$
EXITSETK2: RETURN
REM ********** GET DATA FROM MAIL6.DAT ON DISK
GETMAILDAT:
LOCATE 15, 25
PRINT "Reading data file MAIL6.DAT"
WHILE NOT EOF(3)
CALL GETLINE(YOURCALL$)
CALL GETLINE(MAILCALL$)
CALL GETLINE(COMX$)
CALL GETLINE(COMT$)
CALL GETLINE(TRESET$)
CALL GETLINE(V$)
V = VAL(V$)
CMDMODE$ = CHR$(V)
CALL GETLINE(DISMODE$)
CALL GETLINE(CONVMODE$)
CALL GETLINE(TMODE$)
CALL GETLINE(ENDBINARY$)
CALL GETLINE(V$)
V = VAL(V$)
XON$ = CHR$(V)
CALL GETLINE(V$)
V = VAL(V$)
XOFF$ = CHR$(V)
CALL GETLINE(V$)
TNCN = VAL(V$)
DIM TNC$(TNCN)
FOR V = 1 TO TNCN
CALL GETLINE(TNC$(V))
NEXT
CALL GETLINE(V$)
BBSN = VAL(V$)
DIM BBS$(BBSN)
FOR V = 1 TO BBSN
CALL GETLINE(BBS$(V))
NEXT
CALL GETLINE(V$)
CALLPOS = VAL(V$)
CALL GETLINE(V$)
SNMSGN = VAL(V$)
DIM SNMSG$(SNMSGN)
FOR V = 1 TO SNMSGN
CALL GETLINE(SNMSG$(V))
NEXT
CALL GETLINE(SOFFMSG$)
CALL GETLINE(V$)
FF = VAL(V$)
CALL GETLINE(V$)
T0 = VAL(V$)
CALL GETLINE(V$)
T1 = VAL(V$) * FF
CALL GETLINE(V$)
T2 = VAL(V$) * FF
CALL GETLINE(V$)
T3 = VAL(V$) * FF
CALL GETLINE(V$)
T4 = VAL(V$) * FF
CALL GETLINE(FLAG$)
CALL GETLINE(V$)
KEY 1, V$
CALL GETLINE(V$)
KEY 2, V$
CALL GETLINE(V$)
KEY 3, V$
CALL GETLINE(V$)
KEY 4, V$
CALL GETLINE(V$)
KEY 5, V$
CALL GETLINE(V$)
KEY 6, V$
CALL GETLINE(V$)
KEY 7, V$
CALL GETLINE(V$)
KEY 8, V$
CALL GETLINE(V$)
KEY 9, V$
CALL GETLINE(V$)
KEY 10, V$
V = 0
LONGLOOP: CALL GETLINE(V$) 'LOOP UNTIL ALL LINES IN FILE ARE READ
V = V + 1
IF V < 1000 GOTO LONGLOOP
WEND
RETURN
SUB GETLINE (A$) STATIC
XGETLINE1: LINE INPUT #3, A$
IF LEFT$(A$, 3) = "REM" THEN GOTO XGETLINE1
END SUB