Zero flag

Source: Wikipedia, the free encyclopedia.

The zero flag is a single bit flag that is a central feature on most conventional

flag register
, along with other flags. The zero flag is typically abbreviated Z or ZF or similar in most documentation and assembly languages.

Along with a

compare instruction
as a subtract where the result is discarded. It is also common that processors have a bitwise AND-instruction that does not store the result.

The logical formula of the zero flag for a twos-complement binary operand is NOT(OR(all bits of the operand in question)).

In most processors, the zero flag is mainly used in conditional branch instructions, which alter control flow on previous instruction results, but there are often other uses as well.

In some instruction sets such as the MIPS architecture, a dedicated flag register is not used; jump instructions instead check a register for zero.