×

Flag Register of 8086 Microprocessor

In this article, we are going to study about the one of the registers named flag registers of 8086 microprocessor. We are also going to know where and how to use the Flag register of 8086 microprocessor.

What is Flag Register?

Flag register is one of the special purpose registers. The Flag Register is a 16-bit register and there are only 9 accessible flags on the 8086 microprocessors. Therefore the remaining 7 bits are idle.

With the inclusion of an overflow flag, the condition code flag register is identical to the 8085-flagregister. The flag register's uppermost byte is the control flag register.

It has three flags:

  1. The direction (D) flag
  2. The interrupt (I) flag
  3. The trap flag (T).

Out of the total of 16, there are 9 active flags. The final seven flags with the letter "U" are undefined flags.

There are total of 9 active flags, and they are further divided into two parts namely status flags and control flags. Now, we are going to study briefly about each status flags.

Carry flag

It is set anytime a result's MSB (most significant bit) is carried or borrowed out. For an 8-bit operation, use D7, and for a 16-bit operation, use D15.The result in the ALU will be a maximum of 9 or 17 bits when the microprocessor conducts the addition of two 8- or 16-bit values. Direct copying of the most recent carry created into the carry flag. Similar results are obtained when the microprocessor subtracts (x - y) from two 8-bit or 16-bit values.

The additional borrowing needed to execute subtraction is zero if x y, hence CF = 0.

Additional borrowing is necessary if x y. The result of the subtraction (x - y) will be a negative number represented using the 2's complement method because CF = 1.

Parity flag

Only the 8 LSBs (least significant bits) of the 8 or 16-bit result are stored in the parity flag when the microprocessor executes an arithmetic or logical operation in the ALU.

Auxiliary Carry flag

This flag is used to signify a decimal number in binary code but is inaccessible to programmers.

Zero flag

When the microprocessor's ALU completes an arithmetic or logical operation and all 8 or 16 LSBs of the result are zero, ZF = 1. If the ALU's 8-bit or 16-bit result is not zero, ZF = 0. Additionally, whenever a certain register becomes zero as a result of an action, this flag is set.

Sign flag

When an 8-bit number is subjected to an arithmetic or logical operation by the CPU, the result's MSB (D7 bit) is immediately copied into the sign flag. Like this, the MSBs of the result (D15 bit) are directly duplicated into the sign flag when the CPU executes an arithmetic or logical operation on a 16-bit number. The outcome will be negative if the sign flag is set, while the outcome will be positive otherwise.

Overflow flag

If the result of an arithmetic operation on signed binary numbers performed by the CPU falls inside the range, then OF = 0. OF = 1 if the signed result is out of bounds. The 8-bit signed number range is from +7F to -80H, and the 16-bit signed number range is from +7FFF to -8000H.

Now, let’s discuss about another category that is control flags.

Control flags

Following are the three control flags:

  • Interrupt flag
  • Direction flag
  • Trap flag

Interrupt flag

The hardware interrupt pin INTR can be enabled or disabled using the interrupt flag. When the interrupt flag is set to zero with the CLI (Clear interrupt flag) instruction, the INTR interrupt is disabled.

Direction flag

A block or chain of data is handled by string instructions, and a block of bytes or words is moved from one point in memory to another using the MOV SB/MOV SW instruction

Trap flag

The microprocessor will perform the entire program in one operation, known as a free-running operation if the trap flag is set to zero. The microprocessor will run the program in single-stepping mode if the trap flag is set to one. When debugging software, faults in the program are found using the single-stepping mode.


Related Topics

Microprocessor classification

Introduction: Microprocessor is known as the computer processor. The IC or integrated Circuit makes the microprocessor. that is the brain of the computer machine. The microprocessor is known as the...

6 minutes read.

8085 Pin Configuration

Introduction: Intel 8085 is consist 40 pin IC. The pin name of 8085 is A8 – A15; AD0 – AD7; ALE; IO/M; S0, S1; RD; WR; READY; HOLD; HLDA; INTR; INTA;...

6 minutes read.

BCD to 7 Segment Decoder

What is BCD? BCD is called Binary Coded Decimal. As you know there are a lot of forms in which we can represent the number like Binary, decimal, hexadecimal, and octal...

3 minutes read.

Local Broadcast Address and loopback address

In computer networking, if you send the data from one source to another source or group of sources in the form of packets, then this is called casting. We can categorize...

3 minutes read.

Computer Organization and Architecture Tutorial

Introduction to Computer Organization and Architecture In this modern era, or we can say computer era, Technology from all around surrounds us. Human is conserved, connected and absorbed by Technology. From...

4 minutes read.

Instruction Pipelining and Pipeline Hazards

Instruction Pipelining and Pipeline Hazards To apply pipeline, the prerequisite is to perform the same processing over multiple inputs, then pipelining is important. So instruction execution is the best example for...

10 minutes read.

CPU Registers

CPU Registers Within the CPU, we have small- small storage units called registers. If we are executing a certain program within the CPU, there's a need to store that program content,...

11 minutes read.

Ethernet Frame Format

What is Ethernet? As we know in computer networking, LAN (Local Area Network) is used to connect devices in limited geographical areas like schools or a building.LAN uses different topologies (arrangement...

3 minutes read.

Pipelining: Computer Organization and Architecture

Introduction to Pipelining Before learning pipeline, we have to understand about the Parallel processing. Parallel processing is the processing of data simultaneously. There are three techniques of parallel processing. Types of Processing: Vector ProcessingArray...

7 minutes read.

Types of Microprocessors

Introduction:Microprocessor is known as the computer processor. The IC or integrated Circuit makes the microprocessor. That is the brain of the computer machine.  The microprocessor is the Processor or CPU (Central...

3 minutes read.

8085 instructions set

Introduction: In the computer, the user sends the data. The computer can use data and it also process the data. After the processing, send the result to the user. The specific...

10 minutes read.

Data Path, ALU and Control Unit

Data Path, ALU(Arithmetic Logic Unit) and Control Unit What is the Data path? Suppose any data processing operation should be performed in the CPU like transferring the content of register from one...

5 minutes read.

8086 Microprocessor Pin Configurations

8086 microprocessor is invented and developed by Intel in 1976. The 8086 Microprocessor is an enhanced version of the 8085 Microprocessor. There are 20 address lines and 16 data lines...

6 minutes read.

CarryLook Ahead Adder

What is Adder? Adder is the combinational circuit that is used to add the bits in digital electronics. As we know, in the digital system, every number is represented in the...

4 minutes read.

74138 IC DECODER

74138 DECODER Decoder A combinational circuit called a decoder can have up to 2n output lines and 'n' input lines. When a decoder is enabled, depending on the mix of inputs,...

4 minutes read.

Data Transfer and Manipulation

What is Data Transfer? In computer architecture, data transfer refers to the movement of data between different components within a computer system. These components can include the central processing unit (CPU),...

6 minutes read.

Machine Instructions

What is a Digital Computer? A computer that takes input in a binary form and produces output in binary form. The question arises of what kind of input the computer takes...

4 minutes read.

Control Signals in 8155 Microprocessor

Intel designed the chip 8155 used to interface with I/O devices. Basically, the 8085 microprocessor is directly unable to deal with its peripheral input output devices for reading data or...

3 minutes read.

Convert a number from base 2 to base 6

Base 2 Base 2 is the format where you can represent any number with just two values which are 0 and 1. With the help of 0s and 1s, we can...

4 minutes read.

Digital Number System

Digital Number System: The computer understands digital language only. Many number systems are used in digital technology. The most common are Decimal, Binary, Octal and Hexadecimal number systems. Types of the...

7 minutes read.