SlideShare a Scribd company logo
University of Asia Pacific
6/22/2014
1
What is FLAGS Register??
 The FLAGS register is the status register in Intel
x86 microprocessors that contains the current
state of the processor. This register is 16 bits wide.
Its successors, the EFLAGS and RFLAGS
registers, are 32 bits and 64 bits wide,
respectively. The wider registers retain
compatibility with their smaller predecessors. We
are going to discuss about the FLAGS registers
here.
6/22/2014 2
Category of FLAGS
Registers
There are 2 types of FLAGS register.
• Status Flags
• Control Flags
This register is 16 bits wide. The Status Flags are
located in 0, 2, 4, 6, 7 and 11 bits. Control Flags
are located in 8, 9 and 10 Bits and the System
Flags are located in 12,13 and 14 bits and others
left bits are reserved bits.
6/22/2014 3
Status Flags
There are 6 status flags in 8086 processor.
• Carry Flag
• Parity Flag
• Adjust Flag
• Zero Flag
• Sign Flag
• Overflow Flag
6/22/2014 4
Carry Flag
In 8086 processors the carry flag (usually
indicated as the C flag) is a single bit in a system
status (flag) register used to indicate when an
arithmetic carry or borrow has been generated
out of the most significant ALU bit position. The
carry flag enables numbers larger than a single
ALU width to be added/subtracted by carrying
(adding) a binary digit from a partial
addition/subtraction to the least significant bit
position of a more significant word. It is located in
the 0 bits if a 8086 processor
6/22/2014 5
Parity Flag
In 8086 processors the parity flag indicates if
the number of set bits is odd or even in the
binary representation of the result of the last
operation. It is normally a single bit(2) in a
processor status register. For example,
assume a machine where a set parity flag
indicates even parity. If the result of the last
operation were 26 (11010 in binary), the parity
flag would be 0 since the number of set bits is
odd. Similarly, if the result were 102 (1100110
in binary) then the parity flag would be 1.
6/22/2014 6
Adjust Flag
 The Adjust flag (also known as the Auxiliary
flag) is a flag stored in the FLAGS register on
all 8086 processors. It is bit 4. It is used to
indicate when an arithmetic carry or borrow
has been generated out of the 4 least
significant bits. It is primarily used in BCD
arithmetics.
 Auxiliary flag is set (AF=1) if there is a carry
from low nibble to high nibble or a borrow from
a high nibble to low nibble of the low order 8-
bit of a 16-bit number.(for example, in BCD
addition or subtraction.)
6/22/2014 7
Zero Flag
The Zero Flag is a single bit flag located in 6 bit of a
8086 processor. The zero flag is used to check the
result of an arithmetic operation, including bitwise
logical instructions. It is set if an arithmetic result is
zero, and reset otherwise. This includes results which
are not stored, as most traditional instruction sets
implement the compare instruction as a subtract
where the result is discarded. It is also common that
processors have a bitwise AND-instruction that does
not store the result.
In most processors, the zero flag is mainly used in
conditional branch instructions, which alter control
flow on previous instruction results, but there are often
other uses as well.
6/22/2014 8
Sign Flag
In a 8086 processor the sign flag or
negative flag is a single bit in a system status
(flag) register used to indicate whether the
result of the last mathematical operation
resulted in a value whose most significant bit
was set. In a two's complement interpretation
of the result, the negative flag is set if the
result was negative.
For example, in an 8-bit signed number
system, -37 will be represented as 1101 1011
in binary (the most significant bit is 1), while
+37 will be represented as 0010 0101 (the
most significant bit is 0).
6/22/2014 9
Overflow flag
In 8086 processors, the overflow flag
(sometimes called V flag) is usually a single bit in
a system status register used to indicate when an
arithmetic overflow has occurred in an operation,
indicating that the signed two's-complement result
would not fit in the number of bits used for the
operation (the ALU width). Some architectures
may be configured to automatically generate an
exception on an operation resulting in overflow.
6/22/2014 10
Control Flags
There are 3 Control flags in 8086
processor.
• Trap Flag
• Interrupt Enable Flag
• Direction Flag
6/22/2014 11
Trap flag
A trap flag permits operation of a processor in
single-step mode. If such a flag is available,
debuggers can use it to step through the execution
of a computer program. The 8086 has no
instruction to directly set or reset the trap flag.
These operations are done by pushing the flag
register on the stack, changing the trap flag bit to
what the programmer wants it to be, and then
popping the flag register back off the stack.
6/22/2014 12
Interrupt flag
 Interrupt Flag is a system flag bit in the 8086
