[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[avr-gcc-list] hi8, lo8, hh8 etc?

From: Per Arnold Blåsmo
Subject: [avr-gcc-list] hi8, lo8, hh8 etc?
Date: Mon, 24 Jan 2005 14:58:59 +0100
User-agent: Mozilla Thunderbird 1.0 (X11/20041206)


I have had to do some inline assembly and needed to use some addresses and pointer to those etc.

I "stumbled" over some pseudo-opcodes that I can't see are documented anyplace and that seems to be useful.
I have some example code programed with IAR that uses opcodes like:

       LDI     R17, Low(hwrd(var))    // Address Bits 16->23 of
       OUT     RAMPX, R17 // the field in var
       LDI     XH, High(lwrd(var))    // Address Bits 08->15
       LDI     XL, Low(lwrd(var))     // Address Bits 00->07
'var' has a 24bit address.
Trying to find something like this for avr-gcc I found (binutils file gas/config/tc-avr.c):

http://www.nongnu.org/avr-libc/user-manual/assembler.html mentions lo8, hi8 and pm, but does not document those.
Does any documentation exist or?

I made this code that generates the same:
       LDI     R17, lo8(hlo8(var))    // Address Bits 16->23 of
       OUT     RAMPX, R17 // the field in var
       LDI     XH, hi8(var)    // Address Bits 08->15
       LDI     XL, lo8(var)     // Address Bits 00->07

Am I assuming correct?

For me it seems like 'hh8'and 'hlo8' is the same. They have different code in the src-file, but as far as I can see does the same. Can anyone explain me the difference, if there is some? Also in IAR 'hwrd' seems to be the same as 'hlo8', but I cant find a direct translation of 'lwrd'. But I might not need it?

This is used to access a variable that is located in higher memory location.

Per A.

Per Arnold Blåsmo
e-mail: address@hidden
Get Thunderbird <http://www.mozilla.org/products/thunderbird/>

reply via email to

[Prev in Thread] Current Thread [Next in Thread]