2002-11-25 01:45:40 +03:00
|
|
|
#!/usr/bin/perl
|
|
|
|
#
|
2009-12-30 23:28:23 +03:00
|
|
|
# $Id: makesym.perl,v 1.3 2009-12-30 20:28:23 sshwarts Exp $
|
2002-11-25 01:45:40 +03:00
|
|
|
#
|
2008-01-26 12:15:27 +03:00
|
|
|
# Read output file from as86 (e.g. rombios.txt) and write out a symbol
|
2002-11-25 01:45:40 +03:00
|
|
|
# table suitable for the Bochs debugger.
|
|
|
|
#
|
|
|
|
|
2009-12-30 23:28:23 +03:00
|
|
|
use strict;
|
|
|
|
use warnings;
|
2002-11-25 01:45:40 +03:00
|
|
|
|
2009-12-30 23:28:23 +03:00
|
|
|
my $WHERE_BEFORE_SYM_TABLE = 0;
|
|
|
|
my $WHERE_IN_SYM_TABLE = 1;
|
|
|
|
my $WHERE_AFTER_SYM_TABLE = 2;
|
|
|
|
|
|
|
|
my $where = $WHERE_BEFORE_SYM_TABLE;
|
2002-11-25 01:45:40 +03:00
|
|
|
while (<STDIN>) {
|
|
|
|
chop;
|
2009-12-30 23:28:23 +03:00
|
|
|
if ($where == $WHERE_BEFORE_SYM_TABLE && /^Symbols:/) {
|
2002-11-25 01:45:40 +03:00
|
|
|
$where = $WHERE_IN_SYM_TABLE;
|
|
|
|
} elsif ($where == $WHERE_IN_SYM_TABLE && /^$/) {
|
|
|
|
$where = $WHERE_AFTER_SYM_TABLE;
|
|
|
|
}
|
|
|
|
if ($where == $WHERE_IN_SYM_TABLE) {
|
2009-12-30 23:28:23 +03:00
|
|
|
my $name;
|
|
|
|
my $junk;
|
|
|
|
foreach my $f (split(/\s+/)) {
|
|
|
|
if ($f =~ /^[[:xdigit:]]{4,}$/) {
|
|
|
|
if (defined($name)) {
|
|
|
|
print '000f', lc($f), ' ', $name, "\n";
|
|
|
|
undef($name);
|
|
|
|
undef($junk);
|
|
|
|
next;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
$name = $junk
|
|
|
|
if (defined($junk));
|
|
|
|
$junk = $f;
|
2002-11-25 01:45:40 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2009-12-30 23:28:23 +03:00
|
|
|
|
|
|
|
exit(0);
|