Mike Watson wrote: > On a PIC16C84 I need to keep a table (32x8) of bits in ram, > and be able to change the state of each bit independently. Thus Your code is 41 words; the following code is 14 words. Your code executes in fewer cycles, and is constant time, this code takes longer depending on the bit number. A retlw table could be used to do the bit number to bit mask conversion if constant time is important. ;Note that this destroys the contents of Bit doit movf Byte,w movwf FSR clrw bsf STATUS,0 ;set carry incf Bit ;pre-inc loop rlf Bit ;rotate mask decfsz Bit,loop btfsc Cmd, Data ;what to do? goto Set_Lo iorwf 0 ;or bit into byte return Set_Lo xorlw 0ffh ;invert w andwf 0 ;set bit low return -- Clyde Smith-Stubbs | HI-TECH Software, | Voice: +61 7 3300 5011 clyde@hitech.com.au | P.O. Box 103, Alderley, | Fax: +61 7 3300 5246 | QLD, 4051, AUSTRALIA. | BBS: +61 7 3300 5235 HI-TECH C: Compiling the real world...