Am 05.12.2002 18:19:11, schrieb "Mark Stokes" <[email protected]>:
>Of course ultimately, the more logical solution would be to use a
>#define for this.  Or just use the predefined LCDMEM (in lcd.h).  And I
>would do this, but apparently, ASM statements can't see #define'd
>variables.  Is this a bug?

no. it's how it is. the asm part is just written to the intermediate assembler 
output
from gcc, the preprocessor is not started twice (or again for the intermediate 
asm)

your problem can be solved with parameters to the asm statement. (if you realy
want that asm. i think you could do that also in C)

  asm("":outputs:inputs:clobbers)
so you can pass in and out variables or constants. the clobbers statement
is a list of registers you modify (in your case R11). gcc saves and restores
that registers if needed.

example of an out param:
        __asm__ __volatile__ ("mov.w R1,%0" : "=r" (currentTask->stack));
example of an inparam:
        __asm__ __volatile__ ("mov.w %0,R1" : : "m" (currentTask->stack));

and maybe have a look at this doc: 
http://gcc.gnu.org/onlinedocs/gcc-3.0/gcc_5.html#SEC102

(i think you shoud not use R15, R14 in the asm direclty, but pass then as in 
params:
        __asm__ __volatile__ ("xxx" : : "r"(value), "r"(digit));
)

and maybe string concatenation works? i haven't tried this, but the preprocessor
usualy concatenates strings that follow each other, so:

"\tBIS.B   " str(LCDASCII) "+0x10(R11), ..."

should produce one string, assuming :
#define str_x(x) #x
#define str(x) str_x(x)
or something like that (keyword "stringify")

chris





Reply via email to