> MkImg112/s v1.12a  v1.02 -update option  v1.03 -@ option (: v1.04 Catalogue stored in reverse sector start order 2* Uses default maximum disk size <; Defaults to translating xxxx/x to x/xxxx on DFS FO v1.05 Creates double-sided disk if source dir contains '0','1' or '0','2' P& v1.06 Pads end of unused sectors Z, v1.07 Can create ADFS and HADFS images d8 v1.08 Correctly counts files in DFS subdirectories n' v1.09 inpath can be a single file x4 todo: extending directory with -fs dfs62 C v1.10 added -pad option, WinDOS f_scan, translates leaf names / v1.11 dfs62 done, file.txt -> dfs: t.file Q v1.12 Fixed DFS filecount, d/file -> d.file translation, added -R P v1.12a Allows 'L' in .inf, skips crc, reads date/time/boot, DFS writes 'L' B Adding -dsd will be fiddly, needs major rewrite to implement ! Probably veneer to gbpb(wr) : Pctrl%127,name%79,zp%9:A$=OS_GetEnv:in%=0:out%=0:inc%=0:os%=32:Win_TextIO inc$="":A%=" "+A$," -i@"): These need to be last options ,17):Close_All:exit() ^4X%=ctrl%:Y%=X%256:cycle%=0:files%=0: sj%=FALSE h+ date%=date%:REM Should set from date$ r: |etype$=uc(type$):fstype%="HADFS24",type$):fstype%=0:fstype%=3*"DFS31",type$)+4*"DFS62",type$) ?fstype%<1 fstype%>4:"Unsupported filesystem":exit(220) type$,2)=24:fstype%=0 &fstype%=1:size%>&10000:fstype%=0 (fstype%=1:size%=&10000:size%=&FFFF ,fstype%=0:size%=&1000000:size%=&FFFFFF Jfstype%=0:tln%=16:dsz%=23:fsz%=32:root%=&47:dmax%=&01000000: HADFS24 Hfstype%=1:tln%=16:dsz%=31:fsz%=24:root%=&47:dmax%=&00010000: HADFS Gfstype%=2:tln%=19:dsz%=47:fsz%=26:root%=&02:dmax%=&00200000: ADFS Ffstype%=3:tln%=12:dsz%=31:fsz%=16:root%=&01:dmax%=&00000400: DFS Hfstype%=4:tln%=12:dsz%=62:fsz%=16:root%=&01:dmax%=&00000400: DFS62 size%:dmax%=size% side%=0:dskid%=(65535) !fstype%<3:ex%=: dsd%=FALSE : adebug%:" run$='"run$"'"'"quit$='"quit$"'"'" out$='"out$"'"'" in$='"in$"'"'" inc$='"inc$"'" Qdebug%:" recurse=";rc%;" verbose=";vb%;" fstype%=";fstype%;" dsd%=";dsd% &Wdebug%:" tln=";tln%;" dsz=";dsz%;" fsz=";fsz%;" root=&";~root%;" dskid=&";~dskid% 0Adebug%:" dmax=&";~dmax%;" size%=&";~size%;" pad%=";pad% : debug%:" root='";root$;"'" D: N1 A%-1:max%=-A%-4096: mem% max%:wr%=2:rd%=4 X&out$="":"Destination file: "out$ b: l. IFupd%:IFFNChkDir:PROCEnter0:PROCexit(0) v: Cout%=f_openout(out$):out%=0:"Can't open '"out$"'":exit(192) )title$=title$+20," "),tln%):dskHdr :#out%:out%=0:X%!2=&FFFB2200:fstype%=2:X%!2=&FFFFCE00 7A%=file(out$,2):out%=f_openup(out$):#out%=#out% 7A%=0:idate%=0:in$<>"":A%=f_info(in$):idate%=X%!15 Yin$="" inc$<>"" stdin%:Enter:A%=2 A%=2:cd(in$):ChkDir:Scan("",root%):A%=2 !A%=1:ChkDir:p$="":Add:A%=2 .A%<>2:"Dir. '"in$"' not found" setFSM >pad%:size%:#out%"" stdin%:"Exec "+inc$:inc%=byte(198,0,255):os%=32:inc%=!540 *in$<>"":cd(in$) 4ChkDir:inc%:#inc%=0: >":inc%=0:"Enter filename: "; H3 ""in$:stdin%:11;(16+in$);16+in$,127) R:leaf$="":Add:A%=0:inc%:A%=#inc% (#inc%-#inc%<2) \ in$="" A%:inc$<>"":*Exec f p: z Add Hleaf$="":leaf$=in$:A%=in$,","):A%:leaf$=in$,A%+1):in$=in$,A%-1) ?t%=0:in$<>"":in$<>124:t%=f_info(in$):inc% stdin%:11 ?t%:A%=add in$<>"":in$<>124:"File '"in$"' not found"  : F DEFFNChkDir:fs%=FNfs:sj%=fs%=5:in0$=in$:in$=out$:IFin$="":=FALSE C A%=FNf_info(in$):date%=FNz_date(X%!15):in$=in0$:IFA%=0:=FALSE = A%=FNf_info(in$):IFFNz_date(X%!15)>date% OR A%=0:=FALSE  IFA%=2:PROCcd(in$) 7 =TRUE:REM out$ newer or same as in$, don't update : 6 DEFPROCChkDir:fs%=FNfs:sj%=fs%=5:IFrc%=0:ENDPROC ChkDir:fs%=fs:rc%=0: f_scan(0)<>"0": (A$=f_scan(X%!9):A$<>"1":A$<>"2":  rc%=-2: $: ./Scan(p$,dir%):p%,r%:fstype%<=2: files% 81:in$=f_scan(p%):r%=in$:p%=X%!9:r%:RdName B r%=0: L: VRdName:in$=46:os%<8: `cycle%=X%?0:t%=f_info(in$) j-leaf$=in$:os%-24:leaf$=fn_unbbc(leaf$) tsec%=add:t%<>2: ~rc%=0 sec%=0: -cd(in$):Scan(p$+in$+d$,sec%):cd("^"): : Aݤadd: in$=native source filename, leaf$=Acorn dest leafname !t%=2:fstype%>2:side2:=dir% t%=2:rc%=0:=dir% Kload%=X%!2:exec%=X%!6:fsize%=X%!10:attr%=X%?14:fs%<>16:attr%=attr%&7F Gmdate%=X%!15:mtime%=X%!17:cdate%=X%!20:ctime%=X%!22:acc%=X%!25:inf $vb%:"Adding ";p$;in$;"... "; +#out%=#out%:align:ptr0%=#out%-side% +ptr0%+fsize%>dmax%*256:"disk full":=0 /fsz%=24:fsize%>&7FFFF:"file too long":=0 +files%>=dsz%:fstype%>1:"cat full":=0 files%>=dsz%:extend  : T DFS+ex% DFS+ex%=0 non-DFS P leaf$='file' from PROCScan -> file -> use use use (P leaf$='file/ext' from PROCScan -> file/ext -> e/file use use 2P leaf$='file' from input file -> file -> use use use 

