8-Bit Software Online Conversion
:0.$.Scroll - Listing
10REM > Scroll
20REM Scrolling text file display
30PROCxtr:ver$="1.10":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
120X%=ctrl%:Y%=X%DIV256:IFpr% ANDf$<>"
":pr%=FALSE:PROCgo:PROCcon: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%:max%=Max%
280X%=ctrl%:Y%=X%DIV256:ENDPROC
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
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%):PROCcr
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%:ELSEIFi%=8:PROCl
n: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
690PROCln:ENDPROC
700DEFPROCbk:IFtop%<=data%:PROCln:ENDP
ROC
710t%=top%-100:IFt%<data%:t%=data%
720REPEATt%=t%+1+LEN$t%:UNTILt%+1+LEN$
t%>=top%:IFdata%+1+LEN$data%=top%:t%=dat
a%
730top%=t%:t%=ptr%-100:REPEATt%=t%+1+L
EN$t%:UNTILt%+1+LEN$t%=ptr%:ptr%=t%
740VDU30,11,13:PROCp(top%):PRINTTAB(0,
h%);:PROCln:IFptr%+1+LEN$ptr%<data%+len%
:ENDPROC
750t%=top%:n%=h%:REPEAT:t%=t%+1+LEN$t%
:n%=n%-1:UNTILn%<1ORt%>data%+len%-fst%:p
tr%=t%: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-LENRIGHT$(
f$,30))RIGHT$(" "+STR$(100*(ptr%-data%+f
st%-1)DIVlen%),2)"% Cursors move, P: pr
intout, Esc to exit";:VDU13:PROCon
850ENDPROC
860DEFPROCgbpb(n%,p%):A%=3:PRINT"Read"
;
870?X%=ch%:X%!1=data%:X%!5=n%:X%!9=p%+
pt0%:CALL&FFD1:data%!max%=&D0D0D:*FX21
880PROCcr:ENDPROC
890DEFPROCcr:PRINTCHR$13"Wait";:A%=dat
a%:REPEAT
900IF(?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
910A%=A%+1+LEN$A%:IFA%?-2=10:A%=A%-2
920UNTILA%>end% ORA%>data%+len%:ENDPRO
C
930DEFPROCpr:PRINTSPC(79);CHR$13;"Prin
t out ";f$;" Printout with *";:IFlp
$<>"":FORi%=1TO LENlp$+1:OSCLI"FX138,0,"
+STR$ASCMID$(lp$+" ",i%):NEXT
940INPUT""lp$:IFlp$="":VDU7:PRINT"No p
rintout command found";:A%=INKEY(200):PR
OCpg:ENDPROC
950pr%=TRUE:PROCdis:PRINT"Printing..."
;:OSCLIlp$+" "+f$:PROCgo:PROCon:pr%=FALS
E:PROCpg:ENDPROC
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%:$data%=f$:A%=5:!
X%=data%:=(USR&FFDD)AND&FF
1050:
1060DEFFNOS`GetEnv:LOCALA$,A%,X%,Y%:X%=
1:os%=((USR&FFF4)AND&FF00)DIV256
1070IFINKEY(0)=0:REPEAT A%=INKEY(0):A$=
A$+CHR$A%:UNTIL A%=-1:OSCLI"KEY0":=LEFT$
(A$,LENA$-1+(RIGHT$(A$,2)<" "))
1080IFos%=6 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=""
1110:
1120DEFPROCon:IFm%:OSCLI"CODE "+c$
1130ENDPROC
1140DEFPROCoff:IFm%:OSCLI"CODE 0"
1150ENDPROC
1160DEFPROCcon:IFm%:OSCLI"CODE 251"
1170ENDPROC
1180DEFPROCdis:IFm%:OSCLI"CODE 253"
1190ENDPROC
1200DEFPROCgo:IFm%:OSCLI"disp ON":ENDPR
OC
1210PROCc(-1):ENDPROC
1220DEFPROCp(P%):IFm%:PRINT$P%:ENDPROC
1230REPEATPROCc(?P%):P%=P%+1:UNTILP%?-1
=13:ENDPROC
1240DEFPROCasm:m%=os%<>6:IFm%:ONERROR:O
NERROR OFF:PRINT"Can't find *disp":PROCe
nd(FALSE):END
1250ENDPROC
1260DEFPROCxtr:REM
1270PROCreloc(&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
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
1690B%=(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$)
1700A$=A$+B$:UNTILB$="":OSCLI"KEY0 RUN|
M"+A$:OSCLI"FX138,0,192":PAGE=B%:END
1710ENDPROC