view scripts/list2crc.pl @ 3285:345ff5806dd7

Correct coco.d filename in shipped Defsfile files It seems that 8 years ago in commit 2624:b8c7b7fbf3c9 the coco defs were put into a new "coco.d" (from "systype"), and the various level*/<port>/defsfile were updated. However, the level*/<port>/defs/Defsfile (that are copied to the disk images under DEFS) were apparently wrongly updated.
author hpmachining <aur@hpminc.com>
date Thu, 18 Jun 2020 20:29:32 +0200
parents a0b770fab355
children
line wrap: on
line source

#!/usr/bin/perl

# Copyright 2014  Tormod Volden
#
# Digests assembly listings generated by lwasm, and stores the
# module body listing in a file named by the module CRC.
# Example: for f in *.lst; do ../scripts/list2crc.pl $f; done

open(CRCFILE, ">", "crc.tmp") or die "cannot create crc.tmp: $!";

while (<>) {
	($hoffset, $opbytes, $filepath, $lineno,  $label, $opcode, $operand, $comment) =
		( $_ =~ /^(\w+) (\w+)\s+\((.*)\):(\d+) (\S+)?\s+(\w+)\s*(\S+)?\s*(.*)?/ );

	# print $hoffset, "\t", $opcode, "\t", $comment, "\n";
	if (lc($opcode) eq "mod") {
		$in_module = 1;
	}

	if (lc($opcode) eq "emod") {
		die "double emod" if $found_emod;
		$found_emod = 1;
		$crc = $opbytes;
		$in_module = 0;
	}

#	if ($in_module && $hoffset) {
#		$offset = hex($hoffset);
#		print CRCFILE "$offset\t$filepath\t$lineno\n";
#	}
	if ($in_module) {
		print CRCFILE $_
	}
}
close(CRCFILE);
if ($crc) {
	print "writing $crc.crc\n";
	rename "crc.tmp", $crc . ".crc";
}