ADD或SUB只有两个在ARM操作数 [英] ADD or SUB with only two operands in ARM

查看:706
本文介绍了ADD或SUB只有两个在ARM操作数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我学习ARM汇编语言。
我心中已经阅读ADD应该有3个操作数。然而,我心中已经看到在现实中,只有两个许多情况。如:

I am learning ARM Assembly Language. I'v read ADD should have 3 operands. However, I'v seen many cases in reality there are only two. such as:

STR     R1, [SP,#0x20+var_1C]
LDR     R1, =(a_lua - 0x1DE4E6)
MOVS    R0, R4          ; haystack
ADD     R1, PC          
BLX     strstr
CMP     R0, #0
BNE     loc_1DE4FA

任何一个可以帮助我的ADD与两个操作数的含义是什么?非常感谢!

Can any one help me with the meaning of ADD with two operands? Many thanks!

推荐答案

由于在评论中的信息,这确实是ARM code,没有16位Thumb,那么答案是,你的参考资料predates UAL。

Given the information in the comments that this really is ARM code, not 16-bit Thumb, then the answer is that your reference material predates UAL.

沿的修改叫汇编语法统一汇编语言的这所取代为ARM和Thumb previous语法。不是有两个单独的(和不兼容)语言,UAL允许(在合理范围内)同出一源被汇编为ARM或Thumb指令。其中一个这样的后果是,对于具有2个操作数相当于拇指,指定目标寄存器是可选的3个操作数的ARM指令 - 如果省略则默认为第一源寄存器*

The introduction of the Thumb-2 instruction set brought along a modified assembly syntax called Unified Assembly Language which superceded the previous syntaxes for ARM and Thumb. Rather than have two separate (and incompatible) languages, UAL allows (within reason) the same source to be assembled to either ARM or Thumb instructions. One of the consequences of this is that for any 3-operand ARM instructions that has a 2-operand Thumb equivalent, specifying the destination register is optional - if omitted it will default to the first source register*.

大多数汇编仍然会支持兼容旧的pre-UAL语法,但一旦你过去的基础,因为有一些潜在的混乱变化(如几乎所有的浮点它值得升级到更现代的参照点助记符)。

Most assemblers will still support the older pre-UAL syntax for compatibility, but it's worth updating to a more modern reference once you get past the basics since there are some potentially confusing changes (like nearly all of the floating-point mnemonics).

<子> *除了在 MUL 其中,它的另一种方式轮尴尬的技术原因的情况下。

* except in the case of MUL where it's the other way round for awkward technical reasons.

这篇关于ADD或SUB只有两个在ARM操作数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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