405 CLOSE#2:OPEN KFIL$ AS #2:FIELD #2,126 AS K$,2 AS L$
410 GET#2,1:IF LEFT$(K$,LEN(IFIL$))<>IFIL$ THEN GOSUB 7425
415 FOR I=1 TO 40:GET#2,I+1:LN=CVI(L$):IF LN=0 THEN 420 ELSE K$(I)=LEFT$(K$,LN)
420 NEXT:CLOSE#2
425 CLOSE#1:OPEN COMM$ AS #1:PRINT#1,MODMINIT$;
428 GOSUB 11000
430 ROW=1:COL=1:GOSUB 2820:LOCATE 1,1,1:PRINT GO$
435 '
500 ' Main Input/Output
505 '
510 '-keyboard
515 IF TR THEN IF TR$="X" THEN 4860 ELSE 4060
520 B$=INKEY$:IF B$="" THEN 560
525 IF LEN(B$)>1 THEN 1500
530 IF B$=BS$ THEN CCNT=CCNT-1:IF ECH THEN GOSUB 2655:IF PR THEN PR$=PR$+B$:GOSUB 800:GOTO 555 ELSE 555 ELSE 555
535 IF MARG<=0 THEN 550
540 IF INSTR(B$,CR$)<>0 THEN CCNT=0:GOTO 550
545 CCNT=CCNT+LEN(B$):IF CCNT>=MARG AND CCNT<MARG+10 THEN BEEP
550 IF ECH THEN PRINT B$;:IF PR THEN PR$=PR$+B$:GOSUB 800
553 IF RTTY THEN GOSUB 7800
555 PRINT#1, B$;
560 IF EOF(1) THEN 515 ELSE 605
600 '-comm port
605 IF LOF(1)<128 THEN PSE=-1:PRINT#1,XF$;
610 IF EOF(1) THEN 710
615 A$=INPUT$(LOC(1),#1):IF NS=0 THEN 635
620 FOR I=1 TO NS
625 P=INSTR(A$,S$(I)):IF P=0 THEN 630 ELSE A$=LEFT$(A$,P-1)+R$(I)+RIGHT$(A$,LEN(A$)-P):GOTO 625
630 NEXT
635 IF RTTY THEN GOSUB 7600
636 IF RC THEN PRINT #2,A$;
640 P=INSTR(A$,LF$):IF P=0 THEN 645 ELSE A$=LEFT$(A$,P-1)+RIGHT$(A$,LEN(A$)-P):GOTO 640
645 P=INSTR(A$,BS$):IF P=0 THEN 655 ELSE FOR I=1 TO LEN(A$):IF MID$(A$,I,1)<>BS$ THEN PRINT MID$(A$,I,1);:GOTO 650 ELSE GOSUB 2650
650 NEXT:GOTO 660
655 FOR I=1 TO LEN(A$):PRINT MID$(A$,I,1);:NEXT
660 IF PR THEN PR$=PR$+A$:GOSUB 800
700 '-check status
705 IF SET THEN 715
710 B$=INKEY$:IF B$<>"" THEN 525
715 IF LOC(1)>0 THEN 605
720 IF PSE THEN PSE=0:PRINT#1,XN$;
725 IF SET THEN ROW=CSRLIN:COL=POS(0):GOTO 1000
730 GOTO 515
800 '-printer buffer
805 P=INSTR(PR$,BS$):IF P=0 THEN 810 ELSE IF LEN(PR$)>1 THEN PR$=LEFT$(PR$,P-2)+RIGHT$(PR$,LEN(PR$)-P):GOTO 805
810 P=INSTR(PR$,CR$):IF P=0 THEN 815 ELSE PRINT#3,LEFT$(PR$,P);:PR$=RIGHT$(PR$,LEN(PR$)-P):GOTO 810
815 IF LEN(PR$)>220 THEN PRINT#3,PR$;:PR$="":RETURN
820 RETURN
825 '
1000 ' Alt-Key Input
1005 '
1010 IF ALTSET THEN LOCATE 25,17 ELSE LOCATE 25,15+LEN(ALT$)
1015 C$=INKEY$:IF C$="" THEN IF EOF(1) THEN 1015 ELSE SET=-1:LOCATE ROW,COL:GOTO 605
1020 IF NOT ALTSET THEN 1035
1025 LOCATE 25,19:IF ASC(C$)>=49 AND ASC(C$)<=57 THEN ALTKY=ASC(C$)-48ELSE IF ASC(C$)=48 THEN ALTKY=10 ELSE BEEP:GOTO 1010
1030 IF ALTSET THEN ALTSET=0:SET=-1:LOCATE 25,1:PRINT STRING$(5,16);" Alt-";ALTKY;CHR$(198);" ";CHR$(181);:GOTO 1010
1035 IF LEN(ALT$)>=51 THEN ALT$=LEFT$(ALT$,49):LOCATE 25,64:PRINT" ";CHR$(181);:LOCATE 25,66:BEEP:PRINT"(max 50 chrs.)";:GOTO 1010
1040 IF C$=BS$ THEN IF ALT$="" GOTO 1010 ELSE GOSUB 2650:ALT$=LEFT$(ALT$,LEN(ALT$)-1):GOTO 1010
1045 IF C$=CHR$(13) THEN 1070
1050 IF C$>CHR$(31) THEN PRINT C$; ELSE COLOR HI,BG:PRINT CHR$(ASC(C$)+64);:COLOR FG,BG
1055 PRINT" ";CHR$(181);
1060 IF C$=XCR$ THEN C$=CHR$(13)
1065 ALT$=ALT$+C$:GOTO 1010
1070 IF ALT$<>"" THEN IF ALT$=" " THEN ALT$(ALTKY)="" ELSE ALT$(ALTKY)=ALT$
1075 ALT$="":SET=0:GOTO 1200
1080 '
1200 ' Alt-key Display
1205 '
1210 P=1:FOR I=1 TO 10:LOCATE 25,P:IF I=10 THEN PRINT"0";:COLOR BG,FG:GOTO 1220
1215 PRINT USING "#";I;:COLOR BG,FG
1220 FOR J=1 TO 7:Z$=MID$(ALT$(I),J,1):IF POS(0)=80 THEN 1235
1225 IF J>LEN(ALT$(I)) THEN PRINT" ";:GOTO 1235
1230 IF Z$>=" "THEN PRINT Z$; ELSE IF Z$=CR$ THEN PRINT XCR$; ELSE COLOR HI,FG:PRINT CHR$(ASC(Z$)+64);:COLOR BG,FG
1235 NEXT J:COLOR FG,BG:P=P+8:NEXT I
1240 FOR I=1 TO 10:IF ALT$(I)<>"" THEN EXIT=-1
1245 NEXT:IF EXIT THEN EXIT=0:LOCATE ROW,COL:GOTO 605
1250 LOCATE ROW,COL:GOSUB 2820:GOTO 515
1255 '
1500 ' Extended Codes
1505 '
1510 EX=0:ROW=CSRLIN:COL=POS(0)
1515 IF LEN(B$)=2 THEN EX=ASC(MID$(B$,2,1)) ELSE EX=0
1520 IF EX=75 THEN B$=CHR$(29):GOTO 535 ' cursor left
1525 IF EX=77 THEN B$=CHR$(28):GOTO 535 ' cursor right
1530 IF EX=71 THEN 2000 ' home
1535 IF EX=19 OR EX=81 THEN EX=19:GOTO 3000 ' alt-r or pg-dn
1540 IF EX=47 THEN 3400 ' alt-v
1545 IF EX=20 OR EX=73 THEN EX=20:GOTO 3200 ' alt-t or pg-up
1550 IF EX=25 THEN 5000 ' alt-p
1555 IF EX=32 THEN 6000 ' alt-d
1557 IF EX=36 THEN B$=CHR$(13)+CHR$(10)+"KA9DCA (STEVE) "+DATE$+" "+TIME$+" CST"+CHR$(13)+CHR$(10):GOTO 550 ' alt-j
1560 IF EX=37 THEN 7000 ' alt-k
1565 '-F-keys/Alt-keys
1570 IF EX>=59 AND EX<=68 THEN B$=K$(EX-58):GOTO 535
1575 IF EX>=104 AND EX<=113 THEN B$=K$(EX-93):GOTO 535
1580 IF EX>=84 AND EX<=103 THEN B$=K$(EX-63):GOTO 535
1585 IF EX>=120 AND EX<=129 THEN B$=ALT$(EX-119):GOTO 535
1590 IF EX=131 THEN:BEEP:LOCATE 25,1:PRINT" set Alt-(1-0): ";CHR$(181);:ALTSET=-1:GOTO 1000
1595 '-echo/message/print
1600 IF EX=18 THEN BEEP:PRINT:IF ECH=0 THEN ECH=-1:PRINT"===ECHO ON===":GOTO 515 ELSE ECH=0:PRINT"===ECHO OFF===":GOTO 515 'alt-e
1605 IF EX=50 THEN BEEP:PRINT:IF MSG=0 THEN MSG=-1:PRINT"===MESSAGES ON===":GOTO 515 ELSE MSG=0:PRINT"===MESSAGES OFF===":GOTO 515 ' alt-m
1610 IF EX=114 OR EX=132 THEN BEEP:PRINT:IF PR=0 THEN PR=-1:PRINT"===PRINTOUT ON===":CLOSE#3:OPEN PRNTPORT$ AS #3:PRINT#3,PRNTINIT$;:GOTO 515 ELSE PR=0:CLOSE#3:PRINT"===PRINTOUT OFF===":GOSUB 2715:GOTO 515 ' ctrl-prtsc or ctrl-pgup
1625 IF EX=16 THEN IF DIAL$<>"" THEN 8000 ELSE BEEP:PRINT"(nothing to redial)":PRINT GO$:GOTO 515 ' alt-q
1630 IF EX=31 THEN 3800 ' alt-s
1635 IF EX=33 THEN 5200 ' alt-f
1640 IF EX=45 THEN BEEP:CLS:PRINT"===EXIT TO DOS===":PRINT:PRINT"WARNING! If you proceed you will terminate the program.":PRINT"Do you want to do this (y/n)?";:Q$=INPUT$(1):GOSUB 2555:IF Q$<>"Y" THEN PRINT:PRINT GO$:GOTO 515 ELSE 8915 ' alt-x
1650 IF EX=38 THEN BEEP:PRINT:PRINT"===SPECIFY LOGGED DRIVE===":PRINT"Current default for file specs: ";DRIV$:PRINT"New default: ";:QL=2:GOSUB 2500:IF Q$="" THEN PRINT:PRINT GO$:GOTO 515 ELSE DRIV$=LEFT$(Q$,1)+":":PRINT:PRINT GO$:GOTO 515 ' alt-l
1655 IF EX=21 THEN 3900 ' alt-y
1660 IF EX=46 THEN PRINT CHR$(12):GOSUB 2800:GOTO 515 ' alt-c
1665 IF EX=17 THEN BEEP:PRINT"===SPECIFY WIDTH ALARM===":PRINT"Current setting for right margin:";MARG:PRINT"New setting: ";:QL=3:GOSUB 2500:IF Q$="" THEN PRINT:PRINT GO$:GOTO 515 ELSE MARG=VAL(Q$):PRINT:PRINT GO$:GOTO 515 ' alt-w
1670 IF EX=117 THEN OLDVAL=INP(LCR):BRKVAL=OLDVAL OR 64:OUT LCR,BRKVAL:SOUND 32767,3:SOUND 32767,1:OUT LCR,OLDVAL:GOTO 515 ' ctrl-end
1674 IF EX=35 GOTO 2950 ' alt-h
1675 IF EX=15 THEN RESTORE 9999:READ Q$:PRINT Q$:GOTO 515 ' shift-tab 0─
1676 IF EX=48 GOTO 2840 ' Alt-B Baud Rate Generator
1677 IF EX=30 THEN OUT &H2FC,(INP(&H2FC) XOR &H2):GOTO 515 ' alt-a T/R Switch
1678 IF EX=22 THEN RTTY=NOT RTTY:IF RTTY THEN PRINT "RTTY ON":GOTO 515 ELSE PRINT "RTTY OFF":GOTO 515 ' alt-u
1679 IF EX=49 THEN FIGS=5-FIGS:PRINT "FIGS=";FIGS:GOTO 515 ' (49 IS ALT-N)
1680 IF EX=24 GOTO 1700 ' alt-o switch rswit between 1 and figs
1681 '
1682 '-more Extended Codes can go here (see p.G-6 IBM BASIC manual)
1683 '
1685 GOTO 515 'DON'T remove this line! (failsafe to return to terminal)
2842 PRINT "Input data rate between 10 and 10,000 - ";
2844 INPUT "",RATE$
2845 IF RATE$="?" GOTO 2860 ELSE RAT!=VAL(RATE$)
2846 IF RAT!<10 OR RAT!>10000 GOTO 2842
2848 Z$=MKI$((INT(1152000!/RAT!))/10)
2850 OUT LCR,(INP(LCR) OR &H80)
2852 OUT DLLSB,CVI(LEFT$(Z$,1)+CHR$(0))
2854 OUT DLMSB,CVI(RIGHT$(Z$,1)+CHR$(0))
2856 OUT LCR,(INP(LCR) AND &H7F)
2857 GOSUB 2800
2858 GOTO 515
2860 OUT LCR,(INP(LCR) OR &H80)
2861 R1=INP(DLLSB)
2862 R2=INP(DLMSB)
2866 OUT LCR,(INP(LCR) AND &H7F)
2868 RAT!=115200!/(R1+256*R2)
2870 PRINT "Baud rate=",RAT!:GOTO 2857
2900 LCR=&H2FB
2905 DLLSB=&H2F8
2910 DLMSB=&H2F9
2915 IF COMMPORT$="COM2:" THEN RETURN
2920 IF COMMPORT$<>"COM1:" THEN PRINT "Comm port. name is invalid":GOTO 515
2925 LCR=LCR OR &O100
2930 DLLSB=DLLSB OR &H100
2935 DLMSB=DLMSB OR &H100
2940 RETURN
2950 IF COMMPORT$="COM1:" THEN COMMPORT$="COM2:":GOTO 2960
2955 IF COMMPORT$="COM2:" THEN COMMPORT$="COM1:"
2960 PRINT "Commucication port name is ";COMMPORT$
2965 GOTO 515
3000 ' Receive File
3005 '
3010 IF RC THEN RC=0:RC$="":BEEP:PRINT:PRINT"===RECEIPT OF FILE ";RCV$;" TERMINATED===":PRINT:GOSUB 2700:GOSUB 2800:IF MSG THEN PRINT#1,BL$;CR$;"===FILE RECEIVED===":GOTO 515 ELSE 515
3015 RC$="":BEEP:PRINT:PRINT"===RECEIVE A FILE===":GOTO 3500
3020 IF RC$="X" THEN CLOSE#2:KILL RCV$:OPEN RCV$ AS #2 LEN=128:FIELD #2,128 AS X$:GOTO 3030
3025 IF MSG THEN PRINT#1,BL$;CR$;"===READY TO RECEIVE===
3030 MSG$=" Receiving "+RCVX$+" (ALT-R to Terminate)":GOSUB 2600
3035 RC=-1:IF RC$="X" THEN 4500 ELSE 605
3040 '
3200 ' Transmit File
3205 '
3210 IF TR THEN TR=0:TR$="":MSG1$="===TRANSMISSION OF FILE ":MSG2$=" TERMINATED===":BEEP:PRINT:PRINT MSG1$;TRN$;MSG2$:GOSUB 2715:GOSUB 2800:IF MSG THEN PRINT#1,CR$;MSG1$;MSG2$,BL$:GOTO 515 ELSE 515
3215 IF TR THEN TR=0:TR$="":MSG1$="===END OF FILE":MSG2$="===":BEEP:PRINT:PRINT MSG1$;" ";TRN$;MSG2$:GOSUB 2715:GOSUB 2800:IF MSG THEN PRINT#1,"65529 '";MSG1$;MSG2$;BL$:GOTO 515 ELSE 515
3220 TR$="":BEEP:PRINT:PRINT"===TRANSMIT A FILE===":GOTO 3500
3225 CLOSE#3:OPEN TRN$ AS #3 LEN=128:FIELD #3,128 AS X$
3230 MSG$=" Transmitting "+TRNX$+" (ALT-T to terminate)":IF TR$="X" THEN MSG$=MSG$+" # of blocks:" ELSE IF TR$="P" THEN MSG$=MSG$+" percent remain:" ELSE MSG$=MSG$+" min. remain:"
3235 GOSUB 2600:IF TR$="X" THEN ROW=CSRLIN:COL=POS(0):LOCATE 25,74:CNT!=FIX(LOF(3)/128):FLN!=LOF(3)/128:IF CNT!=FLN! THEN PRINT CNT!;:LOCATE ROW,COL ELSE PRINT CNT!+1;:LOCATE ROW,COL:GOTO 3245
3240 IF MSG THEN PRINT#1,CR$;"0 '===START OF FILE===";BL$
3245 TR=-1:FLN!=LOF(3):IF TR$<>"X" THEN 4000 ELSE 4700
3250 '
3400 ' View File
3405 '
3410 BEEP:PRINT:PRINT"===VIEW A FILE===":GOTO 3500
3415 MSG$=" Viewing "+VEWX$+" Press <space> to continue (Alt-V to terminate)":GOSUB 2600:PRINT:PRINT:PRINT
3420 WHILE NOT EOF(3):FOR I=1 TO 20:LINE INPUT#3,X$:J=LEN(X$):IF J<80 THEN PRINT X$ ELSE PRINT X$;:IF J>80 THEN I=I+FIX(J/80)
3421 IF PR THEN LPRINT X$
3425 NEXT
3430 Q$=INKEY$:IF Q$="" THEN 3430 ELSE IF Q$=" " THEN 3420 ELSE IF Q$=CHR$(0)+CHR$(47) THEN 3445 ELSE BEEP:GOTO 3430
3435 WEND
3440 BEEP:PRINT:PRINT"===END OF FILE ";VEW$;" ===":GOTO 3450
3445 BEEP:PRINT:PRINT"===VIEWING OF FILE ";VEW$;" TERMINATED===
3450 GOSUB 2715:GOSUB 2800:GOTO 515
3455 '
3500 ' File Specs
3505 '
3510 EXIT=0:PRINT" specification:";
3515 Q$=INKEY$:IF Q$="" THEN 3515 ELSE IF Q$=CR$ OR Q$=BS$ THEN FIL$="":PRINT:GOTO 3540
3520 IF LEN(Q$)>1 THEN Q=ASC(MID$(Q$,2,1)):IF Q>=59 AND Q<=68 THEN Q$=K$(Q-58) ELSE IF Q>=104 AND Q<=113 THEN Q$=K$(Q-93) ELSE IF Q>=84 AND Q<=103 THEN Q$=K$(Q-63) ELSE IF Q>=120 AND Q<=129 THEN Q$=ALT$(Q-119) ELSE BEEP:GOTO 3515
3525 IF Q$<>" " THEN PRINT Q$;:QL=128:GOSUB 2510:GOSUB 2555:FIL$=Q$:PRINT:LOCATE,,1:GOTO 3540
3530 IF EX=19 THEN FIL$=RCVX$ ELSE IF EX=20 THEN FIL$=TRNX$ ELSE IF EX=47 THEN FIL$=VEWX$
3575 IF Q$="X" THEN IF EX=19 THEN RC$="X" ELSE IF EX=20 THEN TR$="X
3580 IF LEFT$(Q$,1)="P" THEN TR$="P":PROMPT$=RIGHT$(Q$,LEN(Q$)-1):DEL!=VAL(PROMPT$)
3585 IF TR$="B" OR TR$="X" OR RC$="X" THEN IF DTA$<>"8" THEN BEEP:PRINT"*** You must communicate at 8 DATA BITS for binary or XMODEM ***":GOTO 5015
3590 IF TR$="X" OR RC$="X" THEN IF NS<>0 THEN BEEP:PRINT"*** Stripping disabled for XMODEM ***":NS=0
3595 IF EX=19 THEN CLOSE#2:OPEN FIL$ FOR APPEND AS #2 ELSE CLOSE#3:OPEN FIL$ FOR INPUT AS #3
3600 PRINT STRING$(18+LEN(FIL$),61):IF EX=19 THEN RCV$=FIL$:GOTO 3020
3605 IF EX=20 THEN TRN$=FIL$:GOTO 3225
3610 IF EX=47 THEN VEW$=FIL$:GOTO 3415
3615 IF EX=21 THEN 3915
3620 '-file directory subrout
3625 IF LEN(FIL$)=1 THEN FIL$=DRIV$+"*.*":GOTO 3640 ELSE FIL$=RIGHT$(FIL$,LEN(FIL$)-1):IF LEFT$(FIL$,1)=" " THEN FIL$=RIGHT$(FIL$,LEN(FIL$)-1)
3630 P=INSTR(FIL$,":"):IF P=0 THEN FIL$=DRIV$+FIL$
3635 IF LEN(FIL$)=P THEN FIL$=FIL$+"*.*
3640 PRINT:FILES FIL$:PRINT
3645 RETURN
3650 '
3800 ' Screendump
3805 '
3810 SOUND 440,2:CLOSE#2:OPEN DUMP$ FOR APPEND AS #2:MSG$=" Appending to "+DUMP$+" at "+TIME$:GOSUB 2600
3815 FOR I=1 TO 24:Y$="":FOR J=1 TO 79:X=SCREEN(I,J):Y$=Y$+CHR$(X):NEXT J:PRINT#2,Y$:NEXT I:PRINT#2,STRING$(79,45);CR$;LF$;"*** PC-TALK III SCREENDUMP - ";DATE$;" at ";TIME$;" ***";CR$;LF$;STRING$(79,61):CLOSE#2
4020 LOCATE 25,74:IF TR$<>"P" THEN PRINT USING"###.#";(FLN!-(CNT!*128))/RATE!; ELSE PRINT USING".##";(FLN!-CNT!*128)/FLN!;
4025 GET#3,CNT!:Y$=X$:LOCATE ROW,COL
4030 IF TR$="P" THEN GOSUB 4400:IF NOT ABORT THEN 4050 ELSE ABORT=0:GOTO 1500
4035 PRINT#1,Y$;:IF TR$="B" THEN 4050
4040 P=INSTR(1,Y$,LF$):IF P=0 THEN 4045 ELSE Y$=LEFT$(Y$,P-1)+RIGHT$(Y$,LEN(Y$)-P):GOTO 4040
4045 FOR I=1 TO 128:PRINT MID$(Y$,I,1);:NEXT
4050 ROW=CSRLIN:COL=POS(0):GOSUB 4070:B$=INKEY$:IF B$="" THEN 4060
4055 IF LEN(B$)>1 THEN 1500
4060 CNT!=CNT!+1:IF CNT!*128<FLN! THEN 4020 ELSE GET#3,CNT!:Y$=X$:GOTO 4200
4065 '-xon/xoff subrout
4070 IF EOF(1) THEN 4085 ELSE A$=INPUT$(LOC(1),#1)
4075 P=INSTR(1,A$,XF$):IF P<>0 THEN HLT=-1:COLOR HI,BG:PRINT"<<XOFF>>";:COLOR FG,BG
4080 IF HLT THEN P=INSTR(1,A$,XN$):IF P=0 THEN 4085 ELSE HLT=0:RETURN
4085 IF HLT THEN Q$=INKEY$:IF Q$<>"" THEN IF LEN(Q$)<>2 THEN 4070 ELSE IF ASC(RIGHT$(Q$,1))=24 THEN HLT=0:RETURN ELSE 4070 ELSE 4070
4090 RETURN
4200 '-transmit last block
4205 I=0:CNT!=(CNT!-1)*128
4210 I=I+1:CNT!=CNT!+1:IF I>255 THEN 4230 ELSE Z$=MID$(Y$,I,1)
4215 IF TR$="B" THEN IF CNT!<=FLN! THEN 4235 ELSE 4230
4220 IF Z$<>EF$ THEN 4235 ELSE 4230
4225 IF CNT!<=FLN! THEN 4235
4230 IF EOF(1) THEN 3215 ELSE DMMY$=INPUT$(LOC(1),#1):GOTO 4230
4235 IF TR$="P" THEN IF Z$=LF$ THEN 4210
4240 PRINT#1,Z$;:IF TR$="P" THEN IF Z$=CR$ THEN PRINT Z$;:GOSUB 4425:GOTO 4210
4245 IF TR$="B" OR Z$=LF$ THEN 4210
4250 PRINT Z$;:GOTO 4210
4400 '-line pacing subrout
4405 FOR I=1 TO LEN(Y$):Z$=MID$(Y$,I,1):IF Z$=LF$ THEN 4415 ELSE IF Z$<>CR$ THEN PRINT#1,Z$;:PRINT Z$;:GOTO 4415 ELSE PRINT #1," "+CR$;:PRINT CR$;:B$="":GOSUB 4420
4410 IF ABORT THEN RETURN
4415 NEXT:RETURN
4420 IF LEN(B$)>1 THEN ABORT=-1:RETURN
4425 IF (INP(LSR) AND 96)<>96 THEN 4425
4430 IF DEL!>0 THEN SOUND 32767,18*DEL!:SOUND 32767,1:RETURN
4435 Z$="":WHILE NOT EOF(1):Z$=Z$+INPUT$(LOC(1),#1):WEND:PRINT Z$;:IF Z$="" THEN Z$=CHR$(0) ELSE IF LEN(Z$)>128 THEN Z$=""
4440 P=INSTR(Z$,PROMPT$):B$=INKEY$:IF P<>0 OR B$=" " THEN RETURN ELSE 4420
4445 '
4500 ' Receive w/ XMODEM
4505 '
4510 PRINT"===RECEIVE FILE WITH XMODEM===":PRINT
4515 Y$="":BLK=1:SEC=1:CK=0:ECNT=0
4520 PRINT"***Holding for Start...":GOSUB 4975:PRINT#1,NAK$;
4525 GOSUB 4925:IF ABORT THEN 4645 ELSE 4535
4530 GOSUB 4905:IF Z$="" THEN 4545
4535 Y$=Y$+Z$:IF LEN(Y$)<=131 THEN 4530
4540 '-check block
4545 IF LEN(Y$)=132 THEN LSET X$=MID$(Y$,4,128):N=132:GOTO 4580
4550 IF LEN(Y$)=131 THEN LSET X$=MID$(Y$,3,128):N=131:GOTO 4580
4555 IF LEN(Y$)>132 THEN PRINT"**Long Block in #";BLK:GOTO 4615
4560 IF Y$=EOT$ THEN 4635
4565 IF Y$=CAN$ THEN 4640
4570 IF Y$="" THEN PRINT"***Timeout":GOSUB 4975:PRINT #1,NAK$:GOTO 4525
4575 PRINT"**Short Block in #";BLK:GOTO 4615
4580 IF (ASC(MID$(Y$,1,1)) AND ASC(MID$(Y$,2,1)) AND ASC(MID$(Y$,3,1)))<>0 THEN PRINT"**Error in SOH":Y$="":PRINT #1,NAK$:GOTO 4525
4585 IF ASC(MID$(Y$,2,1))=SEC-1 THEN PRINT"**Requesting Next Block":PRINT#1,ACK$:GOTO 4520
4590 IF SEC<>ASC(MID$(Y$,2,1)) THEN PRINT"**Block # Error in #";BLK:GOTO 4615
4595 IF (SEC XOR 255)<>ASC(MID$(Y$,3,1)) THEN PRINT"**Complement Error in #";BLK:GOTO 4615
4600 FOR I=1 TO 128:CK=CK+ASC(MID$(X$,I,1)):NEXT
4605 IF (CK AND 255)=(ASC(MID$(Y$,N,1))) THEN 4620
4610 PRINT"**Checksum Error in #";BLK:
4615 PRINT#1,NAK$;:ECNT=ECNT+1:IF ECNT<12 THEN 4625 ELSE 4645
4620 LOCATE CSRLIN-1,1:PRINT"Received Block #";BLK;:SEC=255 AND (SEC+1):PUT#2,BLK:BLK=BLK+1:PRINT#1,ACK$;:PRINT"- verified":ECNT=0
4625 Y$="":CK=0:GOSUB 4965:IF ABORT THEN 4645 ELSE 4530
4630 '-terminate
4635 PRINT"***End of File - verified":PRINT#1,ACK$;:GOTO 3010
4640 PRINT"***Cancelled by Transmitter":GOTO 3010
4645 PRINT"***Cancelled by Receiver":PRINT#1,CAN$;:GOSUB 4975:GOTO 3010
5100 COLOR BG,FG:PRINT MID$(COMM$,6,10);:COLOR FG,BG:PRINT:PRINT
5105 PRINT"Echo-";:IF ECH=-1 THEN PRINT"Y"; ELSE PRINT"N";
5110 PRINT" Mesg-";:IF MSG=-1 THEN PRINT"Y"; ELSE PRINT"N";
5115 PRINT" Strip-";:IF NS=0 THEN PRINT"N"; ELSE PRINT USING"#";NS;
5120 PRINT" Pace-";:IF PC$="" THEN PRINT"N" ELSE PRINT PC$
5125 IF NS=0 THEN PRINT:RETURN ELSE FOR I=1 TO NS:PRINT"Strip #";:PRINT USING"#";I;:PRINT" - /";:PRINT USING"###";ASC(S$(I));:PRINT"/";:IF R$(I)="" THEN PRINT"000"; ELSE PRINT USING"###";ASC(R$(I));
5130 PRINT"/":NEXT:PRINT:RETURN
5135 '
5200 ' New Defaults
5205 '
5210 CLS:BEEP:PRINT"===SET NEW DEFAULTS===":PRINT:COLOR BG,FG:PRINT" Present program defaults:";SPACE$(53);:COLOR FG,BG:EXIT=0
5215 FOR I=1 TO DFNUM:J=I+4:P=1:IF I>15 THEN J=I-11:P=32
5220 LOCATE J,P,0:PRINT DP$(I);:LOCATE J,P+16:IF D$(I)>=" " THEN PRINT D$(I); ELSE IF D$(I)="" THEN PRINT "''"; ELSE IF D$(I)=CHR$(0) THEN PRINT "0"; ELSE COLOR HI,BG:PRINT CHR$(ASC(D$(I))+64);:COLOR FG,BG
5225 IF I<15 THEN PRINT SPACE$(12-LEN(D$(I))); ELSE PRINT SPACE$(30-LEN(D$(I)));
5230 NEXT:LOCATE ,,1:IF EXIT THEN 5280 ELSE FOR I=1 TO DFNUM:DT$(I)=D$(I):NEXT
5235 LOCATE 21,1:COLOR BG,FG:PRINT" Enter ";ENT$;" to leave unchanged - <space>";ENT$;" for 'null' value - <ESC>";ENT$;" to quit ":COLOR FG,BG
5240 PRINT"*** Enter new values":ABORT=0:FOR I=1 TO DFNUM:J=I+4:P=1:IF I>15 THEN J=I-11:P=32
5245 IF ABORT THEN 5265
5250 IF D$(I)<>"" THEN LOCATE J,P+17+LEN(D$(I)) ELSE LOCATE J,P+19
5255 IF I>15 THEN QL=16 ELSE QL=4
5260 GOSUB 2500:IF Q$=CHR$(27) THEN GOSUB 2655:GOSUB 2655:ABORT=-1 ELSE IF Q$<>"" THEN DT$(I)=Q$:IF DT$(I)=" " THEN DT$(I)=""
5265 NEXT
5270 GOSUB 5295:PRINT"*** New values ok (y/n)?";:Q$=INPUT$(1):PRINT Q$:GOSUB 2555:IF Q$="N" THEN GOSUB 5295:LOCATE 21,1:PRINT SPACE$(79);:LOCATE 21,1:PRINT"(default routine cancelled)":GOTO 5290 ELSE FOR I=1 TO DFNUM:D$(I)=DT$(I):NEXT
5275 EXIT=-1:GOSUB 5295:PRINT"*** Make these changes permanent (y/n)?";:Q$=INPUT$(1):PRINT Q$+" ...wait";:GOSUB 2555:IF Q$="Y" THEN GOSUB 5440:GOTO 5215 ELSE GOSUB 5600:GOTO 5215
8010 CLS:MSG$=" Redialing... *** HIT ANY KEY TO TERMINATE *** (redial started at "+TIME$+")":GOSUB 2600
8015 SOUND 5000,2:PRINT "===REDIALING ";N$;" at ";TIME$:PRINT#1,MODM$+DIAL$
8020 IF INKEY$<>"" THEN 8095
8025 SOUND 32767,12000/VAL(BAU$):SOUND 32767,1
8030 IF EOF(1) THEN 8020
8035 Q1$=INPUT$(LOC(1),#1)
8040 SOUND 32767,12000/VAL(BAU$):SOUND 32767,1
8045 IF EOF(1) THEN Q2$="":GOTO 8055
8050 Q2$=INPUT$(LOC(1),#1)
8055 Q$=Q1$+Q2$
8060 FOR I=1 TO LEN(Q$):P=ASC(MID$(Q$,I,1)):J=P AND 127:MID$(Q$,I,1)=CHR$(J):NEXT
8065 PRINT Q$;
8070 IF INSTR(Q$,MODM$)<>0 THEN 8020
8075 IF INSTR(Q$,CONNECT$)=0 THEN GOTO 8100 ELSE STRT$=TIME$
8080 MSG$=" REMOTE COMPUTER ON LINE *** HIT ANY KEY TO PROCEED ***":GOSUB 2600
8085 IF INKEY$="" THEN SOUND 600,4:SOUND 900,4:GOTO 8085
8090 PRINT:PRINT"===CONNECTED WITH ";N$:GOSUB 2800:GOTO 515
8095 PRINT#1,CR$:CLS:BEEP:PRINT"===REDIAL TERMINATED...back in terminal mode":PRINT GO$:GOSUB 2800:GOTO 515
8100 I=1
8105 SOUND 32767,20:SOUND 32767,1:IF INKEY$<>"" THEN 8095
8110 I=I+1:IF I=QDELAY THEN 8015 ELSE GOTO 8105
8115 '
8200 ' Elapsed Time
8205 '
8210 IF STRT$="--" THEN MLPSD=0:GOTO 8220
8215 MSTRT=VAL(MID$(STRT$,1,2))*60+VAL(MID$(STRT$,4,2)):MSTOP=VAL(MID$(TIME$,1,2))*60+VAL(MID$(TIME$,4,2)):MLPSD=INT(MSTOP-MSTRT):IF MSTRT>MSTOP THEN MLPSD=MLPSD+1440
8910 BEEP:PRINT:PRINT"*** This program requires that you have a serial port."
8915 PRINT:PRINT:PRINT"(returning to DOS)":SOUND 32767,50:SOUND 32767,1:SYSTEM
8920 BEEP:LOCATE 15,1:PRINT"===PLEASE DO NOT BYPASS THE FREEWARE NOTICE===":GOTO 8915
8925 COLOR HI,BG:PRINT MSG$;:COLOR FG,BG:RETURN
8930 IF ERR=52 OR ERR=64 OR ERR=67 THEN MSG$="Not a valid file name.
8935 IF ERR=53 THEN MSG$="File not found.
8940 IF ERR=70 THEN MSG$="Disk is write protected.
8945 IF ERR=71 THEN MSG$="Check disk drive.
8950 IF ERR=72 THEN MSG$="Disk media error.
8955 RETURN
8960 '
9000 ' Error Traps
9005 '
9010 IF ERL=215 THEN RESUME 5405
9015 IF ERL=225 THEN RESUME 245
9020 IF ERL=5665 THEN RESUME 5670
9025 IF ERL=425 THEN RESUME 245
9030 IF ERR=27 THEN BEEP:MGS$="CHECK PRINTER":GOSUB 8925:PR=0:IF ERL=1610 THEN RESUME 515 ELSE RESUME 820
9035 IF ERL=5280 THEN BEEP:GOSUB 5295:PRINT TAB(31)"*** Invalid communications parameters. Try again.";:EXIT=0:RESUME 5215
9040 IF ERL=6215 AND ERR=64 THEN BEEP:LOCATE 20,1:PRINT"*** Invalid parameters for entry #";Q$:RESUME 6400
9045 IF ERL=6245 THEN BEEP:LOCATE 20,1:PRINT"*** Invalid stripping for entry #";Q$:RESUME 6400
9050 IF ERR=24 THEN MSG$="TIMEOUT":GOSUB 8925:IF PR THEN PR=0:MSG$="PRINTOUT OFF":GOSUB 8925:PR=O:CLOSE#3:RESUME 820 ELSE MSG$="CHECK MODEM":GOSUB 8925:RESUME 515
9055 IF ERR=57 THEN MSG$="":GOSUB 8925:IF RC$="X" THEN RESUME 4525 ELSE IF TC$="X" THEN RESUME 4725 ELSE RESUME 515
9060 IF ERR=69 THEN PRINT#1,XF$;:PSE=-1:MSG$="OVERFLOW":GOSUB 8925:IF NOT PR THEN RESUME 515 ELSE MSG$="PRINTOUT OFF":PR=0:CLOSE#3:RESUME 515
9065 IF ERR=15 AND ERL=660 THEN MSG$="OVERFLOW--PRINTOUT OFF":GOSUB 8925:PR=0:CLOSE#3:RESUME 515
9070 IF ERL=3640 THEN BEEP:PRINT"*** File(s) not found. Try again.":RESUME 3645
9075 IF ERR=61 AND RC$="X" THEN BEEP:PRINT"*** DISK IS FULL":RESUME 4645
9080 IF ERR=61 THEN BEEP:PRINT:PRINT"===DISK IS FULL===":IF RC THEN RESUME 3000 ELSE RESUME 3820
9085 IF ERL=3810 THEN LOCATE 1,40:COLOR HI,BG:PRINT"***CAN'T OPEN ";DUMP$;"***";:LOCATE ROW,COL:RESUME 3820
9090 IF ERR=67 AND ERL=3595 THEN PRINT"*** Either too many files, or
9095 IF ERL=3595 THEN MSG$="":GOSUB 8930:BEEP:PRINT"*** ";MSG$;" Try again.":RESUME 3500
9100 IF ERR=67 OR ERR=70 OR ERR=71 THEN BEEP:PRINT"*** Can't read/write file in the default drive.":PRINT"Correct and hit any key to resume..":Q$=INPUT$(1):IF ERL<400 THEN RESUME 215 ELSE CLS:RESUME 400