Lecture-07: Flag Register of 8086 (MPU)

Flag Register of 8086


15

14

13

12

11

10

9

8

7

6

5

4

3

2

1

0

X

X

X

X

OF

DF

IF

TF

SF

ZF

X

AF

X

PF

X

CF



Full meaning of Register:

1.      CF             Carry Flag Register.

2.      PF              Parity Flag Register.

3.      AF             Auxiliary Carry Flag Register.

4.      ZF             Zero Flag Register.

5.      SF              Sign Flag Register.

6.      TF             Trap Flag Register.

7.      IF               Interrupt Flag Register.

8.      DF             Directional Flag Register.

9.     OF             Overflow Flag Register.


Carry Flag Register: The flag is set whenever there is a carry out either from D7 after an 8-bit operation or from D15 after an 16-bit data operation.

            1: When the D7 or D15 bit carry out.

            0: When the D7 or D15 bit does not carry out.

Parity Flag Register: After certain operation, the parity of the results low-order byte is checked. If the byte has an even number of 1’s the parity flag is set to 1; otherwise, it is cleared (set to 0).

            1: Even number of 1’s.

            0: Odd number of 1’s.

Auxiliary Flag Register: If there is a carry from D3 to D4 of an operation this bit is set to 1; otherwise set to 0 (cleared).

Zero Flag Register: The ZF is set to 1, if the result of the arithmetic or logical operation is zero; otherwise it is set to 0 (cleared).

Sign Flag Register: MSB is used as the sign bit of the binary representation of the signed numbers. After arithmetic or logical operation, the MSB is copied into SF to indicate the sign of the result.

Trap Flag Register: When the flag is set, it allows the program to single step meaning to execute one instruction at a time. Used for debugging purpose.

System use it when debugging is required.

1: When single step mode (debugging is needed)

0: When single stepmode (debugging) is not needed.

Interrupt Flag register: This bit is set on cleared to enable or disable only the external interrupt request.

1: When interrupt is called.

0: When interrupt is not called.

Directional Flag Register: This bit is used to control the direction of the string operations.

1: Strings automatically decrements the address.

0: Strings automatically does not decrement the address.

Overflow Flag Register: This flag is set whenever the result of a signed number operation is too large, causing the high order bit to overflow into the sign bit.

1: When result is too big to fit in the destination.

0: When result is not too big to fit in the destination.

Example: 




Example: Consider A =  10011011 and B = 01010101 added together in from  C  = A  + B find out The value of C and show the status of carry flag, Auxiliary Flag, Parity Flag, Zero Flag, Sign Flag, Overflow Flag.

Solution:

   




Post a Comment

0 Comments