Regulus Berdin wrote: > > Considering 2digit bcd is in one byte, here is my solution (may have some > bugs): > > swapf BCD,w > andlw 0x0f ;w = bcdh > movwf RESULT ;result = bcdh > addwf RESULT,w ;w = bcdh*2 > addwf RESULT,f ;result = bcdh + w > addwf RESULT,f ;result = (bcdh + w) + w = bcdh*5 > rlf RESULT,f ;result = result * 2 = bcdh*10 > ;no need to clear carry flag due > ; previous adds which cannot have overflow > movf BCD,w > andlw 0x0f ;w = bcdl > addwf RESULT,f ;result = bcdh*10 + bcdl Good Reggie, but how about this rrf bcd,W andlw 01111000b ;W = tens*8 movwf temp clrc rrf temp,f ;W = tens*4 rrf temp,f ;W = tens*2 subwf bcd,W ;W = tens*16 + ones - tens*8 ;W = tens*8 + ones addwf temp,W ;W = tens*10 + ones Or if you have the BCD digits in the lower nibbles of the two bytes bcdl and bcdh (per Keitz's naming convention) then consider something Andy posted a long time ago: clrc rlf bcdh,W ;W = tens*2 swapf bcdh,F ;tens = tens*16 rrf bcdh,F ;tens = tens*8 addwf bcdh,W ;W = tens *10 addwf bcdl,W ;W = tens*10 + ones or if you wish to preserve the bcd digits: swapf bcdh,W ;W = tens*16 movwf temp clrc rrf temp,F ;temp = tens*8 rlf bcdh,W ;W = tens*2 addwf bcdl,W ;W = tens*2 + ones addwf temp,W ;W = tens*10 + ones None of these routines have been tested. But all of my free code is either untested or uncommented. :) Scott