
Instruction Set
4-209
SAHF
Store AH in Flags
SAHF
What It Does
SAHF copies AH to the low byte of the Processor Status Flags (FLAGS) register.
Syntax
Description
SAHF loads the SF, ZF, AF, PF, and CF bits in the FLAGS register with values from the
AH register, from bits 7, 6, 4, 2, and 0, respectively.
Operation It Performs
Flag Settings After Instruction
Examples
This example sets the Carry Flag (CF) to 1. Normally, you use STC to perform this operation.
Form
Opcode
Description
Clocks
Am186 Am188
SAHF
9E
Store AH in low byte of the Processor Status Flags register
3
3
SAHF
/* copy AH to low byte of FLAGS */
FLAGS = FLAGS | (0x00FF & (AH & 0xD5));
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
AF=value in bit 4 of AH register
PF=value in bit 2 of AH register
CF=value in bit 0 of AH register
–
–
–
–
res
res
res
SF=value in bit 7 of AH register
ZF=value in bit 6 of AH register
; set CF to 1
LAHF
; copy low byte of FLAGS to AH
OR
AH,00000001b
; set bit 0 (CF) to 1
SAHF
; copy AH to low byte of FLAGS
4
Содержание Am186 Series
Страница 1: ...Am186 and Am188 Family Instruction Set Manual February 1997...
Страница 10: ...Table of Contents x...
Страница 18: ...Programming 1 8...
Страница 40: ...Instruction Set Listing 3 14...