Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/assembly/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Assembly 为什么即使zero标志不是0,程序也会跳转到新的部分?_Assembly - Fatal编程技术网

Assembly 为什么即使zero标志不是0,程序也会跳转到新的部分?

Assembly 为什么即使zero标志不是0,程序也会跳转到新的部分?,assembly,Assembly,在下面的代码中,我跳到下一节,即使没有设置ZF,因为EAX不是0 Label: mov eax, 0x02 dec eax jz Test ; jump only if ZF = 1 测试: mov ebx, 0x11 jmp Label 我已经在GDB中测试了这段代码,即使没有设置ZF,程序也会跳转到测试 为什么??很明显,我对条件跳转有些不理解。如果您的测试:标签紧跟在jz测试之后,这是意料之中的……您没有跳转,只是进入下一条指令。这就是所谓的失败。好吧,我明白了。当我在Label之

在下面的代码中,我跳到下一节,即使没有设置ZF,因为EAX不是0

Label:

mov eax, 0x02
dec eax
jz Test ; jump only if ZF = 1
测试

mov ebx, 0x11
jmp Label 
我已经在GDB中测试了这段代码,即使没有设置ZF,程序也会跳转到测试


为什么??很明显,我对条件跳转有些不理解。

如果您的
测试:
标签紧跟在
jz测试之后,这是意料之中的……您没有跳转,只是进入下一条指令。这就是所谓的失败。好吧,我明白了。当我在Label之后添加一个新的部分时:如果ZF=1,它将前进到测试并错过新的部分;如果ZF=0(如上面的示例所示),则将调用新的部分。