Added Indirect X addressing instructions
authorNick Bannon <[email protected]>
Thu, 3 Jan 2002 12:31:48 +0000 (12:31 +0000)
committerNick Bannon <[email protected]>
Thu, 3 Jan 2002 12:31:48 +0000 (12:31 +0000)
ROM/makeasm.pl

index 7bf28d4..c7b3064 100755 (executable)
@@ -48,7 +48,14 @@ my %twobytesecond = ( '18 38' => 'PULY',
                        '18 3A' => 'ABY',
                        '18 3C' => 'PSHY');
 
-my %onewitharg = ('63' => "COM\t\$%s,X",
+my %twobytesecondword = ( '18 FE' => 'LDY\t%s',
+                       '18 FF' => 'STY\t%s');
+
+my %onewitharg = ('60' => "NEG\t\$%s,X",
+                       '63' => "COM\t\$%s,X",
+                       '64' => "LSR\t\$%s,X",
+                       '67' => "ASR\t\$%s,X",
+                       '68' => "ASL\t\$%s,X",
                        '6A' => "DEC\t\$%s,X",
                        '6C' => "INC\t\$%s,X",
                        '6D' => "TST\t\$%s,X",
@@ -62,8 +69,21 @@ my %onewitharg = ('63' => "COM\t\$%s,X",
                        '86' => "LDAA\t#\$%s",
                        '88' => "EORA\t#\$%s",
                        '8A' => "ORA\t#\$%s",
+                       'A0' => "SUBA\t\$%s,X",
+                       'A1' => "CMPA\t\$%s,X",
+                       'A2' => "SBCA\t\$%s,X",
                        'A3' => "SUBD\t\$%s,X",
+                       'A4' => "ANDA\t\$%s,X",
+                       'A6' => "LDAA\t\$%s,X",
                        'A7' => "STA\t\$%s,X",
+                       'A8' => "EORA\t\$%s,X",
+                       'A9' => "ADCA\t\$%s,X",
+                       'AA' => "ORAA\t\$%s,X",
+                       'AB' => "ADDA\t\$%s,X",
+                       'AC' => "CPX\t\$%s,X",
+                       'AD' => "JSR\t\$%s,X",
+                       'AE' => "LDS\t\$%s,X",
+                       'AF' => "STS\t\$%s,X",
                        'C0' => "SUBB\t#\$%s",
                        'C1' => "CMPB\t#\$%s",
                        'C2' => "SBCB\t#\$%s",
@@ -72,9 +92,21 @@ my %onewitharg = ('63' => "COM\t\$%s,X",
                        'C6' => "LDAB\t#\$%s",
                        'C8' => "EORB\t#\$%s",
                        'CA' => "ORB\t#\$%s",
+                       'E0' => "SUBB\t\$%s,X",
+                       'E1' => "CMPB\t\$%s,X",
+                       'E2' => "SBCB\t\$%s,X",
                        'E3' => "ADDD\t\$%s,X",
+                       'E4' => "ANDB\t\$%s,X",
+                       'E6' => "LDAB\t\$%s,X",
+                       'E7' => "STAB\t\$%s,X",
+                       'E8' => "EORB\t\$%s,X",
+                       'E9' => "ADCB\t\$%s,X",
+                       'EA' => "ORAB\t\$%s,X",
+                       'EB' => "ADDB\t\$%s,X",
                        'EC' => "LDD\t\$%s,X",
-                       'ED' => "STAD\t\$%s,X" );
+                       'ED' => "STD\t\$%s,X",
+                       'EE' => "LDX\t\$%s,X",
+                       'EF' => "STX\t\$%s,X" );
 
 
 my %onewithword = (
@@ -157,7 +189,6 @@ LINE: while (<>) {
 # Usage: instruction line
 sub instruction {
     my ($line) = @_;
-    print ";$line";
 
     $instruction = substr($line,5,2);
 
@@ -176,6 +207,19 @@ sub instruction {
                print "$1\n";
                return;
        }
+    
+       if (defined $twobytesecondword{$thing}) {
+               $athing = substr($line,11,2);
+               $athing2 = substr($line,14,2);
+               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";
+                $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}) {
@@ -200,6 +244,7 @@ sub instruction {
        }
     }
    
+    print ";$line";
     if ($line =~ /^([A-F0-9]{4}) ((([A-F0-9]{2}) )*[A-F0-9]{2})/) {
         @_=split(' ',$2);
         print "\tFCB\t\$".join(', $',@_)."\n";

UCC git Repository :: git.ucc.asn.au