btc - bit test and complement

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

The btc instruction uses the source value as the bit number of the destination to test and complement. 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 btc:

        btc     rax, 15         ; test and flip bit 15 of rax
        btc     eax, 10         ; test and flip bit 10 of eax
        btc     dx, cx          ; cx contains bit number of dx to test & flip
        btc     [x], rdx        ; rdx contains bit number of x to test & flip

flags: CF