Professional Documents
Culture Documents
Lecture 16 23rd Feb 2024
Lecture 16 23rd Feb 2024
Topic-IV
T1. Barry B Brey, The Intel Microprocessors. Pearson, Eight Ed. 2009. Chapter 4-6, 8
23-02-2024
1
2/26/2024
PUSH
Push data from
Registers/Segment Register
Memory
Flag Register
PUSH
• Always transfers 2 bytes of data to the stack;
– 80386 and above transfer 2 or 4 bytes
2
2/26/2024
• PUSHA instruction pushes all the internal 16-bit registers onto the
stack.
• requires 16 bytes of stack memory space to
store all eight 16-bit registers
• After all registers are pushed, the contents of the SP register are
decremented by 16.
• PUSHAD instruction places 32-bit register set on the stack in
80386 - Core2.
– PUSHAD requires 32 bytes of stack storage
PUSHA instruction,
showing the location and order of stack data.
3
2/26/2024
PUSH
Example-PUSH operation
PUSH AX
PUSH EBX
PUSH DS
PUSH WORD PTR[BX]
PUSHF
PUSHFD
PUSHA
PUSHAD
PUSH 16-imm
PUSHD 32-imm
4
2/26/2024
POP
Performs the inverse operation of PUSH
The POP instruction removes a word from the top of the stack
to the specified 16-bit register or memory location.
The stack pointer is incremented by 2 after the execution.
Ex: POP CX
- copies a word from the top of stack to the CX register and
increment SP by 2.
not available as an immediate POP
POP
• POPF (pop flags) removes a 16-bit number from the stack and
places it in the flag register;
– POPFD removes a 32-bit number from the stack and places
it into the extended flag register
• POPA (pop all) removes 16 bytes of data from the stack and
places them into the following registers, in the order shown: DI,
SI, BP, SP, BX, DX, CX, and AX.
– reverse order from placement on the stack by PUSHA
instruction, causing the same data to return to the same
registers
5
2/26/2024
PUSHF
• Pushes flag register on to the stack; First the upper byte and
then the lower byte is pushed on to it. The SP (stack pointer )
is decremented by 2 for each PUSH operation.
PUSHF 10011100
POPF
POPF 10010000
6
2/26/2024
End of Lecture 16
2/26/2024 35