summaryrefslogtreecommitdiffstats
path: root/src/util/disrom.pl
diff options
context:
space:
mode:
Diffstat (limited to 'src/util/disrom.pl')
-rwxr-xr-xsrc/util/disrom.pl12
1 files changed, 7 insertions, 5 deletions
diff --git a/src/util/disrom.pl b/src/util/disrom.pl
index 920a86b2..71eee590 100755
--- a/src/util/disrom.pl
+++ b/src/util/disrom.pl
@@ -28,8 +28,9 @@ my $romfile = shift || "-";
my $rom = new Option::ROM;
$rom->load ( $romfile );
-do {
+my $index = 0;
+do {
die "Not an option ROM image\n"
unless $rom->{signature} == ROM_SIGNATURE;
@@ -38,15 +39,16 @@ do {
die "ROM image truncated (is $filelength, should be $romlength)\n"
if $filelength < $romlength;
+ printf "Index: %d, offset: 0x%08x\n\n", $index++, $rom->file_offset;
printf "ROM header:\n\n";
printf " %-16s 0x%02x (%d)\n", "Length:",
$rom->{length}, ( $rom->{length} * 512 );
printf " %-16s 0x%02x (%s0x%02x)\n", "Checksum:", $rom->{checksum},
- ( ( $rom->checksum == 0 ) ? "" : "INCORRECT: " ), $rom->checksum;
- printf " %-16s 0x%04x\n", "Init:", $rom->{init};
- printf " %-16s 0x%04x\n", "UNDI header:", $rom->{undi_header};
+ ( ( $rom->checksum () == 0 ) ? "" : "INCORRECT: " ), $rom->checksum () if ( exists $rom->{checksum} );
+ printf " %-16s 0x%04x\n", "Init:", $rom->{init} if ( defined $rom->{init} );
+ printf " %-16s 0x%04x\n", "UNDI header:", $rom->{undi_header} if ( exists $rom->{undi_header} );
printf " %-16s 0x%04x\n", "PCI header:", $rom->{pci_header};
- printf " %-16s 0x%04x\n", "PnP header:", $rom->{pnp_header};
+ printf " %-16s 0x%04x\n", "PnP header:", $rom->{pnp_header} if ( exists $rom->{pnp_header} );
printf "\n";
my $pci = $rom->pci_header();