Avr ASM标签* 2 [英] Avr asm label*2
本文介绍了Avr ASM标签* 2的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我是avr asm编程的新手,在下面的示例中,我有几个问题:
Hi i am new in avr asm programming,in the example below, i have few questions:
1)它是标签:8位或16位长吗?
1) Is it label: 8 bit or 16bit long?
2)为什么需要乘以2的乘法标签?
2) Why multiplication label with 2 is needed?
3)指令LPM将其结果存储在寄存器R0中?如果是这样,那与Z有什么关系?
3) Instruction LPM is placing their result in register R0? If so, what does that have to do with Z?
4)您能否从提供的链接中解释引用的文本:
4) Can you explaine the quoted text from the provided link:
如果地址未乘以2并且标签位于字节地址0x60(字地址0x30),则Z将指向存储在此处的代码.希望这可以解决寻址问题.其他版本是"
ldi ZL, low(2*label)
ldi ZH, high(2*label)
label:
.db "Hello world", 0
lpm
谢谢.
推荐答案
- 标签是16位.
- 因为汇编器正在使用字地址,但
LPM
需要字节地址.请注意,并不是所有的汇编程序都这样做,特别是avr-gcc
使用的gas
不会.那么您就不需要乘法了. - 是的,
LPM
的无操作数版本会自动加载到R0
,并从Z
获取地址.请参阅指令集参考. - 这还不是很清楚,但请参阅上面的#2.
- Label is 16 bits.
- Because the assembler is using word addresses, but
LPM
needs byte address. Note that not all assemblers do this, notablygas
that's used byavr-gcc
, doesn't. Then you don't need the multiplication. - Yes, the no-operands version of
LPM
automatically loads intoR0
, and it takes the address fromZ
. See the instruction set reference. - That wasn't too clear LOL, but see #2, above.
这篇关于Avr ASM标签* 2的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文