ON 20110426@10:00:52 AM at page:
On a web page you were interested in at:
http://www.piclist.com/Techref/microchip/math/bit/revbits.htm#40659.4172569444
Christopher Wall[CW-tekind-] Says
I think one correction needs to be made to the following "Middle" method by Dmitry A. Kiryashov. As it is right now, it doesn't work when both 'a' and 'h' are '1'.
Example:
; instruction X W CarryBit 1010 0011 xxxx xxxx x swapf X,W 1010 0011 0011 1010 x xorwf X,W 1010 0011 1001 1001 x andlw 0x66 1010 0011 0000 0000 x xorwf X,F 1010 0011 0000 0000 x rrf X,W 1010 0011 1101 0001 x rrf X,F 1101 0001 1101 0001 x andlw 0x55 1101 0001 0101 0001 x addwf X,F 0010 0010 0101 0001 1 rrf X,F 0001 0001 0101 0001 1 addwf X,F 0110 0010 0101 0001 1 rlf X,W 0110 0010 1100 0100 1 rlf X,F 1100 0100 1100 0100 10b11000100 is not the reverse of 0b10100011 By changing the last "rrf" instruction to a rrcf (rotate file right through carry) this now opperated correctly:
; instruction X W CarryBit 1010 0011 xxxx xxxx x swapf X,W 1010 0011 0011 1010 x xorwf X,W 1010 0011 1001 1001 x andlw 0x66 1010 0011 0000 0000 x xorwf X,F 1010 0011 0000 0000 x rrf X,W 1010 0011 1101 0001 x rrf X,F 1101 0001 1101 0001 x andlw 0x55 1101 0001 0101 0001 x addwf X,F 0010 0010 0101 0001 1 rrcf X,F 1001 0001 0101 0001 0 addwf X,F 1110 0010 0101 0001 0 rlf X,W 1110 0010 1100 0101 0 rlf X,F 1100 0100 1100 0101 0ERROR: Can't email. At least one recipient is required, but none were found.