- pic16_emitpcode(POC_MOVFW,pic16_popGet(AOP(result),0));
- pic16_emitpcode(POC_MOVWF,pic16_popCopyReg(&pic16_pc_fsr0));
-
- if(AOP_SIZE(result) > 1) {
- pic16_emitpcode(POC_BCF, pic16_popCopyGPR2Bit(PCOP(&pic16_pc_status),PIC_IRP_BIT));
- pic16_emitpcode(POC_BTFSC,pic16_newpCodeOpBit(pic16_aopGet(AOP(result),1,FALSE,FALSE),0,0));
- pic16_emitpcode(POC_BSF, pic16_popCopyGPR2Bit(PCOP(&pic16_pc_status),PIC_IRP_BIT));
-
- }
+ pic16_aopOp(result,ic,FALSE);
+ pic16_aopOp(right,ic,FALSE);
+ size = AOP_SIZE(right);
+ offset = 0;
+
+ DEBUGpic16_pic16_AopType(__LINE__,NULL,right,result);
+
+
+ /* if the operand is already in dptr
+ then we do nothing else we move the value to dptr */
+ if (AOP_TYPE(result) != AOP_STR) {
+ /* if this is remateriazable */
+ DEBUGpic16_emitcode ("; ***","%s %d",__FUNCTION__,__LINE__);
+ // WARNING: anythig until "else" is untested!
+ if (AOP_TYPE(result) == AOP_IMMD) {
+ DEBUGpic16_emitcode ("; ***","%s %d",__FUNCTION__,__LINE__);
+ lit = (unsigned)floatFromVal(AOP(result)->aopu.aop_lit);
+ // load FSR0 from immediate
+ pic16_emitpcode(POC_LFSR,pic16_popGetLit2(0,pic16_popGetLit(lit)));
+ offset = 0;
+ while(size--) {
+ if(size) {
+ pic16_emitpcode(POC_MOVFF, pic16_popGet2p(pic16_popGet(AOP(right),offset), pic16_popCopyReg(&pic16_pc_postinc0)));
+ } else {
+ pic16_emitpcode(POC_MOVFF, pic16_popGet2p(pic16_popGet(AOP(right),offset), pic16_popCopyReg(&pic16_pc_indf0)));
+ }
+ offset++;
+ }
+ goto release;
+ }
+ else { /* we need to get it byte by byte */
+ DEBUGpic16_emitcode ("; ***","%s %d",__FUNCTION__,__LINE__);
+ //char *l = pic16_aopGet(AOP(result),0,FALSE,FALSE);
+
+ // set up FSR0 with address of result
+ pic16_emitpcode(POC_MOVFF, pic16_popGet2p(pic16_popGet(AOP(result),0), pic16_popCopyReg(&pic16_pc_fsr0l)));
+ pic16_emitpcode(POC_MOVFF, pic16_popGet2p(pic16_popGet(AOP(result),1), pic16_popCopyReg(&pic16_pc_fsr0h)));
+
+ /* hack hack! see if this the FSR. If so don't load W */
+ if(AOP_TYPE(right) != AOP_ACC) {
+
+ DEBUGpic16_emitcode ("; ***","%s %d",__FUNCTION__,__LINE__);
+
+ while(size--) {
+ if(size) {
+ pic16_emitpcode(POC_MOVFF, pic16_popGet2p(pic16_popGet(AOP(right),offset), pic16_popCopyReg(&pic16_pc_postinc0)));
+ } else {
+ pic16_emitpcode(POC_MOVFF, pic16_popGet2p(pic16_popGet(AOP(right),offset), pic16_popCopyReg(&pic16_pc_indf0)));
+ }
+ offset++;
+ }
+ goto release;
+ }
+ // right = ACC
+ DEBUGpic16_emitcode ("; ***","%s %d",__FUNCTION__,__LINE__);
+
+ pic16_emitpcode(POC_MOVWF,pic16_popCopyReg(&pic16_pc_indf0));
+ goto release;
+ } // if (AOP_TYPE(result) != AOP_IMMD)
+
+ } // if (AOP_TYPE(result) != AOP_STR)
+ /* so dptr know contains the address */
+
+
+ /* if bit then unpack */
+ if (IS_BITFIELD(retype))
+ genPackBits(retype,right,"dptr",GPOINTER);
+ else {
+ size = AOP_SIZE(right);
+ offset = 0 ;