How to pass a #defined constant as an address to the inline assembler

Mark Jonas
Wed Sep 1 01:21:00 GMT 1999


I am trying to pass a constant (defined with #define) to the inline
assembler (CPU32) as an address and it does not do what I expect.

This is my code:
unsigned short foo;
#define MODBASE  0xFFFFF000L
#define CNTR1   (MODBASE+0x060A)
asm volatile ("move.w %1,%0" : "=g" (foo) : "g" (CNTR1));

And the inline assembler generates:
move.w #0F60A,(0FFFE,A6)

This looks OK except that the constant is used as an immediate value.

How do I tell the inline assembler that a constant is to be used as
an address and not as an immediate value?

Thanks in advance
Mark Jonas

Want more information?  See the CrossGCC FAQ,
Want to unsubscribe? Send a note to

More information about the crossgcc mailing list