git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@4402
4a8a32a2-be11-0410-ad9d-
d568d2c75423
-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:
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");
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");
}
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);
}
}