answersLogoWhite

0

On a near call, the stack pointer is 2 less than its original value. On a far call, it is 4 less.

User Avatar

Wiki User

15y ago

What else can I help you with?

Continue Learning about Engineering

What is top pointer of stack?

top pointer of a stack is the pointer that refers to the top most element of the stack.


Can stack be as a pointer?

A stack is a data structure in which last item inserted is taken out first . That's why they are known as LIFO (last in first out). Inserting an item in stack is termed as push and taking an item out from stack I s termed as pop. Stack pointer is the pointer that points to the top of the stack or that points the item at the top of the stack and help in adding or deleting the item from the top of stack.


What is difference between stack pointer and program counter?

Both of them are pointers, but otherwise they are completely unrelated. The former points to the current position of the stack, the latter points to the current instruction of the program.


What is the purpose of the program stack?

Its main use is to store local variables, arguments and return address each time a function is called.When your program calls a function the following happen :- The function arguments are put on the stack- The current instruction pointer is put on the stack- The program jumps to the start of the function- Space is allocated on the stack to hold local variables- The function executes- The space holding local variables is de-allocated- The instruction pointer is restored and removed from the stack (we are now leaving the function and resuming the calling procedure)- The arguments are removed from the stack


Why must the stack pointer be initialized at the beginning of every program?

Because the stack pointer marks the top of the stack. If it is not initialised, it is not possible to determine where the next stack frame will go.

Related Questions

How stack pointer registers are involved in the execution of push and pop instruction?

If the stack is empty assume the stack pointer has a value of P. when you push something on the stack you increment P. when you pull something from stack you decrement P.


What is the difference between stack pointer and program counter?

The stack pointer keeps track of the top of the stack used by the current thread. The program counter keeps track of the next instruction in a program. Both are registers and both store a memory address.


XTHL and SPHL pair in 8085 microprocessor?

XTHL exchanges HL register with the content of the stack. XTHL followed by RET allows to return to an other address than the one which was previously pushed by a CALL. Eg.: ... CALL FOOBAR ... FOOBAR ... LXI, H @@@@ XTHL RET ;return to @@@@, not after the 'call' Alain FOUERE 22april2009


Why stack pointer is 16- bit register?

Program Counter( PC)stores the 16-bit memory address of the next instruction to be fetched. Stack Pointer (SP)stores the address of a memory location which is used as a stack.


Can you use sp as offset address holder with cs?

SP is the stack pointer and can be used in the stack operations. It cannot be used for fetching the instruction


How does push work on registers and variables?

The PUSH instruction decrements the stack pointer by the size of the operand and then stores its operand at the memory address pointed to by the stack pointer. This leaves the stack pointer always pointing to the last element pushed onto the stack.The POP instruction reverses the sequence, retrieving the operand first, and then incrementing the stack pointer by the size of the operand.Also, PUSH and POP do not work on variables - they only work on register values. You can pop/push a variable, however, by using a register and then storing/retrieving the register to/from memory.


What is the function of a stack pointer?

Stack pointer points to the topmost / most recently referenced location on the stack; - Nutan


What is top pointer of stack?

top pointer of a stack is the pointer that refers to the top most element of the stack.


What happens when POP H instruction is executed in 8085?

The POP H instruction in the 8085 copies the top of stack to the HL register and then increments the stack pointer by 2. In C pseudo code, the sequence is L = *(SP++); H = *(SP++);


Can stack be as a pointer?

A stack is a data structure in which last item inserted is taken out first . That's why they are known as LIFO (last in first out). Inserting an item in stack is termed as push and taking an item out from stack I s termed as pop. Stack pointer is the pointer that points to the top of the stack or that points the item at the top of the stack and help in adding or deleting the item from the top of stack.


What is difference between stack pointer and program counter?

Both of them are pointers, but otherwise they are completely unrelated. The former points to the current position of the stack, the latter points to the current instruction of the program.


Why six T-states in call instruction fetch?

Three for opcode fetch, one for decode, two to process the manipulation of the stack pointer.