Hello, I am hoping that someone besides me has experienced the same problem with the MPSIM for pic devices, relating to a macro and the testing of the status register just after the macro. I problem is this, I am trying to run through simulations of my 18Fxxx code using MPSIM. I have many macros which do basic 24bit addition and subtraction. The problem is that, just after the macro routine, I usually test for a carry out or borrow. However, MPSIM sets the status registers just after the macro but before the BTFSS command. For example. ;Let ACCELMOTION_L be the first byte of the 24 bit value and _H and _U are ACCELMOTION_L + 1 and + 2. ; The value is 03CD ;Let ACCELRATE_L be the first byte of the rate to decelerate by of a 24-bit value as similar to above. ; The value is 04FE, ;The result of this 0X03CD - 0X04FE = FECF and the status would show the C bit being low for a borrow. MSUB24 ACCELMOTION_L, ACCELRATE_L, BANKED ; A 24 bit subtraction routine. ;Inside the macro all is ok. The status register shows correct C bit value of low. But when MPSIM goes to the first line ;outside of the macro as follows BTFSS STATUS,C,A ;The status now shows the C bit as being high. Which is wrong. And causes my code testing to fail. BRA DeccComplete. Now MSUB24 is defined as follows: MSUB24 MACRO ArgA,ArgB,bank ;ArgA - ArgB -> ArgA MOVF ArgB,W,bank SUBWF ArgA,F,bank MOVF ArgB+1,W,bank SUBWFB ArgA+1,F,bank MOVF ArgB+2,W,bank SUBWFB ArgA+2,F,bank ENDM As can be seen, it takes 3 arguments A_arg, B_arg and the banking/access bit modifier. Does anyone have a solution to this, or is it just a big fat but in MPSIM. I have had the same results using MPLAB 5 and MPLAB 6. But, if I replace the macro call with the actual code, everthing is ok. Also, how do you report bugs to Microchip? I have found many such bugs that have never been fixed. Regards, James. -- http://www.piclist.com hint: The list server can filter out subtopics (like ads or off topics) for you. See http://www.piclist.com/#topics