processor’s FLAGS register, which determines
whether or not the CPU will handle maskable
hardware interrupts.
 The bit, which is bit 9 of the FLAGS register,
may be set or cleared by programs with
sufficient privileges, as usually determined by
the Operating System. If the flag is set to 1,
maskable hardware interrupts will be handled.
If cleared (set to 0), such interrupts will be
ignored. IF does not affect the handling of non-
maskable interrupts or software interrupts
generated by the INT instruction.
6/22/2014 13
Direction flag
 The direction flag is a flag that controls the left-to-
right or right-to-left direction of string processing,
stored in the FLAGS register on all 8086
processors. It is bit number 10.
 When it is set to 0 (using the clear-direction-flag
instruction CLD),it means that instructions that
auto increment the source index and destination
index (like MOVS) will increase both of them. In
case it is set to 1 (using the set-direction-flag
instruction STD), the instruction will decrease
them.
 This flag is used to determine the direction
(forward or backward) in which several bytes of
data will be copied from one place in the memory,6/22/2014 14
THE END
6/22/2014 15

More Related Content

PPTX
System verilog assertions
DOC
8086 class notes-Y.N.M
PPTX
Lecture #3 Flag Register.pptx
PPTX
Flags registers
PPTX
Bcd arithmetic instructions
PPTX
X86 Architecture
PPTX
Intel x86 and ARM Data types
PPTX
Interrupts
System verilog assertions
8086 class notes-Y.N.M
Lecture #3 Flag Register.pptx
Flags registers
Bcd arithmetic instructions
X86 Architecture
Intel x86 and ARM Data types
Interrupts

What's hot (20)

PPTX
Microprocessor - Intel Pentium Series
PPTX
Multiplication & division instructions microprocessor 8086
PPTX
8086 architecture By Er. Swapnil Kaware
PPT
8086 assembly language
PPT
Memory Organization
PPT
Microprocessor 80386
PDF
Memory segmentation-of-8086
PPT
80286 microprocessor
PDF
Pentium microprocessor
PPTX
AMBA Ahb 2.0
PPTX
PROCEDURAL AND DECLARATIVE KNOWLEDGE IN AI & ML (1).pptx
PPTX
DMA operation
ODP
axi protocol
PPT
PPTX
Memory organization
PPTX
System verilog coverage
PPTX
Computer architecture data representation
PPTX
Basic Computer Organization and Design
PPTX
Register transfer and micro operation
PPTX
AMBA 5 COHERENT HUB INTERFACE.pptx
Microprocessor - Intel Pentium Series
Multiplication & division instructions microprocessor 8086
8086 architecture By Er. Swapnil Kaware
8086 assembly language
Memory Organization
Microprocessor 80386
Memory segmentation-of-8086
80286 microprocessor
Pentium microprocessor
AMBA Ahb 2.0
PROCEDURAL AND DECLARATIVE KNOWLEDGE IN AI & ML (1).pptx
DMA operation
axi protocol
Memory organization
System verilog coverage
Computer architecture data representation
Basic Computer Organization and Design
Register transfer and micro operation
AMBA 5 COHERENT HUB INTERFACE.pptx
Ad

Viewers also liked (6)

PPTX
Operand and Opcode | Computer Science
PPTX
Flag registers, addressing modes, instruction set
PPTX
Memory Segmentation of 8086
PPTX
Serial data transfer
PPTX
PDF
Serial Communication Interfaces
Operand and Opcode | Computer Science
Flag registers, addressing modes, instruction set
Memory Segmentation of 8086
Serial data transfer
Serial Communication Interfaces
Ad

Similar to Flags registor of 8086 processor (20)

