'18 3A' => 'ABY',
'18 3C' => 'PSHY');
-my %twobytesecondword = ( '18 FE' => 'LDY\t%s',
- '18 FF' => 'STY\t%s');
+my %twobytesecondword = ( '18 FE' => 'LDY\t>%s',
+ '18 FF' => 'STY\t>%s');
my %onewitharg = ('60' => "NEG\t\$%s,X",
'63' => "COM\t\$%s,X",
'86' => "LDAA\t#\$%s",
'88' => "EORA\t#\$%s",
'8A' => "ORA\t#\$%s",
+ '8B' => "ADDA\t#\$%s",
'A0' => "SUBA\t\$%s,X",
'A1' => "CMPA\t\$%s,X",
'A2' => "SBCA\t\$%s,X",
'C5' => "BITB\t#\$%s",
'C6' => "LDAB\t#\$%s",
'C8' => "EORB\t#\$%s",
+ 'C9' => "ADCB\t#\$%s",
'CA' => "ORB\t#\$%s",
+ 'CB' => "ADDB\t#\$%s",
'E0' => "SUBB\t\$%s,X",
'E1' => "CMPB\t\$%s,X",
'E2' => "SBCB\t\$%s,X",
my %onewithword = (
- '70' => "NEG\t%s",
- '73' => "COM\t%s",
- '74' => "LSR\t%s",
- '76' => "ROR\t%s",
- '77' => "ASR\t%s",
- '78' => "LSL\t%s",
+ '70' => "NEG\t>%s",
+ '73' => "COM\t>%s",
+ '74' => "LSR\t>%s",
+ '76' => "ROR\t>%s",
+ '77' => "ASR\t>%s",
+ '78' => "LSL\t>%s",
# LSL == ASL
-# '78' => "ASL\t%s",
- '79' => "ROL\t%s",
- '7A' => "DEC\t%s",
- '7C' => "INC\t%s",
- '7D' => "TST\t%s",
- '7F' => "CLR\t%s",
- 'B0' => "SUBA\t%s",
- 'B1' => "CMPA\t%s",
- 'B2' => "SBCA\t%s",
- 'B3' => "SUBD\t%s",
- 'B4' => "ANDA\t%s",
- 'B5' => "BITA\t%s",
- 'B6' => "LDAA\t%s",
- 'B7' => "STAA\t%s",
- 'B9' => "ADCA\t%s",
- 'BA' => "ORAA\t%s",
- 'BB' => "ADDA\t%s",
- 'BC' => "CPX\t%s",
- 'BD' => "JSR\t%s",
- 'BE' => "LDS\t%s",
- 'BF' => "STS\t%s",
- 'F0' => "SUBB\t%s",
- 'F1' => "CMPB\t%s",
- 'F2' => "SBCB\t%s",
- 'F3' => "ADDD\t%s",
- 'F4' => "ANDB\t%s",
- 'F5' => "BITB\t%s",
- 'F6' => "LDAB\t%s",
- 'F7' => "STAB\t%s",
- 'FA' => "ORAB\t%s",
- 'FB' => "ADDB\t%s",
- 'F8' => "EORB\t%s",
- 'F9' => "ADCB\t%s",
- 'FC' => "LDD\t%s",
- 'FD' => "STD\t%s",
- 'FE' => "LDX\t%s",
- 'FF' => "STX\t%s" );
+# '78' => "ASL\t>%s",
+ '79' => "ROL\t>%s",
+ '7A' => "DEC\t>%s",
+ '7C' => "INC\t>%s",
+ '7D' => "TST\t>%s",
+ '7F' => "CLR\t>%s",
+# '95' => "BITA\t<%s",
+ 'B0' => "SUBA\t>%s",
+ 'B1' => "CMPA\t>%s",
+ 'B2' => "SBCA\t>%s",
+ 'B3' => "SUBD\t>%s",
+ 'B4' => "ANDA\t>%s",
+ 'B5' => "BITA\t>%s",
+ 'B6' => "LDAA\t>%s",
+ 'B7' => "STAA\t>%s",
+ 'B9' => "ADCA\t>%s",
+ 'BA' => "ORAA\t>%s",
+ 'BB' => "ADDA\t>%s",
+ 'BC' => "CPX\t>%s",
+ 'BD' => "JSR\t>%s",
+ 'BE' => "LDS\t>%s",
+ 'BF' => "STS\t>%s",
+ 'D5' => "BITB\t>%s",
+ 'F0' => "SUBB\t>%s",
+ 'F1' => "CMPB\t>%s",
+ 'F2' => "SBCB\t>%s",
+ 'F3' => "ADDD\t>%s",
+ 'F4' => "ANDB\t>%s",
+ 'F5' => "BITB\t>%s",
+ 'F6' => "LDAB\t>%s",
+ 'F7' => "STAB\t>%s",
+ 'FA' => "ORAB\t>%s",
+ 'FB' => "ADDB\t>%s",
+ 'F8' => "EORB\t>%s",
+ 'F9' => "ADCB\t>%s",
+ 'FC' => "LDD\t>%s",
+ 'FD' => "STD\t>%s",
+ 'FE' => "LDX\t>%s",
+ 'FF' => "STX\t>%s" );
LINE: while (<>) {
$instruction = substr($line,5,2);
if (defined $transtable{$instruction}) {
+ print ";$line";
print "\t$transtable{$instruction}";
$line =~ /$transtable{$instruction}(.*)$/i;
print "$1\n";
}
if (defined $twobytefirst{$instruction}) {
+ print ";$line";
$thing = substr($line,5,5);
if (defined $twobytesecond{$thing}) {
print "\t" . $twobytesecond{$thing};
if (!($athing2 =~ /\s+/)) {
$curraddr = substr($line,0,4);
printf "FOO%s\tEQU\t\$%s%s\n", $curraddr,$athing,$athing2;
- printf "\t$twobytesecondword{$thing}", ">FOO$curraddr";
+ printf "\t$twobytesecondword{$thing}", "FOO$curraddr";
$line =~ /$twobytesecondword{$thing} [0-9A-F][0-9A-F][0-9A-F][0-9A-F](.*)$/i;
print "\t;$1\n";
return;
}
if (defined $onewitharg{$instruction}) {
+ print ";$line";
$thing = substr($line,8,2);
printf "\t$onewitharg{$instruction}", $thing;
}
if (defined $onewithword{$instruction}) {
+ print ";$line";
$thing = substr($line,8,2);
$thing2 = substr($line,11,2);
if (!($thing2 =~ /\s+/)) {
$curraddr = substr($line,0,4);
printf "FOO%s\tEQU\t\$%s%s\n", $curraddr,$thing,$thing2;
- printf "\t$onewithword{$instruction}", ">FOO$curraddr";
+ printf "\t$onewithword{$instruction}", "FOO$curraddr";
$line =~ /$onewithword{$instruction} [0-9A-F][0-9A-F][0-9A-F][0-9A-F](.*)$/i;
print "\t;$1\n";
return;