1.进位标志操作指令
2.获取状态标志操作指令(LAHF)
3.设置状态标志操作指令(SAHF)
示例:
#include<stdio.h>
int main() {
unsigned char flag0,flag1, flag2, flag3;
_asm {
mov ah, 0
mov flag0, ah
;
sahf; SF = 0, ZF = 0, PF = 0, AF = 0, CF = 0
;
//eflags 00X0 X0X0低8位保留位第一位为1,其余为0,即00X0 X010,0000 0010
//flag0 0x02h
lahf
mov flag1, ah
;
mov dx, 7799h
add dl, dh
//dx=7710h,
lahf
mov flag2, ah
//flag2=0x13h
;
sub dh,84h
//dx=F310h SF=1 ZF=0 X=0 AF=0 X=0 PF=1 X=1 CF=1
clc
//CF=0
lahf
mov flag3,ah
//flag3=86h
}
printf("flag0=%02xh\n",flag0);
printf("flag1=%02xh\n",flag1);
printf("flag2=%02xh\n",flag2);
printf("flag3=%02xh\n",flag3);
return 0;
}