home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
No Fragments Archive 10: Diskmags
/
nf_archive_10.iso
/
MAGS
/
ALIVE
/
ALIVE10A.MSA
/
FILEZ
/
DIM2ST.ZIP
/
DIM2ST
/
dim2st.lst
Wrap
File List
|
2005-05-13
|
3KB
|
122 lines
'
' .dim -> .st
'
' Coded by GGN of KÜA software productions in GFA BASIC 3.50E
' Edited a bit to go with my article for Alive
'
DEFWRD "A-z"
FILESELECT DIR$(GEMDOS(25)+65),"",n$
DIM a|(20*512),b|(5*1024),cluster_map|(2880)
CLS
PRINT
PRINT "Read disk conf:"
PRINT "Get sectors:"
PRINT "Sides:"
PRINT "Sectors:"
PRINT "Start track:"
PRINT "End track:"
PRINT "Sector size:"
PRINT "Sectors per cluster:"
PRINT "Cluster size:"
PRINT "Root dir size (sectors):"
PRINT "FAT size (sectors):"
PRINT "FAT + bootsector size (sectors):"
PRINT "Total system size (sectors):"
PRINT AT(1,1);n$'
OPEN "i",#1,n$
a%=V:a|(0) !a|()=read buffer
b%=V:b|(0) !b|()=empty cluster buffer
BGET #1,a%,32
IF DPEEK(a%)=&H4242 !"BB"=FCopy pro header
PRINT "- FCopy pro image "
disk_conf!=PEEK(a%+2) !true=yes, false=no
get_sec!=PEEK(a%+3) !true=used, false=all
sides=PEEK(a%+6)
sects=PEEK(a%+8)
st_track=PEEK(a%+10)
end_track=PEEK(a%+12)
sect_size=DPEEK(a%+14)
sect_per_clust=DPEEK(a%+16)
clust_size=DPEEK(a%+18)
root_size=DPEEK(a%+20)
fat1_size=DPEEK(a%+22)
fat2_size=DPEEK(a%+24)
total_size=DPEEK(a%+26)
no_of_clusts=DPEEK(a%+28)
IF disk_conf!
PRINT AT(17,2);"Yes"
ELSE
PRINT AT(17,2);"No "
ENDIF
IF get_sec!
PRINT AT(14,3);"Used"
ELSE
PRINT AT(14,3);"All "
ENDIF
PRINT AT(8,4);sides+1
PRINT AT(10,5);sects'
PRINT AT(14,6);st_track'
PRINT AT(12,7);end_track'
PRINT AT(14,8);sect_size'
PRINT AT(22,9);sect_per_clust'
PRINT AT(15,10);clust_size
PRINT AT(26,11);root_size
PRINT AT(20,12);fat1_size
PRINT AT(25,13);fat2_size
PRINT AT(30,14);total_size
f2$=LEFT$(n$,LEN(n$)-3)+"ST"
track_size=sect_size*sects
ELSE
~FORM_ALERT(1,"[3][Baaah!|Not a FCopy pro image!][Drat!]")
END
ENDIF
PRINT SPACE$(10*80);
PRINT AT(1,15);
@dump
CLOSE #1
'
PROCEDURE dump
OPEN "o",#2,f2$
fat1=fat1_size*512
BGET #1,a%,total_size*512
BPUT #2,a%,total_size*512
ARRAYFILL b|(),PEEK(a%+512) !fill empty cluster with data
c%=a%+512+fat1_size*512+3 !point to 2nd FAT first entry!
j=0
ARRAYFILL cluster_map|(),255
'
' Here we check the FAT to see which clusters are used
' Note that bad sectors are not handled yet (dunno if they should be)
' Just for the record, we just check the entry to see if it is in the
' range $ff1 to $ff7
'
FOR k=0 TO ((end_track+1)*sides*sects)/sect_per_clust-1
temp|=PEEK(c%+1)
temp=SHL&(temp| AND 15,8)+PEEK(c%)
IF temp=0 OR (temp=>&HFF1 AND temp<=&HFF7) !Check first 12 bits ("even" entry)
cluster_map|(j)=0
ENDIF
temp=SHL&(PEEK(c%+2),4)+SHR|(temp| AND 240,4)
IF temp=0 OR (temp>=&HFF1 AND temp<=&HFF7) !Check last 12 bits ("odd" entry)
cluster_map|(j+1)=0
ENDIF
ADD c%,3
ADD j,2
NEXT k
'
' Now we check if each cluster is empty or not. If empty, dump an
' "empty" cluster. If not, read from the file and dump it
'
FOR i=0 TO no_of_clusts-1
IF cluster_map|(i)
BGET #1,a%,clust_size
BPUT #2,a%,clust_size
PRINT "O";
ELSE
BPUT #2,b%,clust_size
PRINT "o";
ENDIF
NEXT i
CLOSE #2
RETURN