X86-assembly/Instructions/bt

From aldeid
Jump to navigation Jump to search
You are here:
bt

Description

Selects the bit in a bit string (specified with the first operand, called the bit base) at the bitposition designated by the bit offset operand (second operand) and stores the value of the bit in the CF flag.

CF = Bit(BitBase, BitOffset);

Syntax

bt <base>, <offset>

Examples

.text:00401401                 rdtsc                         ; Read Time-Stamp Counter (0xE868C928)
.text:00401403                 mov     ebx, eax              ; ebx = 0xE868C928
.text:00401405                 push    ebx
.text:00401406                 push    offset public_message ; "User Id  : %u\n"
.text:0040140B                 call    _printf               ; 'User Id  : 3899181352'
.text:00401410                 add     esp, 8
.text:00401413                 mov     edi, offset user_id 
.text:00401418                 bt      ebx, 0                ; 0xE868C928 = 11101000011010001100100100101000
                                                             ; CF = bit 0 = 0
.text:0040141C                 jnb     short zero_bit_set    ; Will take the jump because CF = 0

Comments