(genCodePointerGet): quicker code for bug #700797
authorfrief <frief@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Sat, 22 Mar 2003 21:39:01 +0000 (21:39 +0000)
committerfrief <frief@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Sat, 22 Mar 2003 21:39:01 +0000 (21:39 +0000)
git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@2409 4a8a32a2-be11-0410-ad9d-d568d2c75423

src/mcs51/gen.c

index 638ad61b894cb75cc840cdc961b8f3e3cbd4b0e4..8ca017531c986572fa111b5bcbf7bbd5d05702cc 100644 (file)
@@ -7522,11 +7522,19 @@ genCodePointerGet (operand * left,
 
       while (size--)
        {
-         emitcode ("clr", "a");
-         emitcode ("movc", "a,@a+dptr");
-         aopPut (AOP (result), "a", offset++);
-         if (size || pi)
-           emitcode ("inc", "dptr");
+         if (pi)
+           {
+             emitcode ("clr", "a");
+             emitcode ("movc", "a,@a+dptr");
+             aopPut (AOP (result), "a", offset++);
+             emitcode ("inc", "dptr");
+           }
+         else
+           { 
+             emitcode ("mov", "a,#0x%02x", offset);
+             emitcode ("movc", "a,@a+dptr");
+             aopPut (AOP (result), "a", offset++);
+           }
        }
     }