aboutsummaryrefslogtreecommitdiff
path: root/mkrelocxex.pl
diff options
context:
space:
mode:
Diffstat (limited to 'mkrelocxex.pl')
-rwxr-xr-xmkrelocxex.pl29
1 files changed, 15 insertions, 14 deletions
diff --git a/mkrelocxex.pl b/mkrelocxex.pl
index e4b8a10..a871cd5 100755
--- a/mkrelocxex.pl
+++ b/mkrelocxex.pl
@@ -62,7 +62,15 @@ sub print_table {
printf("lo start/end: \$%04x/\$%04x\n", $start, $end);
printf("hi start/end: \$%04x/\$%04x\n", $hi_start, $hi_end);
-if(($hi_start != ($start + 0x0102)) || ($hi_end != ($end + 0x0102))) {
+if(($start % 0x100) || ($hi_start % 0x100)) {
+ die "starting address not on a page boundary\n";
+}
+
+if($start != ($hi_start - 0x100)) {
+ die "starting addresses not one page apart\n";
+}
+
+if(($hi_start != ($start + 0x0100)) || ($hi_end != ($end + 0x0100))) {
die "mismatched segment lengths\n";
}
@@ -74,21 +82,19 @@ for($i = 0; $i < @bytes; $i++) {
next if $a == $b;
if($b == ($a + 1)) {
push @hi_table, ($i + $start);
- } elsif($b == ($a + 2)) {
- push @lo_table, ($i + $start);
} else {
- die "invalid difference (not 1 or 2)\n";
+ die "invalid difference (not 0 or 1)\n";
}
}
push(@hi_table, 0);
-push(@lo_table, 0);
print_table("hi", \@hi_table);
-print_table("lo", \@lo_table);
+print "table size: " . @hi_table . " bytes\n\n";
($istart, $iend) = read_header($lo);
-warn "istart $istart iend $iend\n";
+
+#warn "istart $istart iend $iend\n";
if($istart == 0x2e2 && $iend == 0x2e3) {
$init = read_word($lo);
}
@@ -96,7 +102,7 @@ if($istart == 0x2e2 && $iend == 0x2e3) {
# OK, make the output file now...
print $out chr(0xff);
print $out chr(0xff);
-warn $start;
+#warn $start;
print $out chr($start & 0xff);
print $out chr($start >> 8);
print $out chr($end & 0xff);
@@ -126,14 +132,9 @@ for(@hi_table) {
$rcode .= chr($_ >> 8);
}
-for(@lo_table) {
- $rcode .= chr($_ & 0xff);
- $rcode .= chr($_ >> 8);
-}
-
$rend = $rstart + length($rcode) - 1;
-warn "$rstart $rend " . length($rcode);
+#warn "$rstart $rend " . length($rcode);
# don't really need a ffff header, makes it easier to read hexdumps.
print $out chr(0xff);