Applied a code patch supplied by Paul Ashmore in comments for Bugs item #954788.
[fw/sdcc] / src / pic / gen.c
index 176ac52b438a570cabdae9d2ab50d9a79412a58c..6d20ae11a22d6ee686871a5e6ceb2cae807a41db 100644 (file)
@@ -1342,16 +1342,6 @@ pCodeOp *popGet (asmop *aop, int offset) //, bool bit16, bool dname)
                pcop = Safe_calloc(1,sizeof(pCodeOpReg) );
                pcop->type = PO_DIR;
                
-               /*
-               if (offset)
-               sprintf(s,"(%s + %d)",
-               aop->aopu.aop_dir,
-               offset);
-               else
-               sprintf(s,"%s",aop->aopu.aop_dir);
-               pcop->name = Safe_calloc(1,strlen(s)+1);
-               strcpy(pcop->name,s);   
-               */
                pcop->name = Safe_calloc(1,strlen(aop->aopu.aop_dir)+1);
                strcpy(pcop->name,aop->aopu.aop_dir);   
                PCOR(pcop)->r = dirregWithName(aop->aopu.aop_dir);
@@ -1380,7 +1370,7 @@ pCodeOp *popGet (asmop *aop, int offset) //, bool bit16, bool dname)
                        PCOR(pcop)->instance = offset;
                        pcop->type = PCOR(pcop)->r->pc_type;
                        //rs = aop->aopu.aop_reg[offset]->name;
-                       DEBUGpic14_emitcode(";","%d regiser idx = %d ",__LINE__,rIdx);
+                       DEBUGpic14_emitcode(";","%d rIdx = r0x%X ",__LINE__,rIdx);
                        return pcop;
                }
                
@@ -4013,7 +4003,7 @@ static void genCmp (operand *left,operand *right,
                                        default:
                                                emitpcode(POC_MOVFW, popGet(AOP(right),0));
                                                emitpcode(POC_ADDLW, popGetLit(0x80));
-                                               emitpcode(POC_ADDLW, popGetLit(((-(lit+1)) & 0xff) ^ 0x80));
+                                               emitpcode(POC_ADDLW, popGetLit(((0-(lit+1)) & 0xff) ^ 0x80));
                                                rFalseIfx.condition ^= 1;
                                                genSkipc(&rFalseIfx);
                                                break;
@@ -6720,7 +6710,7 @@ static void shiftR2Left2Result (operand *left, int offl,
        case 2:
        case 3:
                if(sign)
-                       emitpcode(POC_RLFW,popGet(AOP(result),offr+MSB16));
+                       emitpcode(POC_RLFW,popGet(AOP(left),offl+MSB16));
                else
                        emitCLRC;