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