×

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

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.

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.

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.

Fixed and Floating-Point Number

Fixed and Floating-Point Number: In digital technology, data is stored in memory registers with binary bits 0’s and 1’s because the computer only understands binary language. When we enter data...

6 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.

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.

Use Case Diagram for the online bank system

What is a Use Case Diagram? A tool is called a Use Case Diagram which is used to create, present, and comprehend the functional requirements for a system. The Use Case...

3 minutes read.

Advantages and Disadvantages of Flash Memory

What is Flash Memory? Electrically Erasable Programmable Read-Only Memory (EEPROM) and Erasable Programmable Read-Only Memory (EPROM) are used for flash memory (EEPROM). Although technically the word flash is used in the industry...

3 minutes read.

8085 Arithmetic Instructions

Arithmetic instructions are a type of instruction in a computer's instruction set that perform arithmetic operations on data. These operations can include addition, subtraction, multiplication, and division. Arithmetic instructions can...

4 minutes read.

Addressing Modes

Introduction: Addressing Modes An instruction consists of two parts opcode and operands. Opcode tells the operation going to perform, and operand information is the address of the operand. The CPU interprets...

8 minutes read.

IEEE Standard 754 Floating Point Numbers

Floating Point Representation: IEEE- 754 There were many problems in the conventional representation of floating-point notation like we could not express 0(zero), infinity number. To solve this, scientists have given a...

8 minutes read.

Micro-Operations

Micro-Operations If CPU wants to perform any operation, suppose execution of only one instruction or even break it down one particular execution phase (like fetch instruction, write back, decode, operand fetch...

9 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.

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.

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...

3 minutes read.

8255 Microprocessor Operating Modes

8255 microprocessor was invented by intel in the year 1980s. 8255 microprocessor is a general-purpose microprocessor that can be programmed. 8255 is mostly used as an interface between devices like...

3 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.

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.

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.

Bipartite Graph

A graph is said to be bipartite if and only if we can divide all the vertices of a graph into two sets such that these sets are mutually exclusive...

4 minutes read.