Here is another little optimization to Scott's code. I admit it is not elegant, but Sean wanted speed/compact code... :-) I modified the routine to return the low byte in W and not in rD. This way I could substitute the group MOVLW x / MOVWF rD / RETURN with RETLW x, and add a MOVWF rD outside the routine (if needed). The space is reduced from 27 to 17 words, and the execution time from a total of 11 to 9 cycles (including CALL). That's 10 words and 2 cycles savings! But you may argue "I need the result in rD"! OK, just add a MOVWF rD in the calling place (after CALL POW10). This wastes a word and a cycle, but it's however faster than Scott's code (10 cycles including CALL and MOVWF). Size: 17 words + 1 extra word for each calling point. Adriano ; POW10 ; Given W, where 0<=W<=4 ; outputs rC,W = 10^W ; destroys rC,W,Flags ; 7 cycles (9 including call), 17 words, untested ; ; NOTE: ; Result is in rC,W. To have result in rC,rD just add a "movwf rD" ; in the main code after the call. ; call POW10 ; movwf rD ; (Total 10 cycles, included call and movwf rD) pow10 addwf PCL,f goto p0 goto p1 goto p2 goto p3 p4 movlw 0x27 movwf rC nop retlw 0x10 p0 clrf rC retlw 0x01 p1 clrf rC retlw 0x0A p2 clrf rC retlw 0x64 p3 movwf rC ; W=3 retlw 0xE8