在汇编中只设置零标志,不影响其他标志 [英] set only zero flag in assembly, not affecting other flags

查看:29
本文介绍了在汇编中只设置零标志,不影响其他标志的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要在程序集中设置零标志,但不应更改任何其他标志.所以我想做 pushf,把它弹出到 eax,但我不知道如何给标志 reg 它的新值.我能想到的:

I need to set the zero flag in assembly but it shouldn't change any other flags. so I was thinking to do pushf, pop it to eax but I have no idea how to give the flag reg it's new value. all I can think of :

pushf
pop eax,
or eax , 000..1..00 // set the location of zf to 1

从这里我不知道该怎么做.

and from here I have no idea what to do.

推荐答案

不涉及任何其他寄存器的最简单解决方案:

Simplest solution not involving any other register:

pushf
or dword [esp],64  ;bit[6] has ZF
popf

这篇关于在汇编中只设置零标志,不影响其他标志的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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