BASIC INSTRUCTION seT

3.1.2 Stack Manipulation Instructions

PUSH (Push) decrements the stack pointer (SP) by two and then transfers a word from the source operand to the top of stack indicated by SP. See figure 3-1. PUSH is often used to place parameters on the stack before calling a procedure; it is also the basic means of storing temporary variables on the stack. The PUSH instruction operates on memory operands, immediate operands (new with the 80286), and register operands (including segment registers).

Example: PUSH WORDOPRND. Transfers a 16-bit value from the memory word identified by the label WORDOPRND to the memory location which represents the current top of stack (byte transfers are not allowed).

PUSHA (Push All Registers) saves the contents of the eight general registers on the stack. See figure 3-2. This instruction simplifies procedure calls by reducing the number of instructions required to retain the contents of the general registers for use in a procedure. PUSHA is complemented by POPA (see below).

The processor pushes the general registers on the stack in the following order: AX, ex, DX, BX, the initial value of SP before AX was pushed, BP, sr, and Dr.

Example: PUSHA. Pushes onto the stack the contents of the eight general registers.

HIGH ADDRESS

SS LIMIT

OPERANDS FROM

PREVIOUS PUSH

INSTRUCTIONS

SP ALWAYS POINTS TO

OPERAND _ THE LAST WORD PUSHED ONTO THE STACK (TOS)

SS ALWAYS POINTS TO

LOWEST ADDRESS USED BY

THE STACK

LOW ADDRESS

1

i!

i

 

 

 

 

BEFORE

AFTER

 

 

PUSH OPERAND

PUSH OPERAND

 

PUSH decrements SP by 2 bytes and places the operand In the stack at the location to which SP points.

G3010B

Figure 3-1.PUSH

3-2

Page 58
Image 58
Intel 80287, 80286 manual Stack Manipulation Instructions, Push