<<< POPA Pop All 16-Bit Registers (286+)     Index     POPFD Pop Top of Stack into EFlags (386+) >>>


POPF Pop Top of Stack into Flags

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
        * * * * * * * * *  IF: Interrupt flag ZF: Zero flag CF: Carry flag

Legal forms:

        POPF <none>

Examples:

        POPF

Notes:

POPF pops the 16-bit word at the top of the stack into the Flags register. 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 incremented by two after the word comes off 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.

PUSHF and POPF are most used in writing 16-bit 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


<<< POPA Pop All 16-Bit Registers (286+)     Index     POPFD Pop Top of Stack into EFlags (386+) >>>