From: jesusc Date: Fri, 6 Oct 2006 06:48:39 +0000 (+0000) Subject: src/mcs51/gen.c: emitcode for "add a,0x%02x" requires only 8 bits. X-Git-Url: https://git.gag.com/?a=commitdiff_plain;h=f86f886f5947d065f4e8a0edaeaf92b8a3643395;p=fw%2Fsdcc src/mcs51/gen.c: emitcode for "add a,0x%02x" requires only 8 bits. git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@4402 4a8a32a2-be11-0410-ad9d-d568d2c75423 --- diff --git a/ChangeLog b/ChangeLog index b75d4d34..28eb2601 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,4 +1,8 @@ -2006-09-16 Borut Razem +2006-10-05 Jesus Calvino-Fraga + + * src/mcs51/gen.c: emitcode for "add a,0x%02x" requires only 8 bits. + +2006-10-05 Borut Razem * partially fixed [ 1570701 ] peephole - not replacing code from multiline macros, thanks to dfulab: diff --git a/src/mcs51/gen.c b/src/mcs51/gen.c index 1f010705..382ddddd 100644 --- a/src/mcs51/gen.c +++ b/src/mcs51/gen.c @@ -649,7 +649,7 @@ aopForSym (iCode * ic, symbol * sym, bool result) 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"); @@ -3616,14 +3616,14 @@ genFunction (iCode * ic) 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 ("add", "a,#0x%02x", i); + emitcode ("add", "a,#0x%02x", i & 0xff); emitcode ("mov", "_spx,a"); emitcode ("pop", "acc"); } @@ -10912,7 +10912,7 @@ genAddrOf (iCode * ic) 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); } }