我想要完成:
LABEL:
....
subi r18, LABEL
我需要从寄存器中减去标签的地址。我该怎么做?
答案 0 :(得分:2)
subi r16, pm_lo8(LABEL)
sbci r17, pm_hi8(LABEL)
参考文件:
http://sourceware.org/binutils/docs-2.21/as/AVR_002dModifiers.html#AVR_002dModifiers
答案 1 :(得分:1)
注意:我对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