Slide 10.2: The runtime stack
Slide 10.4: Other push and pop instructions
Home

PUSH and POP Instructions


The PUSH instruction first decrements ESP and then copies either a 16- or 32- bit source operand into the stack. A 16-bit operand causes ESP to be decremented by 2. A 32-bit operand causes ESP to be decremented by 4.

PUSH — Push Word(s) onto Stack

Usage: PUSH src

Flag O D I S Z A P C
Result                

Decrements ESP by the size of the operand (two or four, byte values are sign extended) and transfers one or two words from source to the stack top.
Clocks
Operands 286 386 486 Size Bytes
reg16 3 2 1 1
reg32   2 1 1
mem16 5 5 4 2-4
mem32   5 4 2-4
segreg 3 2 3 1
immed 3 2 1 2-3

The POP instruction removes a value from the stack and places it in a register or variable. After the value is popped from the stack, the stack pointer is incremented to point to the next-highest location in the stack.

POP — Push Word(s) off Stack

Usage: POP dest

Flag O D I S Z A P C
Result                

Transfers word(s) at the current stack top pointed by ESP to the destination then increments ESP to point to the new stack top.
Clocks
Operands 286 386 486 Size Bytes
reg16 5 4 4 1
reg32     4 1
mem16 5 5 6 2-4
mem32     6 2-4
segreg 5 7 3 1