----- Original Message ----- From: "David Meiklejohn" To: "'Microcontroller discussion list - Public.'" Sent: Saturday, June 05, 2010 8:07 PM Subject: RE: [PIC] compare (XOR) 2 bits in a single register > Bob Ammerman wrote: >> >> The following will work because of the convenient locations of the two >> flags >> PM and ALM_PM: >> >> swapf FLAGS,w >> xorwf FLAGS,w >> andlw 1 >> btfss STATUS,Z >> goto alm_end > > Nice! > > I don't think I'll use it though, because if I later changed the flag bit > order, I may not remember that I had to go change this code. For > maintainability I'd prefer to have the comparison code refer to the > symbols > PM and ALM_PM. > > After seeing the responses here - some clever ideas, but I'm with Olin on > transparency. I certainly would not use this trick without careful documentation and would include a note where the bits are defined indicating that they should not be changed and why. -- Bob Ammerman RAm Systems -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist