Hi gurus, 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 I need to write indirectly to a bit in an indirectly addressed register. I have come up with the following code, but I am not sure it is the best way of doing it. It seems 'clumsy'. Anyone got any better ideas? Regards, Mike Watson. -- mike@d-m-g.demon.co.uk Byte equ 0x0c ;byte is table address + 0x10 (start ;of table in RAM) Bit equ 0x0d ;bit is 0..7 Cmd equ 0x0f ;Command plus bit storage. Defined below. Data equ 7h ; ;The next section takes the byte and bit in the table from Byte ;and Bit and changes the appropriate bit to be the same as the ;databit in Cmd. ; DoIt movf Byte,w movwf fsr ;Prepare for indirect bit set/clear. btfsc Cmd, Data ; goto Set_Lo Set_Hi rlf Bit,w ; addwf pc ;relative jump to set correct bit bsf 0,0 ; goto SR_Jump bsf 0,1 goto SR_Jump bsf 0,2 goto SR_Jump bsf 0,3 goto SR_Jump bsf 0,4 goto SR_Jump bsf 0,5 goto SR_Jump bsf 0,6 goto SR_Jump bsf 0,7 goto SR_Jump Set_Lo rlf Bit,w ; addwf pc ;relative jump to set correct bit bcf 0,0 ; goto SR_Jump bcf 0,1 goto SR_Jump bcf 0,2 goto SR_Jump bcf 0,3 goto SR_Jump bcf 0,4 goto SR_Jump bcf 0,5 goto SR_Jump bcf 0,6 goto SR_Jump bcf 0,7 SR_Jump return