This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

How to access local variable in C51 inline-assembly

For efficiency,i have to use inline assembly in my code, but I failed to access local variables
My code is something like this:

void func(void)
{
       unsigned int i;
       i=0;

        #pragma asm
        MOV A,i
        #pragma endasm

}

but i get a error : error A45: UNDEFINED SYMBOL (PASS-2)

So i there and way to solve this problem

Parents
  • will generate code like this
    Two remarks to that:
    1) Not when I try that here it doesn't.
    2) You've been told already that "like this" doesn't cut it. Either that is the actual code, or you're essentially blowing smoke.

    the redundant two instructions
    And have you made absolutely, positively sure that those are actually redundant? Do you understand not just these six machine instructions, but also the entire surrounding code well enough that you can make sure that all of it would still work the same way without these instructions?

Reply
  • will generate code like this
    Two remarks to that:
    1) Not when I try that here it doesn't.
    2) You've been told already that "like this" doesn't cut it. Either that is the actual code, or you're essentially blowing smoke.

    the redundant two instructions
    And have you made absolutely, positively sure that those are actually redundant? Do you understand not just these six machine instructions, but also the entire surrounding code well enough that you can make sure that all of it would still work the same way without these instructions?

Children