Is it possible to refer a C variable inside inline asm? for example, { char abc; #pragma asm MOV A, abc; #pragma endasm } after compile, I got a error at "MOV A, abc" variable abc is not recognized by Compiler. I know I can do this in C, I just wonder if there is a way to use variable in inline assembly. Thank you
Is it possible to refer a C variable inside inline asm? Almost certainly not. The way C51 implements variables (allocating them into registers, overlaying locals from different functions, etc.) makes it pretty much impossible for the assembler to know where the variable will actually be, at a given point in the program. The basic problem is that the interconnection between C51 and Ax51 isn't strong enough to support such tricks, due to the fact that C51 is designed to produce object files directly, rather than via assembly source.