Archive-ByteBoozer
view release on metacpan or search on metacpan
aTarget->data[0] = packStart & 0xff;
aTarget->data[1] = packStart >> 8;
break;
}
case cleanDecr: {
uint packStart = 0xfffd - packLen;
uint trnsStart = 0x0814 + packLen;
cleanDecrCode[0x1e] = packStart & 0xff;
cleanDecrCode[0x1f] = packStart >> 8;
cleanDecrCode[0x23] = trnsStart & 0xff;
cleanDecrCode[0x24] = trnsStart >> 8;
cleanDecrCode[0xde] = startAdress & 0xff;
cleanDecrCode[0xdf] = startAdress >> 8;
target = aTarget->data + 2;
for(i = 0; i < decrLen; ++i) {
target[i] = cleanDecrCode[i];
}
aTarget->data[0] = 0x01;
aTarget->data[1] = 0x08;
break;
}
case normalDecr: {
uint packStart = 0xfffd - packLen;
uint trnsStart = 0x081e + packLen;
normalDecrCode[0x1e] = packStart & 0xff;
normalDecrCode[0x1f] = packStart >> 8;
normalDecrCode[0x23] = trnsStart & 0xff;
normalDecrCode[0x24] = trnsStart >> 8;
normalDecrCode[0xdc] = startAdress & 0xff;
normalDecrCode[0xdd] = startAdress >> 8;
target = aTarget->data + 2;
for(i = 0; i < decrLen; ++i) {
target[i] = normalDecrCode[i];
}
aTarget->data[0] = 0x01;
aTarget->data[1] = 0x08;
t/03-cruncher.t view on Meta::CPAN
my @crunched_data = split '', $crunched_data;
my @expected_data = map { chr $_ } (0xcd, 0xab, 0x58, 0x00, 0x10, 0xbf, 0x01, 0x02, 0x03, 0x04, 0x05, 0xff);
cmp_deeply(\@crunched_data, \@expected_data, 'relocating compressed data to the given start address');
}
#########################
{
my @data = (0x01, 0x02, 0x03, 0x04, 0x05);
my $data = join '', map { chr $_ } @data;
my $in = new IO::Scalar \$data;
my $out = new IO::Scalar;
my $initial_address = 0x2468;
my %params = (source => $in, target => $out, precede_initial_address => $initial_address);
crunch(%params);
my $crunched_data = <$out>;
my @crunched_data = split '', $crunched_data;
my @expected_data = map { chr $_ } (0xf0, 0xff, 0x58, 0x68, 0x24, 0xbf, 0x01, 0x02, 0x03, 0x04, 0x05, 0xff);
cmp_deeply(\@crunched_data, \@expected_data, 'crunching data preceding it with the given initial address');
}
#########################
{
my @data = (0x00, 0x10, 0x01, 0x02, 0x03, 0x04, 0x05);
my $data = join '', map { chr $_ } @data;
my $in = new IO::Scalar \$data;
my $out = new IO::Scalar;
my $initial_address = 0xc4b5;
my %params = (source => $in, target => $out, replace_initial_address => $initial_address);
( run in 0.350 second using v1.01-cache-2.11-cpan-88abd93f124 )