Yahoo Groups archive

AVR-Chat

Index last updated: 2026-04-28 22:41 UTC

Message

Re: [AVR-Chat] This assembly oughta be something silly...

2005-06-15 by Dave VanHorn

>
>     ldi     ZH,high(Test_str)  ; Load Z register high
>     ldi     ZL,low(Test_str)   ; Load Z register low

As a couple of others have pointed out, you need to mult the string 
address by two.
This is because Z is a BYTE pointer, pointing to data that is stored as WORDS.

The string "ABCD" has two words of storage, "AB" and "CD"
The least significant bit then selects which byte you want. a 0 would 
get you "A", and a 1 would get you a "B", and so on.

Also, be aware, the data is stored as words by the asembler/compiler, 
so if you store "ABC" you'll end up with $41,$42,$43,$00

Attachments

Move to quarantaine

This moves the raw source file on disk only. The archive index is not changed automatically, so you still need to run a manual refresh afterward.