try this bsf c,bit_c btfss a,bit_a bcf c,bit_c btfss b,bit_b bcf c,bit_c Correct me if I'm wrong, but I believe this one scores 8 good points. >---------- >From: Scott Dattalo[SMTP:sdattalo@UNIX.SRI.COM] >Sent: Tuesday, September 02, 1997 2:14 PM >To: PICLIST@MITVMA.MIT.EDU >Subject: AND how fast? > >How fast can you logically AND two bits? > >Given: > bit_a of register A > bit_b of register B > bit_c of register C > >The goal in C parlance is: > > C.bit_c = A.bit_a & B.bot_b; > > >And just so it's clear, here's some sluggish PIC code that does >the job: > > CLRW > BTFSC A,bit_a > MOVLW 1 > BTFSC B,bit_b > CLRW > BCF C,bit_c > IORLW 0 > SKPZ > BSF C,bit_c > >9 unbearably long cycles and trashes W. Last week I placed too much >emphasis on preserving W. This week the emphasis is on speeeed. > >So here are how the points are to be tallied: > > 1) Size: 2*(6 - # of execution cycles) > 2) Isosynchonous: 3 points > 3) Preserves W: 2 points > 4) Preserves reg A and B: 1 point > >The example slug scores: 2*(6-9) + 3 + 0 + 1 = -2 > >My pre-Payson/Keitz solution is worth 10 points. >hint: x & y = ~(~x | ~y) > > >Scott >-- > __o > I still buy pizza instead of gas. \< > (*)/(*) >