Sigh... Yet another one. I guess I'll have to remove the "Reply-To" header from my outgoing e-mail. -Andy ------- Forwarded Message Follows ------- From: John Payson Subject: Re: (Fwd) Re: (Fwd) Re: Bit Number to Bit Mask Question To: fastfwd@ix.netcom.com Date: Wed, 17 Sep 1997 20:53:18 -0500 (CDT) > From: Dmitry Kiryashov > > ; Minimizing ... Final pass . > ; > movlw $01 > btfsc BITNUM,1 > movlw $04 > movwf temp > > btfsc BITNUM,0 > addwf temp,f Ah... good way to do the conditional shift without worrying about carry flag. Cool. > > btfsc BITNUM,2 > swapf temp,f > > movfw temp > > ; 9 words / 9 cycles That's a savings. Probably makes it as good as the table for many app- lications. > > movlw $FF > > btfsc BITNUM,0 > > andlw $AA > > btfsc BITNUM,1 > > andlw $CC > > btfsc BITNUM,2 > > andlw $F0 > > movwf temp > > ; Optimizing ... > > sublw 0 > andwf temp,w > ; > ; 10 words / 10 clocks Okay, the SUBLW seems to have been the trick I was looking for. > > Interesting, but even worse (unless I'm missing an optimization on > > that ending part). Anyone see any improvements for those two methods > > above? > The first code looks better . I guess, it does seem to be a word shorter/cycle faster. Though there's something I like aesthetically about the second... I'll just have to find a way to rid of those 4 annoying cycles (and the use of TEMP)... ------- End of Forwarded Message -------