http://www.emu8086.com/assembler_tutorial/asm_tutorial_09.html
1.
keep temporary data;
used by CALL;
RET--compared with IRET used in INT.
2.
PUSH-stores 16 bit value (REG/SREG/memory/immediate)(immediate for 80186 and later)
POP-gets 16 bit value (REG/SRET/memory)(Note: SREG except CS)
they're useful due to
a. limited number of registers.
b. for exchange the values
example:
ORG 100h
MOV AX, 1212h ; store 1212h in AX.
MOV BX, 3434h ; store 3434h in BX
PUSH AX ; store value of AX in stack.
PUSH BX ; store value of BX in stack.
POP AX ; set AX to original value of BX.
POP BX ; set BX to original value of AX.
RET
END
3.LIFO
impt to do equal number of PUSHs and POPs
otherwise the stack maybe corrupted and it will be impossible to return to os
when program starts there is a return address in stack.(genrally 0000h)
4. memory area: SS and SP.
PUSH sourse: (SP-2)-->(SP), write source to SS:SP
POP destination: write the value at SS:SP to destination, (SP+2)-->(SP)
5. The top of the stack: the current address pointed by SS:SP
6. For COM files, stack seg is generally the code seg and SP=0FFFEh
AT SS:0FFFEh stored a return address of RET that is executed in the end of the program.