我正在努力完成:
LABEL:
....
subi r18, LABEL
我需要从寄存器中减去标签的地址。我怎么做?
subi r16, pm_lo8(LABEL)
sbci r17, pm_hi8(LABEL)
正如 avrfreaks 上的回答:
http ://www.avrfreaks.net/index.php?name=PNphpBB2&file=viewtopic&p=857982#857982
参考文档:http:
//sourceware.org/binutils/docs-2.21/as/AVR_002dModifiers.html#AVR_002dModifiers
注意:我对 AVR 汇编器不是很熟悉,这只是我通过阅读一些网页可以得出的结论。我还假设您的地址是 16 位的。
; Address you wish to subtract the label from in R16 (low):R17 (high)
SUBI R16, LOW(LABEL)
SBCI R17, HIGH(LABEL) ; Omit this part if you have < 256 Bytes of ram