??? 08/06/06 13:13 Read: times |
#121729 - mixing Responding to: ???'s previous message |
I have severe reservations on mixing asm and c in the same routine. It is so darn easy to screw it up e.g. who knows if the compiler is saving a value in R0 before and relying on it after the assembly in this 'example' #pragma asm mov r0,#7 #pragma endasmOk the 'example' may be too obvious, but what about things like CY, OV, acc. Now that said, I am happily mixing C and asm , I just keep them in separate modules and, if asm call C this comment lcall Cfunc; NOTE C may screw up ANY register or flagis always there. I have seen this failing because somebody 'tested' which registers the Cfunc affected and relied on that. A later release of the compiler used different registers, it is essential that the caution is applied to ALL registers and flags. Erik |
Topic | Author | Date |
Getting result of inline asm with Keil | 01/01/70 00:00 | |
Return value from an auto | 01/01/70 00:00 | |
Do not fight you tools | 01/01/70 00:00 | |
Adding some C code afterwards | 01/01/70 00:00 | |
That will be another post | 01/01/70 00:00 | |
The asm routines in a a51 file![]() | 01/01/70 00:00 | |
mixing | 01/01/70 00:00 |