10
20 os%=FNfx(0,1)AND&FF:VDU10,8:A%=POS:VDU13:IFA%<50:MODE&87:IFHIMEM>&7C00:MODE&83:IFHIMEM>&4000:MODE&80
30 IFHIMEM<&FFFF:HIMEM=FNfx(132,0)
40 PROCinit:PROChdr:PRINT:ONERRORIFFNerr:END
50 curr%=-1:REPEAT:fs%=FNfs:X%=ctrl%:Y%=X%DIV256:IFPOS:PRINT
60 VDU8:wdt%=POS+1:PRINT
70 IFdrv$="":PRINTCHR$(D%+48)">";ELSEPRINT"["drv$"]";
80 csd%=home%:INPUTLINE" "A$:PROCdo(FNs(A$))
90 UNTIL0
100 DEFPROCinit:ver$="1.31a"
110 DIMctrl% 127,name% 255,thisdir% 63,bitmap% 63,object% 63,dir% &3FF,alloc% &3FF,data% &3FF
120 D%=0:drv$="":path$="":title$="":csd%=0:home%=0:valid$="SJ Research":res%=0
130 opt%=0:fullinf%=TRUE:d$=".":s$="/":IFos%AND-24:d$="/":s$=".":IFos%AND-32:d$="\"
140 cmd$=":MOUNT:DIR:CAT:EX:INFO:TYPE:DUMP:COPY:BLOCK:INF:HELP:QUIT:"
150 hlp$=":<drive>|<image>:<dir>|&<blocknum>:::(<file>):<file> [CTRLS]:<file> [7BIT]:<source> <dest> (<opts>):<blocknum>:FULL|SHORT:::<opts>:"
160 ENDPROC
170 DEFPROChdr:PRINT"SJFiler v"ver$" by J.G.Harston":ENDPROC
180 DEFFNerr:OSCLI"FX229":IFPOS:PRINT
190 REPORT:IFFNfs<>fs%:OSCLI"FX143,18,"+STR$fs%
200 PROCCloseAll:A%=ERR<>17ANDERR<>28:PRINTLEFT$(" at line "+STR$ERL,ERR<128ANDA%):=INKEY-1ANDA%
210 DEFPROCCloseAll
220 out%=out%:IFout%:A%=out%:out%=0:CLOSE#A%
230 dsk%=dsk%:IFdsk%:A%=dsk%:dsk%=0:CLOSE#A%
240 ENDPROC
250 DEFPROCdo(A$):IFA$="?":A$="HELP"
260 IFLEFT$(A$,1)=";"ORA$="":ENDPROC
270 IFLEFT$(A$,1)="*":OSCLIMID$(A$,2):ENDPROC
280 IFLEFT$(A$,1)=".":A$="CAT "+MID$(A$,2)
290 A%=INSTR(A$+" "," "):B$=FNuc(LEFT$(A$,A%-1)):A$=FNs(MID$(A$,A%+1))
300 IFLENB$=1ANDINSTR("01234567",B$):drv$="":D%=VALB$AND(((os%<6)OR3)AND7):home%=0:ENDPROC
310 A%=INSTR(cmd$,":"+B$+":"):IFA%=0:PRINT"Bad command":ENDPROC
320 A%=EVAL("FN_"+B$+"(A$)"):ENDPROC
330 DEFFNsyn(S$):IFA$="":PRINT"Syntax: "B$" "S$:=TRUEELSE=FALSE
340 DEFFN_QUIT(A$):PRINT"Quit"
350 ONERROREND
360 IFos%>5:*QUIT
370 END
380 DEFFN_HELP(A$):PROChdr:p%=2:q%=2:REPEAT
390 A%=INSTR(cmd$,":",p%):PRINTSPC2MID$(cmd$,p%,A%-p%);:p%=A%+1
400 A%=INSTR(hlp$,":",q%):PRINTTAB(8)MID$(hlp$,q%,A%-q%):q%=A%+1
410 UNTILp%>LENcmd$:=0
420 DEFFN_OPT(A$):IFA$="":PRINT"OPT=";opt%'"1:"'"2:"'"4:"'"8:":=0
430 opt%=VAL(A$):=0
440 DEFFN_INF(A$):IFA$="":PRINT"Output "LEFT$("FULL",fullinf%);LEFT$("SHORT",NOTfullinf%)" .inf info":=0
450 fullinf%=FNuc(A$)="S":=0
460 DEFFN_MOUNT(A$):home%=0:IFLENA$<2:PROCdo(A$):=0ELSEdrv$=FNs(A$):D%=-1:=0
470 DEFFN_CAT(A$):PROCLstDir(0):=0
480 DEFFN_EX(A$):PROCLstDir(1):=0
490 DEFFN_DIR(A$):curr%=-1:IFFNsyn("<dir>|&<blocknum>"):=TRUE
500 IFLEFT$(A$,1)="&":csd%=0:A%=FNMount:home%=EVAL(FNuc(A$)):thisdir%!31=home%*256:path$="&"+FNh0(home%,6):=0
510 IFINSTR(A$,".")+INSTR(A$,"^"):PRINT"DIR <Unsupported>":=TRUE
520 IFA$="$":csd%=0:A%=FNMount:home%=root%:path$="$":=0
530 IFFNlook:=TRUE
540 IF(fptr%?&17AND&20)=0:PRINT"'"src$"' not a directory":=TRUE
550 FORA%=0TO63STEP4:thisdir%!A%=ptr%!A%:NEXT
560 path$=LEFT$(path$+".",ptr%?1<>37)+$(ptr%+1):home%=thisdir%!32AND&FFFF
570 =0
580 DEFFN_BLOCK(A$):IFFNsyn("<blocknum>"):=TRUE
590 blk%=EVAL("&"+FNuc(A$)):PROCRdBlocks(data%,blk%,D%,1):O%=data%:ln%=1024:PROCdump(FALSE)
600 =0
610 DEFFN_DUMP(A$):IFFNsyn("<fsp>"):=TRUE
620 IFFNlook:=TRUE
630 PROCdump(TRUE)
640 =0
650 DEFPROCdump(F%):cols%=16:IFwdt%<80:cols%=8
660 FORP%=0TOln%-1STEPcols%:B$=""
670 PRINTFNh0(P%,6)" ";:IFF%:IF(P%AND&3FF)=0:PROCReadData(P%):O%=data%
680 FORQ%=P%TOP%+cols%-1:IFQ%<ln%:PRINTFNh0(?O%,2)" ";ELSE?O%=32:PRINTSPC3;
690 A$=CHR$(?O%AND&7F):IFA$>=" "ANDA$<="~" B$=B$+A$ELSEB$=B$+"."
700 O%=O%+1:NEXT:PRINTB$:NEXT:ENDPROC
710 DEFFN_TYPE(A$):IFFNsyn("<fsp>"):=TRUE
720 msk%=INSTR(A$," [")<>0:msk%=(msk%AND&80)OR&7F:src$=LEFT$(A$,INSTR(A$+" "," ")-1)
730 IFFNlook:=TRUE
740 last%=0:FORP%=0TOln%-1:IF(P%AND&3FF)=0:PROCReadData(P%):O%=data%
750 Q%=?O%ANDmsk%:IFmsk%=255:VDUQ%ELSEIFQ%=10ORQ%=13ORQ%>31VDUQ%
760 IF(Q%=10ORQ%=13)ANDQ%<>last%:VDU23-Q%
770 IFQ%=9:PRINTSPC(8-(POSMOD8));
780 last%=?O%:O%=O%+1:NEXT:IFPOS:PRINT
790 =0
800 DEFFN_INFO(A$)
810 IFA$="":IFFNMount:=TRUE
820 IFA$="":PRINT"Disk: MDFS::"title$
830 IFA$="":PRINT"Root: &"FNh0(root%,6)" Size: &"FNh0(dsize%,6)" CrDate: "FNdate(idate%)" "FNtime(itime%):=0
840 IFFNlook:=TRUE
850 fptr%=object%:x%=0:PROCListFile(1)
860 FORp%=0TO31STEP2:PRINTFNh0(object%?p%,2);FNh0(object%?(p%+1),2)" ";:NEXT:PRINTCHR$8
870 FORp%=32TO63STEP2:PRINTFNh0(object%!p%,4)" ";:NEXT:PRINTCHR$8
880 =0
890 DEFFN_COPY(A$):IFFNsyn("<mdfs source> (inf:)<host dest> (<C>onfirm)"):=TRUE
900 A%=INSTR(A$+" "," "):src$=LEFT$(A$,A%-1):dst$=FNs(MID$(A$,A%+1))
910 cnf%=FNuc(RIGHT$(dst$,2))=" C":IFcnf%:dst$=FNs(LEFT$(dst$,LENdst$-2))
920 inf%=FNuc(LEFT$(dst$,4))="INF:":IFinf%:dst$=MID$(dst$,5)
930 IFdst$="":PRINT"<dest> missing":=TRUE
940 IFos%<6:IFINSTR(dst$,"::")ORLEFT$(dst$,1)="-":PRINT"FS prefix unsupported":=TRUE
950 A$=src$:IFA$<>"$":IFFNlook:=TRUE
960 IFsrc$="$":csd%=0:A%=FNMount:ptr%=thisdir%:IFA%<0:=TRUE
970 cblk%=ptr%
980 IF((object%?&17)AND&20)=0:fptr%=object%:leaf$=src$:PROCCopyOneFile(src$,dst$):=0
990 A%=FNfile(dst$,8):dst$=dst$+d$
1000 PROCCopyDirectory(dst$)
1010 IFsrc$="$":load%=0:exec%=0:length%=&200:attr%=8:mdate%=idate%:mtime%=itime%:cdate%=idate%:ctime%=itime%ELSEPROCFileInfo(thisdir%)
1020 PROCSetInfo(LEFT$(dst$,LENdst$-1))
1030 =0
1040 DEFPROCCopyDirectory(dst$):LOCALentry%,bit%,fptr%
1050 FORA%=0TO63STEP4:thisdir%!A%=cblk%!A%:NEXT
1060 ptr%=32:cblk%=thisdir%!ptr%AND&FFFF
1070 PROCRdDir:PROCRdBitMap
1080 bit%=?bitmap%DIV2:fptr%=dir%+64
1090 entry%=1:REPEAT
1100 IF(entry%AND7)=0:bit%=bitmap%?(entry%DIV8)
1110 IF(entry%AND15)=0:ptr%=ptr%+2:cblk%=thisdir%!ptr%AND&FFFF:IFcblk%:PROCRdDir:fptr%=dir%
1120 IF(bit%AND1)<>0:PROCCopyObject
1130 bit%=bit%DIV2:fptr%=fptr%+64
1140 entry%=entry%+1:UNTILentry%>255
1150 ENDPROC
1160 DEFPROCCopyObject:LOCALptr%,bit%,old_cblk%,thisdir$,bitmap$,object$
1170 PROCFileInfo(fptr%):IFfname$="":ENDPROC
1180 IFcnf%:PRINT"Copy "fname$;:cnf%=FNyna(cnf%):IFcnf%>0:PRINT:ENDPROCELSEVDU13
1190 leaf$=fname$:fname$=FNfn_todos(fname$)
1200 IF(access%AND&20)=0:PROCCopyOneFile(fname$,dst$+fname$):ENDPROC
1210 PRINT"Copying "fname$;SPC(10-LENfname$)" to "dst$+fname$
1220 old_cblk%=cblk%
1230 FORA%=0TO63:thisdir$=thisdir$+CHR$thisdir%?A%:NEXT
1240 FORA%=0TO63:bitmap$ =bitmap$ +CHR$bitmap%?A%:NEXT
1250 FORA%=0TO63:object$ =object$ +CHR$fptr%?A%:NEXT
1260 cblk%=fptr%
1270 A%=FNfile(dst$+fname$,8)
1280 PROCCopyDirectory(dst$+fname$+d$)
1290 FORA%=0TO63:object%?A%=ASCMID$(object$,A%+1):NEXT
1300 PROCFileInfo(object%):PROCSetInfo(dst$+fname$)
1310 FORA%=0TO63:thisdir%?A%=ASCMID$(thisdir$,A%+1):NEXT
1320 FORA%=0TO63:bitmap%?A% =ASCMID$(bitmap$ ,A%+1):NEXT
1330 cblk%=old_cblk%:PROCRdDir
1340 ENDPROC
1350 DEFPROCCopyOneFile(src$,dst$):LOCALcblk%
1360 PRINT"Copying "src$;SPC(10-LENsrc$)" to "dst$;SPC4;
1370 FORA%=0TO63STEP4:object%!A%=fptr%!A%:NEXT
1380 PROCFileInfo(object%):IFFNfile(dst$,5):X%!14=&33:A%=FNfile(dst$,4)
1390 X%!2=load%:X%!6=exec%:X%!10=0:X%!14=length%:A%=FNfile(dst$,7)
1400 IFlength%:PROCCopyData
1410 PROCSetInfo(dst$):PRINTSTRING$(3,CHR$127)
1420 ENDPROC
1430 DEFPROCCopyData
1440 out%=FNf_openout(dst$):P%=0:REPEAT:PROCReadData(P%)
1450 IF(P%AND1023)=0:PRINTSTRING$(3,CHR$8)FNd0(100*P%DIVlength%,2)"%";
1460 num%=1024:IFP%+num%>length%:num%=length%-P%
1470 PROCgbpb(2,out%,data%,num%,0):P%=P%+1024:UNTILP%>length%
1480 CLOSE#out%:out%=0:ENDPROC
1490 DEFPROCSetInfo(dst$):X%!2=load%:X%!6=exec%:X%!10=length%:X%!14=attr%:A%=FNfile(dst$,1)
1500 A$=leaf$+STRING$(11-LENleaf$," ")+FNh0(load%,8)+" "+FNh0(exec%,8)+" "+FNh0(length%,8)
1510 IFfullinf%:A$=A$+" "+FNh0(attr%AND255,2)+" "+FNh0(mdate%,4)+" "+FNh0(mtime%,6)
1520 IFfullinf%:A$=A$+" "+FNh0(cdate%,4)+" "+FNh0(ctime%,6)+" "+FNh0(acc%,4)+" "+FNh0(aux%,4)
1530 A$=A$+CHR$13+CHR$10
1540 IFinf%:out%=OPENOUT(dst$+s$+"inf"):FORp%=1TOLENA$:BPUT#out%,ASCMID$(A$,p%,1):NEXT:CLOSE#out%:out%=0
1550 IFfs%<>5:ENDPROC
1560 A%=FNNetFS_Op(19,CHR$4+CHR$access%+dst$)
1570 X%!8=cdate%:A%=FNNetFS_OpN(19,5,10,dst$)
1580 IFFNNetFS_Op(18,CHR$64+dst$):ENDPROC
1590 X%!8=cdate%:X%!10=ctime%:X%!13=mdate%:X%!15=mtime%
1600 A%=FNNetFS_OpN(19,64,18,dst$)
1610 A%=FNNetFS_Op(0,"ACCOUNT "+dst$+" "+STR$~acc%+" ("+STR$~aux%+")")
1620 ENDPROC
1630 DEFPROCLstDir(cflg%):x%=0:IFFNMount:PRINT"Not an MDFS disk":ENDPROC
1640 PRINT"Path: MDFS::"title$"."path$'
1650 ptr%=32:cblk%=thisdir%!ptr%AND&FFFF
1660 PROCRdDir:PROCRdBitMap
1670 bit%=?bitmap%DIV2:fptr%=dir%+64
1680 FORentry%=1TO255
1690 IF(entry%AND7)=0:bit%=bitmap%?(entry%DIV8)
1700 IF(entry%AND15)=0:ptr%=ptr%+2:cblk%=thisdir%!ptr%AND&FFFF:IFcblk%:PROCRdDir:fptr%=dir%
1710 IF(bit%AND1)<>0THENPROCListFile(cflg%)
1720 bit%=bit%DIV2:fptr%=fptr%+64:NEXTentry%
1730 IF(x%AND3):IF(cflg%AND1)=0:PRINT
1740 ENDPROC
1750 DEFPROCListFile(cflg%)
1760 PROCFileInfo(fptr%):PRINTfname$;SPC(11-LENfname$);
1770 IF(cflg%AND1):PRINTFNh0(load%,8)" "FNh0(exec%,8)" "FNh0(length%,6)" ";
1780 PRINTFNattr(access%);
1790 IF(cflg%AND1):PRINTFNdate(cdate%)" "FNdate(mdate%)" "FNtime(mtime%)" ";
1800 IF(cflg%AND1):PRINTFNh0(acc%,3)" ("FNh0(aux%,3)")":ENDPROC
1810 x%=x%+1:IFx%<(wdt%+1)DIV20:PRINT" ";ELSEx%=0:PRINT
1820 ENDPROC
1830 DEFFNattr(A%):A$=""
1840 IF(A%AND1):A$="r"+A$
1850 IF(A%AND2):A$="w"+A$
1860 A$="/"+A$
1870 IF(A%AND4):A$="R"+A$
1880 IF(A%AND8):A$="W"+A$
1890 IF(A%AND16):A$="L"+A$
1900 IF(A%AND32):A$="D"+A$
1910 IF(A%AND64):A$="P"+A$
1920 IF(A%AND128):A$="M"+A$
1930 =A$+STRING$(8-LENA$," ")
1940 DEFFNdate(A%)=FNd0(A%AND31,2)+"/"+FNd0((A%DIV256)AND15,2)+"/"+FNd0(1981+(A%DIV4096)+((A%AND&E0)/2),2)
1950 DEFFNtime(A%)=FNd0(A%AND255,2)+":"+FNd0(A%DIV256,2)
1960 DEFFNlook:src$=A$:ptr%=FNfind(src$):IFptr%=0:PRINT"'"src$"' not found":=TRUE
1970 FORA%=0TO63STEP4:object%!A%=ptr%!A%:NEXT
1980 ln%=object%!&14AND&FFFFFF:=FALSE
1990 DEFFNfind(A$):match$=FNuc(LEFT$(A$,10)):match%=0:IFFNMount:=0
2000 ptr%=32:cblk%=thisdir%!ptr%AND&FFFF
2010 IFLEFT$(match$,1)="%":cblk%=0
2020 PROCRdDir:PROCRdBitMap
2030 IFcblk%=0:!bitmap%=&FFFF
2040 bit%=?bitmap%DIV2:fptr%=dir%+64
2050 entry%=1:REPEAT
2060 IF(entry%AND7)=0:bit%=bitmap%?(entry%DIV8)
2070 IF(entry%AND15)=0:ptr%=ptr%+2:cblk%=thisdir%!ptr%AND&FFFF:IFcblk%:PROCRdDir:fptr%=dir%
2080 IF(bit%AND1)<>0THENfptr%?11=13:fname$=$(fptr%+1)+CHR$0:match%=(FNuc(LEFT$(fname$,INSTR(fname$,CHR$0)-1))=match$)
2090 IFNOTmatch%:bit%=bit%DIV2:fptr%=fptr%+64:entry%=entry%+1
2100 UNTILentry%>((cblk%<>0AND&FF)OR&0F)ORmatch%
2110 IFmatch%:=fptr%ELSE=0
2120 DEFPROCFileInfo(f%)
2130 A%=f%?&B:f%?&B=13:fname$=FNs($(f%+1)):f%?&B=A%
2140 FORA%=1TOLENfname$:IFMID$(fname$,A%,1)<"!"ORMID$(fname$,A%,1)>"~":fname$=""
2150 NEXTA%
2160 acc%=?f%:load%=f%!&C:exec%=f%!&10
2170 length%=f%!&14AND&FFFFFF
2180 access%=f%?&17
2190 cdate%=f%!&18AND&FFFF:ctime%=0
2200 mdate%=f%!&1AAND&FFFF:mtime%=f%!&1CAND&FFFF
2210 aux%=f%?&1E:vec%=f%?&1FAND1
2220 acc%=acc%OR(f%?&1FAND&0E)*128
2230 aux%=aux%OR(f%?&1FAND&70)*8
2240 attr%=(access%AND3)*16+(access%AND&C)/4+(access%AND16)/2+mdate%*256
2250 ENDPROC
2260 DEFPROCRdDir:IFcurr%=cblk%:ENDPROC
2270 PROCRdBlocks(dir%,cblk%,D%,1):curr%=cblk%:ENDPROC
2280 DEFPROCRdBitMap:FORA%=0TO63STEP4:bitmap%!A%=dir%!A%:NEXT:ENDPROC
2290 DEFFNMount:IFcsd%:=0
2300 curr%=-1:res%=0:data%!&40=0:PROCRdBlocks(data%,0,D%,1)
2310 IFerr%=-2:PRINT"Disk error: image file not found":=-2
2320 data%?(&40+LENvalid$)=13:IF$(data%+&40)<>valid$:res%=1:PROCRdBlocks(data%,0,D%,1)
2330 data%?(&40+LENvalid$)=13:IF$(data%+&40)<>valid$:=-5
2340 FORA%=0TO63STEP4:thisdir%!A%=data%!A%:NEXT:path$="$":root%=thisdir%!32AND&FFFF
2350 data%?&61=13:title$=$(data%+&57):dsize%=data%!&62AND&FFFF
2360 idate%=data%!&7AAND&FFFF:itime%=data%!&7CAND&FFFFFF
2370 home%=root%:csd%=home%
2380 =0
2390 DEFPROCReadData(ptr%):LOCALp%:vec%=object%?&1FAND1
2400 IFvec%=0:p%=32+(ptr%DIV1024)*2:cblk%=object%!p%AND&FFFF:PROCRdBlocks(data%,cblk%,D%,1):ENDPROC
2410 p%=32+(ptr%DIV(512*1024))*2
2420 cblk%=object%!p%AND&FFFF
2430 PROCRdBlocks(alloc%,cblk%,D%,1)
2440 p%=(ptr%AND(512*1024-1))
2450 p%=(p%DIV1024)*2
2460 cblk%=alloc%!p%AND&FFFF
2470 PROCRdBlocks(data%,cblk%,D%,1)
2480 ENDPROC
2490 DEFPROCRdBlocks(addr%,block%,drive%,number%):LOCALp%
2500 err%=0:FORp%=0TOnumber%-1:PROCfdcRd(addr%+p%*1024,block%+res%+p%,drive%,1)
2510 NEXT:ENDPROC
2520 DEFPROCfdcRd(ad%,sc%,drv%,nm%)
2530 FORA%=0TO1023STEP4:ad%!A%=0:NEXT:drv%=drv%AND-5:IFdrv%>7:err%=-1:ENDPROC
2540 IFdrv$="":REPEAT:PROCfdcOp(1):ad%=ad%+1024:sc%=sc%+1:nm%=nm%-1:UNTILnm%<1:ENDPROC
2550 dsk%=FNf_openin(drv$):IFdsk%=0:err%=-2:ENDPROC
2560 IFsc%*1024>EXT#dsk%:CLOSE#dsk%:dsk%=0:err%=-3:PRINT"Disk error: past end of image":ENDPROC
2570 PROCgbpb(3,dsk%,ad%,nm%*1024,sc%*1024):CLOSE#dsk%:dsk%=0
2580 ENDPROC
2590 DEFPROCfdcOp(op%)
2600 IFos%=6:trk%=sc%DIV5:hd%=trk%AND1:trk%=trk%DIV2:sec%=sc%MOD5:SYS"XADFS_DiscOp",,op%,((trk%*2+hd%)*5+sec%)*1024+0+((drv%AND3)<<29),ad%,1024TOerr%
2610 IFos%<6:IFop%=1:trk%=sc%DIV5:trk%=trk%DIV2+80*(trk%AND1):err%=FNscsi(addr%,&08,drv%OR4,trk%*16+sc%MOD5,1)
2620 IFcsd%=0:ENDPROC
2630 IFerr%:IFPOS:PRINT
2640 IFerr%=-1:PRINT"Unsupported":ENDPROC
2650 IFerr%:PRINT"Disk error &"FNh0(err%,2)" at ";drv%":"FNh0(sc%,6)
2660 ENDPROC
2670 DEFFNfn_todos(A$):LOCALB%:IF(os%AND-32)=0:=A$
2680 FORA%=1TOLENA$:B%=INSTR("/?<>+=;\",MID$(A$,A%,1)):IFB%:A$=LEFT$(A$,A%-1)+MID$(".#$^&@%~",B%,1)+MID$(A$,A%+1)
2690 NEXT:=A$
2700 DEFFNyna(A%):IFA%=0:=0
2710 PRINT"? (Y/N/A)";:REPEAT:A%=INSTR("YAN",CHR$(GETAND&DF)):UNTILA%
2720 PRINTSTRING$(7,CHR$127);MID$("YesAllNo ",A%*3-2,3);:=A%-2
2730 DEFFNscsi(addr%,cmd%,drv%,sect%,num%):LOCALfs%
2740 fs%=FNfs:IFfs%<>8:*FADFS
2750 X%?0=0:X%!1=addr%:X%?5=cmd%:X%?6=drv%*32+((sect%AND&1F0000)DIV65536)
2760 X%?7=((sect%AND&FF00)DIV256):X%?8=sect%:X%!9=num%:X%!11=0
2770 A%=&72:CALL&FFF1:A%=?X%:IFfs%<>8:OSCLI"FX143,18,"+STR$fs%
2780 =A%
2790 DEFFNfx(A%,X%):LOCALY%:Y%=X%DIV256:=((USR&FFF4)AND&FFFF00)DIV256
2800 DEFFNh0(A%,N%):=RIGHT$("0000000"+STR$~A%,N%)
2810 DEFFNd0(A%,N%):=RIGHT$("00000000"+STR$A%,N%)
2820 DEFFNs(A$):IFLEFT$(A$,1)=" ":REPEATA$=MID$(A$,2):UNTILLEFT$(A$,1)<>" "
2830 IFRIGHT$(A$,1)=" ":REPEATA$=LEFT$(A$,LENA$-1):UNTILRIGHT$(A$,1)<>" "
2840 =A$
2850 DEFFNuc(A$):LOCALB$:IFA$="":=""
2860 REPEATB$=B$+CHR$(ASCA$AND((A$<"@")OR&DF)):A$=MID$(A$,2):UNTILA$="":=B$
2870 DEFFNfile(A$,A%):IFA%-8:IFPAGE<&FFFFF:$name%=A$:?X%=name%:X%?1=name%DIV256:=(USR&FFDD)AND&FF
2880 A$=FNf_name(A$):IFA%=255ORA%=5:X%!14=OPENIN(A$):IFX%!14:X%!10=EXT#X%!14:CLOSE#X%!14:X%!14=&33
2890 IFA%=255:IFX%?6=0:OSCLI"LOAD """+A$+""" "+STR$~X%!2:=1
2900 IFA%=5:IFX%!14:=1ELSEIFA%=5:=0
2910 IFA%=0:OSCLI"SAVE """+A$+""" "+STR$~X%!10+" "+STR$~X%!14:X%!10=X%!14-X%!10:=1
2920 IFA%=7:OSCLI"SAVE """+A$+""" "+STR$~PAGE+"+"+STR$~X%!10:X%!10=X%!14-X%!10:=1
2930 IFA%-8:=0
2940 IF(os%AND-24):A$="mkdir "+A$ELSEA$="cdir "+A$
2950 IFHIMEM>&FFFF:LOCALERROR:ONERRORLOCAL:=0
2960 OSCLIA$:=2
2970 DEFPROCgbpb(A%,chn%,addr%,num%,ptr%)
2980 ?X%=chn%:X%!1=addr%:X%!5=num%:X%!9=ptr%:IFPAGE<&FFFFF:CALL&FFD1:ENDPROC
2990 IFA%=1ORA%=3:PTR#?X%=X%!9
3000 REPEAT:IFA%=1ORA%=2:BPUT#?X%,?X%!1ELSEIFA%=3ORA%=4:?X%!1=BGET#?X%
3010 X%!1=X%!1+1:X%!5=X%!5-1:UNTIL(EOF#?X%ANDA%>2)ORX%!5<1:ENDPROC
3020 DEFFNfs:IF(os%AND-32)=0:LOCALA%,Y%,E%:=(USR&FFDA)AND&FF
3030 =29
3040 DEFFNf_openin(A$)=OPENIN(FNf_name(A$))
3050 DEFFNf_openout(A$)=OPENOUT(FNf_name(A$))
3060 DEFFNf_name(A$):IFos%AND-32:LOCALA%,B%:REPEATB%=A%:A%=INSTR(A$,"\",A%+1):UNTILA%=0:IFINSTR(A$,".",B%)=0:A$=A$+"."
3070 =A$
3080 DEFFNNetFS_Op(A%,A$)=FNNetFS_OpN(A%,0,7,A$)
3090 DEFFNNetFS_OpN(A%,T%,O%,A$):LOCALN%:!X%=0:X%?1=O%+1+LENA$:X%!3=A%:X%?7=T%:$(X%+O%)=A$
3100 IFHIMEM>&FFFF:FORN%=4TOX%?1:X%?N%=X%?(N%+3):NEXT:SYS&60048,A%,X%+4,O%+LENA$,120TOA%:IFA%=0:X%?3=0:=0
3110 IFHIMEM>&FFFF:IFA%>&FFFF:X%?3=?A%:SYS&2002B,A%+4TO$(X%+4):=X%?3
3120 A%=&14:CALL&FFF1:=X%?3