[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [avr-gcc-list] extracting bytes
From: |
Erik Christiansen |
Subject: |
Re: [avr-gcc-list] extracting bytes |
Date: |
Fri, 3 Dec 2004 20:20:44 +1100 |
User-agent: |
Mutt/1.5.6+20040722i |
On Fri, Dec 03, 2004 at 01:10:18AM -0800, Jonny Dyer wrote:
> In AVR-AS is there an assembler directive like HIGH() and LOW() in the
> Atmel assembler for extracting bytes from a word?
Yes indeedy, there are two modifiers, used as follows:
hi8/lo8 treat the data or progmem label as a byte address, e.g. for use
with lpm. (So manual doubling, as in Atmel examples, is harmful.)
pm_hi8/pm_lo8 treat the progmem label as byte_address/2, e.g. for use
with icall.
e.g.:
ldi ZL,pm_lo8(some_progmem_label)
ldi ZH,pm_hi8(some_progmem_label)
Erik