I have a program in assembler like this:
lots of code
......
.ORG $7000 ;; (or somewhere)
atext: .DB "this is a test string 1"
.ALIGN EVEN
Btext: .DB "this is a test string 2"
- QUESTION : Assuming the length of text 1 is ODD- Is it possible to ALIGN Btext using some kínd of ALIGN command ( like above). The Atmel Assembler (studío 6.2) says NO - but I wonder....
(Problem easily solved by manually alignment like this:
atext: .DB "this is a test string 1",0,0
// 01234567890123456789012 3 4
And adding zeroes where needed to align.
- QUESTION :
I now want to write the text to my serial monitor.
So I do this;
ldi zh,High (text1)
ldi zl,LOW (text1)
push ZH
push ZL
lsl ZL
rol ZH ;; to ensure LPM later
WRTE: lpm R16,Z+ ; get byte/data
cpi R16,0
breq wrte2
call output
rjmp wrte
wrte2:
pop zl
pop zh
ret
Now I wonder: If I use
......
WRTE: LD R16,Z+ ; get byte/data /// BAD - DON'T
.....
What will I get in R16?
Btext
too, even, odd, or something else? Why? I think @Jon has answered your question - aligning data doesn't matter as data is byte addressable. Maybe Jon should promote the comment to an answer? \$\endgroup\$