lahf
SF:ZF:xx:AF:xx:PF:xx:CF -> AH
Transfers the low byte of the flags word to the AH register. The bits (lsb to msb) are: sign, zero, indeterminate, auxiliary carry, indeterminate, parity, indeterminate, and carry.
Transfer the flags word into the AH register:
lahf
sahf
AH -> SF:ZF:xx:AF:xx:PF:xx:CF
Loads flags (sign, zero, indeterminate, auxiliary carry, indeterminate, parity, indeterminate, and carry) with values from the AH register.
Load values from the AH register into the flags word:
sahf
popf{wl}
stack -> flags register
Pops the word or long from the top of the stack and stores the value in the flags register. Stores a word in FLAGS; stores a long in EFLAGS.
Pops the word from the top of the stack and stores it in the flags register:
popfw
Pops the long from the top of the stack and stores it in the eflags register:
popfl
pushf{wl}
flags register -> stack
For a word, SP - 2 and copies FLAGS to the new top of stack pointed to by SP. For a long, SP - 4 and copies EFLAGS to the new top of stack pointed to by SS:eSP.
Pushes the flags register onto the top of the stack:
pushfw
Pushes the eflags register onto the top of the stack:
pushfl
cmc
not CF -> CF
Reverses the setting of the carry flag; affects no other flags.
Reverse the setting of the carry flag:
cmc
clc
0 -> CF
Sets the carry flag to zero; affects no other flags.
Clear the carry flag:
clc
stc
1 -> CF
Sets the carry flag to 1.
Set the carry flag:
stc
cli
0 -> IF
Clears the interrupt flag if the current privilege level is at least as privileged as IOPL; affects no other flags. External interrupts disabled at the end of the cli instruction or from that point on until the interrupt flag is set.
Clear the interrupt flag:
cli
sti
1 -> IF
Sets the interrupt flag to 1.
Set the interrupt flag:
sti
cld
0 -> DF
Clears the direction flag; affects no other flags or registers. Causes all subsequent string operations to increment the index registers, (E)SI and/or (E)DI, used during the operation.
Clear the direction flag:
cld
std
1 -> DF
Sets the direction flag to 1, causing all subsequent string operations to decrement the index registers, (E)SI and/or (E)DI, used during the operation.
Set the direction flag:
std