0 Members and 1 Guest are viewing this topic.
ok, thanks.finally found the problem.I was using: $bitdata = unpack "b*",$data;instead of $bitdata = unpack "B*",$data;in perl :/
sure, will do, thanks olsen just need to figure out format of the other, nonAmiga, diskette first.edit: it seems to use this format: http://nerdlypleasures.blogspot.rs/2015/11/ibm-pc-floppy-disks-deeper-look-at-disk.htmlI've managed to decode the whole diskette, but couldn't check CRC of individual sectors data.
; The CRC is computed not only over the actual data, but including; the SYNC mark (3 * $a1) and the 'ID/DATA - Address Mark' ($fe/$fb).
thanks, excellent, finally it works.I didn't know that:
#!/usr/bin/perl# decode MFM TIM011 SECTOR SIZE= 1024bytes, sectors_per_track=5use strict;use warnings;use Digest::CRC qw(crc32 crcccitt crcccitt_hex crc16 crc16_hex crc_hex crc8_hex);use utf8;use bytes;# OFFSET Count TYPE Description# 0000h 8 byte UAE-1ADF# 0008h 4 byte trackcount# 000Eh 4 byte 0=amigados 1=raw mfm# 0010h 4 byte tracklength# 0014h 4 byte tracklength in bits# ..my ( $i, @tracks, $trackdata, $trackcount, $header, $bitdata, @sector, @track, $image, $data );my ( $file_in, $file_out ) = ( $ARGV[0], $ARGV[1] );my $syncbit = unpack "B*", "\xAA\xAA\xAA\xAA\x44\x89\x44\x89\x44\x89";my $sector_per_track = 5;my $sector_length = 1024;{local $/; open( FILE0, "< :raw :bytes", "$file_in" ) or die "Can't open for reading: $!\n"; $data = ; close(FILE0);}$header = substr ($data, 0, 2004); # header = 8+4+166*12 = 2004$trackcount = unpack "N", substr ($data, 8, 4);$trackdata = substr ($data, 12, 12*$trackcount);@tracks = $trackdata =~ /.{12}/gs;$data = substr ($data, 2004); # print "\n\ndatalen1=" . length $data . "\n";# exit;$bitdata = unpack "B*",$data;for my $i (0 .. 159) { #159 my $tracklenbit = unpack "N", substr ($tracks[$i], 8, 4); print "\ntrack=$i, tracklen=$tracklenbit \n"; my $trackdata = substr ($bitdata, 0, $tracklenbit); $bitdata = substr ($bitdata, $tracklenbit); for my $j (1 .. $sector_per_track) { # 5 my $pos = index ($trackdata, $syncbit)+length($syncbit); my $sector_id = substr ($trackdata, $pos, 16+ 4*8*2); #16:FE $sector_id =~ s/.(.)/$1/gs; #strip clock $sector_id = pack "B*",$sector_id; my ($track_num, $side_num, $sector_num, $sector_s ) = unpack("xc1c1c1c1", $sector_id); print " sector=$sector_num, sector size=$sector_s \n" ; $pos = index ($trackdata, $syncbit, $pos)+length($syncbit); my $sector_dat = substr ($trackdata, $pos+16, $sector_length*8*2+32); # 16:FB 32:CRC=C74C $trackdata = substr ($trackdata, $pos); $sector_dat =~ s/.(.)/$1/gs; #strip clock $sector[$sector_num] = pack "B*", substr ($sector_dat, 0, $sector_length*; my $crc = unpack "n*", pack "B*", substr ($sector_dat, $sector_length*; my $crc_chk = crcccitt( "\xA1\xA1\xA1\xFB" . $sector[$sector_num]); if ( $crc eq $crc_chk) { print "CRC OK!\n"; } else { print "CRC ERROR! , $crc, $crc_chk \n\n" ; exit; } } $track[$i] = join ("", $sector[17], $sector[18], $sector[19], $sector[20], $sector[21]);}$image = join ("", @track);{local $/; open( FILE0, "> :raw :bytes", "$file_out" ) or die "write err: $!\n"; print FILE0 $image; close(FILE0);} exit;
what does ' length 12656/4' mean in output?how long is the header, what is its format?thanks.edit: is it like this:OFFSET Count TYPE Description0000h 8 byte 'UAE-1ADF'0008h 4 byte trackcount000Ch 4 byte 0=amigados 1=raw mfm0010h 4 byte tracklength0014h 4 byte tracklength in bits0018h 4 byte 0=amigados 1=raw mfm...I just cant find '0xAAAA AAAA 4489 4489' ( http://lclevy.free.fr/adflib/adf_info.html#p23 )
there is an option to force 'raw' mode. if it still doesn't work, you can try with some NDOS diskette.
I'm testing with a normal OFS floppy...I did use the -r option... but the output is still ordinary bytes not encoded data
try -1 and maybe -x