开发者

How to fetch a bit in IA32 assembly language?

开发者 https://www.devze.com 2023-03-15 07:34 出处:网络
How can I check if a bit in some position of a word is 1 with the IA32 assemb开发者_如何学Pythonly language?Test, something like:

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)

0

精彩评论

暂无评论...
验证码 换一张
取 消