Moving_Flags ..
See the Flags Register in Flags_and_Jcc. See how Conditional Jumps are affected by the Flags in Jumping.
The main Flags management is done by the processor itself when running Instructions. You can't modify the Flags Register directly. For this you have to use two instructions: Pushf / Popf
pushf
pop eax
or eax, 1 ; set ZF on
push eax
popf ; Done.
Two other instructions are available for Flags management: Lahf / Sahf. Do not use them. They will no longer be available under 64 bits processors.
Another regular way for modifying the Flags states is to use these instructions:
stc - sets carry flag
clc - clears carry flag
cmc - complements (reverses) carry flag
std - sets direction flag (to ''down'')
cld - clears direction flag - direction flag should *always* be returned to it's
''up'' (cleared) condition if you've set it ''down''!!!
sti - sets interrupt flag
cli - clears interrupt flag
The more common way for working with the Flags is to use the Conditional Jumps instructions. See Jumping.
~~~~~~~