I actually used Pete Brink's solution for an application here a few months ago. The following code is for an 8 bit division or "scaling" routine. where the scale factor is n/255. cblock 0x0C Num_bh ;Weighted number high byte Num_bl ;Weighted numver low byte Factor_b ;Scale factor byte Result ;Result byte Res_l ;Result low operation byte LookupVal ;sine data register endc ; ; ;******************************************************************** ;* * ;* SCALING ROUTINE * ;* * ;******************************************************************** ; ; ; Scale - macro to prepare scaling subroutine for operation. ; ; EXAMPLE: ; ; Scale n,f ;(n/255)*f ---> Result ; ; Scale macro n,f movf n,w movwf Num_bl movf f,w movwf Factor_b call sc_subr endm ; ; ; sc_subr: clrf Num_bh ;clear registers clrf Res_l clrf Result NxtBit: bcf STATUS,CRY btfss Factor_b,0 ;test bit for add operation goto NoAdd movf Num_bl,w ;add current weighted value addwf Res_l,1 btfsc STATUS,CRY incf Result,1 movf Num_bh,w addwf Result,1 bcf STATUS,CRY NoAdd: rrf Factor_b,1 movf Factor_b,w iorlw 0 btfsc STATUS,Z return bcf STATUS,CRY rlf Num_bl,1 ;double weighted value rlf Num_bh,1 goto NxtBit