SlideShare a Scribd company logo
1 of 25
WELCOME TO OUR
PRESENTATION
Microprocessor and
Assembly Language
Programming
TEAM :ABRACADABRA
1. Afnanul Hassan #161-15-
7213
2. Khaled Akram Sany #161-15-
7203
3.Shami Al Rahad #161-15-
7349
4. Md. Sohanur Rahman Sakib #161-
WHAT IS MICROCOMPUTER?
• System Bus
Microproc
essor ROM RAM input output
Memory
Element
I/O unit
THE MICROPROCESSOR AND ITS
ARCHITECTURE
•ALU (Arithmetic and Logic Unit)
•The Control Unit
•Registers
HDD
RAM
Cache
Memory
Microprocessor
R1 R1
R3
THE PROGRAMMING
MODEL
•Program visible registers
•We can access via programs
•Program invisible registers
•We can not access via
programs
REGISTERS
16 bit Segment registers
EXAMPLE DATA
• If AX = 20A2H then AH = 20H, AL = A2H
• In other words, if AH = 1CH and AL = A2H then AX =
1CA2H
0010 0000 1010 0010
AH AL
AX
THE FLAGS REGISTER
• FLAGS indicate the condition of the MP
• Also control the operations
• FLAGS are upward compatible from 8086/8088 to
Pentium/Pentium Pro
Figure 2.2: The EFLAG and FLAG registers
THE FLAGS
• Carry Flag – C
• C = 1 if there is a carry out from the msb on addition
• Or, there is a borrow into the msb on subtraction
• Otherwise C = 0
• C flag is also affected by shift and rotate instructions
10101010
11101010
111010100 C = 1, in this case
THE FLAGS
• Parity Flag – P
• P = 1 for even parity, if number contains even number
of ones
• P = 0 for odd parity, if odd number of ones
10101010 10101011
P = 1 P = 0
Even number of ones Odd number of ones
Definition changes from microprocessor to microprocessor
THE FLAGS
• Zero Flag – Z
• Z = 1 for zero result
• Z = 0 for non-zero result
• Sign Flag – S
– S = 1 if msb of a result is 1, means
negative number
– S = 0 if msb of a result is 0, means positive
number
THE FLAGS
• Trap Flag – T
• Enables trapping through an on-chip debugging feature
• T = 1 MP interrupts the flow of a program, i.e. debug mode is
enabled
• T = 0 debug mode is disabled
• Direction Flag – D
– Selects increment/decrement mode of SI and/or DI
registers during string instructions
– D = 1, decrement mode, STD (set direction)
instruction used
– D = 0, increment mode, CLD (clear direction)
THE FLAGS
• Overflow Flag – O
• O = 1 if signed overflow occurred
• O = 0 otherwise
• Overflow is associated with the fact of range of numbers
represented in a computer
• 8 bit unsigned number range (0 to 255)
• 8 bit signed number range (-128 to 127)
• 16 bit unsigned number range (0 to 65535)
• 16 bit signed number range (-32768 to 32767)
SIGNED VS. UNSIGNED OVERFLOW
• Let, AX = FFFFh, BX = 0001h and execute
• ADD AX, BX
1111 1111 1111 1111
+ 0000 0000 0000 0001
1 0000 0000 0000 0000
AX
BX
• Unsigned interpretation
– Correct answer is 10000h = 65536
– But this is out of range.
– 1 is carried out of msb, AX = 0000h, which is
wrong
– Unsigned overflow occured
• Signed interpretation
– FFFFh = -1, 0001h = 1, summation is -1+1 = 0
HOW INSTRUCTIONS AFFECT THE
FLAGS?
• Every time the processor executes a instruction, the
flags are altered to reflect the result
• Let us take the following flags and instructions
• Sign Flag – S
• Parity Flag – P
• Zero Flag – Z
• Carry Flag – C
• MOV/XCH
G
• ADD/SUB
• INC/DEC
• NEG
None
All
All except C
All (C = 1 unless result is 0)
EXAMPLE 1
• Let AX = FFFFh, BX = FFFFh and execute ADD
AX, BX FFFFh
+ FFFFh
1 FFFEh
The result stored in AX is FFFEh = 1111 1111 1111 1110
S
P
Z
C
= 1 because the msb is 1
= 0 because the are 15 of 1 bits, odd parity
= 0 because the result is non-zero
= 1 because there is a carry out of the msb on addition
EXAMPLE 2
• Let AX = 8000h, BX = 0001h and execute SUB
AX, BX 8000h
- 0001h
7FFFh
The result stored in AX is 7FFFh = 0111 1111 1111 1111
S
P
Z
C
= 0 because the msb is 0
= 0 because the are 15 of 1 bits, odd parity
= 0 because the result is non-zero
= 0 because there is no carry
SEGMENT REGISTERS
16 bit Segment registers
*
*
*
Segment 1
Segment 2
Segment n
0000hCS
8000hDS
A000hSS
Fig:The programming model of intel 8086 trough the Pentium pro
Microprocessor and assambly language programming
Microprocessor and assambly language programming
Microprocessor and assambly language programming
Microprocessor and assambly language programming
Microprocessor and assambly language programming
Microprocessor and assambly language programming

