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
  • "For example is sp is initialized to 0x42 (in startup routine) after power up, I need to put this value (0x42) in some variables later on in my proyect."

    Yep, I'm with you so far (although I have no idea why one would want to do this). What I told you before still stands. main() is LJMP'ed to by my runtime startup (maybe yours doesnt'), so this works:

    sp = SP;
    If you think your runtime startup LCALL's main() then:

    sp = SP - 2;

Reply
  • "For example is sp is initialized to 0x42 (in startup routine) after power up, I need to put this value (0x42) in some variables later on in my proyect."

    Yep, I'm with you so far (although I have no idea why one would want to do this). What I told you before still stands. main() is LJMP'ed to by my runtime startup (maybe yours doesnt'), so this works:

    sp = SP;
    If you think your runtime startup LCALL's main() then:

    sp = SP - 2;

Children
No data