Hello, I am trying to put a assembler code into a c code, but it gives me errors. I would be pleased if someone explains me how to do it or gives me an example. Thank you very much
I only want to rotate a register throw the carry in c but I can't. Could it be possible?
"I only want to rotate a register throw the carry in c" You too, eh? http://www.8052.com/forum/read.phtml?id=71318 Same question, two different names, two different forums, but the same answer: DO NOT DO THIS! "Could it be possible?" Not with any sort of reliability, NO! You cannot assume this level of control over specific CPU registers & instructions when you program in 'C'. (yes, you might come across a specifc instance where it appears to work, but you have no guarantee that it will continue to work with changes in surrounding code, changes to Project options, changes to newer compiler versions, etc, etc, etc,...) Anyway, the fundamental question is WHY do you want to do this? What exactly are you trying to achieve? http://www.8052.com/forum/read.phtml?id=71320
My problem: I have a table and I want to shift all the elements of the table. The bit that goes out from a byte have to entry to the next byte. I could use masks to know the top bit and the bottom bit at every pass but it increases the cpu load a lot.
Write an assembler function that does it; call the funtion from 'C'. As I keep saying, there is no single language that can be perfect for every conceivable application: Assembler gives you absolute control, and direct access to every aspect of the processor, but is extremely expensive in terms of programmer time & effort; 'C' is far more economical pf programmer resources, but direct manipulation of individual bits is not its strong point. "I could use masks to know the top bit and the bottom bit at every pass but it increases the cpu load a lot." You need to ask yourself this question: what is more important to you - writing in 'C', or minimising the "CPU load?" The trouble with