More Related Content

Similar to Microprocessor and assambly language programming

Microprocessor Part 3
Microprocessor    Part  3Microprocessor    Part  3
Microprocessor Part 3Sajan Agrawal
 
8086-instruction-set-ppt
 8086-instruction-set-ppt 8086-instruction-set-ppt
8086-instruction-set-pptjemimajerome
 
Intel8086_Flags_Addr_Modes_sample_pgms.pdf
Intel8086_Flags_Addr_Modes_sample_pgms.pdfIntel8086_Flags_Addr_Modes_sample_pgms.pdf
Intel8086_Flags_Addr_Modes_sample_pgms.pdfAnonymous611358
 
8051 MMD Chapter 1.ppt
8051 MMD Chapter 1.ppt8051 MMD Chapter 1.ppt
8051 MMD Chapter 1.pptnotagain0712
 
Mca i-u-2-overview of register transfer, micro operations and basic computer ...
Mca i-u-2-overview of register transfer, micro operations and basic computer ...Mca i-u-2-overview of register transfer, micro operations and basic computer ...
Mca i-u-2-overview of register transfer, micro operations and basic computer ...Rai University
 
overview of register transfer, micro operations and basic computer organizati...
overview of register transfer, micro operations and basic computer organizati...overview of register transfer, micro operations and basic computer organizati...
overview of register transfer, micro operations and basic computer organizati...Rai University
 
8085 paper-presentation
8085 paper-presentation8085 paper-presentation
8085 paper-presentationJiMs ChAcko
 
Bca 2nd sem-u-2.1-overview of register transfer, micro operations and basic c...
Bca 2nd sem-u-2.1-overview of register transfer, micro operations and basic c...Bca 2nd sem-u-2.1-overview of register transfer, micro operations and basic c...
Bca 2nd sem-u-2.1-overview of register transfer, micro operations and basic c...Rai University
 
15CS44 MP &MC Module 3
15CS44 MP &MC Module 315CS44 MP &MC Module 3
15CS44 MP &MC Module 3RLJIT
 
B.sc cs-ii-u-2.1-overview of register transfer, micro operations and basic co...
B.sc cs-ii-u-2.1-overview of register transfer, micro operations and basic co...B.sc cs-ii-u-2.1-overview of register transfer, micro operations and basic co...
B.sc cs-ii-u-2.1-overview of register transfer, micro operations and basic co...Rai University
 
Basic computer organization design
Basic computer organization designBasic computer organization design
Basic computer organization designndasharath
 
Chapter3 presentation2
Chapter3 presentation2Chapter3 presentation2
Chapter3 presentation2surendar88
 
Microprocessor.pptx
Microprocessor.pptxMicroprocessor.pptx
Microprocessor.pptxNishatNishu5
 

Similar to Microprocessor and assambly language programming (20)

Microprocessor Part 3
Microprocessor    Part  3Microprocessor    Part  3
Microprocessor Part 3
 
