Browse Source

Use byte 6 for the checksum, rather than byte 5. (Byte 5 may be part of

the jmp instruction).
tags/v0.9.3
Michael Brown 18 years ago
parent
commit
8d0c5f3302
1 changed files with 6 additions and 10 deletions
  1. 6
    10
      src/util/makerom.pl

+ 6
- 10
src/util/makerom.pl View File

@@ -131,9 +131,9 @@ sub writerom ($$) {
131 131
 sub checksum ($) {
132 132
 	my ($romref) = @_;
133 133
 
134
-	substr($$romref, 5, 1) = "\x00";
134
+	substr($$romref, 6, 1) = "\x00";
135 135
 	my $sum = unpack('%8C*', $$romref);
136
-	substr($$romref, 5, 1) = chr(256 - $sum);
136
+	substr($$romref, 6, 1) = chr(256 - $sum);
137 137
 	# Double check
138 138
 	$sum = unpack('%8C*', $$romref);
139 139
 	if ($sum != 0) {
@@ -168,14 +168,10 @@ sub makerom () {
168 168
 			$romsize = ($filesize + 511) & ~511
169 169
 		}
170 170
 	} else {
171
-		$romsize = getromsize(\$rom);
172
-		# 0 put there by *loader.S means makerom should pick the size
173
-		if ($romsize == 0) {
174
-			# Shrink romsize down to the smallest power of two that will do
175
-			for ($romsize = MAXROMSIZE;
176
-				$romsize > MINROMSIZE and $romsize >= 2*$filesize;
177
-				$romsize /= 2) { }
178
-		}
171
+		# Shrink romsize down to the smallest power of two that will do
172
+		for ($romsize = MAXROMSIZE;
173
+		     $romsize > MINROMSIZE and $romsize >= 2*$filesize;
174
+		     $romsize /= 2) { }
179 175
 	}
180 176
 	if ($filesize > $romsize) {
181 177
 		print STDERR "ROM size of $romsize not big enough for data, ";

Loading…
Cancel
Save