什么是`test`指令呢? [英] What does the `test` instruction do?

查看:251
本文介绍了什么是`test`指令呢?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在看一些小汇编codeS和我无法理解的测试指令和它的使用。我期待在以下code在循环的末尾:

I'm looking at some small assembler codes and I'm having trouble understanding the TEST instruction and its use. I'm looking at the following code at the end of a loop:

8048531:    84 c0                   test   al,al
8048533:    75 dc                   jne    8048511 <function+0x2d>

我理解测试的方式是,它的工作原理有点像AND运算,并设置一些标志。我想我真的不明白的标志是如何工作的。 测试人,人来我看起来像它会检查相同的下限位,总是会得到相同的结果。

The way i understand TEST is that it works a bit like the AND operator and it sets some flags. I guess I don't really understand how the flags work. test al,al to me looks like it checks the same lower bits and will always get the same results.

有人能解释一下吗?

推荐答案

它测试针对其自​​身的寄存器,只需设置标志。其结果将是一个零和非零值不同。

It tests the register against itself, just to set the flags. The result will be different for a zero and a non-zero value.

这篇关于什么是`test`指令呢?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