RLE en/decoder.
Appears on
Library tape from the Sinclair Computer Users Society (SINCUS).
Source Code
1 REM QRL by Jack Dohany 2 REM (415)367-7781 3 REM 10-86 4 CLEAR VAL "30399" 5 REM cassette version 6 DIM E$(VAL "20"): LET C1=VAL "0": LET C2=VAL "7" 10 LET STB=VAL "30400": LET BTS=STB+VAL "3": LET ECD=STB+VAL "6": LET DCD=STB+VAL "9": LET CPF=STB+VAL "12": LET INV=STB+VAL "15": LET TLN=STB+VAL "18":: LET WIP=STB+VAL "21": LET LAD=STB+VAL "26" 20 LET menu=VAL "1": LET MV=VAL "11" 30 BORDER C1: PAPER C1: INK C2 35 RANDOMIZE USR BTS 40 LET L=USR TLN: IF NOT menu THEN GO TO VAL "100" 50 GO SUB VAL "500" 100 LET RET=VAL "110": GO TO VAL "400" 110 IF K$="M" OR K$=CHR$ VAL "13" THEN LET MENU=NOT MENU: GO TO VAL "35" 120 IF K$="L" THEN LET C$=" LOAD ": GO TO VAL "200" 125 IF K$="Q" THEN CLEAR VAL "65368": PRINT AT VAL "21",VAL "10";" OK TO RUN ": STOP 130 IF K$="S" THEN LET C$=" SAVE ": GO TO VAL "300" 135 IF K$="C" THEN RANDOMIZE USR BTS: RANDOMIZE USR CPF: GO TO VAL "40" 140 IF K$="I" THEN RANDOMIZE USR INV: GO TO VAL "35" 145 IF K$="E" THEN GO TO VAL "260" 150 IF K$="D" THEN GO TO VAL "270" 155 IF k$="W" THEN GO TO VAL "700" 160 GO TO VAL "100" 190 FOR I=VAL "0" TO VAL "300": NEXT I: BEEP VAL ".01",VAL "25": RETURN 200 INPUT "LOAD FILE OR SCREEN? "; LINE K$: LET RET=VAL "201": GO TO VAL "420" 201 IF k$="F" THEN LET W$=" RLE FILE ": GO TO VAL "220" 202 IF k$="S" THEN LET W$=" SCREEN ": GO TO VAL "240" 203 GO TO VAL "35" 220 GO SUB VAL "290" 222 LOAD n$CODE 37000: RUN 240 GO SUB VAL "290" 242 CLS : LOAD n$CODE VAL "16384" 250 RANDOMIZE USR STB: RUN 260 PRINT FLASH 1;AT mv+VAL "7",VAL "1";" Allow 10 seconds " 261 FOR i=VAL "0" TO VAL "250": NEXT i 265 RANDOMIZE USR BTS: RANDOMIZE USR ECD: RUN 270 CLS : LET GOOD=USR DCD 271 IF NOT GOOD THEN GO TO VAL "280" 272 RANDOMIZE USR STB: RUN 280 PRINT FLASH VAL "1";AT mv+VAL "7",VAL "1";" INVALID RLE FILE ": FOR i=VAL "0" TO VAL "250": NEXT i: RUN 290 INPUT ("";C$;" ";W$;'"Filename: ");N$: IF LEN n$>VAL "10" THEN GO TO VAL "290" 291 RETURN 300 INPUT "SAVE FILE, SCREEN or PROG? "; LINE K$: LET ret=VAL "301": GO TO VAL "420" 301 IF K$="F" THEN LET W$=" RLE FILE ": GO TO VAL "320" 302 IF K$="S" THEN LET W$=" SCREEN ": GO TO VAL "340" 303 IF K$="P" THEN LET W$=" PROGRAM ": GO TO VAL "360" 304 RUN 320 IF NOT L THEN GO TO VAL "280" 322 GO SUB VAL "290": IF n$="" THEN RUN 324 SAVE N$CODE 37000,L: GO TO VAL "380" 340 GO SUB VAL "290": IF n$="" THEN RUN 350 RANDOMIZE USR BTS: SAVE n$CODE VAL "30800",VAL "6144": GO TO VAL "380" 360 GO SUB VAL "290": IF n$="" THEN RUN 364 SAVE N$ LINE VAL "900": BEEP VAL ".01",VAL "10": SAVE N$CODE VAL "30400",VAL "400" 380 CLS : PRINT AT VAL "20",VAL "0";"VERIFY (Y/N) "; FLASH VAL "1";"?" 381 IF INKEY$="" THEN GO TO VAL "381" 382 IF INKEY$="y" OR INKEY$="Y" THEN GO TO VAL "390" 383 IF INKEY$="n" OR INKEY$="N" THEN RUN 384 GO TO VAL "381" 390 CLS : PRINT AT VAL "20",VAL "0";"REWIND/PLAY TO VERIFY ";N$ 392 IF K$="P" THEN VERIFY N$ 394 VERIFY N$CODE : RUN 400 LET K$=INKEY$: IF K$="" THEN GO TO VAL "400" 405 BEEP VAL ".01",VAL "20" 410 IF K$=INKEY$ THEN GO TO VAL "410" 420 IF K$>"Z" THEN LET K$=CHR$ (CODE K$-VAL "32") 430 GO TO RET 500 PAPER C2: INK C1: PRINT AT MV,VAL "0";E$'" MENU DECODE COPY "'E$'" LOAD ENCODE WIPE "'E$'" SAVE INVERT QUIT "'E$'" rle file:";L;TAB VAL "20"'E$' 505 PLOT VAL "3",VAL "171"-MV*VAL "8": DRAW VAL "152",VAL "0": DRAW VAL "0",-VAL "64": DRAW -VAL "152",VAL "0": DRAW VAL "0",VAL "64" 510 PAPER C1: INK C2: RETURN 700 INPUT "Wipe lines (1-192): "; LINE q$: IF q$="" THEN RUN 704 FOR i=VAL "1" TO LEN q$: IF q$(i)<"0" OR q$(i)>"9" THEN RUN 706 NEXT I: LET X=VAL Q$: IF X<VAL "1" OR X>VAL "192" THEN RUN 710 RANDOMIZE USR BTS: FOR B=VAL "2" TO VAL "0" STEP -VAL "1": FOR R=VAL "7" TO VAL "0" STEP -VAL "1": FOR S=VAL "7" TO VAL "0" STEP -VAL "1": LET A=VAL "16384"+(B*VAL "2048")+(S*VAL "256")+(R*VAL "32") 720 POKE LAD+VAL "1",INT (A/VAL "256"): POKE LAD,A-VAL "256"*PEEK (LAD+VAL "1"): RANDOMIZE USR WIP 730 LET X=X-VAL "1": IF X=VAL "0" THEN RANDOMIZE USR STB: GO TO VAL "40" 740 NEXT S: NEXT R: NEXT B: RUN 900 LOAD N$CODE 910 RANDOMIZE USR VAL "30741": REM clear buffers 920 RUN