Position of the stack pointer

Raviteja.g

Raviteja.g

@ravitejag-02nJVr Oct 26, 2024
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

Welcome, guest

Join CrazyEngineers to reply, ask questions, and participate in conversations.

CrazyEngineers powered by Jatra Community Platform

  • saurabh2486

    saurabh2486

    @saurabh2486-Tr6NOC Aug 19, 2009

    it will be 1000h i suppose and second one is right first push then decrement the pointer
  • Raviteja.g

    Raviteja.g

    @ravitejag-02nJVr Aug 21, 2009

    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

    @silverscorpion-iJKtdQ Aug 24, 2009

    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

    @ameyaamu-myoFwJ Aug 24, 2009

    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

    @namivrm-w4iQGm Aug 25, 2009

    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...