elegante inversion.
/*------------------------------------------------------------------------------ INVERSION DE BYTE 8 BIT, LSB -> MSB ------------------------------------------------------------------------------*/ unsigned char mr; unsigned char invertir_byte (mr) { mr = (mr & 0x0F) << 4 | (mr & 0xF0) >> 4; mr = (mr & 0x33) << 2 | (mr & 0xCC) >> 2; mr = (mr & 0x55) << 1 | (mr & 0xAA) >> 1; return (mr); }
mov c,acc.1 rlc a mov acc.2,c mov c,acc.3 rlc a mov acc.4,c mov c,acc.5 rlc a mov acc.6,c swap a
A neat solution. I'm going to have to remember it - Or (more likely) save to file in my 'snippet' subdirectory.
Thanks.
Just to show that there's rarely anything new when it comes to programming:
8052.com/.../90817
especially when it comes to basic programming tasks like this which has been around since the dawn of computing!