Home > Blockchain >  Why doesn't bitwise NOT affect the ZF bit or any other FLAGS?
Why doesn't bitwise NOT affect the ZF bit or any other FLAGS?

Time:11-07

NOT on a register holding binary 11111111 will produce 00000000, but ZF will still have its old value, so it might not be 1 even though the output value is all zero.

XOR reg, -1 would do the same thing but will set FLAGS according to the result.

Why does bitwise NOT don't affect the ZF bit? Hope someone can explain why, or it was originally designed like this.

CodePudding user response:

Actually, we can let the designer of the 8086, Steve Morse, answer this himself. I hope he'll forgive me for quoting from his book, The 8086 Primer, which he has made available on his website (here):

One Boolean instruction, NOT, is missing from the list of Boolean instructions that affect the flags. NOT does not affect the flags. This was a result of an oversight (I goofed!) when the processor was being defined.

  • Related