Browse Source

Cache labels in a file

master
Gavan Fantom 14 years ago
parent
commit
123d2dc923
  1. 24
      disassem.pl

24
disassem.pl

@ -56,6 +56,21 @@ $baseaddr = 0xff0000;
%labels = {};
$labelnum = 0;
if (open LABELS, "<input.labels") {
while (<LABELS>) {
chomp;
if (($name, $addr) = /(.*): (.*)/) {
$addr = hex $addr;
$labels{$addr} = $name;
if ($name =~ /^L(\d+)$/) {
$labelnum = $1 + 1 if ($labelnum >= $1);
}
}
}
}
close LABELS;
$output = 0;
%io = (
@ -192,6 +207,15 @@ for my $pass (0..1) {
}
}
open LABELS, ">input.labels" or die $!;
foreach my $addr (sort keys %labels) {
printf LABELS "%s: %.6x\n", $labels{$addr}, $addr
if defined($labels{$addr});
}
close LABELS;
sub disassemble
{
my ($start) = @_;

Loading…
Cancel
Save