Reputation: 421
Consider the following code:
.586
.model flat,stdcall
.data
.code
main PROC
mov ax,0
push ax
popf
mov bx,7FFFh
add bx,1 //the value of bx is 8000h, but the parity flay is 1,why?
Ret
main endp
END main
Upvotes: 1
Views: 615
Reputation: 64903
The parity flag is only affected by the lowest byte of the result. So for the calculation of the parity, your value was zero.
If you want to know the parity of a wider value, you can xor the two halves of it together until you have an 8-bit result, after that final xor the parity flag will reflect the parity of the entire original value.
For example in this case, you could do:
xor al, ah
And then the parity flag will reflect the parity of ax
.
Upvotes: 3
Reputation: 706
Į suppose first digit is still considered as sign būt, therefor it's ignored. I suppose overflow flag is also set, that would make this presumption correct.
Upvotes: -2