8-Bit Software Online Conversion
:0.$.Scroll - Listing
20REM Scrolling text file display
30:
40ver$="0.96":c$="128":lp$="lp"
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
100ON ERROR PRINTERL:IF FNerr OR A$<>"
":PROCend:END
110IFpr% AND f$<>"":pr%=FALSE:OSCLI"di
sp ON":OSCLI"CODE 251":cat%=FNlp(f$):f$=
""
120REPEAT: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
130REPEAT:cat%=FALSE:f$=A$:IFf$="":INP
UTLINE"File: "f$:IF LEFT$(f$,1)="*":OSCL
I"CODE 253":OSCLIf$:OSCLI"CODE 251"
140UNTILLEFT$(f$,1)<>"*":cat%=FNlp(f$)
:f$="":UNTILA$<>""
150PROCend:END
160:
170DEFPROCend:*FX4
180*FX229
190*FX225,1
200*CODE 253
210IFquit$<>"":VDU13:PRINT"Exit";
220IFLEFT$(quit$,1)="*":OSCLIquit$:END
PROC
230I%=INSTR(quit$," "):IFI%:OSCLI"KEY0
|@"+MID$(quit$,I%+1)+"|M":*FX138,0,192
240IFquit$<>"":CHAINquit$
250ENDPROC
260:
270DEFFNerr:IFERR<>17:REPORT:IFERR<128
AND ERR<>17:PRINT" at line ";ERL; ELSE
IFERR<>17:PRINT
280cat%=ERR=17:IFch%<>0:A%=ch%:ch%=0:C
LOSE#A%
290=INKEY-1
300:
310DEFPROCinit:cat%=TRUE:ch%=0:pr%=FAL
SE:f$=""
320max%=HIMEM-TOP-600:DIM ctrl% 20,dat
a% max%+2:end%=data%+max%
330ENDPROC
340:
350DEFFNlp(f$):IFf$="":=FALSE
360ch%=OPENIN(f$):IFch%=0:PRINT"File '
"f$"' not found":=FALSE
370len%=EXT#ch%:IFlen%<max%:CLOSE#ch%:
ch%=0:PRINT"Load";:OSCLI"LOAD "+f$+" "+S
TR$÷(data%)
380fst%=0:IFch%:PROCgbpb(max%,fst%)
390OSCLI"CODE "+c$
400top%=data%:PROCpage:*FX4,2
410*FX225,176
420*FX226,128
430*FX227,144
440REPEAT: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
450IFi%=8 ANDptr%+1+LEN$ptr%>end% ANDc
h%:PROCdown
460IFi%=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
470IFi%=9 ANDtop%-100<data% ANDch%:PRO
Cup
480IFi%=9:PROCback:UNTIL0
490IFI%=2 ANDptr%+2000>end% ANDch%:PRO
Cdown
500IFI%=2 ANDptr%<data%+len%:top%=ptr%
:PROCpage:UNTIL0
510IFI%=3:top%=top%-1000:IFtop%<data%:
top%=data% ELSE IFI%=3:top%=top%+1+LEN$t
op%
520IFI%=3:PROCpage:UNTIL0
530IFI%=4 ANDch% ANDfst%<len%-max%:fst
%=len%-max%:PROCgbpb(max%,fst%)
540IFI%=4 ANDch%:top%=end%-1500:top%=t
op%+1+LEN$top%:PROCpage:UNTIL0
550IFI%=4:top%=data%+len%-1500:top%=to
p%+1+LEN$top%:PROCpage:UNTIL0
560IFI%=5 ANDch% ANDfst%>0:fst%=0:PROC
gbpb(max%,0)
570IFI%=5:top%=data%:PROCpage:UNTIL0
580IF(I%AND&FE)=6:c$=STR$(VALc$EOR32):
OSCLI"CODE "+c$:PROCpage:UNTIL0
590IF(I%AND&FE)=16:PROCpr
600UNTILI%=1:*FX229
610*FX225,1
620=TRUE
630:
640DEFPROCpage:CLS:VDU13:ptr%=top%:REP
EATPRINT$ptr%:ptr%=ptr%+1+LEN$ptr%:UNTIL
VPOS=h% OR ptr%>=data%+len%:IFVPOS<h%:OS
CLI"CODE 0":REPEATPRINTSPC(80);:UNTILVPO
S=h%:OSCLI"CODE "+c$
650IFLEN$ptr%=0 AND ?ptr%<>13 PRINT"**
* LF terminated text file.";CHR$13;
660PROCline:ENDPROC
670:
680DEFPROCback:IFtop%<=data%:PROCline:
ENDPROC
690t%=top%-100:IFt%<data%:t%=data%
700REPEATt%=t%+1+LEN$t%:UNTILt%+1+LEN$
t%>=top%:IFdata%+1+LEN$data%=top%:t%=dat
a%
710top%=t%:t%=ptr%-100:REPEATt%=t%+1+L
EN$t%:UNTILt%+1+LEN$t%=ptr%:ptr%=t%
720PRINTCHR$30;CHR$11;CHR$13;$top%;TAB
(0,h%);:PROCline:ENDPROC
730:
740DEFPROCdown:IFfst%+max%=len%:ENDPRO
C
750f%=fst%+max%DIV2:IFf%+max%>len%:f%=
len%-max%
760off%=f%-fst%:IFoff%=0:ENDPROC
770top%=top%-off%:ptr%=ptr%-off%:fst%=
f%:PROCgbpb(max%,fst%):ENDPROC
780:
790DEFPROCup:IFfst%=0:ENDPROC
800f%=fst%-max%DIV2:IFf%-max%<0:f%=0
810off%=f%-fst%:IFoff%=0:ENDPROC
820top%=top%-off%:ptr%=ptr%-off%:fst%=
f%:PROCgbpb(max%,fst%):ENDPROC
830:
840DEFPROCline: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$
850ENDPROC
860:
870DEFPROCgbpb(n%,p%):LOCAL A%,X%,Y%:X
%=ctrl%:Y%=X%DIV256:A%=3:PRINT"Read";
880?X%=ch%:X%!1=data%:X%!5=n%:X%!9=p%:
CALL&FFD1:data%?max%=13:ENDPROC
890:
900DEFPROCpr:PRINTSPC(79);CHR$13;"Prin
t out ";f$;" Default printer is *";
:FORi%=1TO LENlp$:OSCLI"FX138,0,"+STR$AS
CMID$(lp$,i%):NEXT:INPUT""lp$
910pr%=TRUE:OSCLI"CODE 253":PRINT"Prin
ting...";:OSCLIlp$+" "+f$:OSCLI"disp ON"
:OSCLI"CODE "+c$:pr%=FALSE:PROCpage
920ENDPROC
930:
940DEFFNOS`GetEnv:LOCALA$,A%,X%,Y%
950IFINKEY(0)=0:REPEAT A%=INKEY(0):A$=
A$+CHR$A%:UNTIL A%=-1:OSCLI"KEY0":=LEFT$
(A$,LENA$-1+(RIGHT$(A$,2)<" "))
960IF(INKEY-256 AND &F0)=&A0 AND PAGE>
&8000:LOADATN "OS`GetEnv" TO A$:=MID$(A$
,1+INSTR(A$," ",1+INSTR(A$," ",1 +INSTR(
A$," "))))
970X%=ctrl%:Y%=X%DIV256:A%=9:?X%=0:X%!
1=data%:!data%=0:CALL&FFD1:IF!data%:data
%?(1+?data%)=13:=$(data%+1)
980=""