src/mcs51/gen.c: emitcode for "add a,0x%02x" requires only 8 bits.
authorjesusc <jesusc@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Fri, 6 Oct 2006 06:48:39 +0000 (06:48 +0000)
committerjesusc <jesusc@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Fri, 6 Oct 2006 06:48:39 +0000 (06:48 +0000)
git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@4402 4a8a32a2-be11-0410-ad9d-d568d2c75423

ChangeLog
src/mcs51/gen.c

index b75d4d34e2e407ebcf00a352d275668f63a62a1f..28eb260168aaf7a9d53c4ef8f006a2dbfb1f27b7 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,4 +1,8 @@
-2006-09-16 Borut Razem <borut.razem AT siol.net>
+2006-10-05 Jesus Calvino-Fraga <jesusc at ece.ubc.ca>
+
+       * src/mcs51/gen.c: emitcode for "add a,0x%02x" requires only 8 bits.
+
+2006-10-05 Borut Razem <borut.razem AT siol.net>
 
        * partially fixed [ 1570701 ] peephole - not replacing code from multiline macros,
          thanks to dfulab:
 
        * partially fixed [ 1570701 ] peephole - not replacing code from multiline macros,
          thanks to dfulab:
index 1f0107050d4ae11ea862a81249af04999c8e2c1f..382ddddd4521f321fd98efc87aa5581a9202f97e 100644 (file)
@@ -649,7 +649,7 @@ aopForSym (iCode * ic, symbol * sym, bool result)
                   if (accuse)
                     emitcode ("push", "acc");
                   emitcode ("mov", "a,%s", SYM_BP (sym));
                   if (accuse)
                     emitcode ("push", "acc");
                   emitcode ("mov", "a,%s", SYM_BP (sym));
-                  emitcode ("add", "a,#0x%02x", offset);
+                  emitcode ("add", "a,#0x%02x", offset & 0xff);
                   emitcode ("mov", "%s,a", aop->aopu.aop_ptr->name);
                   if (accuse)
                     emitcode ("pop", "acc");
                   emitcode ("mov", "%s,a", aop->aopu.aop_ptr->name);
                   if (accuse)
                     emitcode ("pop", "acc");
@@ -3616,14 +3616,14 @@ genFunction (iCode * ic)
       if (i > 3 && accIsFree)
         {
           emitcode ("mov", "a,_spx");
       if (i > 3 && accIsFree)
         {
           emitcode ("mov", "a,_spx");
-          emitcode ("add", "a,#0x%02x", i);
+          emitcode ("add", "a,#0x%02x", i & 0xff);
           emitcode ("mov", "_spx,a");
         }
       else if (i > 5)
         {
           emitcode ("push", "acc");
           emitcode ("mov", "a,_spx");
           emitcode ("mov", "_spx,a");
         }
       else if (i > 5)
         {
           emitcode ("push", "acc");
           emitcode ("mov", "a,_spx");
-          emitcode ("add", "a,#0x%02x", i);
+          emitcode ("add", "a,#0x%02x", i & 0xff);
           emitcode ("mov", "_spx,a");
           emitcode ("pop", "acc");
         }
           emitcode ("mov", "_spx,a");
           emitcode ("pop", "acc");
         }
@@ -10912,7 +10912,7 @@ genAddrOf (iCode * ic)
           else
             {
               emitcode ("mov", "a,%s", SYM_BP (sym));
           else
             {
               emitcode ("mov", "a,%s", SYM_BP (sym));
-              emitcode ("add", "a,#0x%02x", stack_offset);
+              emitcode ("add", "a,#0x%02x", stack_offset & 0xff);
               aopPut (IC_RESULT (ic), "a", 0);
             }
         }
               aopPut (IC_RESULT (ic), "a", 0);
             }
         }