file/ext -> e/file use use FP leaf$='file.ext' from input file -> file/ext -> e/file use use PP leaf$='d/file' from input file -> d/file -> d/file use use ZP leaf$='d.file' from input file -> d/file -> d/file use use d: n;A%=leaf$,"."):A%:leaf$=leaf$,A%-1)+"/"+leaf$,A%+1) xRA%=0:ex%:A%=leaf$,"/",3):A%:leaf$=uc(leaf$+" ",A%+1,1))+"/"+leaf$,A%-1) 0ex%:leaf$,2,1)<>"/":leaf$=root$+"/"+leaf$ : >t%<>2:in%=f_openin(in$):in%=0:"Can't open '"in$"'.":=0 &t%<>2:trans:#in%:in%=0 mkdir 7align:sect%=ptr0%256:ptr0%=#out%:files%=files%+1 fstype%>2:addDFS fstype%=2:addADFS fstype%<2:addHADFS #out%=#out% vb%:8,8,8:"Done."  =sect% : , Check for .inf metadata on DOS/Windows inf:(os%-24)=0: [A$=in$:f_info(A$+s$+"inf")=0:A$,".")::A$=A$,A$-1):A$,1)=s$A$="":A$=A$,A$-1) NA$=A$+s$+"inf":f_info(A$)=1:X%!10<80:in%=(A$):A$=#in%:#in%:in%=0 "4A%=A$,"BOOT="):A%:opt%=A$,A%+5):A$=A$,A%-1) ,#A%=A$,"CRC="):A%:A$=A$,A%-1) 6 P.file ' rc%=-2. source 0.P.file -> P.file 8leaf$=leaf$+" ",3,7)+(leaf$((attr%8)*16)) 6f_gbpb(rd%-1,out%,mem%,512,side%+512*(files%32)) EA%=25216-4:mem%!A%=mem%!(A%-8):mem%!(256+A%)=mem%!(256+A%-8): )A%=mem%?16:$(mem%+8)=leaf$:mem%?16=A% lmem%?&104=cycle%:mem%?&105=((files%32)+(files%32))*8:mem%?&106=opt%*16+ptr0%65536:mem%?&107=ptr0%256 Dmem%!&108=load%:mem%!&10A=exec%:mem%!&10C=fsize%:mem%?&10F=sect% Umem%?&10E=sect%256+(load%&30000)16384+(fsize%&30000)4096+(exec%&30000)1024 6f_gbpb(wr%-1,out%,mem%,512,side%+512*(files%32))  : 9addADFS:fptr%=mem%:$fptr%=leaf$+13+" ",10) uaddAttr((attr%3)+(attr%8)2+((t%=2)8)+(((attr%6)=4)16)+(attr%&30)*2+(((attr%&60)=&40)128)+(attr%&80)*2) Kfptr%!10=load%:fptr%!14=exec%:fptr%!18=fsize%:fptr%!22=sect%:fptr%?25=0 9f_gbpb(wr%-1,out%,mem%,fsz%,dir%*256+files%*fsz%-21)  &: 0addHADFS :1mdate%=h_date(mdate%):cdate%=h_date(cdate%) DEmtime%=(mtime%&1F)*2048+(mtime%&3F00)8+(mtime%&3F0000)131072 NQ ctime%=(ctime%AND&1F)*2048+(ctime%AND&3F00)DIV8+(ctime%AND&3F0000)DIV131072 X?#out%=dir%*256+12:#out%,files%+((fsz%=32)&80):fptr%=mem% bI$fptr%=leaf$+" ",10):addAttr(((attr%&33)255)+((t%=2)256)) l1fptr%!10=load%:fptr%!14=exec%:fptr%!18=fsize% vjfsz%=32:fptr%!22=sect%:fptr%?25=0:fptr%!26=mdate%:fptr%!28=mtime%:fptr%?30=cdate%:fptr%?31=cdate%256 efsz%=24:fptr%?22=sect%:fptr%?23=sect%256:fptr%?20=(fptr%?207)+(mdate%&F8):fptr%?21=mdate%256 Vfsz%=24:fptr%?9=(fptr%?9127)+(mdate%1)*128:fptr%?13=(fptr%?1363)+(mdate%6)*32 7f_gbpb(wr%-1,out%,fptr%,fsz%,dir%*256+files%*fsz%)  : caddAttr(bits%):bits%=bits%*128:A%=09:fptr%?A%=(fptr%?A% 127)+(bits%128):bits%=bits%2:: : 3extend:f_gbpb(rd%-1,out%,mem%,fsz%,dir%*256) Nfsz%=24:first%=mem%!&14 &FFFF:mem%?&0E=ptr0%&100:mem%?&0F=ptr0%&10000 hfsz%=32:first%=mem%!&14 &FFFFFF:mem%?&17=ptr0%&100:mem%?&18=ptr0%&10000:mem%?&19=ptr0%&1000000 @f_gbpb(wr%-1,out%,mem%,fsz%,dir%*256):first%=0:first%=dir% Zmem%?&0C=mem%?1231:mem%?&14=first%:mem%?&15=first%256:fsz%=24:mem%?&0E=0:mem%?&0F=0 Ffsz%=32:mem%?&17=0:mem%?&18=0:mem%?&19=0:mem%?&16=first%&1000000 'f_gbpb(wr%-1,out%,mem%,fsz%,ptr0%)  *align:#out%,0:align:#out%,0:align +dir%=ptr0%&100:ptr0%=#out%:files%=0:  : *&mkdir:fsize%=(dsz%*fsz%+64)&F00 4 A%=0fsize%-14:mem%!A%=0: >afstype%=2:$mem%=0+"Hugo":mem%?5=0:$(mem%+&4CC)=leaf$:mem%!&4D6=dir%:title$="":title$=leaf$ HNfstype%=2:$(mem%+&4D9)=title$:mem%!&4EC=0:$(mem%+&4FB)="Hugo":mem%?&4FF=0 R^fstype%<2:$mem%=leaf$+" ",10):mem%!&0A=dir%:mem%!&10=dskid%:mem%?&12=opt%:opt%=0 \-fstype%=0:mem%!&0A=&800000:mem%!&1A=dir% f%f_gbpb(wr%,out%,mem%,fsize%,0): p: ztrans:fsize%=0 t%=2: 9copyend%=fsize%:ptr%=0::vb%:sofar(ptr%,copyend%); 4len%=max%:ptr%+len%>copyend%:len%=copyend%-ptr% >f_gbpb(rd%,in%,mem%,len%,0):f_gbpb(wr%,out%,mem%,len%,0) %ptr%=ptr%+len%: ptr%>=copyend%: : #align:A%=02554:mem%!A%=0: ;A%=256-(#out%255):A%<256:f_gbpb(wr%,out%,mem%,A%,0)  : -dskHdr:files%=0:A%=05114:mem%!A%=0: fstype%>2:dfsHdr fstype%=2:adfsHdr fstype%<2:hadfsHdr ptr0%=#out%: : HdfsHdr:$mem%=title$,8):mem%!8=0:$(mem%+256)=title$,9):mem%!260=0 $&f_gbpb(wr%-1,out%,mem%,512,side%) .afstype%=4:!mem%=&AAAAAAAA:mem%!4=&AAAAAAAA:mem%!256=0:f_gbpb(wr%-1,out%,mem%,512,side%+512) 8 B: LEhadfsHdr:$mem%=title$:$(mem%+16)=0+"(C)JGH"+0:mem%!&18=dskid% V;mem%!&1C=dmax%:mem%?31=(fsz%=32)&80:fsz%=24:mem%?30=1 `;f_gbpb(wr%-1,out%,mem%,256,&4600): Fall through to... j adfsHdr t:dir%=root%:leaf$="$":#out%=root%*256:mkdir:title$="" ~ : :setFSM:idate%=h_date(idate%):stp%=2:fsz%=32:stp%=3 size%=0:size%=ptr0%256 2:mem%?&106=opt%*16+size%256:mem%?&107=size% 255:S%=(S%+1)255 (S%=S%+mem%?A%::=S%255 2: "1":in$<>"2": Frc%<>-2 p$<>"": PCsize%:#out%=side%+256+6:#out%,opt%*16+size%256:#out%,size% Z=#out%>&32000:"Side 0 too full":Close_All:exit(128-2) d1#out%=#out%:A%=02554:mem%!A%=&E5E5E5E5: n2:f_gbpb(wr%,out%,mem%,256,0):#out%>=&32000 xside%=&32000:dskHdr: : 1ݤh_date(A%)=(A%&FF00)+(A%31)*8+(A%&E0)32 : W DEFFNz_date(A%):=(A%AND31)+(A%AND&F00)DIV8+((A%AND&F000)DIV8+(A%AND&E0)*256)+&200 : 8ݤsofar(A%,B%):8,8,8:d0(A%/(B%+1)*100,2);"%";:="" : :