Home » Embedded Systems

Types of registers in the 8086 Microprocessor

In this article, we are going to study the different types of flags of the flag register. We will first have a look at the bit representation of this flag register to know which flag is stored at which location, and then will discuss the functioning of each of the flags.
Submitted by Monika Sharma, on July 07, 2019

Flag Register is a 16-bit register, but there are only 9 flags available in the 8086 microprocessor. The rest 7 bits are hence left idle.

flag register 8086 microprocessor

There are two categories of flag register:

  1. Condition flags
  2. Control flags

1) Condition flags

The conditional flags are set or reset after any arithmetic or logical operation is performed on an 8 bit or 16-bit number. This category consists of the following 6 flags:

  1. Carry Flag (CF): The carry flag will be set only if a carry is generated from the MSB of the result after doing any operation in 8086 Microprocessor.
  2. Parity Flag (PF): Parity is related to the number of 1’s contained in the binary data. There exist two types of parity:
    • Even Parity: When the number of 1’s in the binary data are even.
    • Odd Parity: When the number of 1’s in the binary data are odd.

    For the flag, the PF is set if there exists an even parity in data after the execution of the instruction. Else the flag is reset.
  3. Auxiliary-Carry Flag (AF): This flag is set if there is a generation of carrying from a nibble, i.e. 4 bits of data.
  4. Zero Flag (ZF): If the result after performing the required operation (Arithmetic or Logical) on the instructions is zero, in that case, the zero flags are set to 1. Else, it remains reset.
  5. Sign Flag (SF): If the result after performing any arithmetic or logic operation in the given instruction is negative, then the sign flag is set to 1. Else, for a positive result, the sign flag remains reset.
  6. Overflow Flag (OF): This Flag will be set if the register gets overflowed with data after any arithmetic or logic operation. This happens in cases when the carry is getting in in MSB, but there is no space in the register to store the carried out bit.

2) Control flags

The control flags are used to navigate the microprocessor for certain operations. There are 3 types of control flags:

  1. Trap Flag (TF): This flag is used of we need single-step debugging in our code. If the TF is set, then the execution will be done step by step. Otherwise, the free-running operation will be done.
  2. Interrupt Flag (IF): This flag is used to enable the Interrupt. The microprocessor is capable of handling interrupts only if this flag is in the set mode. Otherwise, any interrupt raised while the execution of the instructions will not be handled by the microprocessor.
  3. Direction Flag (DF): This flag is used for string operations. If this flag is set, the string will be read from higher-order bits to lower order bits and vice versa.





Comments and Discussions

Ad: Are you a blogger? Join our Blogging forum.
Learn PCB Designing: PCB DESIGNING TUTORIAL




Languages: » C » C++ » C++ STL » Java » Data Structure » C#.Net » Android » Kotlin » SQL
Web Technologies: » PHP » Python » JavaScript » CSS » Ajax » Node.js » Web programming/HTML
Solved programs: » C » C++ » DS » Java » C#
Aptitude que. & ans.: » C » C++ » Java » DBMS
Interview que. & ans.: » C » Embedded C » Java » SEO » HR
CS Subjects: » CS Basics » O.S. » Networks » DBMS » Embedded Systems » Cloud Computing
» Machine learning » CS Organizations » Linux » DOS
More: » Articles » Puzzles » News/Updates


© https://www.includehelp.com some rights reserved.