8085-paper-presentation.ppt
8085-paper-presentation.ppt8085-paper-presentation.ppt
8085-paper-presentation.ppt
 
8086-instruction-set-ppt
 8086-instruction-set-ppt 8086-instruction-set-ppt
8086-instruction-set-ppt
 
Intel8086_Flags_Addr_Modes_sample_pgms.pdf
Intel8086_Flags_Addr_Modes_sample_pgms.pdfIntel8086_Flags_Addr_Modes_sample_pgms.pdf
Intel8086_Flags_Addr_Modes_sample_pgms.pdf
 
8051 MMD Chapter 1.ppt
8051 MMD Chapter 1.ppt8051 MMD Chapter 1.ppt
8051 MMD Chapter 1.ppt
 
Mca i-u-2-overview of register transfer, micro operations and basic computer ...
Mca i-u-2-overview of register transfer, micro operations and basic computer ...Mca i-u-2-overview of register transfer, micro operations and basic computer ...
Mca i-u-2-overview of register transfer, micro operations and basic computer ...
 
overview of register transfer, micro operations and basic computer organizati...
overview of register transfer, micro operations and basic computer organizati...overview of register transfer, micro operations and basic computer organizati...
overview of register transfer, micro operations and basic computer organizati...
 
Instruction set of 8086
Instruction set of 8086Instruction set of 8086
Instruction set of 8086
 
8085 paper-presentation
8085 paper-presentation8085 paper-presentation
8085 paper-presentation
 
Bca 2nd sem-u-2.1-overview of register transfer, micro operations and basic c...
Bca 2nd sem-u-2.1-overview of register transfer, micro operations and basic c...Bca 2nd sem-u-2.1-overview of register transfer, micro operations and basic c...
Bca 2nd sem-u-2.1-overview of register transfer, micro operations and basic c...
 
15CS44 MP &MC Module 3
15CS44 MP &MC Module 315CS44 MP &MC Module 3
15CS44 MP &MC Module 3
 
B.sc cs-ii-u-2.1-overview of register transfer, micro operations and basic co...
B.sc cs-ii-u-2.1-overview of register transfer, micro operations and basic co...B.sc cs-ii-u-2.1-overview of register transfer, micro operations and basic co...
B.sc cs-ii-u-2.1-overview of register transfer, micro operations and basic co...
 
Basic computer organization design
Basic computer organization designBasic computer organization design
Basic computer organization design
 
Chapter3 presentation2
Chapter3 presentation2Chapter3 presentation2
Chapter3 presentation2
 
Dsp Datapath
Dsp DatapathDsp Datapath
Dsp Datapath
 
UNIT-3.pptx
UNIT-3.pptxUNIT-3.pptx
UNIT-3.pptx
 
MPMC Unit-3 PPT.pdf
MPMC  Unit-3 PPT.pdfMPMC  Unit-3 PPT.pdf
MPMC Unit-3 PPT.pdf
 
12 mt06ped008
12 mt06ped008 12 mt06ped008
12 mt06ped008
 
8086 Instruction set
8086 Instruction set8086 Instruction set
8086 Instruction set
 
Microprocessor.pptx
Microprocessor.pptxMicroprocessor.pptx
Microprocessor.pptx
 

Recently uploaded

Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)Jisc
 
How to setup Pycharm environment for Odoo 17.pptx
How to setup Pycharm environment for Odoo 17.pptxHow to setup Pycharm environment for Odoo 17.pptx
How to setup Pycharm environment for Odoo 17.pptxCeline George
 
Making communications land - Are they received and understood as intended? we...
Making communications land - Are they received and understood as intended? we...Making communications land - Are they received and understood as intended? we...
Making communications land - Are they received and understood as intended? we...Association for Project Management
 
Unit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptxUnit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptxVishalSingh1417
 
How to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POSHow to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POSCeline George
 
Micro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdfMicro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdfPoh-Sun Goh
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfagholdier
 
Spellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please PractiseSpellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please PractiseAnaAcapella
 
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...Nguyen Thanh Tu Collection
 
REMIFENTANIL: An Ultra short acting opioid.pptx
REMIFENTANIL: An Ultra short acting opioid.pptxREMIFENTANIL: An Ultra short acting opioid.pptx
REMIFENTANIL: An Ultra short acting opioid.pptxDr. Ravikiran H M Gowda
 
General Principles of Intellectual Property: Concepts of Intellectual Proper...
General Principles of Intellectual Property: Concepts of Intellectual  Proper...General Principles of Intellectual Property: Concepts of Intellectual  Proper...
General Principles of Intellectual Property: Concepts of Intellectual Proper...Poonam Aher Patil
 
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdfUGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdfNirmal Dwivedi
 
ICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxAreebaZafar22
 
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptx
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptxSKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptx
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptxAmanpreet Kaur
 
How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17Celine George
 
Sociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning ExhibitSociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning Exhibitjbellavia9
 
Interdisciplinary_Insights_Data_Collection_Methods.pptx
Interdisciplinary_Insights_Data_Collection_Methods.pptxInterdisciplinary_Insights_Data_Collection_Methods.pptx
Interdisciplinary_Insights_Data_Collection_Methods.pptxPooja Bhuva
 
Single or Multiple melodic lines structure
Single or Multiple melodic lines structureSingle or Multiple melodic lines structure
Single or Multiple melodic lines structuredhanjurrannsibayan2
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfAdmir Softic
 

Recently uploaded (20)

Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)
 
How to setup Pycharm environment for Odoo 17.pptx
How to setup Pycharm environment for Odoo 17.pptxHow to setup Pycharm environment for Odoo 17.pptx
How to setup Pycharm environment for Odoo 17.pptx
 
Making communications land - Are they received and understood as intended? we...
Making communications land - Are they received and understood as intended? we...Making communications land - Are they received and understood as intended? we...
Making communications land - Are they received and understood as intended? we...
 
Unit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptxUnit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptx
 
Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024
 
How to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POSHow to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POS
 
Micro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdfMicro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdf
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdf
 
Spellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please PractiseSpellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please Practise
 
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
 
REMIFENTANIL: An Ultra short acting opioid.pptx
REMIFENTANIL: An Ultra short acting opioid.pptxREMIFENTANIL: An Ultra short acting opioid.pptx
REMIFENTANIL: An Ultra short acting opioid.pptx
 
General Principles of Intellectual Property: Concepts of Intellectual Proper...
General Principles of Intellectual Property: Concepts of Intellectual  Proper...General Principles of Intellectual Property: Concepts of Intellectual  Proper...
General Principles of Intellectual Property: Concepts of Intellectual Proper...
 
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdfUGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
 
ICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptx
 
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptx
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptxSKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptx
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptx
 
How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17
 
Sociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning ExhibitSociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning Exhibit
 
Interdisciplinary_Insights_Data_Collection_Methods.pptx
Interdisciplinary_Insights_Data_Collection_Methods.pptxInterdisciplinary_Insights_Data_Collection_Methods.pptx
Interdisciplinary_Insights_Data_Collection_Methods.pptx
 
Single or Multiple melodic lines structure
Single or Multiple melodic lines structureSingle or Multiple melodic lines structure
Single or Multiple melodic lines structure
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdf
 

