
Instruction Set
4-129
LAHF
Load AH with Flags
LAHF
What It Does
LAHF copies the low byte of the Processor Status Flags (FLAGS) register to AH.
S yntax
Desc ription
LAHF copies the Processor Status Flags (FLAGS) register to the AH register. After the
copy, the bits shadow the flags as follows:
n
AH bit 0 = Carry Flag
n
AH bit 2 = Parity Flag
n
AH bit 4 = Auxiliary Flag
n
AH bit 6 = Zero Flag
n
AH bit 7 = Sign Flag
Operation It Performs
Flag Settings After Instruc tion
Examples
This example clears the Carry Flag (CF) to 0. Normally, you use CLC to perform this
operation.
Form
Opcode
Description
Clocks
Am186 Am188
LAHF
9F
Load AH with low byte of Processor Status Flags register
2
2
LAHF
/* copy FLAGS to AH */
AH = FLAGS & 0x00FF;
15
14
13
12
11
10
9
8
7
6
5
4
3
2
1
0
Processor Status
Flags Register
reserved
OF DF
–
IF TF SF ZF
–
–
AF
PF
CF
= undefined; – = unchanged
–
–
– res – res – res –
; clear CF to 0
LAHF
AND
SAHF
; copy low byte of FLAGS to AH
; clear bit 0 (CF) to 0
; copy AH to low byte of FLAGS
AH,11111110b
4