At 03:14 AM 9/27/97 GMT+0200, you wrote: >Hi all, > >I have been stuck now for at least 1/2 hour trying to figure out a way to >conditionally complement the carry flag on an '84. The best I could come >up with was: > > comf STATUS, W > movwf Temp > btfsc My_Flags, Complement_Carry > rrf Temp, W > >This just doesn't feel like the right way! > >I also tried: > movlw 01h > btfsc MyFlags, Complement_Carry > xorwf STATUS, F > >but it didn't work. I was hoping that the xorwf instruction would >operate as normal and change the carry flag and afterwards set the Z flag >if the result was 0, but C is totally protected from being modified. > >Has anyone got a better approach (preferably one that does not need a >file register)? Maybe its staring me in the face, but right now I'm >staring at the insides of my eyelids :-O > >G'night (to all on this side of the globe) >Niki > > to complement any bit you can do the following. note: the carry bit (bit 0) is in the status register (ram location 3). btfsc 3,0 ; status,c bcf 3,0 btfss 3,0 bsf 3,0 what instruction was used to place the data into 'w'. if it didn't set the zero flag you could use this iorlw 0 ; sets the zero flag if 'w' is zero michael