8-Bit Software Online Conversion
:0.$.Scroll - Listing
10REM > Scroll
20REM Scrolling text file display
30:
40ver$="0.94":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
100ON ERROR IF FNerr OR A$<>"":PROCend
:END
110REPEAT: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
120REPEAT:cat%=FALSE:f$=A$:IFf$="":INP
UT"File: "f$:IF LEFT$(f$,1)="*":OSCLI"CO
DE 253":OSCLIf$:OSCLI"CODE 251"
130UNTILLEFT$(f$,1)<>"*":cat%=FNlp(f$)
:UNTILA$<>""
140PROCend:END
150:
160DEFPROCend:*FX4
170*FX229
180*FX225,1
190*CODE 253
200IFquit$<>"":VDU13:PRINT"Exit";
210IFLEFT$(quit$,1)="*":OSCLIquit$:END
PROC
220IFquit$<>"":CHAINquit$
230ENDPROC
240:
250DEFFNerr:IFERR<>17:REPORT:IFERR<128
AND ERR<>17:PRINT" at line ";ERL; ELSE
IFERR<>17:PRINT
260cat%=(ERR=17):IFch%<>0 THEN A%=ch%:
ch%=0:CLOSE#A%
270=INKEY-1
280:
290DEFPROCinit:cat%=TRUE:ch%=0
300max%=HIMEM-TOP-500:DIM ctrl% 20,dat
a% max%+2:end%=data%+max%
310ENDPROC
320:
330DEFFNlp(f$):IFf$="":=FALSE
340REM Only does loading
350ch%=OPENIN(f$):IFch%=0:PRINT"File '
"f$"' not found":=FALSE
360len%=EXT#ch%:IFlen%<max%:CLOSE#ch%:
ch%=0:PRINT"Load";:OSCLI"LOAD "+f$+" "+S
TR$÷(data%)
370fst%=0:IFch%:PROCgbpb(max%,fst%)
380OSCLI"CODE "+c$
390top%=data%:PROCpage:*FX4,2
400*FX225,176
410*FX226,128
420*FX227,144
430REPEAT:REPEATK$=GET$:I%=INSTR(CHR$2
7+CHR$&8E+CHR$&8F+CHR$&9E+CHR$&9F+CHR$&B
B+" AQaq/:"+CHR$&BE+CHR$&BF,K$):UNTILI%:
i%=I%AND9
440IFi%=8 ANDptr%+1+LEN$ptr%>end% ANDc
h%:PROCdown
450IFi%=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
460IFi%=9 ANDtop%-100<data% ANDch%:PRO
Cup
470IFi%=9:PROCback:UNTIL0
480IFI%=2 ANDptr%+2000>end% ANDch%:PRO
Cdown
490IFI%=2 ANDptr%<data%+len%:top%=ptr%
:PROCpage:UNTIL0
500IFI%=3:top%=top%-1000:IFtop%<data%:
top%=data% ELSE IFI%=3:top%=top%+1+LEN$t
op%
510IFI%=3:PROCpage:UNTIL0
520IFI%=4 ANDch% ANDfst%<len%-max%:fst
%=len%-max%:PROCgbpb(max%,fst%)
530IFI%=4 ANDch%:top%=end%-1500:top%=t
op%+1+LEN$top%:PROCpage:UNTIL0
540IFI%=4:top%=data%+len%-1500:top%=to
p%+1+LEN$top%:PROCpage:UNTIL0
550IFI%=5 ANDch% ANDfst%>0:fst%=0:PROC
gbpb(max%,0)
560IFI%=5:top%=data%:PROCpage:UNTIL0
570IF(I%AND&FE)=6:c$=STR$(VALc$EOR32):
OSCLI"CODE "+c$:PROCpage:UNTIL0
580UNTILI%=1:*FX229
590*FX225,1
600=TRUE
610:
620DEFPROCpage: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$
630PROCline:ENDPROC
640:
650DEFPROCback:IFtop%<=data%:PROCline:
ENDPROC
660t%=top%-100:IFt%<data%:t%=data%
670REPEATt%=t%+1+LEN$t%:UNTILt%+1+LEN$
t%>=top%:IFdata%+1+LEN$data%=top%:t%=dat
a%
680top%=t%:t%=ptr%-100:REPEATt%=t%+1+L
EN$t%:UNTILt%+1+LEN$t%=ptr%:ptr%=t%
690PRINTCHR$30;CHR$11;CHR$13;$top%;TAB
(0,h%);:PROCline:ENDPROC
700:
710DEFPROCdown:IFfst%+max%=len%:ENDPRO
C
720f%=fst%+max%DIV2:IFf%+max%>len%:f%=
len%-max%
730off%=f%-fst%:IFoff%=0:ENDPROC
740top%=top%-off%:ptr%=ptr%-off%:fst%=
f%:PROCgbpb(max%,fst%):ENDPROC
750:
760DEFPROCup:IFfst%=0:ENDPROC
770f%=fst%-max%DIV2:IFf%-max%<0:f%=0
780off%=f%-fst%:IFoff%=0:ENDPROC
790top%=top%-off%:ptr%=ptr%-off%:fst%=
f%:PROCgbpb(max%,fst%):ENDPROC
800:
810DEFPROCline:IFADVAL(-1)=0:OSCLI"COD
E 0":PRINT"File: "RIGHT$(f$,30);SPC(30-L
ENf$);"Cursors move, COPY extends, Esc t
o exit";:VDU13:OSCLI"CODE "+c$
820ENDPROC
830:
840DEFPROCgbpb(n%,p%):LOCAL A%,X%,Y%:X
%=ctrl%:Y%=X%DIV256:A%=3:PRINT"Read";
850?X%=ch%:X%!1=data%:X%!5=n%:X%!9=p%:
CALL&FFD1:data%?max%=13:ENDPROC
860:
870DEFFNOS`GetEnv:LOCALA$,A%,X%,Y%
880IFINKEY(0)=0:REPEAT A%=INKEY(0):A$=
A$+CHR$A%:UNTIL A%=-1:OSCLI"KEY0":=LEFT$
(A$,LENA$-1+(RIGHT$(A$,2)<" "))
890IF(INKEY-256 AND &F0)=&A0 AND PAGE>
&8000:LOADATN "OS`GetEnv" TO A$:=MID$(A$
,1+INSTR(A$," ",1+INSTR(A$," ",1 +INSTR(
A$," "))))
900X%=ctrl%:Y%=X%DIV256:A%=9:?X%=0:X%!
1=data%:!data%=0:CALL&FFD1:IF!data%:data
%?(1+?data%)=13:=$(data%+1)
910=""