SlideShare a Scribd company logo
Lab-06
Introduction to 8086 flags and addressing modes, and
control transfer instructions
2
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
OF DF IF TF SF ZF AF PF CF
Carry Flag
This flag is set, when there is a carry out
of MSB in case of addition or a borrow in
case of subtraction.
Parity Flag
This is even parity flag. When result has even
number of 1, it will be set to 1, otherwise 0 for
odd number of 1s
Auxiliary Carry Flag
This flag is set, when there is a carry out of low-
nibble in case of addition or a borrow in case of
subtraction
Zero Flag
This flag is set, if the result of the
computation or comparison performed by
an instruction is zero
Sign Flag
After any operation if the MSB is 1, then
it indicates that the number is negative.
And this flag is set to 1
Trap Flag
If this flag is set, the processor enters the
single step execution mode by generating
internal interrupts after the execution of
each instruction
Interrupt Flag
Causes the 8086 to recognize external mask
interrupts; clearing IF disables these interrupts.
Direction Flag
This is used by string manipulation instructions. If this flag bit is ‘0’, the string is
processed beginning from the lowest address to the highest address, i.e., auto
incrementing mode. Otherwise, the string is processed from the highest address
towards the lowest address, i.e., auto decrementing mode.
Over flow Flag
The overflow flag is set to 1 when the result of a signed operation is too large to fit.
Flag Register
3
Addressing Modes
8086 Microprocessor
Every instruction of a program has to operate on a data.
The different ways in which a source operand is denoted in an instruction are
known as addressing modes.
1. Register Addressing
2. Immediate Addressing
3. Direct Addressing
4. Register Indirect Addressing
5. Based Addressing
6. Indexed Addressing
7. Based Index Addressing
8. String Addressing
9. Direct I/O port Addressing
10. Indirect I/O port Addressing
11. Relative Addressing
12. Implied Addressing
4
6. Control Transfer Instructions
Instruction Set
8086 Microprocessor
Mnemonics Explanation
JC disp8 Jump if CF = 1
JNC disp8 Jump if CF = 0
JP disp8 Jump if PF = 1
JNP disp8 Jump if PF = 0
JO disp8 Jump if OF = 1
JNO disp8 Jump if OF = 0
JS disp8 Jump if SF = 1
JNS disp8 Jump if SF = 0
JZ disp8 Jump if result is zero, i.e, Z = 1
JNZ disp8 Jump if result is not zero, i.e, Z = 1
 8086 conditional branch instructions affecting individual flags
5
Checking Different Registers & Flags
Mnemonics Machine
Codes
AX BX CX DX Set Flags
MOV AX, 805EH B8, 5E, 80
MOV DX, 0540H BA, 40, 05
MOV CL, 02H B1, 02
MOV CH, 91H B5, 91
ADD AX, DX 03, C2
MOV BX, 0050H BB, 50, 00
SUB AX, BX 2B, C3
INC DL FE, C2
DEC BX 4B
XCHG CX, BX 87, CB
HLT F4
6
Understanding Overflow and Carry Flags
Mnemonics Machine Code OF CF Comment
MOV AX, 805EH B8, 5E, 80 -ve number
MOV DX, 8040H BA, 40, 80 -ve number
ADD AX, DX 03, C2 +ve number
MOV AX, 505EH B8, 5E, 50 +ve number
MOV DX, 5040H BA, 40, 50 +ve number
ADD AX, DX 03, C2 -ve number
MOV AX, 805EH B8, 5E, 80 -ve number
MOV DX, 5040H BA, 40, 50 +ve number
ADD AX, DX 03, C2 -ve number
7
Understanding Addressing Modes
Mnemonics Machine
Code
Check Contents Comments on
Addressing
Mode
MOV AX, 0001H B8, 01, 00
MOV DS, AX 8E, D8
MOV BX, 2000H BB, 00, 20
MOV AX, [1FFEH] A1, FE, 1F AX = ?
MOV CH, [BX] 8A, 2F CH=?
MOV CL, [BX+01H] 8A, 4F, 01 CL=?
MOV SI, BX 8B, F3
MOV CX, [SI+02H] 8B, 4C, 02 CX=?
MOV DX, [BX+SI+08H] 8B, 50, 08 DX=? CF=?
UP: CMC F5 CF=?
JC UP 72, FD
HLT F4
Memory Data
0001:1FFE 01
1FFF 02
2000 03
2001 04
2002 05
2003 06
0001:4008 07
0001: 4009 08
MOV AX, 0001H
MOV DX, 0000H
MOV CX, 0008H
NEXT: MUL CX
LOOP NEXT
HLT
TEST: Write a program to calculate 8!.

More Related Content

