view scripts/list2crc.pl @ 3267:024ad1d926fd

Get gfx2 to build from cmds folders Now that gfx2.asm needs to include coco3vtio.d the latter needs to be built first and be accessed from the port-specific defs folder. OTOH the one built in 3rd-party/packages/basic09 is built only later during a full build. (All the different defs folders and .d files still puzzle me.) Also updated coco3fpga/defs/makefile to be based on the coco3 one. The mc09l2 port doesn't need gfx and gfx2. Note for later: This whole build of basic09 components from the 3rdparty folder during the ports builds is not very nice. At a minimum we should try to limit the extra --includedir to the few commands needing it.
author Tormod Volden <debian.tormod@gmail.com>
date Wed, 17 Jul 2019 01:14:55 +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";
}