1 #!/usr/local/bin/perl -w
3 print "\tORG\t\$8000\n";
5 my %transtable = ( '02' => 'IDIV' ,
45 my %twobytefirst = ( '18' => '1' );
47 my %twobytesecond = ( '18 38' => 'PULY',
53 # if blank line, print blank line
54 if (/^\s*$/) { print "\n"; next LINE; }
56 # if comment line, pass straight through
57 if (/^\s*;/) { print; next LINE; }
59 # if duplicate label - rename uniquely
60 if (/^\s*((loop|jump82|goto91):)/) { print "${1}_$.\n"; next LINE; }
62 # if it's a label, print label
63 if (/^\s*(\w*:)/) { print "$1\n"; next LINE; }
65 # if it's a vector table, print words
66 if (/^\t\.word\t([a-f0-9]{4})$/) { print "\tFDB\t\$\U$1\n"; next LINE; }
68 # otherwise, catch all, print bytes
69 if (/^([A-F0-9]{4}) ((([A-F0-9]{2}) )*[A-F0-9]{2})/) {
74 # if control Z, remove it
75 if (/^\cZ$/) { next LINE; }
77 # FINAL print commented out
81 # Process one instruction
82 # Usage: instruction line
87 $instruction = substr($line,5,2);
89 if (defined $transtable{$instruction}) {
90 print "\t$transtable{$instruction}";
91 $line =~ /$transtable{$instruction}(.*)$/i;
96 if (defined $twobytefirst{$instruction}) {
97 $thing = substr($line,5,5);
98 if (defined $twobytesecond{$thing}) {
99 print "\t" . $twobytesecond{$thing};
100 $line =~ /$twobytesecond{$thing}(.*)$/i;
106 if ($line =~ /^([A-F0-9]{4}) ((([A-F0-9]{2}) )*[A-F0-9]{2})/) {
108 print "\tFCB\t\$".join(', $',@_)."\n";