Latest

6/recent/ticker-posts

WHAT IS STACK AND SUBROUTINE? SHORT NOTES ON STACK AND SUBROUTINE

 


    Stack is a group of memory location in the R/W memory that is used for temporary storage of binary information during the execution of a program. Stack is defined using LXI SP which loads 16 bit memory address in the stack pointer register. Storing of data bytes begin from one memory address less than the address in the stack pointer register and continues in reverse numerical order. It is recommended to initialize stack memory address as high as possible to avoid the program from being destroyed by the stack information.

#Stack is a memory location in R/W memory and stack pointer is a 16 bit register in 8085 microprocessor.

PUSH operation is used to store data bytes from register pairs to stack memory location and POP is used to transfer data bytes from stack memory location to register pairs.

SOME IMPORTANT INSTRUCTIONS: 

1. LXI SP 16 bit : Load 16 bit address in stack register.

2. PUSH  Rp : 1 byte instruction. It is used to load the contents of register pairs to stack memory location. First contents from high order register is copied following the low order register. 

 PUSH PSW means the contents of accumulator and flag registers are being copied to stack memory.

3. POP Rp: 1 byte instruction. It is used to load contents of stack memory to register pairs. First contents of memory location is copied to low order register and then to the high order register.


From PUSH and POP operation, it is clear that stack is a LAST IN FIRST OUT memory location. 


Post a Comment

0 Comments