8-Bit Software Online Conversion

TextFile Reader - Listing

10REM > Scroll 20REM Scrolling text file display 30: 40ver$="1.00b":c$="128" 50MODE&80:h%=31:w%=79:IFHIMEM<&8000:M ODE&83:h%=24 60PROCinit:A$=FNOS`GetEnv:*disp ON 70I%=INSTR(A$," -q"):quit$="":IFI%:qu it$=MID$(A$,INSTR(A$," ",I%+1)+1) 80IFLEFT$(A$,2)="-?":PRINT"Syntax: Sc roll <afsp> (-quit (*)<filename>)":PROCe nd:END 90A$=LEFT$(A$,INSTR(A$+" "," ")-1):ca t%=A$="":IFmax%<2500:PRINT"Not enough me mory to run":PROCend:END 100lp$=FNFindLP 110ON ERROR IFFNerr OR A$<>"":PROCend: END 120IFpr% AND f$<>"":pr%=FALSE:OSCLI"di sp ON":OSCLI"CODE 251":cat%=FNlp(f$):f$= "" 130REPEAT:IFcat%:CLS:PRINT">> Scroll V ersion "ver$" - (C) J.G.Harston Buffer size: &";÷max%;" (";max%;" bytes) <<"': OSCLI".":PRINT'"Press SHIFT-Escape to ex it.":*FX4 140REPEAT:cat%=FALSE:f$=A$:IFf$="":INP UTLINE"File: "f$:IF LEFT$(f$,1)="*":OSCL I"CODE 253":OSCLIf$:OSCLI"CODE 251" 150UNTILLEFT$(f$,1)<>"*":cat%=FNlp(f$) :f$="":UNTILA$<>"" 160PROCend:END 170: 180DEFPROCend:*FX4 190*FX229 200*FX225,1 210*CODE 253 220IFquit$<>"":VDU13:PRINT"Exit"; 230IFLEFT$(quit$,1)="*":OSCLIquit$:END PROC 240I%=INSTR(quit$," "):IFI%:OSCLI"KEY0 |@"+MID$(quit$,I%+1)+"|M":*FX138,0,192 250IFquit$<>"":CHAINquit$ 260ENDPROC 270: 280DEFFNerr:IFERR<>17:REPORT:IFERR<128 AND ERR<>17:PRINT" at line ";ERL; ELSE IFERR<>17:PRINT 290cat%=ERR=17:IFch%:A%=ch%:ch%=0:CLOS E#A% 300=INKEY-1 310: 320DEFPROCinit:cat%=TRUE:ch%=0:pr%=FAL SE:f$="" 330max%=HIMEM-TOP-800:DIM ctrl% 20,dat a% max%+4:end%=data%+max% 340ENDPROC 350: 360DEFFNlp(f$):IFf$="":=FALSE 370ch%=OPENIN(f$):IFch%=0:PRINT"File ' "f$"' not found":=FALSE 380len%=EXT#ch%:IFlen%<max%:CLOSE#ch%: ch%=0:PRINT"Loading";:OSCLI"LOAD "+f$+" "+STR$÷(data%) 390fst%=0:IFch%:PROCgbpb(max%,fst%) 400OSCLI"CODE "+c$ 410top%=data%:PROCpage:*FX4,2 420*FX225,176 430*FX226,128 440*FX227,144 450REPEAT:OSCLI"FX21":REPEATK$=GET$:I% =INSTR(CHR$27+CHR$&8E+CHR$&8F+CHR$&9E+CH R$&9F+CHR$&BB+" AQaq/:"+CHR$&BE+CHR$&BF+ "Pp",K$):UNTILI%:i%=I%AND&F9 460IFi%=8 ANDptr%+1+LEN$ptr%>end% ANDc h%:PROCdown 470IFi%=8 ANDptr%<data%+len% ANDptr%+1 +LEN$ptr%<end%:top%=top%+1+LEN$top%:OSCL I"CODE 0":PRINTSPC(79);:VDU13:OSCLI"CODE "+c$:PRINT$ptr%:ptr%=ptr%+1+LEN$ptr%:PR OCline:UNTIL0 480IFi%=9 ANDtop%-100<data% ANDch%:PRO Cup 490IFi%=9:PROCback:UNTIL0 500IFI%=2 ANDptr%+2000>end% ANDch%:PRO Cdown 510IFI%=2 ANDptr%<data%+len% ANDptr%+1 +LEN$ptr%<end%:top%=ptr%:PROCpage:UNTIL0 520IFI%=3:top%=top%-1000:IFtop%<data%: top%=data% ELSE IFI%=3:top%=top%+1+LEN$t op% 530IFI%=3:PROCpage:UNTIL0 540IFI%=4 ANDch% ANDfst%<len%-max%:fst %=len%-max%:PROCgbpb(max%,fst%) 550IFI%=4 ANDch%:top%=end%-1500:top%=t op%+1+LEN$top%:PROCpage:UNTIL0 560IFI%=4:top%=data%+len%-1500:top%=to p%+1+LEN$top%:PROCpage:UNTIL0 570IFI%=5 ANDch% ANDfst%>0:fst%=0:PROC gbpb(max%,0) 580IFI%=5:top%=data%:PROCpage:UNTIL0 590IF(I%AND&FE)=6:c$=STR$(VALc$EOR32): OSCLI"CODE "+c$:PROCpage:UNTIL0 600IF(I%AND&FE)=16:PROCpr 610UNTILI%=1:*FX229 620*FX225,1 630=TRUE 640: 650DEFPROCpage:CLS:VDU13:ptr%=top%:REP EATPRINT$ptr%:ptr%=ptr%+1+LEN$ptr%:UNTIL VPOS>=h% OR ptr%>=data%+len%:IFVPOS<h%:O SCLI"CODE 0":REPEATPRINTSPC(80);:UNTILVP OS=h%:OSCLI"CODE "+c$ 660IFLEN$ptr%=0 AND ?ptr%<>13 PRINT"** * LF terminated text file.";CHR$13; 670PROCline:ENDPROC 680: 690DEFPROCback:IFtop%<=data%:PROCline: ENDPROC 700t%=top%-100:IFt%<data%:t%=data% 710REPEATt%=t%+1+LEN$t%:UNTILt%+1+LEN$ t%>=top%:IFdata%+1+LEN$data%=top%:t%=dat a% 720top%=t%:t%=ptr%-100:REPEATt%=t%+1+L EN$t%:UNTILt%+1+LEN$t%=ptr%:ptr%=t% 730PRINTCHR$30;CHR$11;CHR$13;$top%;TAB (0,h%);:PROCline:ENDPROC 740: 750DEFPROCdown:IFfst%+max%>=len%:ENDPR OC 760f%=fst%+max%DIV2:IFf%+max%>len%:f%= len%-max% 770off%=f%-fst%:IFoff%=0:ENDPROC 780top%=top%-off%:ptr%=ptr%-off%:fst%= f%:PROCgbpb(max%,fst%):ENDPROC 790: 800DEFPROCup:IFfst%=0:ENDPROC 810f%=fst%-max%DIV2:IFf%-max%<0:f%=0 820off%=f%-fst%:IFoff%=0:ENDPROC 830top%=top%-off%:ptr%=ptr%-off%:fst%= f%:PROCgbpb(max%,fst%):ENDPROC 840: 850DEFPROCline:IFADVAL(-1)=0:OSCLI"COD E 0":PRINT"File: "RIGHT$(f$,30);SPC(30-L ENf$);RIGHT$(" "+STR$(100*(ptr%-data%+fs t%-1)DIVlen%),2);"% Cursors move, P: pr intout, Esc to exit";:VDU13:OSCLI"CODE " +c$ 860ENDPROC 870: 880DEFPROCgbpb(n%,p%):LOCAL A%,X%,Y%:X %=ctrl%:Y%=X%DIV256:A%=3:PRINT"Read"; 890?X%=ch%:X%!1=data%:X%!5=n%:X%!9=p%: CALL&FFD1:data%?max%=13:*FX21 900ENDPROC 910: 920DEFPROCpr:PRINTSPC(79);CHR$13;"Prin t out ";f$;" Printout with *";:IFlp $<>"":FORi%=1TO LENlp$:OSCLI"FX138,0,"+S TR$ASCMID$(lp$,i%):NEXT 930INPUT""lp$:IFlp$="":VDU7:PRINT"No p rintout command found";:A%=INKEY(200):PR OCpage:ENDPROC 940pr%=TRUE:OSCLI"CODE 253":PRINT"Prin ting...";:OSCLIlp$+" "+f$:OSCLI"disp ON" :OSCLI"CODE "+c$:pr%=FALSE:PROCpage 950ENDPROC 960: 970DEFFNFindLP:IFFNi("lp")=1:="lp" 980A%=FNi("%.lp"):IFA%=1:="%.lp" 990IFA%=2:IFFNi("%.lp.#"):="%.lp.#" 1000IFA%=2:IFFNi("%.lp.*"):="%.lp.*" 1010IFFNi("$.lp"):="$.lp" 1020IFFNi(":0.$.lp"):=":0.$.lp" 1030="" 1040DEFFNi(f$):LOCALA%,X%,Y%:$data%=f$: X%=ctrl%:Y%=X%DIV256:A%=5:!X%=data%:=(US R&FFDD)AND&FF 1050: 1060DEFFNOS`GetEnv:LOCALA$,A%,X%,Y% 1070IFINKEY(0)=0:REPEAT A%=INKEY(0):A$= A$+CHR$A%:UNTIL A%=-1:OSCLI"KEY0":=LEFT$ (A$,LENA$-1+(RIGHT$(A$,2)<" ")) 1080IF(INKEY-256 AND &F0)=&A0 AND PAGE> &8000:LOADATN "OS`GetEnv" TO A$:=MID$(A$ ,1+INSTR(A$," ",1+INSTR(A$," ",1 +INSTR( A$," ")))) 1090X%=ctrl%:Y%=X%DIV256:A%=9:?X%=0:X%! 1=data%:!data%=0:CALL&FFD1:IF!data%AND?d ata%+data%?2<>8:data%?(1+?data%)=13:=$(d ata%+1) 1100=""