270 'DETERMINE SCREEN SIZE AND SET THE SCROLL PARAMETERS
280 A=CSRLIN:PRINT STRING$(60," ");:IF A=CSRLIN THEN CMAX=80 ELSE CMAX=40
290 CLS
300 'READ THE INITIALIZATION PARAMETERS
310 QBEL=0:RCNT=1:LPTR$="LPT1:"
320 ON ERROR GOTO 430
330 OPEN "PARMS.RTY" FOR INPUT AS #1
340 WHILE NOT EOF(1)
350 INPUT#1,P$:P$=LEFT$(P$,4)
360 FOR PL=1 TO LEN(P$)
370 P=ASC(MID$(P$,PL,1)):IF (P>&H60) AND (P<&H7B) THEN MID$(P$,PL,1)=CHR$(P-&H20)
380 NEXT PL
390 IF P$="LPT2" THEN LPTR$="LPT2:":GOTO 420
400 IF P$="LPT3" THEN LPTR$="LPT3:":GOTO 420
410 IF P$="QB" THEN QBEL=-1
420 WEND
430 CLOSE #1
440 REM $PAGE
450 'INITIALIZE PROGRAM VARIABLES
460 ON ERROR GOTO 0
470 INPUT "ENTER NAME OF FILE TO PROCESS";PF$
480 IF PF$="" THEN 470
490 OPEN PF$ FOR INPUT AS #2
500 INPUT "WOULD YOU LIKE TO SAVE THE RESULTS";P$
510 P$=LEFT$(P$,1):IF P$="Y" OR P$="y" THEN GOSUB 790
520 INPUT "DO YOU WANT TO PRINT THE FILE";P$
530 P$=LEFT$(P$,1):IF P$="Y" OR P$="y" THEN PRNTR=-1 ELSE PRNTR=0
540 CLS
550 WIDTH LPTR$,255
560 OPEN LPTR$ AS #1
570 'THIS IS THE MAIN PROGRAM LOOP
580 IF UNCOMP THEN GOSUB 920:GOTO 610
590 IF EOF(2) THEN 620
600 TCH$=INPUT$(1,#2):GOSUB 920
610 GOTO 580
620 CLOSE:END
630 'GET THE NEXT RECEIVED CHARACTER AND DISPLAY IT
640 B$=CHR$(BAU):IF BAU > 31 OR BAU=7 OR BAU=10 OR BAU=13 THEN 660 ELSE 770
650 'B$ CONTAINS THE ASCII CHARACTER
660 IF PRNTR THEN IF BAU<>7 THEN PRINT#1,B$;
670 CURIN=ASC(B$)
680 IF NOT COMP THEN 720
690 IF BFILE THEN IF CURIN=LASTIN THEN RCNT=RCNT+1:GOTO 720 ELSE IF LASTIN<>10 AND LASTIN<>13 THEN IF RCNT=1 THEN PRINT#3,CMP$;:GOTO 710 ELSE IF RCNT=2 THEN PRINT#3,CMP$;CMP$;:GOTO 710
700 IF BFILE THEN IF LASTIN<>10 AND LASTIN<>13 THEN IF RCNT=26 THEN PRINT#3,CMP$;CHR$(255);CHR$(25);CMP$; ELSE PRINT#3,CHR$(255);CHR$(RCNT);CMP$;
710 IF BFILE THEN CMP$=B$:RCNT=1
720 IF BFILE THEN IF CURIN=13 AND (LASTIN=10 OR LASTIN=13) THEN PRINT#3,
730 IF BFILE THEN IF CURIN=10 OR CURIN=13 THEN PRINT#3,CHR$(CURIN+10); ELSE IF LASTIN=10 OR LASTIN=13 THEN PRINT#3,
740 IF BFILE AND NOT COMP AND CURIN<>10 AND CURIN<>13 THEN PRINT#3,B$;
750 LASTIN = CURIN
760 GOSUB 870:'PUT CHARACTER ON SCREEN
770 RETURN
780 'SEND RECEIVED CHARACTERS TO SPECIFIED FILE
790 BFILE=0
800 INPUT "ENTER NAME OF NEW FILE";BF$
810 IF BF$="" THEN 850
820 OPEN BF$ FOR APPEND AS #3
830 BFILE=-1:INPUT "DO YOU WANT COMPRESSION (Y/N) ";P$
840 P$=LEFT$(P$,1):IF P$="Y" OR P$="y" THEN COMP=-1 ELSE COMP=0
850 RETURN
860 'PUT RECEIVED CHARACTER ON SCREEN
870 RCH=ASC(B$):IF RCH=13 THEN LOCATE CSRLIN,1,0:RETURN
880 PRINT B$;
890 RETURN
900 REM $PAGE
910 'PUT CHAR TO SEND ON SCREEN
920 TCH=ASC(TCH$):IF UNCOMP THEN TCNT=TCNT-1:TCH=UTCH:TCH$=UTCH$:IF TCNT=0 THEN UNCOMP=0:GOTO 980 ELSE GOTO 980
930 IF UCNT THEN UCNT=0:UNCOMP=-1:UTCH=TCH:IF TCH=13 THEN UTCH$=CHR$(23):RETURN ELSE UTCH$=TCH$:RETURN
940 IF USTRT THEN USTRT=0:UCNT=-1:TCNT=TCH:RETURN
950 IF CRLF THEN CRLF=0:IF TCH=10 THEN LTCH=10:RETURN
960 IF QBL THEN QBL=0:IF TCH=7 THEN LTCH=7:RETURN
970 IF TCH=255 THEN USTRT=-1:RETURN
980 IF TCH=13 OR TCH=10 THEN IF LTCH=20 OR LTCH=23 THEN RETURN ELSE TCH$=CHR$(TCH+10)
990 IF TCH=20 OR TCH=23 THEN BAU=TCH-10 ELSE BAU=TCH
1000 GOSUB 640
1010 LTCH=TCH
1020 IF TCH=13 THEN TCH=10:CRLF=-1:GOTO 990
1030 IF QBEL AND TCH=39 THEN TCH=7:QBL=-1:GOTO 990