File: bytecode.pl

package info (click to toggle)
retty 1.0-1
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 96 kB
  • ctags: 54
  • sloc: ansic: 414; asm: 205; makefile: 42; perl: 24
file content (27 lines) | stat: -rwxr-xr-x 545 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#!/usr/bin/perl

$state = 0;
while ($l = <STDIN>) {
	chomp($l);
	if (!$state && $l =~ /^[0-9a-f]* <.*>:/) {
		$state++;
	} elsif ($state) {
		if ($l =~ /^\s*([0-9a-f]*):\t(.*)\t(.*)$/) {
			$c = $1;
			$a = $2;
			$b = $3;
			$a =~ s/[^0-9a-f]//g;
			$a =~ s/([0-9a-f]{2})/0x\1,/g;
			printf("/* %04s */\t%-30s\t/* \%s */\n", $c, $a, $b);
		} elsif ($l =~ /^([0-9a-f]+) <(\S+)>:\s*$/) {
			push (@id, [$2, $1]);
		}
	}
}

print "};\n";
foreach my $i (@id) {
	my ($id, $ofs) = @$i;
	print "poke_32($ARGV[0], 0x$ofs+1, fd_$id);\n";
}
print "{\n";