#!/usr/bin/perl
# vp 04.02.2010 13:54

# Prüfsummen erzeugen

$ARGV[0] = 'packedroms.bin';

open IN, "<$ARGV[0]";
binmode IN;

open OUT, ">megarom_chksum.inc";

#Filetyp ermitteln
for ($i=0; $i<256; $i++) {
	read IN, $block, 10240; # 10K
	
	#$chksum = unpack ("%16C*", $block);	# 16 Bit
	#print OUT "	dw $chksum	; Bank$i\n";

	$chksum = unpack ("%8C*", $block);	# 8 Bit
	print OUT "	db $chksum	; Bank$i\n";
}

close IN;
close OUT;
