打印

请教一个ARM的语句问题。

[复制链接]
2238|7
手机看帖
扫描二维码
随时随地手机跟帖
跳转到指定楼层
楼主
xjc|  楼主 | 2007-1-8 09:32 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
请教一个ARM的语句问题。
在杜春雷的《ARM体系结构与编程》书中的219页中有这样的一段程序。

........

;延时
     ldr  r4 ,  =0xff
01   subs r4 , r4 ,  #0x01
     bne  %b01

我的疑问是:bne %b01这段汇编是怎么一个机构?
               %b在这里是什么意思呢  ?


相关帖子

沙发
pigjiang| | 2007-1-8 09:36 | 只看该作者

这个 在李光驹的书上有

bne  %b01
说得是"不等的话,跳转到以前的最近的一个叫01的标号处"

如果表示往后的第一个标号好像是用&f01吧,忘了.

使用特权

评论回复
板凳
xjc|  楼主 | 2007-1-8 10:08 | 只看该作者

请问哪里有讲这个语法的?

谢谢回答了。

请问哪里有讲这个语法的?

杜春雷的《ARM体系结构与编程》好象没有啊 。

使用特权

评论回复
地板
pigjiang| | 2007-1-8 10:18 | 只看该作者

李光驹有本写4510的书

网上有下载的.

使用特权

评论回复
5
pigjiang| | 2007-1-8 10:20 | 只看该作者

不一定要保定哪本书嘛,到google上一搜就有了.

使用特权

评论回复
6
John_light| | 2007-1-8 15:47 | 只看该作者

摘抄如下,不要问我从哪里来

Local labels

A local label is a number in the range 0-99, optionally followed by a name. The same number can be used for more than one local label in an ELF section.

Local labels are typically used for loops and conditional code within a routine, or for small subroutines that are only used locally. They are particularly useful in macros.

You can use the same number for more than one local label even within the same scope.

By default, the assembler links a local label reference to:
. the most recent local label of the same number, if there is one within the scope
. the next following local label of the same number, if there is not a preceding one within the scope.

Use the optional parameters to modify this search pattern if required.

Syntax

The syntax of a local label is:
n{routname}
The syntax of a reference to a local label is:
%{F|B}{A|T}n{routname}

where:

n        is the number of the local label.
routname is the name of the current scope.
%        introduces the reference.
F        instructs the assembler to search forwards only.
B        instructs the assembler to search backwards only.
A        instructs the assembler to search all macro levels.
T        instructs the assembler to look at this macro level only.

If neither F or B is specified, the assembler searches backwards first, then forwards.
If neither A or T is specified, the assembler searches all macros from the current level to the top level, but does not search lower level macros.

从你给出的代码:
     ldr  r4 ,  =0xff
01   subs r4 , r4 ,  #0x01
     bne  %b01
%b01的意思恐怕是向backwark搜索标号01

使用特权

评论回复
7
John_light| | 2007-1-8 15:50 | 只看该作者

晕,排了老半天还是很难看

使用特权

评论回复
8
XJC| | 2007-1-8 17:17 | 只看该作者

谢谢各位了。!

使用特权

评论回复
发新帖 我要提问
您需要登录后才可以回帖 登录 | 注册

本版积分规则

xjc

14

主题

81

帖子

1

粉丝