answersLogoWhite

0


Best Answer

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

14y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: What is the contents of the stack pointer after the execution of the call instruction?
Write your answer...
Submit
Still have questions?
magnify glass
imp
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.


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++);


How ISR is serviced?

when interrupt occurs, the program counter content will stores into stack, an PC will load interrupt address for next instruction execution. ofter completion ISR process PC will retrieves the stack values and execution will be continued.


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.


Push and pop instruction of 8086 microprocessor?

I am not sure about 8086, but I can tell you the whole procedure in 8085. PUSH instruction always pushes two bytes of data i.e. total 16 bits. Example: Assume that Stack is already initialized and SP is at 2008 address location. Then PUSH B instruction will have following steps: 1) The stack pointer (SP) will be pointing to the uppermost position of the stack (actually stack works in opposite order in terms of Addresses. e.g. if SP is now at address 2008, then PUSH instruction will store the contents on 2007 & 2006). 2) The contents of register B & C will be saved on to the stack such that contents of register B will be at 2007 & that of C will be at 2006 address location. 3) The SP is now modified to 2006.