0
votes

I am trying to accomplish:

LABEL:
....
subi r18, LABEL

I need to subtract address of a label from a register. How do I do that?

2

2 Answers

1
votes

Note: I'm not that familiar with AVR assembler, this is just what I could gauge from reading a few webpages. I'm also assuming that your addresses are 16-bit.

; 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