是否可以在汇编器中对多个项目进行异或?
只是想知道是否可以在汇编器中对多个字节进行异或。 因为你通常会这样做 异或 a,A 我只是不确定它会如何完成。 任何帮助将不胜感激,谢谢。
Just wondering if it would be possible to XOR multiple bytes in assembler.
Since you would normally do
XOR al,A
I'm just not sure how it would be done.
Any help would be appreciated, thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
高级架构可以为此提供指示。事实上,我很多个月前设计的一个有一个 16 位位掩码,它可以指定您想要用于此类操作的任意数量的寄存器:
将依次检查每个位,如果将其设置为 1,则 < code>r3 将与相关寄存器进行
异或
。然而,这仅作为预实施模拟器存在,并且被认为是不必要的。我猜他们认为让用户手动执行此操作在芯片上更便宜。高级汇编程序也可能提供此功能,也许允许您编写:
并将其转换为相当于以下的机器语言:
当然,这并不是真正的机器代码级别的多参数指令,只是汇编程序是更聪明一点。也不要将其与使用两个以上参数(其中一个为目标)的实际指令相混淆,例如:
但是,这是您通常会按顺序执行的操作,尤其是在您不知道的情况下 您预先使用的值:
如果您希望对您的注册进行
异或
常量项,您可以通过异或
预先将它们组合起来>首先对它们进行运算,因为xor
是可交换的:例如,如果您想使用
0x11
和0x12
来异或
您的寄存器,您可以使用:Advanced architectures may provide an instruction for this. In fact, one I designed many moons ago had a 16-bit bitmask which could specify any number of the registers that you wanted to use for such an operation:
Each bit would be examined in turn and, if it was set to 1,
r3
would bexor
'ed with the relevant register. However, this only ever existed as a pre-implementaion simulator and it was deemed unnecessary. I guess they figured it was cheaper in silicon to let the user do that manually.And advanced assemblers may also provide this functionality, perhaps allowing you to write:
and having that turned into the machine language equivalent of:
That is, of course, not really a multi-argument instruction at the machine code level, just the assembler being a little more intelligent. It's also not to be confused with real instructions that use more than two arguments with one being the destination, such as:
However, this is something you would just normally do in sequence, especially if you didn't know the values you were using in advance:
If you have constant items that you wish to
xor
your register with, you can combine them beforehand byxor
ing them first, sincexor
is commutative:For example, if you wanted to
xor
your register with0x11
and then0x12
, you could use: