X-Git-Url: https://git.gag.com/?a=blobdiff_plain;f=src%2Fpic16%2Fgen.c;h=00ffa03838faa168bf1fa0b3b5d3fb709d9a4fda;hb=b7850ad97a05bb3170ab58ae065086c32f8e9a0d;hp=7dda28ae056c28530af3232e9066dfa7fa38d5f4;hpb=4464999cca73961d7fd19c9d60ff1305f6ae399e;p=fw%2Fsdcc diff --git a/src/pic16/gen.c b/src/pic16/gen.c index 7dda28ae..00ffa038 100644 --- a/src/pic16/gen.c +++ b/src/pic16/gen.c @@ -266,6 +266,7 @@ void pic16_emitpcomment (char *fmt, ...) (lineHead = newLineNode(lb))); lineCurr->isInline = _G.inLine; lineCurr->isDebug = _G.debugLine; + lineCurr->isComment = 1; pic16_addpCode2pBlock(pb,pic16_newpCodeCharP(lb)); va_end(ap); @@ -378,6 +379,8 @@ void pic16_emitcode (char *inst,char *fmt, ...) (lineHead = newLineNode(lb))); lineCurr->isInline = _G.inLine; lineCurr->isDebug = _G.debugLine; + lineCurr->isLabel = (lbp[strlen (lbp) - 1] == ':'); + lineCurr->isComment = (*lbp == ';'); // VR fprintf(stderr, "lb = <%s>\n", lbp); @@ -3758,6 +3761,8 @@ static void genFunction (iCode *ic) pic16_pushpCodeOp( pic16_popCopyReg( &pic16_pc_prodh )); pic16_pushpCodeOp( pic16_popCopyReg( &pic16_pc_fsr0l )); pic16_pushpCodeOp( pic16_popCopyReg( &pic16_pc_fsr0h )); + pic16_pushpCodeOp( pic16_popCopyReg( &pic16_pc_pclath )); + pic16_pushpCodeOp( pic16_popCopyReg( &pic16_pc_pclatu )); // pic16_pBlockConvert2ISR(pb); } @@ -3942,6 +3947,8 @@ static void genEndFunction (iCode *ic) _G.useWreg = 0; if (IFFUNC_ISISR(sym->type)) { + pic16_poppCodeOp( pic16_popCopyReg( &pic16_pc_pclatu )); + pic16_poppCodeOp( pic16_popCopyReg( &pic16_pc_pclath )); pic16_poppCodeOp( pic16_popCopyReg( &pic16_pc_fsr0h )); pic16_poppCodeOp( pic16_popCopyReg( &pic16_pc_fsr0l)); pic16_poppCodeOp( pic16_popCopyReg( &pic16_pc_prodh )); @@ -11718,7 +11725,7 @@ static void genPackBits (sym_link *etype , operand *result, || SPEC_BLEN(etype) <= 8 ) { int fsr0_setup = 0; - if (blen != 8 || bstr != 0) { + if (blen != 8 || (bstr % 8) != 0) { // we need to combine the value with the old value if(!shifted_and_masked) { @@ -11753,7 +11760,12 @@ static void genPackBits (sym_link *etype , operand *result, if (lit != 0) pic16_emitpcode(POC_IORLW, pic16_popGetLit(lit)); } - } // if (blen != 8 || bstr != 0) + } else { // if (blen == 8 && (bstr % 8) == 0) + if (shifted_and_masked) { + // move right (literal) to WREG (only case where right is not yet in WREG) + pic16_mov2w(AOP(right), (bstr / 8)); + } + } /* write new value back */ if ((IS_SYMOP(result) && !IS_PTR(operandType(result)))