> ImgToDisk v0.24 2::exit() <A$=OS_GetEnv+" ":fs%=fs F!cl("-?",0):syntax:exit(0) P"cl("-help",0):help:exit(0) Z ctrl% 31:X%=ctrl%:Y%=X%256 dks(A$)="":"Source file: "in$:"Destination drive: "out$:"Disk size (K): "sz$:A$=in$+" "+out$+" "+sz$ n]dbug%=cl("-d",0):auto%=cl("-a",0):verb%=cl("-v",0):size%=cl("-s",1):mix%=cl("-m",0) xCinv%=cl("-i",0):form%=cl("-f",0):in$=cl("",0):out$=cl("",0) "size%=0:A$:size%=cl("",0) Msize%<50:size%=size%*100-40*(size%=6)-20*(size%=7size%=3)-40*(size%=14) out$>"@":out$=(out$-17) +drive%=out$:geom$=A$:geom$="":auto%= zdbug%:"in$ ='"in$"'"'"out$ ='"out$"'"'"geom$='"geom$"'"'"size%=";size%'"auto%=";auto%'"verb%=";verb%'"debug=";dbug% idiskrec% 255:logbps%=0:max%=0:parameters:size%=(sides%*tracks%*spt%*2^logbps%)/1024:auto%:size%=-1 geom:auto%:geom$="" !logbps%=0:syntax:exit(220) ?:"FX143,18,"+fs%:Close_All:Hour_Glass(-3)::exit() :in%=(in$):in%=0:"File '"in$"' not found":exit(214) 5auto%:size%=#in%1024:auto%=0:parameters:geom *dbug%:" D:S:H:TK:Z:NM:S0"'"G:"geom$ ;verb%:"Copy ";size%+"K ",size%>0);"image to ";geom >FDC_Init(diskrec%,logbps%,spt%,heads%,den%,tracks%,sec0%) >bps%=2^logbps%:bsz%=spt%*bps%:data% bsz%-1:num%=spt%*bps% "2drive%=drive%3:os%<6:den%=2:drive%=drive%4 ,format:diskwrite:finish 6exit(0): Jformat:form%=0: T&verb%:"Formatting drive ";drive% ^>geom$="2:1:2:80:1:16:00":"adfs:Format "+drive%+" L Y": hBgeom$="2:0:2:80:2:09:01":"adfs:Format "+drive%+" DOS/M Y": r>geom$="2:0:2:80:3:05:00":"adfs:Format "+drive%+" D Y": |Bgeom$="4:0:2:80:2:18:01":"adfs:Format "+drive%+" DOS/Q Y": >geom$="4:0:2:80:3:10:00":"adfs:Format "+drive%+" F Y": "Couldn't format"  diskwrite !#in%=0:dstep%=(tracks%>63)+2 dseq%:head%=0sides%-1:track%=0tracks%-1:track(head%*tracks%*dstep%+track%):track%:head%: [track%=0tracks%-1:head%=0sides%-1:track(track%*sides%*dstep%+head%):head%:track%   finish  verb%: #in%:in%=0:exit(0)  track(offset%) &verb%:=0:"----"; 00verb%:8;8;8;8;head%;":";d0(track%,2); :gbpb(4,in%,data%,num%,0) D2inv%:A%=0spt%*bps%-14:data%!A%=data%!A%: Nir%=diskop(2):r%:" c",verb%);"C",verb%);"an't write track";" "+head%+":"+d0(track%,2),verb%) X lparameters Alogbps%=10:spt%=16:den%=2:-<20480:logbps%=8:spt%=16:den%=1 8dstep%=:tracks%=80:sec0%=0:sides%=2:heads%=1:seq%= auto%:size%=0:size%=-1:  auto%= 1size%:A$="G:"+size(size%):A$="G:":geom$="" %logbps%=8:spt%=10:den%=1:sides%=1 :A$=s(A$) A%=p("D"):A%<>:den%=A% A%=p("Q"):A%<>:seq%=A% A%=p("H"):A%<>:sides%=A%  A%=p("T"):A%<>:tracks%=A% "A%=p("S"):A%<>:logbps%=A%+7  A%=p("N"):A%<>:spt%=A% *3A$,1)="Z":sec0%=("&"+A$,2)):A$=A$,2+~A%) 4A$,1)=":":A$=A$,2) >"DQHTSNZ",A$,1))=0A$="" H%A$,2)<>"G:":geom:A$="G:"+geom$ f1A$,2)<>"G:":"Unknown geomtry":exit(220): p/den%=A$,3):seq%=A$,5)<>0:sides%=A$,7) zRheads%=sides%:tracks%=A$,9):logbps%=7+A$,12):logbps%>14:logbps%=logbps%-7 (spt%=A$,14):sec0%=("&"+A$,17,2)) seq%:heads%=2:heads%=1  ݤp(B$):A$,1)<>B$:= !A%=A$,2):A$=A$,2+A%):=A% ]syntax:"ImgToDisk () (-size ) -format -v -help": 6help:syntax:$(+17)" (C)J.G.Harston 2008-2014" 5" -auto attempts to autosense dest disk layout" " -inv invert data" " is:" F" G:::::::" " or any combination of:" $K" D:Q:H:T:S:N:Z" . " known -size options are:" 8A%=50160010 B9geom$=size(A%):geom$<>"":" -size ";A%;"K : ";geom L: `ݤsize(size%) t"size%=200:="1:1:1:80:1:10:00" ~"size%=320:="2:1:1:80:1:16:00" "size%=400:="1:1:2:80:1:10:00" "size%=640:="2:1:2:80:1:16:00" "size%=720:="2:0:2:80:2:09:01" "size%=800:="2:0:2:80:3:05:00" #size%=1440:="4:0:2:80:2:18:01" #size%=1600:="4:0:2:80:3:10:00" "size%=100:="1:1:1:40:1:10:00" "size%=160:="2:1:1:40:1:16:00" "size%=360:="2:0:2:40:2:09:01" "size%=400:="2:1:2:40:2:10:01" "size%=070:="1:1:1:35:0:16:01"  "size%=140:="1:1:2:35:0:16:01" "size%=280:="2:1:1:35:1:16:01" ="" 2 ݤgeom < geom$="":="autosensed disk" P>geom$="1:1:1:40:1:10:00":="1*40*10*256 FM disk (40T DFS)" Z>geom$="2:1:1:40:1:16:00":="1*40*16*256 MFM disk (ADFS S)" d>geom$="1:1:1:80:1:10:00":="1*80*10*256 FM disk (80T DFS)" n>geom$="2:1:1:80:1:16:00":="1*80*16*256 MFM disk (ADFS M)" x]geom$="1:1:2:80:1:10:00":="2*80*10*256 FM disk (2xDFS, L2FS, AcornCPM, TorchCPN, HADFS)" Ogeom$="2:1:2:80:1:16:00":="2*80*16*256 MFM disk (ADFS L, L3FS, Filestore)" [geom$="2:0:2:80:1:16:00":="80*2*16*256 MFM disk (interleaved ADFS L, L3FS, Filestore)" @geom$="2:0:2:80:2:09:01":="80*2*9*512 MFM disk (DOS 720K)" Pgeom$="2:0:2:80:3:05:00":="80*2*5*1024 MFM disk (MDFS, AcornDOS, ADFS D,E)" Ageom$="4:0:2:80:2:18:01":="80*2*18*512 MFM disk (DOS 1440K)" ?geom$="4:0:2:80:3:10:00":="80*2*10*1024 MFM disk (ADFS F)" ?geom$="1:1:1:35:0:16:01":="1*35*16*128 FM disk (1xMZ-80K)" ?geom$="1:1:2:35:0:16:01":="2*35*16*128 FM disk (2xMZ-80K)" @geom$="2:1:1:35:1:16:01":="1*35*16*256 MFM disk (MZ-80A/B)" ?geom$="2:0:2:40:2:09:01":="40*2*9*512 MFM disk (360K DOS)" Dgeom$="2:1:2:40:2:10:01":="2*40*10*512 MFM disk (MZ-80A/B CPM)" Egeom$="2:1:2:80:2:10:00":="2*80*10*512 MFM disk (Slogger DDCPM)" ="G:"+geom$+" disk" " geom ,mgeom$=den%+":"+(seq%1)+":"+sides%+":"+tracks%+":"+(logbps%-7)+":"+"0"+spt%,2)+":"+"0"+~sec0%,2) 6 Jݤimgtype(in$) Tin%=(in$):in%=0:=-1 ^'gbpb(4,in%,data%,16,0):#in%:in%=0 hdata%?11=13 r$data%="Slogger CPM":=&1A6 |$data%="SLOGGER CPM":=&1A6 data%?8=13 $data%="Acorn CP":=&1A6 $data%="ACORN CP":=&1A6 $(data%+5)="DOS":=&FC8  =&B22 7FDC_Init(dskrec%,bps%,spt%,hds%,den%,trks%,sec0%) i%:os%<>6: ?dskrec%?0=bps%:dskrec%?1=spt%:dskrec%?2=hds%:dskrec%?3=den% 2i%=4594:dskrec%!i%=0::dskrec%!64=&20000000 7dskrec%?8=sec0%:dskrec%!16=trks%*spt%*(2^bps%)*hds%  ݤdiskop(op%) hos%=6:ș"XADFS_DiscOp",0,op%+64+(diskrec%<<6),offset%*spt%*bps%+(drive%<<29),data%,spt%*bps%r%:=r% &Fden%=1:op%=1:=disk(data%,&53,drive%+head%*2,track%,0,spt%,den%) 0Fden%=1:op%=2:=disk(data%,&4B,drive%+head%*2,track%,0,spt%,den%) :Fden%=1:op%=3:=disk(data%,&5B,drive%+head%*2,track%,0,spt%,den%) DDden%=2:op%=1:=scsi(data%,&008,drive%,track%*16+head%*80,spt%) NDden%=2:op%=2:=scsi(data%,&10A,drive%,track%*16+head%*80,spt%) X=-1 lClose_All v"in%=in%:in%:A%=in%:in%=0:#A% 'out%=out%:out%:A%=out%:out%=0:#A%  #gbpb(A%,chn%,addr%,num%,ptr%) 4?X%=chn%:X%!1=addr%:X%!5=num%:X%!9=ptr%:&FFD1: #ݤh0(A%,N%)="0000000"+~A%,N%) #ݤd0(A%,N%)="00000000"+A%,N%) Hour_Glass(A%):os%<>6: A%=-1:ș"Hourglass_On": A%=-2:ș"Hourglass_Off":  A%=-3:ș"Hourglass_Smash": ș"Hourglass_Percentage",A%    :ݤOS_GetEnv:A$,A%:X%=1:os%=((&FFF4)&FF00)256:X%-1 *Jos%=32:>&FFFF:ș"GetModuleFileName",0,X%,255:A$=$$X%:run$=A$:=@cmd$ 4os%=32:A$=$&100 >{A$=0:>&7FFF:run$=$&8100:ș"OS_GetEnv"A$,,A%:ș"OS_WriteEnv","",A%:A$=A$,1+A$+" "," ",1+A$," "))):A$=0:A$=run$ H0A$=0:?(P-3):A$=$&600A$=0:A$=$(-&300) R7A%=A$+" "," "):run$=A$,A%-1):run$<>"":=A$,A%+1) \bY%=X%256:A%=9:?X%=0:X%!1=X%+16:X%!16=0:&FFD1:A%=X%+16:!A%?A%+A%?2<>8:A%?(A%+1)=13:=$(A%+1) f="" zexit(A%):"FX1,"+A%:  cݤcl(l$,n%):l$="":A$=s(A$):A$=34:A%=A$+" "" ",""" ",2):l$=A$,2,A%-2):A$=s(A$,A%+1)):=l$ "":A%=A$,l$):A%:A$=s(A$,A%-1)+A$,A$," ",A%)+1))+" ":= n%=0:l$<>"":= %A%=" ",l$=32)+A$,l$):A%=0:="" 'A$=A$,A%-1)+s(A$,A$," ",A%)+1)) Cl$=32:l$=A$,A%):A$=A$,A%-1):=l$,1-(l$=34),l$+2*(l$=34)) PA$,A%,1)<>34:l$=A$,A%,A$+" "," ",A%)-A%):A$=A$,A%-1)+A$,A%+l$+1):=l$ Jl$=A$,A%+1,A$+""" ",""" ",A%+1)-A%-1):A$=A$,A%-1)+A$,A%+l$+3):=l$ /ݤs(A$):A$,1)=" ":A$=A$,2):A$,1)<>" " +A$,1)=" ":A$=A$,A$-1):A$,1)<>" " =A$ 4ݤdisk(addr%,cmd%,drv%,trk%,sec%,num%,den%):fs% $fs%=fs:fs%<>4:*FX143,18,4 .7X%?0=drv%+den%*24+8:X%!1=addr%:X%?5=3-7*(cmd%>127) 8=X%?6=cmd%:X%?7=trk%:X%?8=sec%:X%?9=num%&20:A%=127:&FFF1 B5A%=X%?(7+X%?5):A%<>&10:fs%<>4:"FX143,18,"+fs% L=A% `+ݤscsi(addr%,cmd%,drv%,sect%,num%):fs% jfs%=fs:fs%<>8:*FADFS tDX%?0=0:X%!1=addr%:X%?5=cmd%:X%?6=drv%*32+((sect%&1F0000)65536) ~9X%?7=((sect%&FF00)256):X%?8=sect%:X%!9=num%:X%!11=0 IA%=&72:&FFF1:A%=?X%:fs%<>8:"DISMOUNT",cmd%>255):"FX143,18,"+fs% =A% ݤfs:A%,E%,Y%:=(&FFDA)&FF   A{   "  g{N{LQ%=PA.:CH."* BASIC f{Z{{{檤`T{T{`` g{,z0ȱhX{` ee  { {hX{쩏 `