This may be what you are looking for:
Register_B = Register_A & 0x003F; // Take the 6 LSB (bits 0-5)
Register_C = Register_A & 0x07C0; // Take the bits 6-10
Register_C = (Register_A & 0x07C0) >> 6; // Or maybe you want to place these bits elsewhere using bit shift?
Here is more clarification about using bits in C. Mostly for microcontrollers, but the exact same can be used in Windows, except you don't use registers directly in Windows.
Decimal 5 = binary 0000 0101 = hexadecimal 0x05
Decimal 16 = hex 0x10
Now, this an example in binary:
x = (5 << 1);
5 = 0000 0101
5 << 1 = 0000 1010 (Same sa 5, but bits are shifted left by 1)
5 << 2 = 0001 0100 (5 shifted by 2 bits to the left.)
Finally, you can also compare bits, of 'MASK' bits:
This code shows how to compare bits.
x = 5;
if( x & 0x01)
{ .. code here is executed because at least 1 bit from "0x01" is present in "decimal 5"
}
- (variable & var2) means that at least one bit is "1" in both variable
- (Var1 | Var2) means that any of the two variables are true.
- (Var1 ^ Var2) means that at least one bit is "1" in one variable and "0" in the other. Basically if Var1 is different from Var2, this will be true.
You can also MASK bits:
Var1 = 254; // All 8 bits are "1" except the least significant bit which is 0.
Var2 = Var1 & 0x0F; // 0x0F = only last 4 bits "1".
In that case, Var2 will end up with 0000 1110 because 1111 1110 & 0000 1111 gives that result. All the bits that are "1" in both values will become "1" for Var2, but all others will be 0. This is a bitwise AND operation, where each bit of the result depends only on the corresponding bits of the inputs.
I know you don't need this a lot in Windows, but programming microchip means playing a lot with bits directly.
About registers again... just think about them as normal variables, but the microcontroller reads and writes to them all the time, so writing a value there can have an effect, like blinking an LED or sending a byte on the USART/COM port. Reading the datasheet will even show you that some registers are read-only or write-only, and will normally explain in details what the register do. If you program an MCU like a PIC or AVR, you will need to understand datasheets. They are your most valuable tool.