??? 11/06/08 07:49 Read: times |
#159816 - I now see the point with Keil... Responding to: ???'s previous message |
... thanks for the explanation to all.
I would feel this as an annoying limitation, if I would use Keil. I understand, that the compiler makers want to sell the illusion that the compiler solves all the problems a developer can have, but they must also understand, that the power users will wish to have full control over their product, including hand-optimised parts where appropriate. I see that there is a kludge how to work around the problem (putting the asm part to a separate file), but still an unnecessary annoyance. So, I would put down the following as basic guidelines for those who wish to do asm in C on '51: 1. RTFM. Keywords, syntax etc. are compiler/assembler dependent. There is most probably a "howto add asm" section in your manual. 2. Don't attempt to insert a piece of asm in between C statements, unless you know for 100% the internals of the compiler (which is possible only in open-source compilers), or if the compiler maker assures you this is OK (which is never). The compiler makes things which you would find surprising. Don't assume from a casual inspection of a compiled code that the compiler will follow the same pattern next time you compile. 3. Rather, write pure asm functions. RTFM for how to do that, and for the convention in your compiler, what resources (registers) is your asm function supposed to preserve and how are the parameters passed. 4. Specifically for Keil, put all asm functions to a separate file, only to be added to the project via linking. Please comment. JW |