Inline assembly! asm { ;you assembly code goes here. } My version is so out of date, tho, it may already support it and I don't even know.
What version do you have? It's been available since at least v6.03!
The REAL method, not the .SRC workaround, where is it documented?, my manual document the .SRC.
Not sure what you're getting at there, Erik? Keil, in common with some other compiler writers, have chosen to implement inline assembler via .SRC and the Assembler. But isn't it fun, anyway!?
I guess the REAL questions is "How does the Keil C51 compiler generate an OBJ file?". Many C compilers generate assembler output that must then be assembled with an assembler. This is a 2-step process that requires running the C compiler and then the assembler. Many C compilers make this transparent and run the assembler for you (without you knowing it). The KEIL C compiler generates the .OBJ file without calling or running the assembler. Therefore, when you include in-line assembly statements, we chose to simply generate a .SRC file and let you assemble it. The rationale behind that is that if you are generating assembler code from the compiler, you are probably going to want to hand tweak it somewhat. Jon
>The KEIL C compiler generates the .OBJ >file without calling or running the assembler. >Therefore, when you include in-line assembly statements, >we chose to simply generate a .SRC file and let you assemble it. >The rationale behind that is that if you are generating >assembler code from the compiler, you are probably going >to want to hand tweak it somewhat. Can you say that this 2 ways always produce the same .OBJ: 1) .C --> .OBJ 2) .C --> .SRC --> .OBJ in case of no using any #pragma asm/endasm ?
Can you say that this 2 ways always produce the same .OBJ: 1) .C --> .OBJ 2) .C --> .SRC --> .OBJ in case of no using any #pragma asm/endasm ? Method (2) means that you have to call both C51.exe and A51.exe separately, so you'd have to ensure that all your command-line options matched precisely Also, I'm not sure whether C51 disables all optimisation when generating .SRC? (this could make sense, given Jon's earlier comments about "tweakability")
Can you say that this 2 ways always produce the same .OBJ: 1) .C --> .OBJ 2) .C --> .SRC --> .OBJ in case of no using any #pragma asm/endasm ?
View all questions in Keil forum