Position of the stack pointer

In Assembly Language Programing , if we use a stack then we have to allocate some memory for the stack.Now , my question is if we give the space from 1000h to 2000h in memory then what will be the position of stack pointer. Is it 1000h or 2000h😕
And when we push an element into the stack there are two possibilities:
1. first decrement the stack pointer and then pushes the given element on to the stack.
2.first pushes the element onto the stack and then decrement the stack pointer

which is correct😕

Replies

  • saurabh2486
    saurabh2486
    it will be 1000h i suppose and second one is right first push then decrement the pointer
  • Raviteja.g
    Raviteja.g
    see baba
    i refer i came to know that the stack is a pushdown stack,
    and it starts from 2000h and when it is pushed first it decrements and then the element is inserted.

    so , i think this the correct process in the push operation of stack.
  • silverscorpion
    silverscorpion
    Well, I guess it depends on the device you are using.

    For example, in 8051, the data is first pushed into the stack and then the stack pointer is decremented.

    In 8085, it's vice versa.
  • ameyaamu
    ameyaamu
    Raviteja.g
    In Assembly Language Programing , if we use a stack then we have to allocate some memory for the stack.Now , my question is if we give the space from 1000h to 2000h in memory then what will be the position of stack pointer. Is it 1000h or 2000h😕
    And when we push an element into the stack there are two possibilities:
    1. first decrement the stack pointer and then pushes the given element on to the stack.
    2.first pushes the element onto the stack and then decrement the stack pointer

    which is correct😕
    hiiii
    when using stack
    stack ptr willbe decremented first thenvalue will be pushed
    rev take place for pop,ie retrieve then increment
    stack willpt to 1000h
  • namivrm
    namivrm
    it may be 1000h n also 2000h... we can use any..it's depanded on us..
    in "push operation first d pointer's position changes aftr that... elt inserting"
    1>> wn pointer starts frm 2000h dn 1st decrement d position of pointer aftr dat insert elt...
    2>> wn it starts frm 1000h 1st incremanet d position n dn insert elt...

You are reading an archived discussion.

Related Posts

I'm posing this question in order to overcome my confusion and get some clarity. I wanna know what's the difference between the following words. 1.Unary operator and Binary operator 2.Relation...
can any one give me a brief explanation about piping. What is piping? For what purpose it is used? and the sites which can give me some help.......
Guys , Google is conducting coding competetion. Check this link for more details... Google Code Jam 2009 PS..If this is invalid please delete it 😀
Hi All, I'm currently involved in a project related to solar energy. Its a project to light up village streets using solar energy. We are just at the start up...
Please suggest me the topics for electrical projects based on Silicon controlled rectifier(SCR). And if posible a short abstract on that topic.