How to fetch a bit in IA32 assembly language?
How can I check if a bit in some position of a word is 1 with the IA32 assemb开发者_如何学Pythonly language?
Test
, something like:
value = 000100h
mov eax, your_word
test eax, value
jnz was_set
NASM:
bt ax, <POS> ; test if bit at position is set: 1 means carry will be set 0 means carry will be unset
adc eax, 0 ; add 0 + carry to eax
You could also use jc
(jump carry set) jnc
(jump carry not set)
精彩评论