<<< PUSHAD Push All 32-Bit GP Registers (386+)     Index     PUSHFD Push 32-Bit EFlags onto Stack (386+) >>>


PUSHF Push 16-Bit Flags onto Stack

Flags affected:

        O D I T S Z A P C  OF: Overflow flag  TF: Trap flag AF: Aux carry
        F F F F F F F F F  DF: Direction flag SF: Sign flag PF: Parity flag
            <none>         IF: Interrupt flag ZF: Zero flag CF: Carry flag

Legal forms:

        PUSHF <none>

Examples:

        PUSHF

Notes:

PUSHF simply pushes the current contents of the Flags register onto the top of the stack. The top of the stack is defined as the word at SS:SP, and there is no way to override that with prefixes.

SP is decremented before the word goes onto the stack. Remember that SP always points to either an empty stack or else real data. There is a separate pair of instructions, PUSH and POP, for pushing and popping other register data and memory data.

The Flags register is not affected when you push the flags, but only when you pop them back with POPF.

PUSHF and POPF are most used in writing interrupt service routines, where you must be able to save and restore the environment, that is, all machine registers, to avoid disrupting machine operations while servicing the interrupt.

        r8 = AL AH BL BH CL CH DL DH        r16 = AX BX CX DX BP SP SI DI
        sr = CS DS SS ES FS GS              r32 = EAX EBX ECX EDX EBP ESP ESI EDI
        m8 = 8-bit memory data              m16 = 16-bit memory data
        m32 = 32-bit memory data            i8 = 8-bit immediate data
        i16 = 16-bit immediate data         i32 = 32-bit immediate data
        d8 = 8-bit signed displacement      d16 = 16-bit signed displacement
        d32 = 32-bit unsigned displacement


<<< PUSHAD Push All 32-Bit GP Registers (386+)     Index     PUSHFD Push 32-Bit EFlags onto Stack (386+) >>>