Hi Dwayne, As I am also interested in generating optimized assembler for multiplying=20 by painfull constants I decided to take the plunge and embed the code in a= =20 web page (you wont need to compile anything now just plug in your numbers) It is at http://xcprod.com/pic_mult_html.html There are some optimization you will be able to perform which will depend=20 on the range of numbers you will be using. Also plugging in 171 shows an interesting repeating pattern which could be= =20 converted into a couple of subroutines e.g. ; res =3D x * 171 ; res =3D x * 0xAB ; res =3D x * 2^8 - x * 2^6 - x * 2^4 - x * 2^2 - x ; where arg0:arg1 =3D x start: ;=3D=3D=3D=3D=3D=3D change this ;; res :=3D arg ; movf arg0,w ; movwf res0 ; movf arg1,w ; movwf res1 ;; res :=3D res << 8 ; movf res0,w ; movwf res1 ; clrf res0 ;=3D=3D=3D=3D=3D=3D to this ; res :=3D arg << 8 movf arg0,w movwf res1 clrf res0 ;=3D=3D=3D=3D=3D=3D ;=3D=3D=3D=3D=3D=3D remove this code if we use arg instead of tmp ; to do all the shifting and subtracting but ; beware the comments will need to be adjusted ; tmp :=3D arg movf arg0,w movwf tmp0 movf arg1,w movwf tmp1 ;=3D=3D=3D=3D=3D=3D ; tmp :=3D arg << 0; res :=3D res - tmp call just_sub ; tmp :=3D arg << 2; res :=3D res - tmp call shift_and_sub ; tmp :=3D arg << 4; res :=3D res - tmp call shift_and_sub ; tmp :=3D arg << 6; res :=3D res - tmp call shift_and_sub return shift_and_sub: ; tmp :=3D tmp << 2 bcf STATUS,C rlf tmp0 rlf tmp1 bcf STATUS,C rlf tmp0 rlf tmp1 ; NOTE: drop through is intensional just_sub: ; res :=3D res - tmp bsf STATUS,C movf tmp0,w subwf res0 btfss STATUS,C decf res1 movf tmp1,w subwf res1 return Regards Sergio --=20 http://www.piclist.com/techref/piclist PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist .