Merry Christmas Scott and other guys. ;) Some magic is here. ;) ; high=a.b low=c.d movlw 0xF0 andwf low,F ;c.0 swapf low,F ;0.c swapf high,F ;b.a andwf high,W ;b.0 xorwf low,F ;b.c swapf high,W ;a.b addwf low,F ;a.b+b.c movlw 0x0F andwf high,F ;0.a skpnc incf high,F ;add carry ;12 clocks/words WBR Dmitry. > Division by 16 is trivial: > > swapf t2h,f > swapf t2l,f > movlw 0x0f > andwf t2l,f > andwf t2h,w > xorwf t2h,w > iorwf t2l,f > > ; xorwf t2h,f ; not needed because of trick below > > ; now add 1/16 of the above to itself > > swapf t2h,w > addwf t2l,f > movlw 0x0f > andwf t2h,f > skpnc > incf t2h,f > > One more instruction then the mystical 12 barrier - suggesting there's an > optimization lurking somewhere. -- http://www.piclist.com#nomail Going offline? Don't AutoReply us! email listserv@mitvma.mit.edu with SET PICList DIGEST in the body