A weird flag register flag register

note:

mov, push, pop and other transfer instructions, the execution result has no effect on the flag register!

ZF flag: if the result is 0 , ZF is 1; if it is not 0, ZF is 0; (zero flag)

PF sign: if the number of 1 is even, pf=1; if it is odd, then pf=0;

SF flag: if the result is negative , SF is 1; if the result is non-negative, SF is 0

CF flag: It is a flag bit that is meaningful for unsigned number operations [see if there is a carry]

OF flag: a flag bit that is meaningful for signed number operations [see if there is overflow]

Monitoring point 11.1:

sub al, al al = 0h ZF = 1 PF = 1 SF = 0        

al is 0h, the result is 0, so ZF is 1 for true, there are 0 even numbers, so PF is 1, and the result is non-negative, so SF is 0. When we calculate the data as an unsigned number, the value of the SF bit has no meaning.

mov al,1 al=1h ZF=1 PF=1 SF=0       

 mov means that the transfer instruction has no effect on the flag register, and the flag register does not change.

push ax ax=1h ZF=1 PF=1 SF=0      

Push means that the transfer instruction has no effect on the flag register, and the flag register does not change.

pop bx bx=1h ZF=1 PF=1 SF=0      

pop means that the transfer instruction has no effect on the flag register, and the flag register does not change.

add al,bl al=2h ZF=0 PF=0 SF=0      

The binary value of 2h is 0010, the result is not 0, ZF is 0, and the odd number is 1, PF is 0, SF is 0

add al,10 al=12h ZF=0 PF=1 SF=0    

 The binary value of 12h is 10010. This is an 8-bit register so the value is 0010. If the result is not 0, ZF is 0, and even number 1 is PF 1, and SF is 0.

mul al ax=144h ZF=0 PF=1 SF=0    

 The binary value of 144h is 101000100. This is a 16-bit register, so the value is 01000100. If the result is 0, ZF is 0, and even number 1 is PF 1, and SF is 0.

Monitoring point 11.2

Guess you like

Origin blog.csdn.net/weixin_42859280/article/details/108153563