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 > > i should be awake when i reply, i knew something was wrong with that code but just looked at it long enough to convince myself that it looked ok. try this swap status,f ; this will save the carry bit in bit 4 btfss status,4 ; was the carry set bcf status,0 ; no, clear the carry btfsc status,4 ; was the carry cleared bsf status,0 ; no, set the carry iorlw 0 ; set the zero flag michael