bt - bit test

CF = bit(dest, source)  ; extract bit numbered by source from dest

The bt instruction uses the source value as the bit number of the destination to test. The destination can be a 64, 32 or 16 bit register or memory location. The source can be either an immediate value or a register of the same size as the destination.

When testing based on a memory address using a register, the register can hold a larger integer which defines a doubleword in memory to test and a bit within the doubleword. So you can access an array of bits.

Some examples of using bt:

        bt     rax, 15         ; test bit 15 of rax
        bt     eax, 10         ; test bit 10 of eax
        bt     dx, cx          ; cx contains bit number of dx to test
        bt     [x], rdx        ; rdx contains bit number of x to test

flags: CF