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.
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
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?
You could either pass the local as a parameter to an assembler routine, or move up and write more of the calling code in assembler.
With C51, you generally mix C and assembler function-by-function, not line-by-line inside a single function.