8-Bit Software Online Conversion

Textual Filer - Listing

10REM > Filer 20REM Text-based desktop system 50HIMEM=&8000:A%=FNfx(135,0)DIV256:MO DE&80+A%+(A%=7):PROCsz:IFwd%<40:MODE&86: PROCsz 60quit$="":test%=TRUE:ver$="0.15":ONE RROR:REPORT:PROCend:END 70PRINTFNc(1)SPC(wd%DIV2-19)"Textual Filer "ver$" (C)1997 J.G.Harston"SPC(wd% -POS)FNc(0);:PROCInit:A$=FNOS`GetEnv:md$ =FNcl("-m") 80quit$=FNcl(" -q"):Z$=FNcl("-?"):A$= FNcl(" "):IFA$="""""":A$="" 90IFmd$<>"":MODE&80+VALmd$:PROCsz 100exit$="":IFMe$<>"":exit$=" -quit "+ Me$+" -mode "+STR$(FNfx(135,0)DIV256):IF quit$<>"":exit$=exit$+" -quit "+quit$ 110IFINSTR(" "+A$+Z$," -?"):PRINT"Synt ax: Desktop (<dir>) (-quit <fname>)":PRO Cend:END 120PROCChkDate:ONERRORIFFNerr:PROCend 130REPEAT:X%=ctrl%:Y%=X%DIV256:PROCRdD ir:PROCDisp:UNTILFNmenu:PRINT:PROCend 140END 150: 160DEFPROCInit:err%=FALSE:max%=35:DIMc trl%30:X%=ctrl%:Y%=X%DIV256 170DIMdata%80,n$(max%),l%(max%),e%(max %),n%(max%),a%(max%),t%(max%):w$="" 180DIMt$(19):t$(0)="Data":t$(1)="File" :t$(2)="Directory":t$(3)="Application" 190t$(4)="Text":t$(5)="Exec":t$(6)="MC ode":t$(7)="Utility":t$(8)="Basic" 200t$(9)="ROM":t$(10)="Teletext":t$(11 )="Archive":REM Screen? 210ptr%=0:dw%=1:fs%=FNfs:PROCDrv:Path$ =FNp:Me$="":Sc$="":Ar$="":Tr$="" 220FORz%=0TO2:a$=MID$("$.%.",5-2*z%,2) :d$=a$:IFd$="":d$=Path$+"." 230IFMe$="":IFFNfile(a$+FNS,5)=1:Me$=d $+FNS 240IFSc$="":IFFNfile(a$+"Scroll",5)=1: Sc$=d$+"Scroll" 250IFAr$="":IFFNfile(a$+"Archive",5)=1 :Ar$=d$+"Archive" 260IFTr$="":IFFNfile(a$+LEFT$("TreeCop y",10+3*(FNfs=4)),5)=1:Tr$=d$+LEFT$("Tre eCopy",10+3*(FNfs=4)) 270A%=(Me$<>""ANDSc$<>""ANDAr$<>""ANDT r$<>""):IFA%:z%=3 280IFNOTA%ANDz%=0:IFFNfile("%",5)<>2:z %=1 290NEXT:ENDPROC 300: 310DEFPROCon:VDU23,1;0;0;0;0:*FX4,2 320*FX225,128 330ENDPROC 340DEFPROCoff:VDU23,1,1;0;0;0;:*FX4 350*FX225,1 360ENDPROC 370DEFPROCend:PROCoff:PRINTFNc(0);:IFq uit$<>"":PROCos(quit$):END 380END 390DEFFNS=$(PAGE+8) 400DEFFNerr:PRINTFNc(1);TAB(0,y%);SPC( 80);TAB(0,y%-1);:REPORT:PRINTFNc(0); 410A%=INKEY(50):=test%ANDINKEY-1 420: 430DEFFNbyte(A%,X%,Y%)=((USR&FFF4)AND& FF00)DIV256 440DEFFNfx(A%,X%):LOCALY%:Y%=X%DIV256: =((USR&FFF4)AND&FFFF00)DIV256 450DEFFNfile(A$,A%):$data%=A$:?X%=data %:X%?1=data%DIV256:=(USR&FFDD)AND&FF 460DEFFNgbpb(A%):X%!1=data%:CALL&FFD1: A%=data%+((A%<>5)AND(1+?data%)):A%?(1+?A %)=13:=$(A%+1) 470DEFFNfs:LOCALA%,Y%,E%:=(USR&FFDA)AN D&FF 480DEFFNtime:A%=14:?X%=0:CALL&FFF1:IF? X%:X%?24=13:=$X% ELSE ="" 490DEFFNDofW(d$):=0 500DEFFNh(A%,N%)=RIGHT$("0000000"+STR$ ÷A%,N%) 510DEFFNd(A%,N%)=RIGHT$("0000000"+STR$ A%,N%) 520DEFFNu(A$):LOCALA%,B$:FORA%=1TOLENA $:B$=B$+CHR$(ASCMID$(A$,A%,1)+32*(MID$(A $,A%,1)>"£")):NEXT:=LEFT$(B$,LENA$) 530DEFFNp:IFFNfs=4:OSCLI"DIR$":="$" 540LOCALn$,p$:A%=6:REPEAT 550X%!1=data%:CALL&FFD1:?(data%+2+?dat a%+?(data%+?data%+1))=13:n$=$(data%+2+?d ata%):*DIR ^ 560n$=LEFT$(n$,INSTR(n$+" "," ")-1):p$ =n$+"."+p$:UNTILn$="$" 570p$=LEFT$(p$,LENp$-1):OSCLI"DIR "+p$ :=p$ 580DEFFNOS`GetEnv:A$="":IFINKEY(0)=0:R EPEATA%=INKEY(0):A$=A$+CHR$A%:UNTILA%=-1 :OSCLI"KEY0":=LEFT$(A$,LENA$-1+(RIGHT$(A $,2)<" ")) 590IF(INKEY-256 AND&F0)=&A0 ANDPAGE>&8 000:LOADATN"OS`GetEnv"TOA$:=MID$(A$,1+IN STR(A$," ",1+INSTR(A$," ",1+INSTR(A$," " )))) 600A%=9:?X%=0:X%!1=data%:!data%=0:CALL &FFD1:IF!data%AND?data%+data%?2<>8:data% ?(1+?data%)=13:=$(data%+1) 610IF?&FFF7=&6C:A$=$&780:$&780="":=A$ 620="" 630DEFFNcl(l$):LOCALI%:IFASCl$=32 AND A$<>"":A$=" "+A$ 640I%=INSTR(A$,l$):l$="":IFI%:l$=MID$( A$,INSTR(A$," ",I%+1)+1):IFMID$(A$,I%,1) <>" ":l$=LEFT$(l$,INSTR(l$," ")-1) 650IFI%:IFMID$(A$,I%,1)=" ":A$=LEFT$(A $,I%-1) ELSE IFI%:A$=MID$(A$,INSTR(A$,l$ )+1+LENl$) 660=l$ 670: 680DEFPROCos(A$):IFLEFT$(A$,1)="*":OSC LIA$:ENDPROC 690I%=INSTR(A$," "):IFI%:PROCKey("|@"+ MID$(A$,I%+1)) 700CHAINA$:ENDPROC 710DEFPROCKey(A$):OSCLI"Key0"+A$:OSCLI "FX138,0,192":ENDPROC 720DEFFNs(A$)=LEFT$(A$,INSTR(A$+" "," ")-1) 730DEFFNget(P%,V%):LOCALp%,v%,A$:p%=PO S:v%=VPOS:REPEATPRINTTAB(P%,V%);MID$(FNt ime,17);TAB(p%,v%);:A$=INKEY$(100):UNTIL A$<>"":=A$ 740DEFPROCsz:wd%=FNbyte(160,10,0)-FNby te(160,8,0)+1:ht%=FNbyte(160,9,0)-FNbyte (160,11,0)+1:ENDPROC 750DEFFNc(A%):COLOUR7AND(A%=0):COLOUR1 28+(7AND(A%<>0)):="" 760: 770DEFPROCChkDate:A$=FNtime:IFA$<>"" A NDMID$(A$,5,2)<>"00" AND A$<>"Fri,31 Dec 1999.23:59:59":ENDPROC 780INPUT" Enter the date (DD/MM/YY): " d$:IFINSTR(d$," ")=0 AND d$<>"":d$=d$+" 0"+STR$FNday(d$) 790IFFNfs=16:OSCLI"HSETDATE "+d$ 800INPUTLINE" Enter the time (HH:MM): "t$:IFt$<>"":TIME=(60*INTVALt$+VALRIGHT$ (t$,2))*60*100 810ENDPROC 820DEFFNday(d$):d%=VALd$:m%=VALMID$(d$ ,INSTR(d$,"/")+1):y%=1900+VALRIGHT$(d$,2 ):IFy%<1980:y%=y%+100 830y%=y%MOD400:=(y%*365.25+m%*30+d%+VA LMID$("120112234455",m%,1)+((y%MOD4)=0)- ((y%-1)DIV100)-(m%>2 AND((y%MOD4)=0 AND( y%MOD100)<>0 ORy%=0))+3)MOD7+1 840: 850DEFPROCDrv:Dir$=FNs(FNgbpb(6)):data %?(1+?data%)=13:Drive$=FNs($(data%+1)):D isk$=FNs(FNgbpb(5)):A%=FNfs:I%=1+INSTR(" 00405060816",STR$A%)DIV2:FS$=MID$("DISKN ETHADFS"+STR$A%,VALMID$("110105110908",I %*2-1,2),VALMID$("543545",I%,1)):ENDPROC 860DEFPROCRdDir:IFerr%:ENDPROC 870err%=TRUE:IFFNfs<>fs%:PROCDrv:Path$ =FNp 880p%=0:n%=0:sel%=0:fs%=FNfs:REPEAT 890X%!1=data%:X%!5=1:X%!9=p%:A%=8:CALL &FFD1 900p%=X%!9:r%=X%!5:IFr%=0:PROCRdName:n %=n%+1 910UNTILr%=1ORn%>max%:err%=FALSE:ENDPR OC 920DEFPROCRdName:data%?(1+?data%)=13:f $=FNs($(data%+1)):IFASCf$=46:n%=n%-1:END PROC 930n$(n%)=f$:X%!14=0:t%(n%)=FNfile(f$, 5) 940l%(n%)=X%!2:e%(n%)=X%!6:n%(n%)=X%!1 0:a%(n%)=X%!14AND(-129OR(fs%<>8)) 950IFt%(n%)=2:IFLEFT$(f$,1)="!":t%(n%) =3:ENDPROC ELSEIFt%(n%)=2:ENDPROC 960IF(X%!2ORX%!6)=0OR(X%!3AND&FFFFFF)= &FFFFFD:t%(n%)=0:ENDPROC 970IF(X%!2AND&FFFF)=&8000 OR(X%!3AND&F FFFFF)=&FFFBBC:t%(n%)=9:ENDPROC 980IF(X%!3AND&FFFFFF)=&FFFFFF:t%(n%)=4 :ENDPROC 990IF(X%!3AND&FFF)=&FFBOR((X%!4AND&FFF F)=(X%!8AND&FFFF)AND((X%?2=0AND(X%?7AND& 80)=&80)OR(X%!2<X%!6ANDX%?7<&80 ANDX%!2+ X%!10-X%!6<&200 ANDX%!10>&200 ANDX%?3>&1 F))):t%(n%)=8:ENDPROC 1000IFX%!6=TRUE:t%(n%)=5:ENDPROC 1010IFX%?3>&0F ANDX%?3<&7C:t%(n%)=6:END PROC 1020IF(X%!4AND&FFFF)=(X%!8AND&FFFF)AND( (X%?3AND&F8)=8ORX%?3=&DD):t%(n%)=7:ENDPR OC 1030IF(X%!3AND&FFFFFF)=&FFFF7C:t%(n%)=1 0:ENDPROC 1040ENDPROC 1050: 1060DEFFNa(A%,T%):LOCALA$:IF(A%AND128)A ND(fs%<>5):A$="P" 1070IFT%=2:A$=A$+"D" 1080IF(A%AND8):A$=A$+"L" 1090IFT%=2:=LEFT$(A$+"/ ",7) 1100IF(A%AND5)=4:A$=A$+"E" 1110IF(A%AND2):A$=A$+"W" 1120IF(A%AND1):A$=A$+"R" 1130A$=A$+"/":IF(A%AND80)=64:A$=A$+"E" 1140IF(A%AND32):A$=A$+"W" 1150IF(A%AND16):A$=A$+"R" 1160=LEFT$(A$+" ",7) 1170DEFFNdt(A%):A%=(A%AND&FFFF00)DIV256 :IFA%=0:="00/00/0000" 1180=FNd(A%AND31,2)+"/"+FNd((A%AND&F00) DIV256,2)+"/"+FNd(1981+((A%AND&F000)DIV& 1000)+(A%AND&E0)DIV2,4) 1190DEFFNat(p%):PRINTTAB((wd%DIVx%)*(p% MODx%),1-(wd%<80)+p%DIVx%);:="" 1200DEFFNat2(p%):PRINTTAB(sz%+(wd%DIVx% )*(p%MODx%),1-(wd%<80)+p%DIVx%);:="" 1210DEFPROCpr(z%):PRINT" "FNc(t%(z%)AND &10000);LEFT$(n$(z%)+" ",10); 1220IF(dw%AND4):PRINT" "FNh(l%(z%),8)" "FNh(e%(z%),8)" "FNh(n%(z%),6); 1230IF(dw%AND1):PRINT" "FNa(a%(z%),t%(z %)AND&FF); 1240IF(dw%AND4):PRINT" "FNdt(a%(z%)); 1250IF(dw%AND2):PRINT" "LEFT$(t$(t%(z%) AND&FF)+" ",9); 1260PRINTFNc(0);SPC((dw%AND2)+2+((dw%AN D3)=1)-(dw%=2));:IFPOS>(wd%-14)OR(dw%AND 4)PRINT 1270ENDPROC 1280: 1290DEFPROCDisp:IF(dw%AND7)>1 ANDwd%<80 :dw%=dw%AND1 1300PRINTFNc(0);:CLS:PRINTFNc(1)LEFT$(" Drive "+Drive$,-80*(Drive$<>""))SPC((70 -wd%/2)-LEN(LEFT$(FS$+Disk$+Path$,57+22* (wd%<80)))DIV2)RIGHT$(FS$+"::"+Disk$+"." +Path$,60+22*(wd%<80))SPC(wd%-POS)FNc(0) ; 1310IFerr%:VDU11:REPORT:PRINT:n%=0ELSEI Fn%=0:PRINT"Empty" ELSE z%=0:REPEATPROCp r(z%):z%=z%+1:UNTILz%=n% OR VPOS=ht%-3:I FPOS:PRINT 1320y%=VPOS:IFptr%>=n%:ptr%=n%-1 1330PRINTFNc(1)" Access, Copy, Delete, Expand, Goto, "SPC((wd%<80)AND4)"cHange drive, Load, Move, New dir"LEFT$("ectory ",-6*(wd%>40))","SPC(4+((wd%<80)AND2))"O S Command, Quit, Rename, setType, Up,"SP C(1-(wd%<80)); 1340PRINT"siZe, RETURN=Run, *"SPC(wd%-P OS)FNc(0);:sz%=11+8*(dw%AND1)+5*(dw%AND2 )+9*(dw%AND4):x%=wd%DIV(sz%+1):IFw$<>"" ANDerr%=0:err%=TRUE:OSCLI"."+w$:err%=FAL SE 1350ENDPROC 1360: 1370DEFFNmenu:err%=FALSE:PROCon:B$="!!" :REPEAT:REPEATPRINTFNat(ptr%);:ptr%=ptr% +(VPOS>ht%-4):UNTILVPOS<ht%-3 1380IFn%:PRINTFNat(ptr%)">"FNat2(ptr%)" <";:REM TAB(0,y%)FNc(1)" "t$(t%(ptr%)AND &FFFF)" "n$(ptr%)SPC(wd%-POS)FNc(0); 1390PRINTFNc(1);:REPEATA$=FNget(wd%-9,0 ):IFA$>"£" ANDA$<"¼":A$=CHR$(ASCA$-32) 1400IFA$="^":A$="U" 1410IFn%=0 AND INSTR("ACDLMOPRST  1420UNTILINSTR("*ACDEGHLMNOPQRSTUWZ ,1):PRINTFNc(0);:IFn%=0:ptr%=0 1430IFINSTR("  ="    1440IF(INSTR("ACDMORTS",A$)ANDsel%<1)OR (A$=CHR$13 AND((t%(ptr%)AND&10000)=0)):t %(ptr%)=t%(ptr%)OR&10000:PRINTFNat(ptr%) ;:PROCpr(ptr%):sel%=sel%+1:IFA$=CHR$13:A $="!" 1450IFINSTR(CHR$1+CHR$3,A$):FORz%=0TOn% -1:t%(z%)=(t%(ptr%)AND&FFFF)OR((A$=CHR$1 )AND&10000):NEXT:sel%=n%AND(A$=CHR$1):PR OCDisp:A$="!" 1460IFA$=CHR$13 AND B$<>CHR$13+CHR$13:A $="!" 1470IFA$=" " AND(t%(ptr%)AND&10000):t%( ptr%)=t%(ptr%)AND&FFFF:PRINTFNat(ptr%);: PROCpr(ptr%):sel%=sel%-1 1480IFINSTR("LR",A$)ANDsel%>1:A$="!" 1490IFA$="Z":dw%=VALMID$("125..7.0",dw% +1,1):PROCDisp:A$="!" 1500IFA$="W":PROCw:INPUT"Output window: "w$:A$="!":PROCDisp:PROCon 1510IFA$="E":dw%=7:PROCDisp:A$="!" 1520UNTILINSTR("!  1530PROCw:IFB$=CHR$13+CHR$13 ANDsel%=1: PROCRun(""):=0 1540IFA$=CHR$13:=0 1550IFA$="O":INPUT"*"A$:PRINTTAB(0,y%)" "A$" "f$;" ";:INPUT""a$:PRINTFNc(0);:PR OCdo(A$):A$="*" 1560IFA$="*":REPEATINPUTLINE"*"A$:PRINT FNc(0);:OSCLIA$:UNTILA$="":=0 1570I%=INSTR("ACDGHLMNQRSTU",A$):PRINTM ID$("Set Access ofCopyDeleteGoto directo ryChange to driveLoadMoveNew directoryQu itRenameStampSetType ofGo Up",VALMID$("* 01141824385357617478848999",I%*2,2),VALM ID$("*13040614150404130406051005",I%*2,2 ));" "; 1580IFINSTR("ACDLMRST",A$):PRINTf$;:IFI NSTR("ACLMRT",A$):PRINT" to "; 1590a$="!":IFINSTR("QU",A$)=0:INPUT""a$ :VDU11 1600PROCon:IFA$="A":PROCdo("Access"):=0 1610IFINSTR("CM",A$):PROCCopy(A$="M"):= 0 1620IFA$="D":PROCdo("Delete"):=0 1630IFA$="G":PROCGoto(a$):=0 1640IFA$="H":PROCGoto(MID$(":"+a$,1-(LE FT$(a$,1)=":"))):=0 1650IFA$="L":PROCLoad:=0 1660IFA$="S":PROCdo("!Stamp"):=0 1670IFa$="":=0 1680IFA$="N":OSCLI"CDir "+a$:=0 1690IFA$="R":OSCLI"Rename "+f$+" "+a$:= 0 1700IFA$="S":PROCdo("!Stamp"):=0 1710IFA$="T":PROCdo("!SetType"):=0 1720IFA$="U":PROCUp:=0 1730=A$="Q" 1740DEFPROCw:PRINTTAB(0,y%);FNc(1);SPC( wd%)FNc(0)SPC(80+(wd%MOD80))TAB(1,y%);FN c(1);:PROCoff:ENDPROC 1750: 1760DEFPROCCall(N$,A$,B$):IFA$<>"":PROC os(A$+" "+B$+exit$) ELSE PRINTCHR$13;" ' "N$"' not available"SPC(wd%-POS);CHR$13; :A%=INKEY(50) 1770ENDPROC 1780: 1790DEFPROCRun(a$):PRINTTAB(0,y%)FNc(1) " Select "f$" "a$FNc(0);:T%=t%(ptr%)AND& FF:PROCoff 1800IFT%=2:PROCDir(f$):ENDPROC 1810IFT%=4:PROCCall("Scroll",Sc$,f$):EN DPROC 1820IFT%=5:OSCLI"Exec "+f$:END 1830IF(T%AND&FE)=6:OSCLI"Run "+f$+" "+a $:ENDPROC 1840IFT%=8 AND(l%(ptr%)AND&FFF00)=&FFB0 0:PROCCall("",f$,a$):ENDPROC 1850IFT%=8 ANDe%(ptr%)=&7B00:OSCLI"Run "+f$+" "+a$:ENDPROC 1860IFT%=8:CHAINf$:ENDPROC 1870IFT%=9:PROCKey("/SrLoad "+f$+" I|MC H."""+Me$+"""|M"):END 1880IFT%=10:REM Teletext 1890IFT%=11:PROCCall("Archive",Ar$,f$): ENDPROC 1900ENDPROC 1910: 1920DEFPROCLoad:PRINTTAB(0,y%)FNc(1)" L oad "f$" to "a$;FNc(0);:T%=t%(ptr%)AND&F F:PROCoff:a$=FNu(a$) 1930IFa$="VIEW"ORa$="WORD":T%=4 1940IFa$="BASIC":T%=8 1950IF(T%AND&FE)=4 ANDa$="":PROCKey("LO AD "+f$+"|M"):*WORD 1960IF(T%AND&FE)=4:PROCKey("READ "+f$+" |M"):*WORD 1970IFT%=1OR(T%AND&FE)=6:OSCLI"Load "+f $+" "+a$:ENDPROC 1980IFT%=8:PROCKey("LOAD"""+f$+"""|F|M" ):VDU21:END 1990ENDPROC 2000: 2010DEFPROCDir(f$):OSCLI"DIR "+f$:IFLEN f$=1 ANDINSTR("$%&",f$):Path$="" 2020PROCDrv:Path$=Path$+"."+Dir$:IFLEFT $(Path$,1)=".":Path$=MID$(Path$,2) 2030ENDPROC 2040: 2050DEFPROCUp:OSCLI"DIR ^":IFINSTR(Path $,"."):REPEATPath$=LEFT$(Path$,LENPath$- 1):UNTILRIGHT$(Path$,1)=".":Path$=LEFT$( Path$,LENPath$-1) 2060ENDPROC 2070: 2080DEFPROCGoto(a$):IFLEFT$(a$,1)="-":I %=INSTR(a$,"-",2):IFI%:a$=MID$(a$,2,I%-2 )+":"+MID$(a$,I%+1) 2090fs$="":I%=INSTR(a$,":",2):IFI%:fs$= LEFT$(a$,I%-1):a$=MID$(a$,I%+1) 2100fs%=0:OSCLIfs$:OSCLI"Dir "+a$:ENDPR OC 2110: 2120DEFPROCdo(A$):IFA$="":PROCRun(a$):E NDPROC 2130FORz%=0TOn%-1:A%=t%(z%)AND&10000:IF A%:IFLEFT$(A$,1)="!":A%=EVAL("FN"+MID$(A $,2))ELSEIFA%:OSCLIA$+" "+n$(z%)+" "+a$ 2140NEXT:ENDPROC 2150: 2160DEFFNStamp:PRINTTAB(0,0)"Stamp ";n$ (z%):=0 2170: 2180DEFFNSetType:REM A%=FNfile(n$(z%),5 ) 2190ctrl%!2=&FFF00000+&100*EVAL("&"+a$) :A%=FNfile(n$(z%),2):=0 2200: 2210DEFFNRename:OSCLI"Rename "+n$(z%)+" "+a$+"."+n$(z%):=0 2220: 2230DEFFNCopy:OSCLI"Copy "+n$(z%)+" "+a $+"."+n$(z%):IFMv%:OSCLI"Delete "+n$(z%) 2240=0 2250: 2260DEFPROCCopy(Mv%):IFa$="":a$=w$:PRIN TTAB(10+LENf$,y%)a$;:INPUT" "A$:IFA$<>"" :ENDPROC 2270IFMv%ANDINSTR(a$,":")=0:PROCdo("!Re name"):ENDPROC 2280IFsel%>1OR(t%(ptr%)AND&FF)<>2:PROCd o("!Copy"):ENDPROC 2290PROCCall("TreeCopy",Tr$,f$+" "+a$+" ."+f$+" A÷C"+LEFT$("÷",1+Mv%)+"DEF÷PR÷S" ):ENDPROC 2300REM A do All dfs directories 2310REM ÷C No Confirm 2320REM ?D Delete after copying 2330REM E Expand into dfs directories 2340REM F Force overwriting 2350REM ÷P No Pause 2360REM R Recurse 2370REM ÷S Not put dfs directories into Subdirectories 2380REM ?U copy User account informatio n