<<< Indirect Access to Stack Values | Index | Saving General Purpose Registers on the Stack >>> |
Program can push and pop flags onto the stack with the PUSHF and POPF instructions.
These instructions save and then restore the status of the flags.
Program can also use PUSHF and POPF around procedure calls to preserve flag status of the caller.
The 32-bit versions of these instructions are PUSHFD and POPFD.
This example saves the flags register before calling the systask procedure:
pushfd call systask popfd
If you do not need to store the entire flags register, you can use the LAHF instruction to manually load and store the status of the lower byte of the flag register in the AH register. SAHF restores the value.
Operation of PUSHF
<<< Indirect Access to Stack Values | Index | Saving General Purpose Registers on the Stack >>> |