如何在IA32汇编语言中获取一点?

时间:2011-06-24 09:05:28

标签: assembly x86 bit

如何使用IA32汇编语言检查单词某个位置的某位是否为1?

2 个答案:

答案 0 :(得分:4)

Test,类似于:

value = 000100h

mov eax, your_word
test eax, value
jnz was_set

答案 1 :(得分:2)

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

您还可以使用jc(跳转进位设置)jnc(跳转进位未设置)