Thanks for the detailed reply. The reason for the assembly is to get rid of the C overhead for certain routines. This is why I'm accessing the Registers directly. As for the loading of the variables directly using the parameter passing into assembly, I'll probably have to do that for this particular variable. I did not appreciate the mention for me to read the docs, since I found nowhere in the docs (the gcc .ps file), where it states that I can't reference a #define directive in my inline asm. I am able to do this operation in C. However, in my particulate case, The asm I wrote is approx 50 bytes, and the asm that mspgcc wrote is about 95 bytes. I haven't timed the asm yet, but I suspect it will be a bit faster, and as we all know... Time is electrons (or battery life).
Anyway, RTFM doesn't help. This type of reply does, thanks -Mark -----Original Message----- From: mspgcc-users-ad...@lists.sourceforge.net [mailto:mspgcc-users-ad...@lists.sourceforge.net] On Behalf Of Chris Liechti Sent: Thursday, December 05, 2002 2:51 PM To: mspgcc-users@lists.sourceforge.net Subject: Re: [Mspgcc-users] Inline ASM question (Possible compiler bug) Am 05.12.2002 18:19:11, schrieb "Mark Stokes" <m.sto...@ieee.org>: >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 ------------------------------------------------------- This sf.net email is sponsored by:ThinkGeek Welcome to geek heaven. http://thinkgeek.com/sf _______________________________________________ Mspgcc-users mailing list Mspgcc-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mspgcc-users