The microprocessor contains several registers (its blocks of memory cells that forms ultrafast memory). One of them is the flag register. It shows the current state of the microprocessor.
For example:
1) Carry flag (CF):
-it shows an availability of the carry during addition of binary numbers
10011+11001=101100: if 1+1 then CF=1, if 1+0 or 0+1 or 0+0 then CF=0.
2) Zero Flag (ZF):
-it shows the result of the previous command
0+0=0 => ZF=1
0+1=1 => ZF=0
3) Overflow flag (OF):
-it shows whether the result of the previous command is out of range
0 1101 + 0 0001 = 0 1110 (4-bit numbers) => OF=0
0 1101 + 0 1001 = 1 0110 (4-bit numbers) => OF=1
4) Sign Flag (SF):
-it shows the most significant bit of the result
0 1101 + 0 0001 = 0 1110 (4-bit numbers) => SF=0
0 1101 + 0 1001 = 1 0110 (4-bit numbers) => SF=1
5) Parity Flag (PF):
-it shows an even or odd number of units in the low byte.
0010 0110 (2 units) => PF=1
0001 0111 (3 units) => PF=0
Comments
Leave a comment