FLAG TRANSFER INSTRUCTIONS
- LAHF Instruction – Load Register AH From Flags
LAHF instruction copies the value of SF, ZF, AF, PF, and CF, into bits of 7, 6, 4, 2, 0 respectively of AH register. This LAHF instruction was provided to make conversion of assembly language programs written for 8080 and 8085 to 8086 easier.
SAHF instruction – Store AH Register into FLAGS
SAHF instruction transfers the bits 0-7 of AH of SF, ZF, AF, PF, and CF, into the Flag register.
- PUSHF Instruction – Push flag register on the stack
This instruction decrements the SP by 2 and copies the word in flag register to the memory location pointed to by SP.
POPF Instruction – Pop word from top of stack to flag – register.
This instruction copies a word from the two memory location at the top of the stack to flag register and increments the stack pointer by 2.