PPTX
Flagsregistor
PPTX
flag register of 8086
PPTX
Register Organisation of 8086 Microprocessor
PPTX
Microprocessor- Flaf registor
DOCX
Intel Microprocessors 8086 Documentation
PDF
microprocessor_part_3_compressed_1588259301.pdf
PPTX
PPTX
Register Organisation of 8086 Microprocessor
PDF
8086 microprocessor
PDF
chapter 2 8086 architecture L11_2024.pdf
DOCX
digital communication,micro processor,pulse and digital circuits
PPTX
Microprocessor 8086
DOC
3 organization of intel 8086
PPTX
1.Registers.pptx tjrktjgktjghththyjytjytjyy
PPTX
Register & flags
PPSX
8086 microprocessor
DOCX
c++
PPT
12973 block diagram of 8085
PPT
Advanced micro -processor
PDF
unit-2-co-all-ppt_2-umbers – Integer/floating point
Flagsregistor
flag register of 8086
Register Organisation of 8086 Microprocessor
Microprocessor- Flaf registor
Intel Microprocessors 8086 Documentation
microprocessor_part_3_compressed_1588259301.pdf
Register Organisation of 8086 Microprocessor
8086 microprocessor
chapter 2 8086 architecture L11_2024.pdf
digital communication,micro processor,pulse and digital circuits
Microprocessor 8086
3 organization of intel 8086
1.Registers.pptx tjrktjgktjghththyjytjytjyy
Register & flags
8086 microprocessor
c++
12973 block diagram of 8085
Advanced micro -processor
unit-2-co-all-ppt_2-umbers – Integer/floating point

Recently uploaded (20)

PPTX
Construction Project Organization Group 2.pptx
PPT
Total quality management ppt for engineering students
PDF
BMEC211 - INTRODUCTION TO MECHATRONICS-1.pdf
PDF
Mohammad Mahdi Farshadian CV - Prospective PhD Student 2026
PPTX
Internet of Things (IOT) - A guide to understanding
PPTX
Artificial Intelligence
PPTX
6ME3A-Unit-II-Sensors and Actuators_Handouts.pptx
PPTX
FINAL REVIEW FOR COPD DIANOSIS FOR PULMONARY DISEASE.pptx
PPTX
CYBER-CRIMES AND SECURITY A guide to understanding
PPT
introduction to datamining and warehousing
PPTX
MET 305 2019 SCHEME MODULE 2 COMPLETE.pptx
PPT
Project quality management in manufacturing
PPTX
M Tech Sem 1 Civil Engineering Environmental Sciences.pptx
PDF
BIO-INSPIRED HORMONAL MODULATION AND ADAPTIVE ORCHESTRATION IN S-AI-GPT
PDF
PPT on Performance Review to get promotions
PDF
Categorization of Factors Affecting Classification Algorithms Selection
PPTX
additive manufacturing of ss316l using mig welding
PDF
Well-logging-methods_new................
PDF
Embodied AI: Ushering in the Next Era of Intelligent Systems
PPTX
Current and future trends in Computer Vision.pptx
Construction Project Organization Group 2.pptx
Total quality management ppt for engineering students
BMEC211 - INTRODUCTION TO MECHATRONICS-1.pdf
Mohammad Mahdi Farshadian CV - Prospective PhD Student 2026
Internet of Things (IOT) - A guide to understanding
Artificial Intelligence
6ME3A-Unit-II-Sensors and Actuators_Handouts.pptx
FINAL REVIEW FOR COPD DIANOSIS FOR PULMONARY DISEASE.pptx
CYBER-CRIMES AND SECURITY A guide to understanding
introduction to datamining and warehousing
MET 305 2019 SCHEME MODULE 2 COMPLETE.pptx
Project quality management in manufacturing
M Tech Sem 1 Civil Engineering Environmental Sciences.pptx
BIO-INSPIRED HORMONAL MODULATION AND ADAPTIVE ORCHESTRATION IN S-AI-GPT
PPT on Performance Review to get promotions
Categorization of Factors Affecting Classification Algorithms Selection
additive manufacturing of ss316l using mig welding
Well-logging-methods_new................
Embodied AI: Ushering in the Next Era of Intelligent Systems
Current and future trends in Computer Vision.pptx

