Mercurial > hg > Members > kono > nitros9-code
annotate scripts/list2crc.pl @ 3295:6b7a7b233925 default tip
makefile: Allow PORTS with level1/2 mix
https://sourceforge.net/p/nitros9/feature-requests/10/
author | Tormod Volden <debian.tormod@gmail.com> |
---|---|
date | Tue, 19 Apr 2022 18:12:17 +0200 (2022-04-19) |
parents | a0b770fab355 |
children |
rev | line source |
---|---|
2955
a0b770fab355
Add scripts/os9.gdb and list2crc.pl for gdb debugging
Tormod Volden <debian.tormod@gmail.com>
parents:
diff
changeset
|
1 #!/usr/bin/perl |
a0b770fab355
Add scripts/os9.gdb and list2crc.pl for gdb debugging
Tormod Volden <debian.tormod@gmail.com>
parents:
diff
changeset
|
2 |
a0b770fab355
Add scripts/os9.gdb and list2crc.pl for gdb debugging
Tormod Volden <debian.tormod@gmail.com>
parents:
diff
changeset
|
3 # Copyright 2014 Tormod Volden |
a0b770fab355
Add scripts/os9.gdb and list2crc.pl for gdb debugging
Tormod Volden <debian.tormod@gmail.com>
parents:
diff
changeset
|
4 # |
a0b770fab355
Add scripts/os9.gdb and list2crc.pl for gdb debugging
Tormod Volden <debian.tormod@gmail.com>
parents:
diff
changeset
|
5 # Digests assembly listings generated by lwasm, and stores the |
a0b770fab355
Add scripts/os9.gdb and list2crc.pl for gdb debugging
Tormod Volden <debian.tormod@gmail.com>
parents:
diff
changeset
|
6 # module body listing in a file named by the module CRC. |
a0b770fab355
Add scripts/os9.gdb and list2crc.pl for gdb debugging
Tormod Volden <debian.tormod@gmail.com>
parents:
diff
changeset
|
7 # Example: for f in *.lst; do ../scripts/list2crc.pl $f; done |
a0b770fab355
Add scripts/os9.gdb and list2crc.pl for gdb debugging
Tormod Volden <debian.tormod@gmail.com>
parents:
diff
changeset
|
8 |
a0b770fab355
Add scripts/os9.gdb and list2crc.pl for gdb debugging
Tormod Volden <debian.tormod@gmail.com>
parents:
diff
changeset
|
9 open(CRCFILE, ">", "crc.tmp") or die "cannot create crc.tmp: $!"; |
a0b770fab355
Add scripts/os9.gdb and list2crc.pl for gdb debugging
Tormod Volden <debian.tormod@gmail.com>
parents:
diff
changeset
|
10 |
a0b770fab355
Add scripts/os9.gdb and list2crc.pl for gdb debugging
Tormod Volden <debian.tormod@gmail.com>
parents:
diff
changeset
|
11 while (<>) { |
a0b770fab355
Add scripts/os9.gdb and list2crc.pl for gdb debugging
Tormod Volden <debian.tormod@gmail.com>
parents:
diff
changeset
|
12 ($hoffset, $opbytes, $filepath, $lineno, $label, $opcode, $operand, $comment) = |
a0b770fab355
Add scripts/os9.gdb and list2crc.pl for gdb debugging
Tormod Volden <debian.tormod@gmail.com>
parents:
diff
changeset
|
13 ( $_ =~ /^(\w+) (\w+)\s+\((.*)\):(\d+) (\S+)?\s+(\w+)\s*(\S+)?\s*(.*)?/ ); |
a0b770fab355
Add scripts/os9.gdb and list2crc.pl for gdb debugging
Tormod Volden <debian.tormod@gmail.com>
parents:
diff
changeset
|
14 |
a0b770fab355
Add scripts/os9.gdb and list2crc.pl for gdb debugging
Tormod Volden <debian.tormod@gmail.com>
parents:
diff
changeset
|
15 # print $hoffset, "\t", $opcode, "\t", $comment, "\n"; |
a0b770fab355
Add scripts/os9.gdb and list2crc.pl for gdb debugging
Tormod Volden <debian.tormod@gmail.com>
parents:
diff
changeset
|
16 if (lc($opcode) eq "mod") { |
a0b770fab355
Add scripts/os9.gdb and list2crc.pl for gdb debugging
Tormod Volden <debian.tormod@gmail.com>
parents:
diff
changeset
|
17 $in_module = 1; |
a0b770fab355
Add scripts/os9.gdb and list2crc.pl for gdb debugging
Tormod Volden <debian.tormod@gmail.com>
parents:
diff
changeset
|
18 } |
a0b770fab355
Add scripts/os9.gdb and list2crc.pl for gdb debugging
Tormod Volden <debian.tormod@gmail.com>
parents:
diff
changeset
|
19 |
a0b770fab355
Add scripts/os9.gdb and list2crc.pl for gdb debugging
Tormod Volden <debian.tormod@gmail.com>
parents:
diff
changeset
|
20 if (lc($opcode) eq "emod") { |
a0b770fab355
Add scripts/os9.gdb and list2crc.pl for gdb debugging
Tormod Volden <debian.tormod@gmail.com>
parents:
diff
changeset
|
21 die "double emod" if $found_emod; |
a0b770fab355
Add scripts/os9.gdb and list2crc.pl for gdb debugging
Tormod Volden <debian.tormod@gmail.com>
parents:
diff
changeset
|
22 $found_emod = 1; |
a0b770fab355
Add scripts/os9.gdb and list2crc.pl for gdb debugging
Tormod Volden <debian.tormod@gmail.com>
parents:
diff
changeset
|
23 $crc = $opbytes; |
a0b770fab355
Add scripts/os9.gdb and list2crc.pl for gdb debugging
Tormod Volden <debian.tormod@gmail.com>
parents:
diff
changeset
|
24 $in_module = 0; |
a0b770fab355
Add scripts/os9.gdb and list2crc.pl for gdb debugging
Tormod Volden <debian.tormod@gmail.com>
parents:
diff
changeset
|
25 } |
a0b770fab355
Add scripts/os9.gdb and list2crc.pl for gdb debugging
Tormod Volden <debian.tormod@gmail.com>
parents:
diff
changeset
|
26 |
a0b770fab355
Add scripts/os9.gdb and list2crc.pl for gdb debugging
Tormod Volden <debian.tormod@gmail.com>
parents:
diff
changeset
|
27 # if ($in_module && $hoffset) { |
a0b770fab355
Add scripts/os9.gdb and list2crc.pl for gdb debugging
Tormod Volden <debian.tormod@gmail.com>
parents:
diff
changeset
|
28 # $offset = hex($hoffset); |
a0b770fab355
Add scripts/os9.gdb and list2crc.pl for gdb debugging
Tormod Volden <debian.tormod@gmail.com>
parents:
diff
changeset
|
29 # print CRCFILE "$offset\t$filepath\t$lineno\n"; |
a0b770fab355
Add scripts/os9.gdb and list2crc.pl for gdb debugging
Tormod Volden <debian.tormod@gmail.com>
parents:
diff
changeset
|
30 # } |
a0b770fab355
Add scripts/os9.gdb and list2crc.pl for gdb debugging
Tormod Volden <debian.tormod@gmail.com>
parents:
diff
changeset
|
31 if ($in_module) { |
a0b770fab355
Add scripts/os9.gdb and list2crc.pl for gdb debugging
Tormod Volden <debian.tormod@gmail.com>
parents:
diff
changeset
|
32 print CRCFILE $_ |
a0b770fab355
Add scripts/os9.gdb and list2crc.pl for gdb debugging
Tormod Volden <debian.tormod@gmail.com>
parents:
diff
changeset
|
33 } |
a0b770fab355
Add scripts/os9.gdb and list2crc.pl for gdb debugging
Tormod Volden <debian.tormod@gmail.com>
parents:
diff
changeset
|
34 } |
a0b770fab355
Add scripts/os9.gdb and list2crc.pl for gdb debugging
Tormod Volden <debian.tormod@gmail.com>
parents:
diff
changeset
|
35 close(CRCFILE); |
a0b770fab355
Add scripts/os9.gdb and list2crc.pl for gdb debugging
Tormod Volden <debian.tormod@gmail.com>
parents:
diff
changeset
|
36 if ($crc) { |
a0b770fab355
Add scripts/os9.gdb and list2crc.pl for gdb debugging
Tormod Volden <debian.tormod@gmail.com>
parents:
diff
changeset
|
37 print "writing $crc.crc\n"; |
a0b770fab355
Add scripts/os9.gdb and list2crc.pl for gdb debugging
Tormod Volden <debian.tormod@gmail.com>
parents:
diff
changeset
|
38 rename "crc.tmp", $crc . ".crc"; |
a0b770fab355
Add scripts/os9.gdb and list2crc.pl for gdb debugging
Tormod Volden <debian.tormod@gmail.com>
parents:
diff
changeset
|
39 } |