Skip to content

Instantly share code, notes, and snippets.

@BlockoS
Created February 12, 2010 22:09
Show Gist options
  • Save BlockoS/303035 to your computer and use it in GitHub Desktop.
Save BlockoS/303035 to your computer and use it in GitHub Desktop.
Create a crappy html showing zero page occupancy from pceas sym file
#!/usr/bin/perl
use strict;
use Data::Dumper;
my $zp = {};
foreach my $line (`head -n -2 $ARGV[0]`)
{
my ($label, $addr, $bank) = $line =~ /^\s*([\w.]+)\s*([0-9A-Fa-f]{4})\s*([0-9A-Fa-f]{2})$/;
if( ( ( $bank eq "f8" ) ||
( $bank eq "f0" ) ) &&
( $addr =~ m/20[0-9A-Fa-f]{2}/ ) )
{
if( exists( $zp->{ $addr } ) )
{
push @{$zp->{ $addr }}, $label;
}
else
{
$zp->{ $addr } = [ $label ];
}
}
}
print <<EOT;
<html>
<head>
<title>!</title>
</head>
<style type="text/css">
div.map {
display: table;
}
div.row {
display: table-row;
}
div.element {
display: table-cell;
background-color: red;
width: 16px;
}
div.empty {
display: table-cell;
background-color: green;
width: 16px;
}
</style>
<body>
<div class="map">
EOT
for(my $j=0; $j<16; $j++)
{
print '<div class="row">';;
for(my $i=0; $i<16; $i++)
{
print '<div class="';
my $addr = sprintf("20%02x", $i+($j*16));
if( exists( $zp->{ $addr }) )
{
print 'element';
}
else
{
print 'empty';
}
print '">&nbsp;</div>';
}
print "</div>\n";
}
print <<EOT;
</div>
</html>
</body>
EOT
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment