Eight, eight, I have eight. Do I hear seven...?? Bob Ammerman RAm Systems ----- Original Message ----- From: "Dmitriy A. Kiryashov" To: Sent: Friday, July 19, 2002 2:18 PM Subject: Re: [PIC]: Code optimization > Hi Scott. > > #define ab b'01010101 > > movlw 0x03 ;oooooo11 > btfsc num,0 > movlw 0x0C ;oooo11oo > btfsc num,1 > movlw 0x30 ;0011oooo > > iorwf var,F ;xxxxxx11 | xxxx11xx | xx11xxxx > andlw ~ab ;00000010 | 00001000 | 00100000 > xorwf var,F > > > WBR Dmitry. > > > > damn. > > > > #define _ABABABAB b'01010101 ; or whatever > > > > movlw 0xfc ; bit 0,1 are low > > > > btfsc number,0 ; LSB set? > > movlw 0xf3 ; bit 2,3 are low > > btfsc number,1 ; Bit 1 set? > > movlw 0xcf ; bit 4,5 are low > > > > ; write the _AB_ bit pattern > > andwf var,f ; clear the dest bits > > xorlw 0xff ; complement the bit mask > > andlw _ABABABAB ; select the two desired AB's > > iorwf var,f ; write them > > -- > http://www.piclist.com#nomail Going offline? Don't AutoReply us! > email listserv@mitvma.mit.edu with SET PICList DIGEST in the body > > -- http://www.piclist.com#nomail Going offline? Don't AutoReply us! email listserv@mitvma.mit.edu with SET PICList DIGEST in the body