Hi, Following code may not work very well. I'm not sure if my post was made, but setting/clearing bits directly on port is not reliable. Use a temporary register and them mov the register to port. > movwf test ; stick the bit to clear in test. > decf test ; subtract one. Takes one less cycle than yours > > rlf test,W ; Double the value and stick back in W > andlw 0xf ; make sure to make result in the jump table. > addwf PCL,F ; Jump to the appropriate instruction > bcf PORTB,0 ; Clear bit 0 > goto done ; and finished. > bcf PORTB,1 ; Clear bit 1 > goto done ; and finished. > bcf PORTB,2 ; Clear bit 2 > goto done ; and finished. > > And so forth. The value in W coming in will select with pair of bcf, goto > instructions to execute. > > I use this technique in my NPCI interpreter. To further generalize it the > address of the target is placed in the FSR register and the bcf instructions > are executed on INDF. That way the code can be applied against any register > file in the system instead of just PORTB. > > Hope this helps, > > BAJ