I hate C too, so here is my code: ; Xvar=Xvar*2+1 movf Xvar,w ;put X in W addwf Xvar,f ; add W to X (X*2) incf Xvar,f ; add 1 (x*2+1) Note that the result is modulo 256 so it's working only if X<127. Thus you can check the C flag for overfolw and use it also for X>127 Mircea Chiriciuc EMCO INVEST -- http://www.piclist.com hint: To leave the PICList mailto:piclist-unsubscribe-request@mitvma.mit.edu