PPTX
Assembly language.pptx
PPTX
Flag registers, addressing modes, instruction set
PPTX
Microprocessors-based systems (under graduate course) Lecture 4 of 9
PDF
8086 Register organization and Architecture details
PPT
instruction-set-of-8086-mr-binu-joy3.ppt
PPTX
assembly flag resister
PPT
12 mt06ped008
PPT
1344 Alp Of 8086
Assembly language.pptx
Flag registers, addressing modes, instruction set
Microprocessors-based systems (under graduate course) Lecture 4 of 9
8086 Register organization and Architecture details
instruction-set-of-8086-mr-binu-joy3.ppt
assembly flag resister
12 mt06ped008
1344 Alp Of 8086

Similar to microprocessor presentation 8086 flags (20)

PPTX
Introduction of 8086 micro processor .
PPSX
8086 microprocessor
PPT
Al2ed chapter7
PPTX
The 8051 microcontroller
PPTX
Register & flags
PPTX
Register Organisation of 8086 Microprocessor
PPT
Lecture_4__8051_Instruction_Set__Rv01.ppt
PPT
Chapt 06
PPT
Chapt 06
PPTX
Flags registor of 8086 processor
DOCX
Instruction set of 8086
PDF
Instructionsetof8086 180224060745(3)
PPT
8086-instruction sets.ppt
PPT
1. Instructionset.pptfor engineering student
PPT
microprocessor and microcontroller notes ppt
PPT
addressingmodes8051.ppt
PPT
Programming-8085 programming, description and base model.ppt
PDF
8086 Architecture, Pin diagram, Addressing modes (3).pdf
PPTX
Mastering Assembly Language: Programming with 8086
DOC
Instruction set summary
Introduction of 8086 micro processor .
8086 microprocessor
Al2ed chapter7
The 8051 microcontroller
Register & flags
Register Organisation of 8086 Microprocessor
Lecture_4__8051_Instruction_Set__Rv01.ppt
Chapt 06
Chapt 06
Flags registor of 8086 processor
Instruction set of 8086
Instructionsetof8086 180224060745(3)
8086-instruction sets.ppt
1. Instructionset.pptfor engineering student
microprocessor and microcontroller notes ppt
addressingmodes8051.ppt
Programming-8085 programming, description and base model.ppt
8086 Architecture, Pin diagram, Addressing modes (3).pdf
Mastering Assembly Language: Programming with 8086
Instruction set summary
Ad

Recently uploaded (20)

PDF
Abrasive, erosive and cavitation wear.pdf
PDF
Soil Improvement Techniques Note - Rabbi
PDF
distributed database system" (DDBS) is often used to refer to both the distri...
PPTX
communication and presentation skills 01
PDF
737-MAX_SRG.pdf student reference guides
PPTX
Fundamentals of Mechanical Engineering.pptx
PPTX
Graph Data Structures with Types, Traversals, Connectivity, and Real-Life App...
PPTX
"Array and Linked List in Data Structures with Types, Operations, Implementat...
PPTX
CyberSecurity Mobile and Wireless Devices
PDF
Improvement effect of pyrolyzed agro-food biochar on the properties of.pdf
PDF
SMART SIGNAL TIMING FOR URBAN INTERSECTIONS USING REAL-TIME VEHICLE DETECTI...
PDF
Categorization of Factors Affecting Classification Algorithms Selection
PDF
BIO-INSPIRED HORMONAL MODULATION AND ADAPTIVE ORCHESTRATION IN S-AI-GPT
PDF
A SYSTEMATIC REVIEW OF APPLICATIONS IN FRAUD DETECTION
PPTX
ASME PCC-02 TRAINING -DESKTOP-NLE5HNP.pptx
PDF
August 2025 - Top 10 Read Articles in Network Security & Its Applications
PPTX
tack Data Structure with Array and Linked List Implementation, Push and Pop O...
PDF
EXPLORING LEARNING ENGAGEMENT FACTORS INFLUENCING BEHAVIORAL, COGNITIVE, AND ...
PDF
Influence of Green Infrastructure on Residents’ Endorsement of the New Ecolog...
PPTX
Software Engineering and software moduleing
Abrasive, erosive and cavitation wear.pdf
Soil Improvement Techniques Note - Rabbi
distributed database system" (DDBS) is often used to refer to both the distri...
communication and presentation skills 01
737-MAX_SRG.pdf student reference guides
Fundamentals of Mechanical Engineering.pptx
Graph Data Structures with Types, Traversals, Connectivity, and Real-Life App...
"Array and Linked List in Data Structures with Types, Operations, Implementat...
CyberSecurity Mobile and Wireless Devices
Improvement effect of pyrolyzed agro-food biochar on the properties of.pdf
SMART SIGNAL TIMING FOR URBAN INTERSECTIONS USING REAL-TIME VEHICLE DETECTI...
Categorization of Factors Affecting Classification Algorithms Selection
BIO-INSPIRED HORMONAL MODULATION AND ADAPTIVE ORCHESTRATION IN S-AI-GPT
A SYSTEMATIC REVIEW OF APPLICATIONS IN FRAUD DETECTION
ASME PCC-02 TRAINING -DESKTOP-NLE5HNP.pptx
August 2025 - Top 10 Read Articles in Network Security & Its Applications
tack Data Structure with Array and Linked List Implementation, Push and Pop O...
EXPLORING LEARNING ENGAGEMENT FACTORS INFLUENCING BEHAVIORAL, COGNITIVE, AND ...
Influence of Green Infrastructure on Residents’ Endorsement of the New Ecolog...
Software Engineering and software moduleing
Ad

