limit to just my boiler model
[vrDialog] / errors / dump.pl
1 #!/usr/bin/perl
2 use warnings;
3 use strict;
4
5 use File::Slurp;
6 use Data::Dump qw(dump);
7
8 my $file = read_file 'vrDIALOG.EN';
9 warn "# ", length($file), " bytes\n";
10
11 my $offset = 0x13B68;
12 #$offset = 0x00013C90;
13 #$offset = 0x014024;
14 #$offset = 0x0141da + 2; # possible errors?
15 #$offset = 0x014502 + 2;
16 #$offset = 0x014190;
17
18 my $len = 1;
19 my $page = 0;
20
21 while ( $page < 20 ) {
22
23 again:
24 printf "%02x ", ord(substr($file, $offset + $_, 1 )) foreach ( -2 .. 2 );
25 $len = ord(substr($file, $offset, 1));
26
27 if ( $len == 0 ) {
28         $page++;
29         $offset += 2;
30         printf "0x%06x %-5d %s\n", $offset, $len, '?';
31         goto again;
32
33 }
34
35 my $string = substr($file,$offset + 1, $len * 2);
36 $string =~ s/\x00//g;
37 printf "0x%06x %-5d %s\n", $offset, $len, $string;
38
39 $offset += ( $len + 1 ) * 2;
40
41 }