]> git.sur5r.net Git - cc65/commitdiff
Fixed a bug
authorcuz <cuz@b7a2c559-68d2-44c3-8de9-860c34a00d81>
Thu, 27 Nov 2003 20:43:37 +0000 (20:43 +0000)
committercuz <cuz@b7a2c559-68d2-44c3-8de9-860c34a00d81>
Thu, 27 Nov 2003 20:43:37 +0000 (20:43 +0000)
git-svn-id: svn://svn.cc65.org/cc65/trunk@2688 b7a2c559-68d2-44c3-8de9-860c34a00d81

src/cc65/coptind.c

index 6941a2c024efcecc644ac1344d3548e3cdda9258..97f9dcfed3a3fbe44bc41e2fc0c7e729b9c1fb80 100644 (file)
@@ -7,7 +7,7 @@
 /*                                                                           */
 /*                                                                           */
 /* (C) 2001-2003 Ullrich von Bassewitz                                       */
-/*               Römerstrasse 52                                             */
+/*               Römerstraße 52                                              */
 /*               D-70794 Filderstadt                                         */
 /* EMail:        uz@cc65.org                                                 */
 /*                                                                           */
@@ -1322,13 +1322,25 @@ unsigned OptPrecalc (CodeSeg* S)
         switch (E->OPC) {
 
             case OP65_LDA:
+                if (E->AM != AM65_IMM && RegValIsKnown (Out->RegA)) {
+                    /* Result of load is known */
+                    Arg = MakeHexArg (Out->RegA);
+                }
+                break;
+
             case OP65_LDX:
+                if (E->AM != AM65_IMM && RegValIsKnown (Out->RegX)) {
+                    /* Result of load is known */
+                    Arg = MakeHexArg (Out->RegX);
+                }
+                break;
+
             case OP65_LDY:
-                if (E->AM == AM65_IMM) {
-                    /* If we do already have an immediate load, bail out */
-                    break;
+                if (E->AM != AM65_IMM && RegValIsKnown (Out->RegY)) {
+                    /* Result of load is known */
+                    Arg = MakeHexArg (Out->RegY);
                 }
-                /* FALLTHROUGH */
+                break;
 
             case OP65_ADC:
             case OP65_ASL:
@@ -1336,7 +1348,7 @@ unsigned OptPrecalc (CodeSeg* S)
             case OP65_LSR:
             case OP65_SBC:
                 if (RegValIsKnown (Out->RegA)) {
-                    /* Accu AND zp with known contents */
+                    /* Accu op zp with known contents */
                     Arg = MakeHexArg (Out->RegA);
                 }
                 break;