> DiskToImg 0.10  (C) J.G.Harston $ Some routines from HADFS Filer :  Quick hack: :"Disk Image Creater" (" (2)00K, (4)00K or (6)40K disk? ";  A$=:"246",A$): A$  A$="2":size%=200  A$="4":size%=400  A$="6":size%=640 / size%=200:REM single-sided DFS style disk / size%=400:REM double-sided DFS style disk % size%=640:REM ADFS-L style disk =+size%*1024+32768 ? size%=200: '"Creates 200k image of 256*10*80*1 FM disk"' ? size%=400: '"Creates 400k image of 256*10*80*2 FM disk"' @ size%=640: '"Creates 640k image of 256*16*80*2 MFM disk"' ? bytes/sectors/tracks/sides  : : : -bufsz%=20*256: diskrec% 256,data% bufsz% : '"Source drive: "drv$:drive%= drv$ "Dest. file: "out$ 2out%=(out$): out%=0:"Can't open '"out$"'": 9 size%=200:spt%=10:FDC_Init(diskrec%,8,spt%,1,1,80) 9 size%=400:spt%=10:FDC_Init(diskrec%,8,spt%,1,1,80) 9 size%=640:spt%=16:FDC_Init(diskrec%,8,spt%,1,2,80) : ' Temp body to quickly get working:  image% size%*1024 !3dummy%=fdc_access(image%,0,(size%*1024)256,1) ")ș "OS_GBPB",2,out%,image%,size%*1024 ##out%:out%=0 $*"SetType "+out$+" B22":"Stamp "+out$ % &: ': ( head% =0 1 ) track% =0 79 * sector%=0 9 + ,< 13;sector%;":";track%;":";head%;":";drive%;" "; -N FDC_Op(data%,sector%,track%,head%,drive%,1,1,diskrec%):"- error" . byte% =0 255 / #out%,data%?byte% 0 byte% 1 2 sector% 3 track% 4 head% 5#out%:out%=0: 60 OS."SetType "+out$+" 123":OS."Stamp "+out$ 7 8: 9: : FDC Routines ; ============ <: =C FDC_Init - Initialise disk record block for passed disk shape >: ?P FDC_Init(dskrec%,bps%,spt%,hds%,den%,trks%): Initialise FDC Record Block @ i% A.dskrec%?0=bps% : 2^bps bytes per sector B)dskrec%?1=spt% : sectors per track C&dskrec%?2=hds% : num of heads-1 D$dskrec%?3=den% : density 1=FM E6 i%=4 59 4:dskrec%!i%=0:: Clear disk record F/dskrec%!16=(trks%*1)*spt%*(2^bps%)*(hds%+1) G#FDC_spt%=spt% : Extern: s/t H#FDC_bps%=2^bps% : Extern: b/s I&FDC_trks%=trks% : Extern: tracks J K: L> FDC_Op - Passed absolute sector addressing information M: N4 FDC_Op(mem%,sec%,trk%,hd%,drv%,num%,op%,rec%) O3trk%=((hd%+1)*FDC_trks%*FDC_spt%+sec%)*FDC_bps% Pop%=op%+(rec%<<6) Qrec%?34=drv% R?ș "XADFS_DiscOp",0,op%,trk%+(drv%<<29),mem%,256*num% op% S=op% T: U! ------- do later --------- V: W% Passed absolute sector address: X: Y: FDC_Rd(addr%,absSec%,drv%,num%):=FDC_Access(read%) Z; FDC_Wr(addr%,absSec%,drv%,num%):=FDC_Access(write%) [: \$ FDC_Access(type%): num%=0:= ]: Convert absSec% to sec/trk/head, pass to lower level ^: _r fdc_access(data%,sec%,length%,type%): IF(test%AND1) VDU4:PRINT"S:";~sec_start%,sec_start%,~length%,length% ` length%=0:= a- IF sec%<1600 AND sec%+length%>1600 THEN b= IF NOTFNfdc_access(data%,sec%,1600-sec%,type%):=FALSE cK =FNfdc_access(data%+256*(1600-sec%),1600,length%-(1600-sec%),type%) d ENDIF e" I don't know if I need this: f+ sec%<80*spt% sec%+length%>80*spt% g6 fdc_access(data%,sec%,80*spt%-sec%,type%):= hQ =fdc_access(data%+256*(80*spt%-sec%),80*spt%,length%-(80*spt%-sec%),type%) i j& r%,hd%,dr%,reason%,disc_address% kdr%=drive%: MOD 2 l3 dr%>3 =partition(data%,sec%,length%,type%) mB IF sec%>1599 PROCwarning("Can't do tracks 1599+ yet"):=FALSE n4hd%=0: sec%>(80*spt%)-1:hd%=1:sec%=sec%-80*spt% oZ sec%>(80*spt%)-1:sec%=sec%-80*spt%:hd%=(sec% spt%) 1:sec%=80*spt%+sec% (2*spt%) p: q(track%=(hd%*FDC_trks%*spt%+sec%)*256 r: s hd%=(sec%>799) AND 1 t IFsec%>799 sec%=sec%-800 uI IFsec%>799 sec%=sec%-800:hd%=(sec% DIV 10)AND 1:sec%=800+sec%DIV 20 v( track%=(hd%*FDC_trks%*10+sec%)*256 wreason%=type%+(diskrec%<<6) x$ disc_address%=track%+(dr%<<29) ySdiskrec%?34=dr%: IFtest%AND2 PRINT"Head:";hd%,"Trk:";~track%,"Sec:";sec_start% zFș"XADFS_DiscOp",0,reason%,track%+(dr%<<29),data%,256*length% r% {3 r%<>0 err%=:warning(memtostr(r%+4,100)):= |= }: ~0 partition(data%,sec_start%,length%,type%) # type%=1, read; type%=2, write ! GBPB 1, write; GBPB 3, read , DiskChn%=0 warning(mess("Err14")):= Dș "OS_GBPB",5-type%*2,DiskChn%,data%,length%*256,sec_start%*256 X sec_start%=70 type%=1 type%=(#DiskChn%)256:data%?28=type%:data%?29=type%256 = :    Now transfer data:  length%<>0  length%=(length%+255)256  length% <= bufsec% 6 ș "OS_File",&FF,pathname$,data%,0: Load data 9 dum=fdc_access(data%,startsec%,length%,2): 2=WR   in%= pathname$ ( saveloop%=0 length% bufsec% X saveloop%=length% bufsec% size=(length% bufsec%)*256 size = bufsec%*256 0 ș "OS_GBPB",4,in%,data%,size ,,,not M dum=fdc_access(data%,startsec%+saveloop%*bufsec%,(size+255)256,2) #in%   Qfiles_actioned%=files_actioned%+1:setOpt(fileraction%,3, files_actioned%,) free:ForceActionRedraw  : : :  sectors<=bufsec% - dum=fdc_access(data%,start%,sectors,1) < "SAVE "+pathname$+" "+~(data%)+" "+~(data%+length)  < dum=fdc_access(data%,start%,bufsec%,1): do first bit A "SAVE "+pathname$+" "+~(data%)+" "+~(data%+bufsec%*256)  out%= pathname$  #out%=#out% M endsec%=sectors bufsec%: endsec%=sectors/bufsec% endsec%=endsec%-1 ' saveloop%=1 endsec%: do rest N saveloop%=endsec% size=length (bufsec%*256) size = bufsec%*256 Q dum=fdc_access(data%,start%+bufsec%*saveloop%,(size+255) 256,1): 1=RD & ș "OS_GBPB",2,out%,data%,size  #out%