Hi again, I had checked your code, seems that there are two errors on the result and may not work. regards, Reggie Dmitry Kiryashov wrote: > > movfw Cy ;carry cell > xorlw K ;constant or second var > iorwf Cy,f ;invertion mask > xorwf R,f ;result > andwf R,w ;pre-carry > xorwf Cy,f lfinal true carry > > --> > +--------+-------------+ > | R K Cy | w Cy R w Cy | > +--------+-------------+ > | 0 0 0 | 0 0 0 0 0 | > | 0 0 1 | 1 1 1 1 0 | > | 0 1 0 | 1 1 1 1 0 |final Cy should be 1 because W=1 and Cy=0 > | 0 1 1 | 0 1 0 0 1 | > | 1 0 0 | 0 0 1 0 0 | > | 1 0 1 | 1 1 0 0 1 | > | 1 1 0 | 1 1 0 0 1 |also Cy should be 0 because W=0 and Cy=0 > | 1 1 1 | 0 1 1 0 1 | > +--------+-------------+