#!perl -w
use strict;
use IO::File;
if (@ARGV!=2) {
    die "Usage: perl x512.pl  osimage512.dat  osimage520.dat\n"
}
my $ifn=shift;
my $ifh=IO::File->new($ifn, "r") or die "$ifn:$!\n";
binmode $ifh;

my $ofn=shift;
my $ofh=IO::File->new($ofn, "w") or die "$ofn:$!\n";
binmode $ofh;

my $ifn8=$ofn.".8bytes";
my $ifh8=IO::File->new($ifn8, "r") or die "$ifn8:$!\n";
binmode $ifh8;

my $ofs=0;
while (!$ifh->eof) {
    my $data;
    $ifh->read($data, 512);
    $ofh->print($data);
    $ofs+=512;
    $ifh8->read($data, 8);
    $ofh->print($data);
    $ofs+=8;
}
$ifh->close;
$ifh8->close;
$ofh->close;


