8-Bit Software Online Conversion
:0.%.Scroll - Listing
10REM > Scroll
20REM Scrolling text file display
30PROCxtr:A$=FNOS`GetEnv:ver$="1.11":
c$="128"
40MODE&83:h%=24:w%=79:IFHIMEM>&4000:M
ODE&80:h%=31
50PROCinit:lp$=FNcl("-l"):tt$=FNcl("-
4"):ch$=FNcl("-c"):pl$=FNcl("-p")
60quit$=FNcl(" -q"):Z$=FNcl("-?"):A$=
FNcl(" "):PROCasm:PROCgo
70IFINSTR(" "+A$+Z$," -?"):PRINT"Synt
ax: Scroll (-lp <fname>) (-4 <fname>) <a
fsp>|-chan <num>+<ext> (-plen <num>) (-q
uit <fname>)":PROCend(FALSE):END
80IFA$="""""":A$=""
90cat%=A$+ch$="":IFmax%<2500:PRINT"No
t enough memory to run":PROCend(FALSE):E
ND
100IFlp$="":lp$=FNFindLP
110plen%=66:IFpl$<>"":plen%=VALpl$
120ONERROR IFFNerr OR A$<>"":PROCend(F
ALSE):END
130X%=ctrl%:Y%=X%DIV256:IFpr% ANDf$<>"
":pr%=FALSE:PROCgo:PROCcon:cat%=FNlp(f$)
:f$=""
140REPEAT: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
150REPEAT:cat%=FALSE:f$=A$:IFf$+ch$=""
:INPUTLINE"File: "f$:IFLEFT$(f$,1)="*":P
ROCdis:OSCLIf$:PROCcon
160UNTILLEFT$(f$,1)<>"*":cat%=FNlp:f$=
"":UNTILA$<>""
170PROCend(FALSE):END
180:
190DEFPROCend(F%):PROCcl:*FX4
200*FX229
210*FX225,1
220PROCdis:IFF%:ENDPROC
230IFquit$<>"":VDU13:PRINT"Exit";:PROC
os(quit$)
240ENDPROC
250DEFFNerr:IFERR<>17:REPORT:IFERR<128
AND ERR<>17:PRINT" at line ";ERL; ELSE
IFERR<>17:PRINT
260cat%=ERR=17:PROCcl:=INKEY-1
270DEFPROCinit:cat%=TRUE:ch%=0:pr%=FAL
SE:f$=""
280Max%=HIMEM-LOMEM-900:DIMctrl%20,dat
a% Max%+4:end%=data%+Max%:max%=Max%
290X%=ctrl%:Y%=X%DIV256:ENDPROC
300DEFFNcl(l$):LOCAL I%:IFASCl$=32 AND
A$<>"":A$=" "+A$
310I%=INSTR(A$,l$):l$="":IFI%:l$=MID$(
A$,INSTR(A$," ",I%+1)+1):IFMID$(A$,I%,1)
<>" ":l$=LEFT$(l$,INSTR(l$," ")-1)
320IFI%:IFMID$(A$,I%,1)=" ":A$=LEFT$(A
$,I%-1) ELSE IFI%:A$=MID$(A$,INSTR(A$,l$
)+1+LENl$)
330=l$
340DEFPROCcl:IFch%:A%=ch%:ch%=0:CLOSE#
A%
350ENDPROC
360DEFPROCos(c$):IFASCc$=42ORc$="":OSC
LIc$:ENDPROC ELSE CHAINc$:ENDPROC
370DEFFNlp:len%=0:IFf$+ch$="":=FALSE
380IFch$<>"":len%=INSTR(ch$,"+"):ch%=V
ALLEFT$(ch$,len%-1):len%=EVALMID$(ch$,le
n%+1)
390IFch$="":ch%=OPENIN(f$):IFch%=0:PRI
NT"File '"f$"' not found":=FALSE
400len%=(EXT#ch% AND(len%=0))+len%:pt0
%=PTR#ch%:IFlen%<max% ANDch$="":CLOSE#ch
%:ch%=0:PRINT"Loading";:OSCLI"LOAD "+f$+
" "+STR$÷data%:PROCcr
410fst%=0:IFch%:PROCgbpb(max%,fst%)
420PROCon:top%=data%:PROCpg:*FX4,2
430*FX225,176
440*FX226,128
450*FX227,144
460REPEATOSCLI"FX15":REPEATK$=GET$:I%=
INSTR(CHR$27+CHR$&8E+CHR$&8F+CHR$&9E+CHR
$&9F+CHR$&BB+" AQaq/:"+CHR$&BE+CHR$&BF+"
Pp4",K$):UNTILI%:i%=I%AND&F9
470IFi%=8 ANDptr%+1+LEN$ptr%>end% ANDc
h%:PROCdn
480IFi%=8 ANDptr%<data%+len% ANDptr%+1
+LEN$ptr%<end%:top%=top%+1+LEN$top%:PROC
off:PRINTSPC(79);:VDU13:PROCon:PROCp(ptr
%):ptr%=ptr%+1+LEN$ptr%:ELSEIFi%=8:PROCl
n:UNTIL0
490IFi%=9 ANDtop%-100<data% ANDch%:PRO
Cup
500IFi%=9:PROCbk:UNTIL0
510IFI%=2 ANDptr%+2000>end% ANDch%:PRO
Cdn
520IFI%=2 ANDptr%<data%+len% ANDptr%+1
+LEN$ptr%<end%:top%=ptr%:PROCpg:UNTIL0
530IFI%=3:top%=top%-1000:IFtop%<data%:
top%=data% ELSE IFI%=3:top%=top%+1+LEN$t
op%
540IFI%=3:PROCpg:UNTIL0
550IFI%=4 ANDch% ANDfst%<len%-max%:fst
%=len%-max%:PROCgbpb(max%,fst%)
560IFI%=4 ANDch%:top%=end%-1500:top%=t
op%+1+LEN$top%:PROCpg:UNTIL0
570IFI%=4:top%=data%+len%-1500:top%=to
p%+1+LEN$top%:PROCpg:UNTIL0
580IFI%=5 ANDch% ANDfst%>0:fst%=0:PROC
gbpb(max%,0)
590IFI%=5:top%=data%:PROCpg:UNTIL0
600IF(I%AND&FE)=6:c$=STR$(VALc$EOR32):
PROCon:PROCpg:UNTIL0
610IF(I%AND&FE)=16:PROCpr
620IFI%=18 ANDtt$<>"":PROCend(TRUE):PR
INT"Mode7";:PROCos(tt$+" "+f$)
630UNTILI%=1:*FX229
640*FX225,1
650=TRUE
660:
670DEFPROCpg:CLS:VDU13:ptr%=top%:REPEA
TPROCp(ptr%):ptr%=ptr%+1+LEN$ptr%:UNTILV
POS>=h% ORptr%>=data%+len% ORptr%>=end%:
IFVPOS<h%:PROCoff:REPEATPRINTSPC(80);:UN
TILVPOS=h%:PROCon
680PROCln:ENDPROC
690DEFPROCbk:IFtop%<=data%:PROCln:ENDP
ROC
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%
730VDU30,11,13:PROCp(top%):PRINTTAB(0,
h%);:PROCln:IFptr%+1+LEN$ptr%<data%+len%
:ENDPROC
740t%=top%:n%=h%:REPEAT:t%=t%+1+LEN$t%
:n%=n%-1:UNTILn%<1ORt%>data%+len%-fst%:p
tr%=t%:ENDPROC
750DEFPROCdn:IFfst%+max%>=len%:ENDPROC
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
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
830DEFPROCln:IFADVAL(-1)=0:PROCoff:PRI
NT"File: "RIGHT$(f$,30)SPC(30-LENRIGHT$(
f$,30))RIGHT$(" "+STR$(100*(ptr%-data%+f
st%-1)DIVlen%),2)"% Cursors move, P: pr
intout, Esc to exit";:VDU13:PROCon
840ENDPROC
850DEFPROCgbpb(n%,p%):A%=3:PRINT"Read"
;
860?X%=ch%:X%!1=data%:X%!5=n%:X%!9=p%+
pt0%:CALL&FFD1:data%!max%=&D0D0D:*FX21
870PROCcr:ENDPROC
880DEFPROCcr:PRINTCHR$13"Wait";:A%=dat
a%:REPEAT
890IF(?A%=10 AND A%?1=13)OR(?A%=13 AND
A%?1=10):?A%=32:A%?1=13:A%=A%+1 ELSE IF
?A%=10:?A%=13
900A%=A%+1+LEN$A%:IFA%?-2=10:A%=A%-2
910UNTILA%>end% ORA%>data%+len%:ENDPRO
C
920DEFPROCpr:PRINTSPC(79);CHR$13;"Prin
t out ";f$;" Printout with *";:IFlp
$<>"":FORi%=1TO LENlp$+1:OSCLI"FX138,0,"
+STR$ASCMID$(lp$+" ",i%):NEXT
930INPUT""lp$:IFlp$="":VDU7:PRINT"No p
rintout command found";:A%=INKEY(200):PR
OCpg:ENDPROC
940pr%=TRUE:PROCdis:PRINT"Printing..."
;:OSCLIlp$+" "+f$:PROCgo:PROCon:pr%=FALS
E:PROCpg:ENDPROC
950:
960DEFFNFindLP:IFFNi("lp")=1:="lp"
970A%=FNi("%.lp"):IFA%=1:="%.lp"
980IFA%=2:IFFNi("%.lp.#"):="%.lp.#"
990IFA%=2:IFFNi("%.lp.*"):="%.lp.*"
1000IFFNi("$.lp"):="$.lp"
1010IFFNi(":0.$.lp"):=":0.$.lp"
1020=""
1030DEFFNi(f$):LOCALA%:$data%=f$:A%=5:!
X%=data%:=(USR&FFDD)AND&FF
1040:
1050DEFFNOS`GetEnv:LOCALA$:A%=0::X%=1:o
s%=((USR&FFF4)AND&FF00)DIV256
1060IFos%=6ANDPAGE>&8000:LOADATN"OS`Get
Env"TOA$:A$=MID$(A$,1+INSTR(A$," "))
1070IFos%=32:A$=$&100
1080IFLENA$=0:IF?(TOP-3):A$=$&600 ELSE
IFLENA$=0:=$&3800
1090A%=INSTR(A$+" "," "):run$=LEFT$(A$,
A%-1):=MID$(A$,A%+1)
1100:
1110DEFPROCon:IFm%:OSCLI"CODE "+c$
1120ENDPROC
1130DEFPROCoff:IFm%:OSCLI"CODE 0"
1140ENDPROC
1150DEFPROCcon:IFm%:OSCLI"CODE 251"
1160ENDPROC
1170DEFPROCdis:IFm%:OSCLI"CODE 253"
1180ENDPROC
1190DEFPROCgo:IFm%:OSCLI"disp ON":ENDPR
OC
1200PROCc(-1):ENDPROC
1210DEFPROCp(P%):IFm%:PRINT$P%:ENDPROC
1220REPEATPROCc(?P%):P%=P%+1:UNTILP%?-1
=13:ENDPROC
1230DEFPROCasm:m%=os%<>6:IFm%:ONERROR:O
NERROR OFF:PRINT"Can't find *disp":PROCe
nd(FALSE):END
1240ENDPROC
1250DEFPROCxtr:REM
1260IF(INKEY-256 AND&F0)=&A0:ENDPROC EL
SE IF?(TOP-3):$&700=$&600
1270PROCreloc(&500,3):A%=PAGE:REPEATA%=
A%+1+LEN$A%:I%=INSTR($A%,CHR$&DD+CHR$&F2
+"xtr:"):UNTILI%:A%!(I%+5)=!(TOP-3+2*(?(
TOP-3)=0)):LOMEM=A%+I%+8-2*(?(TOP-3)=0):
IF?(TOP-3):$&600=$&700:ENDPROC ELSE ENDP
ROC
1280ENDPROC:REM Last line MUST end with
ENDPROC
1290DEFPROCc(A%):IFA%<0:flg%=0:out%=1:E
NDPROC
1300IFA%<32:PROCctrl(A%):ENDPROC
1310IFflg%>127:PROCflg(A%):ENDPROC
1320out%=out%+1:IFA%=32:A%=9
1330IFflg%=0:VDU A% ELSE PROCout(A%)
1340ENDPROC
1350DEFPROCctrl(A%)
1360IFA%=9:FORz%=(out%AND 7)TO 7:PROCc(
32):NEXT:ENDPROC
1370IFA%=13 OR A%=10:PRINT:out%=1:ENDPR
OC
1380IFA%=28:flg%=flg%EOR 1:ENDPROC:REM
Underline
1390IFA%=29:flg%=flg%OR 128:ENDPROC:REM
Wait for next character
1400ENDPROC
1410DEFPROCflg(A%):flg%=flg%AND 127:IFA
%<65 OR A%>126:ENDPROC
1420b%=0:a%=A%<96:A%=A% AND &DF
1430IFA%=ASC"B":b%=&FD
1440IFA%=ASC"H":b%=&BF
1450IFA%=ASC"I":b%=&F7
1460IFA%=ASC"Q":b%=&BB:REM Almost
1470IFA%=ASC"S":b%=&EF
1480IFA%=ASC"W":b%=&FB
1490IFA%=ASC"X":b%=&BB
1500IFA%=ASC"Y":b%=&DF
1510IFb%=0:PRINT"(";CHR$A%;")";:ENDPROC
1520flg%=(flg%AND b%)OR(a% AND (b% EOR
255)):ENDPROC
1530DEFPROCout(C%):IFC%=9:C%=32
1540LOCAL z%,a%:A%=10:?X%=C%:CALL &FFF1
1550IF(flg%AND 1):X%?8=255:REM or X%?8
EOR 255
1560IF(flg%AND 2):FOR z%=1 TO 8:X%?z%=X
%?z% OR(X%?z% DIV 2):NEXT
1570IF(flg%AND 8):X%?1=X%?1 DIV4:X%?2=X
%?2 DIV4:X%?3=X%?3 DIV2:X%?4=X%?4 DIV2:X
%?7=X%?7*2:X%?8=X%?8*2
1580IF(flg%AND 48):X%?2=X%?3:X%?3=X%?5:
X%?4=X%?6:X%?5=X%?7:X%!6=0
1590IF(flg%AND 32):X%!8=X%!5:X%!4=X%!1:
X%?1=0:X%?2=0:X%?3=0
1600REM Sub/Super need a bit of modific
ation
1610IF(flg%AND 4):FORz%=1 TO 8:?(X%+9+z
%)=X%?z%:X%?z%=(X%?z% AND 128)+(X%?z% AN
D 128)DIV 2+(X%?z% AND 64)DIV 2+(X%?z% A
ND 64)DIV4+(X%?z% AND 32)DIV 4+(X%?z% AN
D 32)DIV 8+(X%?z% AND 16)DIV 8+(X%?z% AN
D 16)DIV 16:NEXT:PROCoutB
1620IF(flg%AND 4):FORz%=1 TO 8:X%?z%=?(
X%+z%+9):X%?z%=(X%?z% AND 1)+(X%?z% AND
1)*2+(X%?z% AND 2)*2+(X%?z% AND 2)*4+(X%
?z% AND 4)*4+(X%?z% AND 4)*8+(X%?z% AND
8)*8+(X%?z% AND 8)*16:NEXT
1630PROCoutB:ENDPROC
1640DEFPROCoutB
1650IF(flg%AND 68)=68:VDU 23,255:FORz%=
5 TO 8:VDU X%?z%,X%?z%:NEXT:VDU 10,255,8
,11:FORz%=7 TO 0 STEP -2:?(X%+z%+1)=?(X%
+1+z%DIV2):?(X%+z%)=?(X%+1+z%DIV2):NEXT
1660IF(flg%AND 68)=64:VDU 23,255:FORz%=
1 TO 4:VDU X%?z%,X%?z%:NEXT:VDU 11,255,8
,10:FORz%=0 TO 7 STEP 2:?(X%+z%+1)=?(X%+
5+z%DIV2):?(X%+z%+2)=?(X%+5+z%DIV2):NEXT
1670VDU 23,255:FORz%=1 TO 8:VDUX%?z%:NE
XT:VDU 255:ENDPROC
1680DEFPROCreloc(S%,X%):A%=133:X%=X%OR&
80:A%=(USR&FFF4 AND&FFFF00)DIV256:IFA%-L
OMEM>S%:ENDPROC
1690$&700=$&600:B%=(PAGE+(A%-LOMEM-S%))
AND&FF00:PRINT"Relocating to &";÷B%:FORA
%=0TO LOMEM-PAGE+4 STEP4:A%!B%=A%!PAGE:N
EXT:C$="":REPEATB$=INKEY$(0):IFB$<" " AN
D B$<>"":B$="|"+CHR$(64+ASCB$)
1700C$=C$+B$:UNTILB$="":OSCLI"KEY0 RUN|
M"+C$:OSCLI"FX138,0,192":PAGE=B%:$&600=$
&700:END
1710ENDPROC