I want to write few assembly instructions during I'm writting a C code for my 89C52 microcontroller. Do you know How? I don't want write another asm file and link it to my C file. thanx
It's all described in the Manual: look-up the SRC, ASM, and ENDASM directives. Note that this will cause your entire 'C' file to be converted to assembler, and you must then pass this to the assembler to generate the object. This means that 1. You lose the 'C'-level source debugging & browsing; 2. 'C' files with the SRC option are re-translated every time you build the project - whether the source has changed or not! Therefore it's usually best to isolate your inline assembler into a very small file - or actually have a separate assembler module!
Thanks, but I'd tested #pragma asm #pragma endasm before, and I could not use it. Do you have any example of using it?
"I could not use it." What happened? Why couldn't you use it? "Do you have any example of using it?" There are examples in the manual You did remember the SRC directive, didn't you...?
//here is a sample of Keil C51 main() { #asm mov a,b #endasm } // and you must set two options about 'SRC..' of this file. To right hit this file in the file tree -->Options for file..
The manual? Where can I get it? THANKS.
After creating or opening a project, click the "Books" tab in the Project Window.
Another issue with inline assembler is that (at least in the past) it completely kills optimization for the module in question.
"Another issue with inline assembler is that (at least in the past) it completely kills optimization for the module in question." Not anymore. See the last half of this thread: http://www.keil.com/forum/docs/thread1657.asp
"Another issue with inline assembler is that (at least in the past) it completely kills optimization for the module in question." Well, Jon Ward has assured us that it is all in the past now: "This was true a long time ago, but using the SRC option generates the same assembly output that the compiler would. All optimizations are used." http://www.keil.com/forum/docs/thread1657.asp Posted 7/6/02 13:41:12
There's an echo in here! ;-)
Yeah, it turns out you're only 14.75km away from me when all this time I thought you were across the pond!