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
  • How do I access a local variable in assembly?

    Only slightly simplified answer: you don't. Inline assembly in C51 isn't integrated anywhere near well enough with the C compiler to allow such tricks.

    Generally, the best idea is to re-evaluate the whole plan: are you absolutely sure that you need inline assembly for the task at hand?

Reply
  • How do I access a local variable in assembly?

    Only slightly simplified answer: you don't. Inline assembly in C51 isn't integrated anywhere near well enough with the C compiler to allow such tricks.

    Generally, the best idea is to re-evaluate the whole plan: are you absolutely sure that you need inline assembly for the task at hand?

Children