I took my perl script that generates a spark map and hacked it apart to make a script that will dump the hex values for a table to your screen. I tested it against a couple builds of the 87T2_Master code and the values looked ok. It took about an hour to get working, as the other code was already working pretty well. You can just run the script for a usage example.
I can probably use perl2exe to create an executable for all the windows folks (if anyone wants it) or they can get a perl runtime (which can be a PITA). It doesn't currently dump out any FF bytes after the table, but that should be a simple update if wanted. I would like to eventually add this and the config flag to chem2, but I dunno when I'll be able to get to it. Since I can't seem to post attachments here's the code:
Code:
#!/usr/bin/perl
#program to read .tbl and .bin and print table info out in format
#usable by chemasm for LM's
#
#usage: dump_entries($table_offset, $FILE_WITH_CAL_DATA );
sub dump_entries()
{
$off_info = $_[0];
$CALFILE = $_[1];
$offset = hex($off_info) - hex(C000);
#seek to position in bin, and read the number of entries for this table
seek( $CALFILE, $offset, SEEK_SET );
#read and convert number of entries
read( $CALFILE, $in, 1);
$num_tbl_entrs = unpack("C", $in);
#dump number of table entries
printf("hex %02x\n" , unpack("C", $in));
# print STDERR "number of entries in " . @$tbl_info[0] . " : " . $num_tbl_entrs . "\n";
# print STDERR "offset of table: " . $offset . "\n";
#for the number of entries in the tables
#read through the next set of bytes and dump them out
for( $i=0; $i < $num_tbl_entrs; $i++)
{
#read x value from ith table entry
read($CALFILE, $in, 1);
printf("hex %02x " , unpack("C", $in));
#read y value from ith table entry
read($CALFILE, $in, 1);
printf("%02x ", unpack("C", $in));
#if not at last entry, dump slopes for this entry
if ($i < $num_tbl_entrs-1)
{
#rise
read($CALFILE, $in, 1);
printf("%02x", unpack("C", $in));
#run
read($CALFILE, $in, 1);
printf("%02x\n", unpack("C", $in));
}
else
{
printf("\n");
}
}
}
my($input_tbl, $input_bin, $maplist);
my(@raw_tbl_entries);
if ($#ARGV != 1)
{
print STDERR "Usage: dump_tblinfo.pl <base filename> <comma seperated list of tables to dump> \n";
print STDERR "Example: dump_tblinfo.pl 87T2_S1 WOTMAP,HOTMAP,CLDMAP,PEFTBL\n";
exit(1);
}
$input_tbl = $ARGV[0].".tbl";
$input_bin = $ARGV[0].".bin";
#substitute commas for pipes to be used in regex
$_ = $ARGV[1];
s/\,/\|/g;
$maplist = $_;
open(TBL,"<$input_tbl") || die "couldn't open file $input_tbl";
open(BIN,"<$input_bin") || die "couldn't open file $input_bin";
binmode(BIN);
# read and parse table
while( <TBL> )
{
@raw_tbl_entries = split(' ', $_);
if(@raw_tbl_entries[12] =~ m/$maplist/)
{
print "@raw_tbl_entries[12] \n";
&dump_entries(@raw_tbl_entries[0], BIN);
}
}