We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
Is there a method for using inline assembly AND the variables passed to it? I understand the requirement for using SRC, but it makes things a wee bit unmaintainable. For example:
void test(char value) { char dummy; #pragma asm mov a,value mov dummy,a #pragma endasm }
?_test?BYTE: value?040: DS 1 ORG 1 dummy?041: DS 1 RSEG ?PR?_test?CREDMSGS USING 0 _test: MOV value?040,R7 ; SOURCE LINE # 172 ; { ; SOURCE LINE # 173 ; char dummy; ; ; #pragma asm ; mov a,value mov a,value ; mov dummy,a mov dummy,a ; #pragma endasm ; } ; SOURCE LINE # 180 RET ; END OF _test
Hi Lloyd, Can you tell the compiler to push parameters on the stack and reserve space for locals on the stack for the duration of your asm function with a pragma? It looks like it is reserving space in ram. Maybe the compiler is set to make auto variables static. If the stack isn't too much of an issue you ought to be able to keep the code the same by referring to a local stack frame. Also, as long as you are only changing code between the #pragma ASM/ENDASM, shouldn't the compiler work out the symbol name changes? Doug Moore
Timing is of high importance (only reason I dropped into ASM in the first place), so no, using the stack is not an option. I need to refer to the params quickly. The compiler doesn't work out the name changes because (my guess at it), the designer opt'ed for a method that reduced the development of the compiler. For the compiler to work things out it has to understand 8051 assembly and THAT makes things more difficult on the compiler writer (otherwise it would just output an OBJ and I would be done!). Thanks for the input, Cheers, Lloyd