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

Compiler internal variables

Hello all,

In my application I need to access to the value that Stack is initialized, in general C51 does it in the startup code:

MOV SP,#?STACK-1

What I need is to be able to use later on in my code the value "?STACK-1" and copy it to other variable.

Thanks for your help in advance!
Alfredo M.

Parents
  • "Do you still follow me? Now you know why I did not explain it from the beggining."

    It didn't need all that explanation. You asked how to get the value of the stack pointer. At entry to main(), SP contains the result of the MOV SP,#?STACK-1. You can read and write SP. Simple. You don't even need access to the stack area's name. But do it however you want.

Reply
  • "Do you still follow me? Now you know why I did not explain it from the beggining."

    It didn't need all that explanation. You asked how to get the value of the stack pointer. At entry to main(), SP contains the result of the MOV SP,#?STACK-1. You can read and write SP. Simple. You don't even need access to the stack area's name. But do it however you want.

Children
  • Hi,
    The things is that you missundertood me, what I need is NOT the value of SP, but the value to which it is initiated at the very begging in the startup code, which is not a variable but a constant value called "#?STACK-1" in the startup file.

    Thanks for you effort,
    Alfredo.

  • "The things is that you missundertood me..."

    No, the thing is that you are not able to understand such a simple thing. OK, I'll be the first to say "you don't get it" and "I don't particularly care anymore" -- and neither do you since you are on your way now!

  • You dont have to be so upset,

    You mean to keep the value in a varible an use it later, isnt it? but it should be possible to do it without memory usage since it is only a constant definition.

    I am sorry if I am so stupid and we dont understand, lets stop here since the forum is not a e-mail account for msgs.

    Anyway thanks for your help one more time.