Flags registor of 8086 processor

  • 1. University of Asia Pacific 6/22/2014 1
  • 2. What is FLAGS Register??  The FLAGS register is the status register in Intel x86 microprocessors that contains the current state of the processor. This register is 16 bits wide. Its successors, the EFLAGS and RFLAGS registers, are 32 bits and 64 bits wide, respectively. The wider registers retain compatibility with their smaller predecessors. We are going to discuss about the FLAGS registers here. 6/22/2014 2
  • 3. Category of FLAGS Registers There are 2 types of FLAGS register. • Status Flags • Control Flags This register is 16 bits wide. The Status Flags are located in 0, 2, 4, 6, 7 and 11 bits. Control Flags are located in 8, 9 and 10 Bits and the System Flags are located in 12,13 and 14 bits and others left bits are reserved bits. 6/22/2014 3
  • 4. Status Flags There are 6 status flags in 8086 processor. • Carry Flag • Parity Flag • Adjust Flag • Zero Flag • Sign Flag • Overflow Flag 6/22/2014 4
  • 5. Carry Flag In 8086 processors the carry flag (usually indicated as the C flag) is a single bit in a system status (flag) register used to indicate when an arithmetic carry or borrow has been generated out of the most significant ALU bit position. The carry flag enables numbers larger than a single ALU width to be added/subtracted by carrying (adding) a binary digit from a partial addition/subtraction to the least significant bit position of a more significant word. It is located in the 0 bits if a 8086 processor 6/22/2014 5
  • 6. Parity Flag In 8086 processors the parity flag indicates if the number of set bits is odd or even in the binary representation of the result of the last operation. It is normally a single bit(2) in a processor status register. For example, assume a machine where a set parity flag indicates even parity. If the result of the last operation were 26 (11010 in binary), the parity flag would be 0 since the number of set bits is odd. Similarly, if the result were 102 (1100110 in binary) then the parity flag would be 1. 6/22/2014 6
  • 7. Adjust Flag  The Adjust flag (also known as the Auxiliary flag) is a flag stored in the FLAGS register on all 8086 processors. It is bit 4. It is used to indicate when an arithmetic carry or borrow has been generated out of the 4 least significant bits. It is primarily used in BCD arithmetics.  Auxiliary flag is set (AF=1) if there is a carry from low nibble to high nibble or a borrow from a high nibble to low nibble of the low order 8- bit of a 16-bit number.(for example, in BCD addition or subtraction.) 6/22/2014 7
  • 8. Zero Flag The Zero Flag is a single bit flag located in 6 bit of a 8086 processor. The zero flag is used to check the result of an arithmetic operation, including bitwise logical instructions. It is set if an arithmetic result is zero, and reset otherwise. This includes results which are not stored, as most traditional instruction sets implement the compare instruction as a subtract where the result is discarded. It is also common that processors have a bitwise AND-instruction that does not store the result. In most processors, the zero flag is mainly used in conditional branch instructions, which alter control flow on previous instruction results, but there are often other uses as well. 6/22/2014 8
  • 9. Sign Flag In a 8086 processor the sign flag or negative flag is a single bit in a system status (flag) register used to indicate whether the result of the last mathematical operation resulted in a value whose most significant bit was set. In a two's complement interpretation of the result, the negative flag is set if the result was negative. For example, in an 8-bit signed number system, -37 will be represented as 1101 1011 in binary (the most significant bit is 1), while +37 will be represented as 0010 0101 (the most significant bit is 0). 6/22/2014 9
  • 10. Overflow flag In 8086 processors, the overflow flag (sometimes called V flag) is usually a single bit in a system status register used to indicate when an arithmetic overflow has occurred in an operation, indicating that the signed two's-complement result would not fit in the number of bits used for the operation (the ALU width). Some architectures may be configured to automatically generate an exception on an operation resulting in overflow. 6/22/2014 10
  • 11. Control Flags There are 3 Control flags in 8086 processor. • Trap Flag • Interrupt Enable Flag • Direction Flag 6/22/2014 11
  • 12. Trap flag A trap flag permits operation of a processor in single-step mode. If such a flag is available, debuggers can use it to step through the execution of a computer program. The 8086 has no instruction to directly set or reset the trap flag. These operations are done by pushing the flag register on the stack, changing the trap flag bit to what the programmer wants it to be, and then popping the flag register back off the stack. 6/22/2014 12
  • 13. Interrupt flag  Interrupt Flag is a system flag bit in the 8086 processor’s FLAGS register, which determines whether or not the CPU will handle maskable hardware interrupts.  The bit, which is bit 9 of the FLAGS register, may be set or cleared by programs with sufficient privileges, as usually determined by the Operating System. If the flag is set to 1, maskable hardware interrupts will be handled. If cleared (set to 0), such interrupts will be ignored. IF does not affect the handling of non- maskable interrupts or software interrupts generated by the INT instruction. 6/22/2014 13
  • 14. Direction flag  The direction flag is a flag that controls the left-to- right or right-to-left direction of string processing, stored in the FLAGS register on all 8086 processors. It is bit number 10.  When it is set to 0 (using the clear-direction-flag instruction CLD),it means that instructions that auto increment the source index and destination index (like MOVS) will increase both of them. In case it is set to 1 (using the set-direction-flag instruction STD), the instruction will decrease them.  This flag is used to determine the direction (forward or backward) in which several bytes of data will be copied from one place in the memory,6/22/2014 14