Microprocessor and assambly language programming

  • 3. TEAM :ABRACADABRA 1. Afnanul Hassan #161-15- 7213 2. Khaled Akram Sany #161-15- 7203 3.Shami Al Rahad #161-15- 7349 4. Md. Sohanur Rahman Sakib #161-
  • 4. WHAT IS MICROCOMPUTER? • System Bus Microproc essor ROM RAM input output Memory Element I/O unit
  • 5. THE MICROPROCESSOR AND ITS ARCHITECTURE •ALU (Arithmetic and Logic Unit) •The Control Unit •Registers HDD RAM Cache Memory Microprocessor R1 R1 R3
  • 6. THE PROGRAMMING MODEL •Program visible registers •We can access via programs •Program invisible registers •We can not access via programs
  • 8. EXAMPLE DATA • If AX = 20A2H then AH = 20H, AL = A2H • In other words, if AH = 1CH and AL = A2H then AX = 1CA2H 0010 0000 1010 0010 AH AL AX
  • 9. THE FLAGS REGISTER • FLAGS indicate the condition of the MP • Also control the operations • FLAGS are upward compatible from 8086/8088 to Pentium/Pentium Pro Figure 2.2: The EFLAG and FLAG registers
  • 10. THE FLAGS • Carry Flag – C • C = 1 if there is a carry out from the msb on addition • Or, there is a borrow into the msb on subtraction • Otherwise C = 0 • C flag is also affected by shift and rotate instructions 10101010 11101010 111010100 C = 1, in this case
  • 11. THE FLAGS • Parity Flag – P • P = 1 for even parity, if number contains even number of ones • P = 0 for odd parity, if odd number of ones 10101010 10101011 P = 1 P = 0 Even number of ones Odd number of ones Definition changes from microprocessor to microprocessor
  • 12. THE FLAGS • Zero Flag – Z • Z = 1 for zero result • Z = 0 for non-zero result • Sign Flag – S – S = 1 if msb of a result is 1, means negative number – S = 0 if msb of a result is 0, means positive number
  • 13. THE FLAGS • Trap Flag – T • Enables trapping through an on-chip debugging feature • T = 1 MP interrupts the flow of a program, i.e. debug mode is enabled • T = 0 debug mode is disabled • Direction Flag – D – Selects increment/decrement mode of SI and/or DI registers during string instructions – D = 1, decrement mode, STD (set direction) instruction used – D = 0, increment mode, CLD (clear direction)
  • 14. THE FLAGS • Overflow Flag – O • O = 1 if signed overflow occurred • O = 0 otherwise • Overflow is associated with the fact of range of numbers represented in a computer • 8 bit unsigned number range (0 to 255) • 8 bit signed number range (-128 to 127) • 16 bit unsigned number range (0 to 65535) • 16 bit signed number range (-32768 to 32767)
  • 15. SIGNED VS. UNSIGNED OVERFLOW • Let, AX = FFFFh, BX = 0001h and execute • ADD AX, BX 1111 1111 1111 1111 + 0000 0000 0000 0001 1 0000 0000 0000 0000 AX BX • Unsigned interpretation – Correct answer is 10000h = 65536 – But this is out of range. – 1 is carried out of msb, AX = 0000h, which is wrong – Unsigned overflow occured • Signed interpretation – FFFFh = -1, 0001h = 1, summation is -1+1 = 0
  • 16. HOW INSTRUCTIONS AFFECT THE FLAGS? • Every time the processor executes a instruction, the flags are altered to reflect the result • Let us take the following flags and instructions • Sign Flag – S • Parity Flag – P • Zero Flag – Z • Carry Flag – C • MOV/XCH G • ADD/SUB • INC/DEC • NEG None All All except C All (C = 1 unless result is 0)
  • 17. EXAMPLE 1 • Let AX = FFFFh, BX = FFFFh and execute ADD AX, BX FFFFh + FFFFh 1 FFFEh The result stored in AX is FFFEh = 1111 1111 1111 1110 S P Z C = 1 because the msb is 1 = 0 because the are 15 of 1 bits, odd parity = 0 because the result is non-zero = 1 because there is a carry out of the msb on addition
  • 18. EXAMPLE 2 • Let AX = 8000h, BX = 0001h and execute SUB AX, BX 8000h - 0001h 7FFFh The result stored in AX is 7FFFh = 0111 1111 1111 1111 S P Z C = 0 because the msb is 0 = 0 because the are 15 of 1 bits, odd parity = 0 because the result is non-zero = 0 because there is no carry
  • 19. SEGMENT REGISTERS 16 bit Segment registers * * * Segment 1 Segment 2 Segment n 0000hCS 8000hDS A000hSS Fig:The programming model of intel 8086 trough the Pentium pro