Hi i am new in avr asm programming,in the example below, i have few questions:
1) Is it label: 8 bit or 16bit long?
2) Why multiplication label with 2 is needed?
3) Instruction LPM is placing their result in register R0? If so, what does that have to do with Z?
4) Can you explaine the quoted text from the provided link:
"If the address is not multiplied by two and label is at byte address 0x60 (word address 0x30), Z will point at the code stored there. I hope this clarified the addressing problem. Other versions are"
ldi ZL, low(2*label)
ldi ZH, high(2*label)
label:
.db "Hello world", 0
lpm
Thanks.
avr-gcc
, I assume you could just do asizeof(label)
in C and find it out (it's also likely to have the same size as a pointer, because, um, it is a pointer if I'm not terribly mistaken), – user529758