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

accessing local "c" variables in inline assembly

How do I access a local variable in assembly?

I have used the SRC to determine how the compiler created the variable. it changes it's name from variable to variable?nnn where nnn is a number.

How do I determine what nnn is? (other than looking at the .src file)
can I access the variable using the original label name?

If I use the variable:nnn , nnn will occasionally change and ten I get errors!

Help

Parents
  • this little snippet

    #pragma endasm
                    i=8;
                    ACC=RcvFIFOEmptyFlagHi;
    #pragma asm
    

    access the accumulator in C and, while it MAY not blow it all up, the practice is, at least, dangerous. Thus it does not matter if you can "access local "c" variables in inline assembly" since the whole mess, most likely, will blow up anyhow.

    To the OP
    rewrite the mess totally in assembler and look up the OVERLAYABLE command to the assembler, that will give you local variables in an assembler routine.

    Erik

Reply
  • this little snippet

    #pragma endasm
                    i=8;
                    ACC=RcvFIFOEmptyFlagHi;
    #pragma asm
    

    access the accumulator in C and, while it MAY not blow it all up, the practice is, at least, dangerous. Thus it does not matter if you can "access local "c" variables in inline assembly" since the whole mess, most likely, will blow up anyhow.

    To the OP
    rewrite the mess totally in assembler and look up the OVERLAYABLE command to the assembler, that will give you local variables in an assembler routine.

    Erik

Children
No data