1050 IF RST THEN INPUT "ENTER THE NAME OF THE FILE CONTAINING RUNTIME PARAMETERS";PS$
1060 IF LEFT$(PS$,1)=" " THEN PS$=RIGHT$(PS$,LEN(PS$)-1):GOTO 1060
1070 IF PS$="" THEN PARMS$="PARMS.RTY" ELSE PARMS$=PS$
1080 ON ERROR GOTO 3900
1090 FERR=0:OPEN PARMS$ FOR INPUT AS #1
1100 IF FERR THEN IF INSTR(PARMS$,".")=0 THEN PARMS$=PARMS$+".RTY":GOTO 1090 ELSE PRINT "ERROR ACCESSING FILE - ";PARMS$:PRINT "ERROR NUMBER";ERR:GOTO 1790
1110 WHILE NOT EOF(1)
1120 INPUT#1,P$:IF P$="" THEN GOTO 1780
1130 FOR PL=1 TO LEN(P$)
1140 P=ASC(MID$(P$,PL,1)):IF (P>&H60) AND (P<&H7B) THEN MID$(P$,PL,1)=CHR$(P-&H20)
1150 NEXT PL:PL$=LEFT$(P$,4):PRINT P$
1160 IF PL$="XTAL" THEN PL=INSTR(P$,"="):IF PL=0 OR PL=LEN(P$) THEN 1770 ELSE XTAL!=VAL(RIGHT$(P$,LEN(P$)-PL))*1000000!/16:GOTO 1780
1170 IF PL$="COMM" THEN PL=INSTR(P$,"="):IF PL=0 OR PL=LEN(P$) THEN 1770 ELSE DIV.LSB=VAL(RIGHT$(P$,LEN(P$)-PL)):GOTO 1780
1180 IF PL$="COM2" THEN COMM=2:DIV.LSB=DIV.LSB2:GOTO 1780
1190 IF PL$="TIME" THEN PL=INSTR(P$,"="):IF PL=0 OR PL=LEN(P$) THEN 1770 ELSE TMTYP$=RIGHT$(P$,LEN(P$)-PL):IF LEFT$(TMTYP$,1)="?" THEN GOTO 1780 ELSE QTIME=0:TMTYP$=LEFT$(TMTYP$,3):GOTO 1780
1200 IF LEFT$(PL$,3)="RTS" THEN PL=INSTR(P$,"="):IF PL=0 OR PL=LEN(P$) THEN 1770 ELSE RTS=VAL(RIGHT$(P$,LEN(P$)-PL)):IF (RTS>1 AND RTS<10) OR (RTS>11) THEN 1770 ELSE 1780
1210 IF LEFT$(PL$,3)="DTR" THEN PL=INSTR(P$,"="):IF PL=0 OR PL=LEN(P$) THEN 1770 ELSE DTR=VAL(RIGHT$(P$,LEN(P$)-PL)):IF (DTR>1 AND DTR<10) OR (DTR>11) THEN 1770 ELSE 1780
1220 IF PL$<>"BAUD" THEN 1250 ELSE PL=INSTR(P$,"="):IF PL=0 OR PL=LEN(P$) THEN 1770
1230 IF PL=5 THEN IF MAXBAUD(1)=10 THEN 1770 ELSE P=MAXBAUD(1):MAXBAUD(1)=P+1:GOTO 1240 ELSE P=VAL(MID$(P$,5,PL-5)):IF P>10 OR P>MAXBAUD(1)+1 THEN 1770 ELSE IF P>MAXBAUD(1) THEN MAXBAUD(1)=P:P=P-1 ELSE P=P-1
1250 IF PL$<>"ASCI" THEN 1280 ELSE PL=INSTR(P$,"="):IF PL=0 OR PL=LEN(P$) THEN 1770
1260 IF PL=5 THEN IF MAXBAUD(0)=10 THEN 1770 ELSE P=MAXBAUD(0):MAXBAUD(0)=P+1:GOTO 1270 ELSE P=VAL(MID$(P$,5,PL-5)):IF P>10 OR P>MAXBAUD(0)+1 THEN 1770 ELSE IF P>MAXBAUD(0) THEN MAXBAUD(0)=P:P=P-1 ELSE P=P-1
1280 IF PL$="BSEL" THEN PL=INSTR(P$,"="):IF PL=0 OR PL=LEN(P$) THEN 1770 ELSE BSELCAL$=MID$(P$,PL+1,10):GOTO 1780
1290 IF PL$="ASEL" THEN PL=INSTR(P$,"="):IF PL=0 OR PL=LEN(P$) THEN 1770 ELSE ASELCAL$=MID$(P$,PL+1,10):GOTO 1780
1300 IF PL$="BGSL" THEN PL=INSTR(P$,"="):IF PL=0 OR PL=LEN(P$) THEN 1770 ELSE GBSEL$=MID$(P$,PL+1,10):GOTO 1780
1310 IF PL$="AGSL" THEN PL=INSTR(P$,"="):IF PL=0 OR PL=LEN(P$) THEN 1770 ELSE GASEL$=MID$(P$,PL+1,10):GOTO 1780
1320 IF PL$="ESEL" THEN PL=INSTR(P$,"="):IF PL=0 OR PL=LEN(P$) THEN 1770 ELSE ESEL$=MID$(P$,PL+1,10):GOTO 1780
1330 IF PL$="GESL" THEN PL=INSTR(P$,"="):IF PL=0 OR PL=LEN(P$) THEN 1770 ELSE GESEL$=MID$(P$,PL+1,10):GOTO 1780
1340 IF PL$="NKEY" THEN PL=INSTR(P$,"="):IF PL=0 OR PL=LEN(P$) THEN 1770 ELSE NOTKEYS$=MID$(P$,PL+1,10):GOTO 1780
1350 IF PL$="COLO" THEN TXF=11:TXB=1:RXF=14:RXB=2:STSF=0:STSB=6:KEYF=0:KEYB=3:ERRF=12:ERRB=0:GOTO 1780
1360 IF LEFT$(PL$,3)="TXF" THEN PL=INSTR(P$,"="):IF PL=0 OR PL=LEN(P$) THEN 1770 ELSE TXF=VAL(RIGHT$(P$,LEN(P$)-PL)):GOTO 1780
1370 IF LEFT$(PL$,3)="TXB" THEN PL=INSTR(P$,"="):IF PL=0 OR PL=LEN(P$) THEN 1770 ELSE TXB=VAL(RIGHT$(P$,LEN(P$)-PL)):GOTO 1780
1380 IF LEFT$(PL$,3)="RXF" THEN PL=INSTR(P$,"="):IF PL=0 OR PL=LEN(P$) THEN 1770 ELSE RXF=VAL(RIGHT$(P$,LEN(P$)-PL)):GOTO 1780
1390 IF LEFT$(PL$,3)="RXB" THEN PL=INSTR(P$,"="):IF PL=0 OR PL=LEN(P$) THEN 1770 ELSE RXB=VAL(RIGHT$(P$,LEN(P$)-PL)):GOTO 1780
1400 IF PL$="STSF" THEN PL=INSTR(P$,"="):IF PL=0 OR PL=LEN(P$) THEN 1770 ELSE STSF=VAL(RIGHT$(P$,LEN(P$)-PL)):GOTO 1780
1410 IF PL$="STSB" THEN PL=INSTR(P$,"="):IF PL=0 OR PL=LEN(P$) THEN 1770 ELSE STSB=VAL(RIGHT$(P$,LEN(P$)-PL)):GOTO 1780
1420 IF PL$="KEYF" THEN PL=INSTR(P$,"="):IF PL=0 OR PL=LEN(P$) THEN 1770 ELSE KEYF=VAL(RIGHT$(P$,LEN(P$)-PL)):GOTO 1780
1430 IF PL$="KEYB" THEN PL=INSTR(P$,"="):IF PL=0 OR PL=LEN(P$) THEN 1770 ELSE KEYB=VAL(RIGHT$(P$,LEN(P$)-PL)):GOTO 1780
1440 IF PL$="ERRF" THEN PL=INSTR(P$,"="):IF PL=0 OR PL=LEN(P$) THEN 1770 ELSE ERRF=VAL(RIGHT$(P$,LEN(P$)-PL)):GOTO 1780
1450 IF PL$="ERRB" THEN PL=INSTR(P$,"="):IF PL=0 OR PL=LEN(P$) THEN 1770 ELSE ERRB=VAL(RIGHT$(P$,LEN(P$)-PL)):GOTO 1780
1460 IF PL$="ALCR" THEN PL=INSTR(P$,"="):IF PL=0 OR PL=LEN(P$) THEN 1770 ELSE ALCR=VAL(RIGHT$(P$,LEN(P$)-PL)):GOTO 1780
1470 IF PL$="BDUP" THEN PL=INSTR(P$,"="):IF PL=0 OR PL=LEN(P$) THEN 1770 ELSE BDUP(VAL(MID$(P$,5,PL-5)))=VAL(RIGHT$(P$,LEN(P$)-PL)):GOTO 1780
1480 IF PL$="BDLW" THEN PL=INSTR(P$,"="):IF PL=0 OR PL=LEN(P$) THEN 1770 ELSE BDLOW(VAL(MID$(P$,5,PL-5)))=VAL(RIGHT$(P$,LEN(P$)-PL)):GOTO 1780
1490 IF PL$="BDOT" THEN PL=INSTR(P$,"="):IF PL=0 OR PL=LEN(P$) THEN 1770 ELSE BDOUT(VAL(MID$(P$,5,PL-5)))=VAL(RIGHT$(P$,LEN(P$)-PL)):GOTO 1780
1500 IF PL$="RXLN" THEN PL=INSTR(P$,"="):IF PL=0 OR PL=LEN(P$) THEN 1770 ELSE RXL=VAL(RIGHT$(P$,LEN(P$)-PL)):IF RXL<2 OR RXL>(19+INT(CMAX/60)) THEN 1770 ELSE RXLINES=RXL:GOTO 1780
1510 IF PL$="DIDL" THEN DIDL=-1:GOTO 1780
1520 IF PL$="ECHO" THEN ECHO=-1:GOTO 1780
1530 IF PL$="LPT2" THEN LPTR$="LPT2:":GOTO 1780
1540 IF PL$="LPT3" THEN LPTR$="LPT3:":GOTO 1780
1550 IF PL$="QB" THEN QBEL=-1:GOTO 1780
1560 IF PL$="ART" THEN ART=-1:GOTO 1780
1570 IF PL$="UOS" THEN UNSHIFT=-1:GOTO 1780
1580 IF PL$="ZULU" THEN ZTM=-1:DTM$="DDHHMMZ MON YY":PL=INSTR(P$,"="):IF PL=0 OR PL=LEN(P$) THEN 1780 ELSE ZTM=-2:UTM=VAL(RIGHT$(P$,LEN(P$)-PL)):GOTO 1780
1590 IF PL$="NPDT" THEN PDATOK=0:GOTO 1780
1600 IF PL$="PDAT" THEN PL=INSTR(P$,"="):IF PL=0 OR PL=LEN(P$) THEN 1770 ELSE PDAT$=RIGHT$(P$,LEN(P$)-PL):GOTO 1780
1610 IF PL$="PACK" THEN PACKET=-1:TYPE=0:ALCR=&H3:GOTO 1780
1620 IF PL$="SPLF" THEN SPLF=-1:GOTO 1780
1630 IF PL$="MODE" THEN PL=INSTR(P$,"="):IF PL=0 OR PL=LEN(P$) THEN 1770 ELSE IF MID$(P$,PL+1)="A" THEN TYPE=0:GOTO 1780 ELSE 1770
1640 IF PL$="BLLF" THEN BLLF=-1:GOTO 1780
1650 IF PL$="NOBP" THEN NOBP=-1:GOTO 1780
1660 IF PL$="ATCR" THEN ATCR=-1:GOTO 1780
1670 IF PL$="WARN" THEN PL=INSTR(P$,"="):IF PL=0 OR PL=LEN(P$) THEN 1770 ELSE CWARN=VAL(RIGHT$(P$,LEN(P$)-PL))+1:GOTO 1780
1680 IF PL$="LLEN" THEN PL=INSTR(P$,"="):IF PL=0 OR PL=LEN(P$) THEN 1770 ELSE CEND=VAL(RIGHT$(P$,LEN(P$)-PL))+1:GOTO 1780
1690 IF PL$="MARS" THEN MARS=-1:BDOUT(32)=&HC4:GOTO 1780
1700 IF PL$="NCHR" THEN PL=INSTR(P$,"="):IF PL=0 OR PL=LEN(P$) THEN 1770 ELSE NCHR=VAL(RIGHT$(P$,LEN(P$)-PL)):GOTO 1780
1710 IF PL$="DTTM" THEN PL=INSTR(P$,"="):IF PL=0 OR PL=LEN(P$) THEN 1770 ELSE DTM$=RIGHT$(P$,LEN(P$)-PL):GOTO 1780
1720 IF PL$="EURO" THEN EURO=-1:DTM$="HH:MM:SS TMT DD.MON.YYYY" ELSE GOTO 1760
1760 IF PL$="FILE" THEN PL=INSTR(P$,"="):IF PL=0 OR PL=LEN(P$) THEN 1770 ELSE P=VAL(MID$(P$,5,PL-5)):IF P<1 OR P>10 THEN 1770 ELSE FLNM$(P)=RIGHT$(P$,LEN(P$)-PL):GOTO 1780
1770 PRINT "INVALID PARMS.RTY ENTRY":PRINT " ";P$;" ":INPUT "PRESS ENTER TO CONTINUE";P$
1780 WEND
1790 CLOSE #1
1800 P=VAL(RIGHT$(TIME$,2)):P=P+3:IF P>59 THEN P=P-60
2220 IF UNSHIFT THEN FK$(4)="UOS ON" ELSE FK$(4)="UOS OF"
2230 ON ERROR GOTO 3830
2240 'START COMMUNICATIONS FILE
2250 I = INP(LINE.STS)
2260 IF PACKET THEN 2280
2270 OPEN COMM$+":110,N,7,2,RS,CS0,DS0,CD0" AS #1:GOTO 2300
2280 OPEN COMM$+":110,N,8,1" AS #1:
2290 GOSUB 4620:'SET TO XMIT MODE
2300 GOSUB 4190:'SET MODE
2310 OUT MOD.CTL,(INP(MOD.CTL) AND &HFC) OR RMSK:'SET DTR AND RTS (PUT T.U. IN RX MODE)
2320 ON KEY(1) GOSUB 3940:KEY(1) ON:ON KEY(2) GOSUB 4620:KEY(2) ON
2330 GOSUB 3940
2340 IF NOT QTIME THEN 2430
2350 CLS:PRINT "THE DEFAULT TIME TYPE IS 'UTC'":INPUT "ENTER THE TIME TYPE ";TMTYP$:IF TMTYP$="" THEN TMTYP$="UTC" ELSE FOR PL=1 TO LEN(TMTYP$):P=ASC(MID$(TMTYP$,PL,1)):IF (P>&H60) AND (P<&H7B) THEN MID$(TMTYP$,PL,1)=CHR$(P-&H20):NEXT PL
2360 TMTYP$=LEFT$(TMTYP$,3)
2370 PRINT "THE TIME IS SET TO "+TIME$+" "+TMTYP$
2380 INPUT "ENTER THE TIME ";TCH$
2390 IF TCH$<>"" THEN TIME$ = TCH$
2400 PRINT "THE DATE IS SET TO "+DATE$
2410 INPUT "ENTER THE DATE ";TCH$
2420 IF TCH$<>"" THEN DATE$=TCH$
2430 TCH = VAL(RIGHT$(DATE$,4)):MON(2)=28:IF (TCH MOD 4) = 0 AND (TCH MOD 100) <>0 THEN MON(2)=29
2440 IF TMTYP$="UTC" THEN UTM=0 ELSE IF ZTM=-1 THEN INPUT "ENTER THE TIME DIFFERENCE FOR ZULU TIME";UTM
2450 IF ZTM=-2 THEN ZTM=-1
2460 CLS:GOSUB 4630:GOSUB 4040
2470 IF PACKET AND PDATOK THEN GOSUB 6830
2480 FOR I = 1 TO 25
2490 CALL SCROLL (RRB,RRE,CMAX,SCRX)
2500 CALL SCROLL (RWB,RWE,CMAX,SCTX)
2510 NEXT I
2520 LOCATE RW,CW,0:COLOR TXBR,TXFR:PRINT " ";
2530 GOSUB 6440:TSS!=TCS!
2540 IF INKEY$<>"" THEN 2540:'CLEAR THE INKEY$ BUFFER
2550 GOSUB 6460
2560 REM $PAGE
2570 '
2580 'THIS IS THE MAIN PROGRAM LOOP
2590 COLOR STSF,STSB:LOCATE TMLN1,1,0:PRINT TIME$+" "+TMTYP$;:IF DATE$ <> ZDT$ THEN GOSUB 6460
2600 GOSUB 6440:IF TCS!<TSS! THEN TCS!=TCS!+86400!
2610 TS!=TCS!-TSS!:TH=INT(TS!/3600):TM=INT(TS!/60)-TH*60:TS=TS!-CSNG(TH)*3600-CSNG(TM)*60:LOCATE TMLN1,30,0:PRINT USING "##_:##_:##";TH,TM,TS;
2620 IF BFILE THEN IF CMAX=40 THEN LOCATE TMLN2,1,0 ELSE LOCATE TMLN1,41,0
2630 IF BFILE THEN PRINT LEFT$("RX-"+BF$,19);
2640 IF RFILE THEN IF CMAX=40 THEN LOCATE TMLN2,21,0 ELSE LOCATE TMLN1,61,0
2650 IF RFILE THEN PRINT LEFT$("TX-"+RF$,19);
2660 COLOR TXF,TXB
2670 TCS!=FRE("")
2680 IF MSG THEN IF PMSG=VAL(RIGHT$(TIME$,2)) THEN GOSUB 6530
2690 FOR ML = 1 TO 10
2700 IF RST THEN IF PS$="" THEN 2110 ELSE CLOSE:CLEAR:RST=-1:GOTO 450
2710 IF NEWLINE THEN NEWLINE=0:B$=CHR$(13):GOSUB 4510:B$=CHR$(10):GOSUB 4510
2720 FOR MLL = 1 TO 2:IF NOT EOF(1) THEN GOSUB 3090:NEXT MLL
2730 IF TXEND THEN GOSUB 4660:GOTO 2760
2740 IF MODE=1 AND BUFS<>BUFE THEN GOSUB 4800 ELSE IF DIDL AND (MODE=1) AND NOT TPAUSE THEN GOSUB 6440:IF LDS<>SS THEN LDS=SS:COA=0:GOSUB 4880
2750 IF COA = 5 THEN GOSUB 4620:COA=0
2760 IF BUFFULL THEN 2800
2770 IF UNCOMP THEN GOSUB 5070:GOTO 2800
2780 IF RFILE THEN IF NOT EOF(2) THEN TCH$=INPUT$(1,#2):GOSUB 5070:GOTO 2800 ELSE GOSUB 5880:GOTO 2800
2790 IF DFILE THEN IF LEN(DTTM$)=0 THEN DFILE=0 ELSE TCH$=LEFT$(DTTM$,1):DTTM$=RIGHT$(DTTM$,LEN(DTTM$)-1):GOSUB 5070
2800 KCH$=INKEY$:IF KCH$="" THEN GOTO 3010
2810 IF LEN(KCH$)=1 THEN GOTO 3010 ELSE KCH2=ASC(RIGHT$(KCH$,1))
2820 IF KCH2<>30 THEN 2840 ELSE ART=NOT ART:GOSUB 4750
2830 GOSUB 6250:GOTO 3040
2840 IF KCH2<>31 THEN GOTO 2910 ELSE SELCAL=NOT SELCAL:DSEL=0:PSEL=0:IF SELCAL THEN GOSUB 6360 ELSE MSG$="SELCAL TURNED OFF":GOSUB 6480:GOTO 3040
2850 GOSUB 6420:INPUT "DO YOU WANT SELCAL DATA SENT TO DISK, PRINTER OR BOTH (D/P/B) ";FSEL$:IF FSEL$="" THEN SELCAL=0:GOTO 2900 ELSE P$=CHR$(ASC(LEFT$(FSEL$,1)) OR 32):IF P$<>"p" AND P$<>"b" AND P$<>"d" THEN GOTO 2850
2860 IF P$="p" THEN PSEL=-1:MSG$="SELCAL SET TO PRINT":GOTO 2890
2870 GOSUB 6420:INPUT "ENTER SELCAL FILENAME FOR RECEIVING ";FSEL$
2880 DSEL=-1:IF P$="b" THEN PSEL=-1:MSG$="SELCAL SET TO PRINT AND DISK" ELSE MSG$="SELCAL SET TO DISK"
2890 GOSUB 6480
2900 GOSUB 6460:GOSUB 6390:GOTO 3040
2910 IF KCH2<>38 THEN GOTO 2960 ELSE GOSUB 6360:GOSUB 6420:INPUT "ENTER CALLSIGN OF STATION WORKED ";LOG1$
2920 GOSUB 6420:INPUT "ENTER COMMENTS AND/OR OTHER DATA ";LOG2$
2930 FERR=0:OPEN "LOG.RTY" FOR APPEND AS #5:IF FERR THEN GOTO 2950
2960 IF KCH2<>20 THEN 2970 ELSE MSG$="SWAP TRANSMIT BUFFER":GOSUB 6480:GOSUB 6580:GOTO 3040
2970 IF KCH2<>46 THEN 2980 ELSE MSG$="CLEAR TRANSMIT BUFFER":GOSUB 6480:GOSUB 6750:GOTO 3040
2980 IF KCH2<>49 THEN 2990 ELSE NOTKEYS=NOT NOTKEYS:IF NOTKEYS THEN MSG$="NOT AT KEYS MSG ON":GOSUB 6480:GOTO 3040 ELSE MSG$="NOT AT KEYS MSG OFF":GOSUB 6480:GOTO 3040
2990 IF KCH2<>32 THEN 3000 ELSE GOSUB 6830:GOTO 3040
3000 KCH2 = KCH2 - 119:IF KCH2<1 OR KCH2>10 THEN 3040 ELSE MSG$="SEND FILE"+STR$(KCH2):GOSUB 6480:GOSUB 5750:GOTO 3040
3010 IF (BUFFULL OR UNCOMP OR RFILE OR DFILE) THEN KEYBUF$=KEYBUF$+KCH$:GOTO 3040 ELSE IF LEN(KEYBUF$)=0 THEN TCH$=KCH$ ELSE TCH$=LEFT$(KEYBUF$,1):KEYBUF$=RIGHT$(KEYBUF$,LEN(KEYBUF$)-1)+KCH$
3020 IF LEN(TCH$)=0 THEN 3040
3030 GOSUB 5070
3040 NEXT ML
3050 GOTO 2590
3060 REM $PAGE
3070 '
3080 'GET THE NEXT RECEIVED CHARACTER AND DISPLAY IT
3090 IF NOT SELCAL THEN IF NOTKEYS THEN 3130 ELSE 3160
3100 IF TYPE=0 THEN 3110 ELSE IF BSELCAL$=RIGHT$(SELCHK$,LEN(BSELCAL$)) OR GBSEL$=RIGHT$(SELCHK$,LEN(GBSEL$)) THEN GOSUB 3640:GOTO 3160 ELSE GOTO 3150
3110 IF ASELCAL$=RIGHT$(SELCHK$,LEN(ASELCAL$)) OR GASEL$=RIGHT$(SELCHK$,LEN(GASEL$)) THEN GOSUB 3640:GOTO 3160
3120 GOTO 3150
3130 IF NOTKEYS$<>RIGHT$(SELCHK$,LEN(NOTKEYS$)) THEN GOTO 3150 ELSE GOSUB 5970:GOSUB 5820:IF NOT SELCAL THEN FSEL$="WHILE.OUT"
3140 GOSUB 3650:GOTO 3160
3150 IF ESEL$=RIGHT$(SELCHK$,LEN(ESEL$)) OR GESEL$=RIGHT$(SELCHK$,LEN(GESEL$)) THEN GOSUB 3710
3160 BAU=ASC(INPUT$(1,#1)) AND &H7F
3170 IF TYPE = 0 THEN B$=CHR$(BAU):IF BAU > 31 OR BAU=7 OR BAU=10 OR BAU=13 OR BAU=8 THEN 3250 ELSE RETURN
3180 'CONVERT BAUDOT INPUT TO ASCII CHARACTER
3190 IF BAU=0 THEN IF SELCAL OR NOTKEYS THEN SELCHK$=RIGHT$(SELCHK$,9)+CHR$(0):RETURN ELSE RETURN
3200 IF BAU=27 THEN IF CASE<>1 THEN CASE=1:RETURN ELSE IF SELCAL OR NOTKEYS THEN SELCHK$=RIGHT$(SELCHK$,9)+CHR$(24):RETURN ELSE RETURN
3210 IF BAU=31 THEN IF CASE<>0 THEN CASE=0:RETURN ELSE IF SELCAL OR NOTKEYS THEN SELCHK$=RIGHT$(SELCHK$,9)+CHR$(25):RETURN ELSE RETURN
3220 IF UNSHIFT AND BAU=4 THEN CASE=0
3230 IF CASE=0 THEN B$=CHR$(BDLOW(BAU)) ELSE B$=CHR$(BDUP(BAU))
3240 'B$ CONTAINS THE ASCII CHARACTER
3250 CURIN=ASC(B$)
3260 IF SELCAL OR NOTKEYS THEN SELCHK$=RIGHT$(SELCHK$,9)+B$
3270 IF CURIN=13 AND LASTIN=13 THEN RETURN
3280 IF MARS AND CURIN=7 AND TYPE<>0 THEN B$="@"
3290 IF NOT COMP THEN 3370
3300 IF NOT BFILE THEN 3450
3310 IF CURIN=10 THEN GOTO 3330
3320 IF CURIN=LASTIN THEN RCNT=RCNT+1:GOTO 3380
3330 IF LASTIN=10 OR LASTIN=13 THEN 3360 ELSE IF RCNT=1 THEN PRINT#3,CMP$;:GOTO 3360
3340 IF RCNT=2 THEN PRINT#3,CMP$;CMP$;:GOTO 3360
3350 IF RCNT=26 THEN PRINT#3,CMP$;CHR$(255);CHR$(25);CMP$; ELSE PRINT#3,CHR$(255);CHR$(RCNT);CMP$;
3360 CMP$=B$:RCNT=1
3370 IF NOT BFILE THEN 3450
3380 IF ART THEN 3420
3390 IF CURIN=13 THEN PRINT#3,:BFLCNT=BFLCNT+1:GOTO 3430
3400 IF CURIN=10 AND LASTIN<>13 THEN PRINT#3,:BFLCNT=BFLCNT+1
3410 GOTO 3430
3420 IF CURIN=10 OR CURIN=13 THEN PRINT#3,CHR$(CURIN+10); ELSE IF LASTIN=10 OR LASTIN=13 THEN PRINT#3,:BFLCNT=BFLCNT+1
3430 IF BFLCNT>14 THEN BFLCNT=0:CLOSE #3:OPEN BF$ FOR APPEND AS #3
3440 IF NOT COMP AND CURIN<>10 AND CURIN<>13 THEN PRINT#3,B$;
3450 IF ART OR (CURIN <> 10 AND CURIN <> 13) THEN 3500
3460 IF CURIN=10 AND LASTIN=13 THEN LASTIN=10:RETURN
3470 IF CURIN=10 THEN 3500
3480 GOSUB 4510:IF PRNTR THEN LP$=B$:GOSUB 3760
3490 B$=CHR$(10)
3500 LASTIN = CURIN
3510 IF MARS AND CURIN=7 AND TYPE<>0 THEN B$=CHR$(7)
3520 IF PRNTR THEN LP$=B$:GOSUB 3760
3530 GOSUB 4510:'PUT CHARACTER ON SCREEN
3540 RETURN
3550 '
3560 'SET TO BAUDOT LETTERS MODE
3570 CASE=0:RETURN
3580 REM $PAGE
3590 'FORCE A CR-LF IN RX MODE
3600 IF PRNTR THEN LP$=CHR$(13):GOSUB 3760:LP$=CHR$(10):GOSUB 3760
3610 IF BFILE THEN PRINT#3,:BFLCNT=BFLCNT+1
3620 NEWLINE=-1:RETURN
3630 'START SELCAL SAVE FILE
3640 IF PSEL THEN IF NOT PRNTR THEN PRNTR=-1:FK$(6)="PRT ON":GOSUB 6250:PSCACT=-1
3650 IF BFILE THEN RETURN ELSE IF NOT DSEL THEN RETURN ELSE GOSUB 6360:COMP=0:IF FSEL$="" THEN 3690
3660 BF$=FSEL$:FERR=0:OPEN FSEL$ FOR APPEND AS #3
3670 IF FERR THEN CLOSE #3:GOTO 3690
3680 BFILE=-1:SCACT=-1:GOSUB 6420
3690 GOSUB 6460:GOSUB 6390:RETURN
3700 'STOP SELCAL SAVE FILE
3710 IF PSEL THEN IF PSCACT THEN PSCACT=0:PRNTR=0:FK$(6)="PRT OF":GOSUB 6250
3720 IF BFILE AND SCACT THEN GOSUB 6360:PRINT#3,:CLOSE #3:BFILE=0:SCACT=0:GOSUB 6460:GOSUB 6390:RETURN
3730 RETURN
3740 '
3750 'SEND DATA TO PRINTER
3760 ON ERROR GOTO 3910
3770 LP=ASC(LP$)
3780 IF LP<>7 THEN PRINT#4,LP$;
3790 IF LP>31 THEN LPCNT=LPCNT+1 ELSE IF LP=12 OR LP=13 THEN LPCNT=0 ELSE IF LP=10 THEN PRINT#4,STRING$(LPCNT," ");
3800 ON ERROR GOTO 3830:RETURN
3810 '
3820 'ERROR HANDLER
3830 IF ERR=57 OR ERR=69 THEN RESUME
3840 IF ERR=53 OR ERR=55 OR ERR=64 THEN FERR=-1:GOTO 3870
3850 IF ERR<>61 THEN ON ERROR GOTO 0:CLS:ERROR ERR:END
3860 BFILE=0:CLOSE #3
3870 IF ERR=53 THEN MSG$="FILE NOT FOUND" ELSE IF ERR=55 THEN MSG$="FILE ALREADY OPEN" ELSE IF ERR=64 THEN MSG$="BAD FILE NAME" ELSE MSG$="DISK FULL"
3880 GOSUB 6480:BEEP
3890 RESUME NEXT
3900 FERR=-1
3910 RESUME NEXT
3920 '
3930 'TOGGLE THE FUNCTION KEY DEFINITIONS
3940 KEYS = NOT KEYS
3950 GOSUB 6250
3960 IF KEYS THEN 3990
3970 ON KEY(3) GOSUB 4390:KEY(3) ON:ON KEY(4) GOSUB 6220:KEY(4) ON:ON KEY(5) GOSUB 4300:KEY(5) ON:ON KEY(6) GOSUB 4260:KEY(6) ON
5270 IF TCH=18 THEN DTTM$=DTTM$+TL$:DFILE=-1:RETURN
5280 IF TCH=19 THEN 5500
5290 IF TCH=255 THEN USTRT=-1:RETURN
5300 IF TCH=13 OR TCH=10 THEN IF LTCH=20 OR LTCH=23 THEN RETURN ELSE TCH$=CHR$(TCH+10)
5310 LOCATE RW,CW,0:STCH=SCREEN(RW,CW):COLOR TXF,TXB:IF TCH<>10 AND TCH<>20 THEN PRINT TCH$ ELSE IF STCH<>32 THEN PRINT CHR$(STCH); ELSE IF NOT NOBP OR NOT ART OR TCH<>7 THEN PRINT TCH$;
5320 IF TCH=10 THEN BUFL(BUFE)=0 ELSE IF TCH=20 THEN BUFL(BUFE)=200 ELSE BUFL(BUFE)=CW
5330 IF TCH=13 OR TCH=23 THEN CW=1:GOTO 5360
5340 IF TCH=10 OR TCH=20 THEN RW=RW+1:GOTO 5360
5350 IF CW=CMAX-1 THEN RW=RW+1:CW=1 ELSE CW=CW+1
5360 BUFN=BUFE+1:IF BUFN=BSIZ+1 THEN BUFN=0
5370 BUFC=BUFN-BUFS:IF BUFC<0 THEN BUFC=BUFC+BSIZ
5380 IF BUFC>=BSIZ-2 THEN BUFFULL=-1
5390 IF TCH=20 OR TCH=23 THEN BUF(BUFE)=TCH-10 ELSE BUF(BUFE)=TCH
5400 BUFE=BUFN:LTCH=TCH
5410 IF TCH=13 THEN TCH=10:CRLF=-1:BUFL(BUFE)=0:GOTO 5340
5420 IF QBEL AND TCH=39 THEN TCH=7:TCH$=CHR$(7):QBL=-1:GOTO 5310
5430 IF RW=24 THEN RW=23:CALL SCROLL (RWB,RWE,CMAX,SCTX)