microprocessor presentation 8086 flags

  • 1. Lab-06 Introduction to 8086 flags and addressing modes, and control transfer instructions
  • 2. 2 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 OF DF IF TF SF ZF AF PF CF Carry Flag This flag is set, when there is a carry out of MSB in case of addition or a borrow in case of subtraction. Parity Flag This is even parity flag. When result has even number of 1, it will be set to 1, otherwise 0 for odd number of 1s Auxiliary Carry Flag This flag is set, when there is a carry out of low- nibble in case of addition or a borrow in case of subtraction Zero Flag This flag is set, if the result of the computation or comparison performed by an instruction is zero Sign Flag After any operation if the MSB is 1, then it indicates that the number is negative. And this flag is set to 1 Trap Flag If this flag is set, the processor enters the single step execution mode by generating internal interrupts after the execution of each instruction Interrupt Flag Causes the 8086 to recognize external mask interrupts; clearing IF disables these interrupts. Direction Flag This is used by string manipulation instructions. If this flag bit is ‘0’, the string is processed beginning from the lowest address to the highest address, i.e., auto incrementing mode. Otherwise, the string is processed from the highest address towards the lowest address, i.e., auto decrementing mode. Over flow Flag The overflow flag is set to 1 when the result of a signed operation is too large to fit. Flag Register
  • 3. 3 Addressing Modes 8086 Microprocessor Every instruction of a program has to operate on a data. The different ways in which a source operand is denoted in an instruction are known as addressing modes. 1. Register Addressing 2. Immediate Addressing 3. Direct Addressing 4. Register Indirect Addressing 5. Based Addressing 6. Indexed Addressing 7. Based Index Addressing 8. String Addressing 9. Direct I/O port Addressing 10. Indirect I/O port Addressing 11. Relative Addressing 12. Implied Addressing
  • 4. 4 6. Control Transfer Instructions Instruction Set 8086 Microprocessor Mnemonics Explanation JC disp8 Jump if CF = 1 JNC disp8 Jump if CF = 0 JP disp8 Jump if PF = 1 JNP disp8 Jump if PF = 0 JO disp8 Jump if OF = 1 JNO disp8 Jump if OF = 0 JS disp8 Jump if SF = 1 JNS disp8 Jump if SF = 0 JZ disp8 Jump if result is zero, i.e, Z = 1 JNZ disp8 Jump if result is not zero, i.e, Z = 1  8086 conditional branch instructions affecting individual flags
  • 5. 5 Checking Different Registers & Flags Mnemonics Machine Codes AX BX CX DX Set Flags MOV AX, 805EH B8, 5E, 80 MOV DX, 0540H BA, 40, 05 MOV CL, 02H B1, 02 MOV CH, 91H B5, 91 ADD AX, DX 03, C2 MOV BX, 0050H BB, 50, 00 SUB AX, BX 2B, C3 INC DL FE, C2 DEC BX 4B XCHG CX, BX 87, CB HLT F4
  • 6. 6 Understanding Overflow and Carry Flags Mnemonics Machine Code OF CF Comment MOV AX, 805EH B8, 5E, 80 -ve number MOV DX, 8040H BA, 40, 80 -ve number ADD AX, DX 03, C2 +ve number MOV AX, 505EH B8, 5E, 50 +ve number MOV DX, 5040H BA, 40, 50 +ve number ADD AX, DX 03, C2 -ve number MOV AX, 805EH B8, 5E, 80 -ve number MOV DX, 5040H BA, 40, 50 +ve number ADD AX, DX 03, C2 -ve number
  • 7. 7 Understanding Addressing Modes Mnemonics Machine Code Check Contents Comments on Addressing Mode MOV AX, 0001H B8, 01, 00 MOV DS, AX 8E, D8 MOV BX, 2000H BB, 00, 20 MOV AX, [1FFEH] A1, FE, 1F AX = ? MOV CH, [BX] 8A, 2F CH=? MOV CL, [BX+01H] 8A, 4F, 01 CL=? MOV SI, BX 8B, F3 MOV CX, [SI+02H] 8B, 4C, 02 CX=? MOV DX, [BX+SI+08H] 8B, 50, 08 DX=? CF=? UP: CMC F5 CF=? JC UP 72, FD HLT F4 Memory Data 0001:1FFE 01 1FFF 02 2000 03 2001 04 2002 05 2003 06 0001:4008 07 0001: 4009 08
  • 8. MOV AX, 0001H MOV DX, 0000H MOV CX, 0008H NEXT: MUL CX LOOP NEXT HLT TEST: Write a program to calculate 8!.