SlideShare a Scribd company logo
1 of 14
Assembly Language Programming:
1. Introduction
Prepared by:
Md. Jahidul Islam (Lecturer, Dept. of CSE, UIU.)
Special Thanks to:
Muhammad Tasnim Mohiuddin (Lecturer, Dept. of CSE, UIU.)
April 2015.
Department of Computer Science & Engineering (CSE), United International University (UIU).
Programming Languages
1) Machine Language
2) Assembly Language (Low Level Language)
3) High Level Languages
April 2015.
Department of Computer Science & Engineering (CSE), United International University (UIU).
Simple Computer Model
April 2015.
Department of Computer Science & Engineering (CSE), United International University (UIU).
Inside the CPU
April 2015.
Department of Computer Science & Engineering (CSE), United International University (UIU).
CPU Registers
• General purpose registers
• Segment registers
• Instruction Pointer
• Flags register
• Special purpose registers
oDebug registers
oMachine Control registers
April 2015.
Department of Computer Science & Engineering (CSE), United International University (UIU).
6
 AX (accumulator register):
 Stores operands for arithmetic & data transfer instructions.
 BX Register (base register):
 Holds the starting base address of a memory within a data segment.

CX Register (counter register):
 Primarily used in loop instruction to store loop counter.

DX Register (data register)
 Used to contain I/O port address for I/O instruction.
General Purpose Registers
7
General Purpose Registers (contd.)
 Each of these 16-bit registers are further subdivided into two 8-bit
registers.
AH AL
BH BL
CH CL
DH DL
AX
BX
CX
DX
8
Memory Segmentation
 Data Segment
 contains variable definitions
 declared by .DATA
 Stack segment
 used to store the stack
 declared by .STACK size
 default stack size is 1KB.
 Code segment
 contains program’s instructions
 declared by .CODE
Extra segment

DS
CS
SS
ES
64 KB
64 KB
64 KB
8086 Memory
64 KB
Flag Register
9
 Flag register determines the current status of the microprocessor.
 It is modified automatically by CPU after mathematical operations.
 This allows to determine the type of the result.
 8086 has 16-bit Flag register.
 There are two kinds of flags: Status Flags and Control Flags
Flag Register (contd.)
10
Status Flags Control Flags
Carry Flag (CF) Trap Flag
Auxiliary-carry Flag (AF) Interrupt Flag
Zero Flag (ZF) Directional Flag
Sign Flag (SF)
Parity Flag (PF)
Overflow Flag (OF)
Flag Register (contd.)
11
Flag Purpose
Carry (CF) CF = 1 if there is a carry out from the MSB on addition or there
is a Borrow into the MSB on subtraction.
Parity (PF) PF=1 if the low byte of a result has an even number of one bits
(even parity).
Auxiliary (AF) Holds the carry (half–carry) after addition or borrow after
subtraction between bit positions 3 and 4 of the result
(for example, in BCD addition or subtraction.)
Zero (ZF) Shows the result of the arithmetic or logic operation.
Z=1; result is zero. Z=0; The result is 0
Sign (SF) Holds the sign of the result after an arithmetic/logic instruction
execution. SF=1 if the MSB of a result is 1.
Flag Register (contd.)
12
Flag Purpose
Trap (TF) Enables the trapping through an on-chip debugging feature.
Interrupt (IF)
Controls the operation of the INTR (interrupt request)
IF = 0 if the INTR pin is disabled
IF = 1, if the INTR pin isenabled.
Direction (DF)
Selects either the increment or decrement mode for DI
and /or SI registers during the string instructions.
Overflow (OF)
Overflow occurs when signed numbers are added or
subtracted. An overflow indicates the result has exceeded
the capacity of the machine.
13
 Stack Pointer (SP)
 A 16-bit register pointing to program stack
 Base Pointer (BP)
 A 16-bit register used to access data in stack segment
 Usually used for based indexed or register indirect addressing
 Source Index (SI) & Destination Index (DI)
 16-bit registers
 Used to point to memory locations in the data segment
Pointer and Index Registers
Any Questions?
Thank You
April ,2015.
Department of Computer Science & Engineering (CSE), United International University (UIU).

More Related Content

What's hot

8086 assembly language
8086 assembly language8086 assembly language
8086 assembly languageMir Majid
 
system software 16 marks
system software 16 markssystem software 16 marks
system software 16 marksvvcetit
 
Arrays and addressing modes
Arrays and addressing modesArrays and addressing modes
Arrays and addressing modesBilal Amjad
 
Assembly language programming_fundamentals 8086
Assembly language programming_fundamentals 8086Assembly language programming_fundamentals 8086
Assembly language programming_fundamentals 8086Shehrevar Davierwala
 
Intermediate code- generation
Intermediate code- generationIntermediate code- generation
Intermediate code- generationrawan_z
 
Chapter 4 programming concepts III
Chapter 4  programming concepts IIIChapter 4  programming concepts III
Chapter 4 programming concepts IIISHREEHARI WADAWADAGI
 
Microprocessor chapter 9 - assembly language programming
Microprocessor  chapter 9 - assembly language programmingMicroprocessor  chapter 9 - assembly language programming
Microprocessor chapter 9 - assembly language programmingWondeson Emeye
 
Assembler directives and basic steps ALP of 8086
Assembler directives and basic steps ALP of 8086Assembler directives and basic steps ALP of 8086
Assembler directives and basic steps ALP of 8086Urvashi Singh
 
Assembly Language Programming By Ytha Yu, Charles Marut Chap 4 (Introduction ...
Assembly Language Programming By Ytha Yu, Charles Marut Chap 4 (Introduction ...Assembly Language Programming By Ytha Yu, Charles Marut Chap 4 (Introduction ...
Assembly Language Programming By Ytha Yu, Charles Marut Chap 4 (Introduction ...Bilal Amjad
 
Computer architecture instruction formats
Computer architecture instruction formatsComputer architecture instruction formats
Computer architecture instruction formatsMazin Alwaaly
 
Chapter 2 programming concepts - I
Chapter 2  programming concepts - IChapter 2  programming concepts - I
Chapter 2 programming concepts - ISHREEHARI WADAWADAGI
 
Examinable Question and answer system programming
Examinable Question and answer system programmingExaminable Question and answer system programming
Examinable Question and answer system programmingMakerere university
 
MASM -UNIT-III
MASM -UNIT-IIIMASM -UNIT-III
MASM -UNIT-IIIDr.YNM
 

What's hot (20)

8086 assembly language
8086 assembly language8086 assembly language
8086 assembly language
 
system software 16 marks
system software 16 markssystem software 16 marks
system software 16 marks
 
Chapter 5 programming concepts iv
Chapter 5  programming concepts ivChapter 5  programming concepts iv
Chapter 5 programming concepts iv
 
Arrays and addressing modes
Arrays and addressing modesArrays and addressing modes
Arrays and addressing modes
 
Two pass Assembler
Two pass AssemblerTwo pass Assembler
Two pass Assembler
 
Assembly language programming_fundamentals 8086
Assembly language programming_fundamentals 8086Assembly language programming_fundamentals 8086
Assembly language programming_fundamentals 8086
 
Intermediate code- generation
Intermediate code- generationIntermediate code- generation
Intermediate code- generation
 
8086 assembly
8086 assembly8086 assembly
8086 assembly
 
Chapter 4 programming concepts III
Chapter 4  programming concepts IIIChapter 4  programming concepts III
Chapter 4 programming concepts III
 
Microprocessor chapter 9 - assembly language programming
Microprocessor  chapter 9 - assembly language programmingMicroprocessor  chapter 9 - assembly language programming
Microprocessor chapter 9 - assembly language programming
 
Assembler directives and basic steps ALP of 8086
Assembler directives and basic steps ALP of 8086Assembler directives and basic steps ALP of 8086
Assembler directives and basic steps ALP of 8086
 
Addressing modes
Addressing modesAddressing modes
Addressing modes
 
Code generation
Code generationCode generation
Code generation
 
Assembly Language Programming By Ytha Yu, Charles Marut Chap 4 (Introduction ...
Assembly Language Programming By Ytha Yu, Charles Marut Chap 4 (Introduction ...Assembly Language Programming By Ytha Yu, Charles Marut Chap 4 (Introduction ...
Assembly Language Programming By Ytha Yu, Charles Marut Chap 4 (Introduction ...
 
Computer architecture instruction formats
Computer architecture instruction formatsComputer architecture instruction formats
Computer architecture instruction formats
 
Chapter 1 archietecture of 8086
Chapter 1 archietecture of 8086Chapter 1 archietecture of 8086
Chapter 1 archietecture of 8086
 
Chapter 2 programming concepts - I
Chapter 2  programming concepts - IChapter 2  programming concepts - I
Chapter 2 programming concepts - I
 
Compiler unit 4
Compiler unit 4Compiler unit 4
Compiler unit 4
 
Examinable Question and answer system programming
Examinable Question and answer system programmingExaminable Question and answer system programming
Examinable Question and answer system programming
 
MASM -UNIT-III
MASM -UNIT-IIIMASM -UNIT-III
MASM -UNIT-III
 

Viewers also liked (20)

Complement
ComplementComplement
Complement
 
Complements
ComplementsComplements
Complements
 
1's and 2's complement
1's and 2's complement 1's and 2's complement
1's and 2's complement
 
Binary Arithmetic Presentation about Binary Numbers 2015
Binary Arithmetic Presentation about Binary Numbers 2015Binary Arithmetic Presentation about Binary Numbers 2015
Binary Arithmetic Presentation about Binary Numbers 2015
 
Binary arithmetic
Binary arithmeticBinary arithmetic
Binary arithmetic
 
binary arithmetic rules
binary arithmetic rulesbinary arithmetic rules
binary arithmetic rules
 
Introduction number systems and conversion
 Introduction number systems and conversion Introduction number systems and conversion
Introduction number systems and conversion
 
Arithmetic & logical operations in 8051
Arithmetic & logical operations in 8051Arithmetic & logical operations in 8051
Arithmetic & logical operations in 8051
 
Logic gates
Logic gatesLogic gates
Logic gates
 
Conversion of number system
Conversion of number systemConversion of number system
Conversion of number system
 
Conversion binary to decimal
Conversion binary to decimalConversion binary to decimal
Conversion binary to decimal
 
1s and 2s complement
1s and 2s complement1s and 2s complement
1s and 2s complement
 
BINARY NUMBER SYSTEM
BINARY NUMBER SYSTEMBINARY NUMBER SYSTEM
BINARY NUMBER SYSTEM
 
Number System
Number SystemNumber System
Number System
 
08. Numeral Systems
08. Numeral Systems08. Numeral Systems
08. Numeral Systems
 
Number system
Number systemNumber system
Number system
 
number system
number systemnumber system
number system
 
Logic gates
Logic gatesLogic gates
Logic gates
 
Decimal to binary number
Decimal to binary numberDecimal to binary number
Decimal to binary number
 
Number System
Number SystemNumber System
Number System
 

Similar to Assembly Language Programming Guide: Introduction to Registers, Segments, and Flags

Introduction to CPU registers
Introduction to CPU registersIntroduction to CPU registers
Introduction to CPU registersMuhammad Waqas
 
Register introduction
Register introductionRegister introduction
Register introductionmaamir farooq
 
SAQIB ALI.pptx
SAQIB ALI.pptxSAQIB ALI.pptx
SAQIB ALI.pptxastik11
 
26677766 8086-microprocessor-architecture
26677766 8086-microprocessor-architecture26677766 8086-microprocessor-architecture
26677766 8086-microprocessor-architectureSaurabh Jain
 
N_Asm Assembly registers (sol)
N_Asm Assembly registers (sol)N_Asm Assembly registers (sol)
N_Asm Assembly registers (sol)Selomon birhane
 
Microprocessor 8086 and Microcontoller
Microprocessor 8086 and MicrocontollerMicroprocessor 8086 and Microcontoller
Microprocessor 8086 and MicrocontollerSaad Tanvir
 
INTEL 8086 MP Architecture
INTEL 8086 MP ArchitectureINTEL 8086 MP Architecture
INTEL 8086 MP ArchitectureMd. Arif Hossain
 
Flag registers, addressing modes, instruction set
Flag registers, addressing modes, instruction setFlag registers, addressing modes, instruction set
Flag registers, addressing modes, instruction setaviban
 
Intel Microprocessors 8086 Documentation
Intel Microprocessors 8086 DocumentationIntel Microprocessors 8086 Documentation
Intel Microprocessors 8086 DocumentationAdeel Rasheed
 
8086 microprocessor-architecture-120207111857-phpapp01
8086 microprocessor-architecture-120207111857-phpapp018086 microprocessor-architecture-120207111857-phpapp01
8086 microprocessor-architecture-120207111857-phpapp01jemimajerome
 
8086 microprocessor-architecture
8086 microprocessor-architecture8086 microprocessor-architecture
8086 microprocessor-architectureprasadpawaskar
 

Similar to Assembly Language Programming Guide: Introduction to Registers, Segments, and Flags (20)

Introduction to CPU registers
Introduction to CPU registersIntroduction to CPU registers
Introduction to CPU registers
 
Register introduction
Register introductionRegister introduction
Register introduction
 
SAQIB ALI.pptx
SAQIB ALI.pptxSAQIB ALI.pptx
SAQIB ALI.pptx
 
Registers
RegistersRegisters
Registers
 
26677766 8086-microprocessor-architecture
26677766 8086-microprocessor-architecture26677766 8086-microprocessor-architecture
26677766 8086-microprocessor-architecture
 
N_Asm Assembly registers (sol)
N_Asm Assembly registers (sol)N_Asm Assembly registers (sol)
N_Asm Assembly registers (sol)
 
8086
8086 8086
8086
 
Register & flags
Register & flagsRegister & flags
Register & flags
 
Advanced micro -processor
Advanced micro -processorAdvanced micro -processor
Advanced micro -processor
 
Microprocessor 8086 and Microcontoller
Microprocessor 8086 and MicrocontollerMicroprocessor 8086 and Microcontoller
Microprocessor 8086 and Microcontoller
 
Chapter 2
Chapter 2Chapter 2
Chapter 2
 
register
registerregister
register
 
INTEL 8086 MP Architecture
INTEL 8086 MP ArchitectureINTEL 8086 MP Architecture
INTEL 8086 MP Architecture
 
Flag registers, addressing modes, instruction set
Flag registers, addressing modes, instruction setFlag registers, addressing modes, instruction set
Flag registers, addressing modes, instruction set
 
Intel Microprocessors 8086 Documentation
Intel Microprocessors 8086 DocumentationIntel Microprocessors 8086 Documentation
Intel Microprocessors 8086 Documentation
 
intel 8086 introduction
intel 8086 introductionintel 8086 introduction
intel 8086 introduction
 
Amp
AmpAmp
Amp
 
8086 microprocessor-architecture-120207111857-phpapp01
8086 microprocessor-architecture-120207111857-phpapp018086 microprocessor-architecture-120207111857-phpapp01
8086 microprocessor-architecture-120207111857-phpapp01
 
8086 microprocessor-architecture
8086 microprocessor-architecture8086 microprocessor-architecture
8086 microprocessor-architecture
 
8086 microprocessor
8086 microprocessor8086 microprocessor
8086 microprocessor
 

Recently uploaded

Sachpazis Costas: Geotechnical Engineering: A student's Perspective Introduction
Sachpazis Costas: Geotechnical Engineering: A student's Perspective IntroductionSachpazis Costas: Geotechnical Engineering: A student's Perspective Introduction
Sachpazis Costas: Geotechnical Engineering: A student's Perspective IntroductionDr.Costas Sachpazis
 
Mine Environment II Lab_MI10448MI__________.pptx
Mine Environment II Lab_MI10448MI__________.pptxMine Environment II Lab_MI10448MI__________.pptx
Mine Environment II Lab_MI10448MI__________.pptxRomil Mishra
 
Crushers to screens in aggregate production
Crushers to screens in aggregate productionCrushers to screens in aggregate production
Crushers to screens in aggregate productionChinnuNinan
 
Instrumentation, measurement and control of bio process parameters ( Temperat...
Instrumentation, measurement and control of bio process parameters ( Temperat...Instrumentation, measurement and control of bio process parameters ( Temperat...
Instrumentation, measurement and control of bio process parameters ( Temperat...121011101441
 
CCS355 Neural Networks & Deep Learning Unit 1 PDF notes with Question bank .pdf
CCS355 Neural Networks & Deep Learning Unit 1 PDF notes with Question bank .pdfCCS355 Neural Networks & Deep Learning Unit 1 PDF notes with Question bank .pdf
CCS355 Neural Networks & Deep Learning Unit 1 PDF notes with Question bank .pdfAsst.prof M.Gokilavani
 
Risk Management in Engineering Construction Project
Risk Management in Engineering Construction ProjectRisk Management in Engineering Construction Project
Risk Management in Engineering Construction ProjectErbil Polytechnic University
 
welding defects observed during the welding
welding defects observed during the weldingwelding defects observed during the welding
welding defects observed during the weldingMuhammadUzairLiaqat
 
Katarzyna Lipka-Sidor - BIM School Course
Katarzyna Lipka-Sidor - BIM School CourseKatarzyna Lipka-Sidor - BIM School Course
Katarzyna Lipka-Sidor - BIM School Coursebim.edu.pl
 
11. Properties of Liquid Fuels in Energy Engineering.pdf
11. Properties of Liquid Fuels in Energy Engineering.pdf11. Properties of Liquid Fuels in Energy Engineering.pdf
11. Properties of Liquid Fuels in Energy Engineering.pdfHafizMudaserAhmad
 
IVE Industry Focused Event - Defence Sector 2024
IVE Industry Focused Event - Defence Sector 2024IVE Industry Focused Event - Defence Sector 2024
IVE Industry Focused Event - Defence Sector 2024Mark Billinghurst
 
Main Memory Management in Operating System
Main Memory Management in Operating SystemMain Memory Management in Operating System
Main Memory Management in Operating SystemRashmi Bhat
 
Class 1 | NFPA 72 | Overview Fire Alarm System
Class 1 | NFPA 72 | Overview Fire Alarm SystemClass 1 | NFPA 72 | Overview Fire Alarm System
Class 1 | NFPA 72 | Overview Fire Alarm Systemirfanmechengr
 
BSNL Internship Training presentation.pptx
BSNL Internship Training presentation.pptxBSNL Internship Training presentation.pptx
BSNL Internship Training presentation.pptxNiranjanYadav41
 
Unit7-DC_Motors nkkjnsdkfnfcdfknfdgfggfg
Unit7-DC_Motors nkkjnsdkfnfcdfknfdgfggfgUnit7-DC_Motors nkkjnsdkfnfcdfknfdgfggfg
Unit7-DC_Motors nkkjnsdkfnfcdfknfdgfggfgsaravananr517913
 
Energy Awareness training ppt for manufacturing process.pptx
Energy Awareness training ppt for manufacturing process.pptxEnergy Awareness training ppt for manufacturing process.pptx
Energy Awareness training ppt for manufacturing process.pptxsiddharthjain2303
 
Transport layer issues and challenges - Guide
Transport layer issues and challenges - GuideTransport layer issues and challenges - Guide
Transport layer issues and challenges - GuideGOPINATHS437943
 
Input Output Management in Operating System
Input Output Management in Operating SystemInput Output Management in Operating System
Input Output Management in Operating SystemRashmi Bhat
 
Software and Systems Engineering Standards: Verification and Validation of Sy...
Software and Systems Engineering Standards: Verification and Validation of Sy...Software and Systems Engineering Standards: Verification and Validation of Sy...
Software and Systems Engineering Standards: Verification and Validation of Sy...VICTOR MAESTRE RAMIREZ
 
THE SENDAI FRAMEWORK FOR DISASTER RISK REDUCTION
THE SENDAI FRAMEWORK FOR DISASTER RISK REDUCTIONTHE SENDAI FRAMEWORK FOR DISASTER RISK REDUCTION
THE SENDAI FRAMEWORK FOR DISASTER RISK REDUCTIONjhunlian
 

Recently uploaded (20)

Sachpazis Costas: Geotechnical Engineering: A student's Perspective Introduction
Sachpazis Costas: Geotechnical Engineering: A student's Perspective IntroductionSachpazis Costas: Geotechnical Engineering: A student's Perspective Introduction
Sachpazis Costas: Geotechnical Engineering: A student's Perspective Introduction
 
Mine Environment II Lab_MI10448MI__________.pptx
Mine Environment II Lab_MI10448MI__________.pptxMine Environment II Lab_MI10448MI__________.pptx
Mine Environment II Lab_MI10448MI__________.pptx
 
Crushers to screens in aggregate production
Crushers to screens in aggregate productionCrushers to screens in aggregate production
Crushers to screens in aggregate production
 
Instrumentation, measurement and control of bio process parameters ( Temperat...
Instrumentation, measurement and control of bio process parameters ( Temperat...Instrumentation, measurement and control of bio process parameters ( Temperat...
Instrumentation, measurement and control of bio process parameters ( Temperat...
 
CCS355 Neural Networks & Deep Learning Unit 1 PDF notes with Question bank .pdf
CCS355 Neural Networks & Deep Learning Unit 1 PDF notes with Question bank .pdfCCS355 Neural Networks & Deep Learning Unit 1 PDF notes with Question bank .pdf
CCS355 Neural Networks & Deep Learning Unit 1 PDF notes with Question bank .pdf
 
Risk Management in Engineering Construction Project
Risk Management in Engineering Construction ProjectRisk Management in Engineering Construction Project
Risk Management in Engineering Construction Project
 
Design and analysis of solar grass cutter.pdf
Design and analysis of solar grass cutter.pdfDesign and analysis of solar grass cutter.pdf
Design and analysis of solar grass cutter.pdf
 
welding defects observed during the welding
welding defects observed during the weldingwelding defects observed during the welding
welding defects observed during the welding
 
Katarzyna Lipka-Sidor - BIM School Course
Katarzyna Lipka-Sidor - BIM School CourseKatarzyna Lipka-Sidor - BIM School Course
Katarzyna Lipka-Sidor - BIM School Course
 
11. Properties of Liquid Fuels in Energy Engineering.pdf
11. Properties of Liquid Fuels in Energy Engineering.pdf11. Properties of Liquid Fuels in Energy Engineering.pdf
11. Properties of Liquid Fuels in Energy Engineering.pdf
 
IVE Industry Focused Event - Defence Sector 2024
IVE Industry Focused Event - Defence Sector 2024IVE Industry Focused Event - Defence Sector 2024
IVE Industry Focused Event - Defence Sector 2024
 
Main Memory Management in Operating System
Main Memory Management in Operating SystemMain Memory Management in Operating System
Main Memory Management in Operating System
 
Class 1 | NFPA 72 | Overview Fire Alarm System
Class 1 | NFPA 72 | Overview Fire Alarm SystemClass 1 | NFPA 72 | Overview Fire Alarm System
Class 1 | NFPA 72 | Overview Fire Alarm System
 
BSNL Internship Training presentation.pptx
BSNL Internship Training presentation.pptxBSNL Internship Training presentation.pptx
BSNL Internship Training presentation.pptx
 
Unit7-DC_Motors nkkjnsdkfnfcdfknfdgfggfg
Unit7-DC_Motors nkkjnsdkfnfcdfknfdgfggfgUnit7-DC_Motors nkkjnsdkfnfcdfknfdgfggfg
Unit7-DC_Motors nkkjnsdkfnfcdfknfdgfggfg
 
Energy Awareness training ppt for manufacturing process.pptx
Energy Awareness training ppt for manufacturing process.pptxEnergy Awareness training ppt for manufacturing process.pptx
Energy Awareness training ppt for manufacturing process.pptx
 
Transport layer issues and challenges - Guide
Transport layer issues and challenges - GuideTransport layer issues and challenges - Guide
Transport layer issues and challenges - Guide
 
Input Output Management in Operating System
Input Output Management in Operating SystemInput Output Management in Operating System
Input Output Management in Operating System
 
Software and Systems Engineering Standards: Verification and Validation of Sy...
Software and Systems Engineering Standards: Verification and Validation of Sy...Software and Systems Engineering Standards: Verification and Validation of Sy...
Software and Systems Engineering Standards: Verification and Validation of Sy...
 
THE SENDAI FRAMEWORK FOR DISASTER RISK REDUCTION
THE SENDAI FRAMEWORK FOR DISASTER RISK REDUCTIONTHE SENDAI FRAMEWORK FOR DISASTER RISK REDUCTION
THE SENDAI FRAMEWORK FOR DISASTER RISK REDUCTION
 

Assembly Language Programming Guide: Introduction to Registers, Segments, and Flags

  • 1. Assembly Language Programming: 1. Introduction Prepared by: Md. Jahidul Islam (Lecturer, Dept. of CSE, UIU.) Special Thanks to: Muhammad Tasnim Mohiuddin (Lecturer, Dept. of CSE, UIU.) April 2015. Department of Computer Science & Engineering (CSE), United International University (UIU).
  • 2. Programming Languages 1) Machine Language 2) Assembly Language (Low Level Language) 3) High Level Languages April 2015. Department of Computer Science & Engineering (CSE), United International University (UIU).
  • 3. Simple Computer Model April 2015. Department of Computer Science & Engineering (CSE), United International University (UIU).
  • 4. Inside the CPU April 2015. Department of Computer Science & Engineering (CSE), United International University (UIU).
  • 5. CPU Registers • General purpose registers • Segment registers • Instruction Pointer • Flags register • Special purpose registers oDebug registers oMachine Control registers April 2015. Department of Computer Science & Engineering (CSE), United International University (UIU).
  • 6. 6  AX (accumulator register):  Stores operands for arithmetic & data transfer instructions.  BX Register (base register):  Holds the starting base address of a memory within a data segment.  CX Register (counter register):  Primarily used in loop instruction to store loop counter.  DX Register (data register)  Used to contain I/O port address for I/O instruction. General Purpose Registers
  • 7. 7 General Purpose Registers (contd.)  Each of these 16-bit registers are further subdivided into two 8-bit registers. AH AL BH BL CH CL DH DL AX BX CX DX
  • 8. 8 Memory Segmentation  Data Segment  contains variable definitions  declared by .DATA  Stack segment  used to store the stack  declared by .STACK size  default stack size is 1KB.  Code segment  contains program’s instructions  declared by .CODE Extra segment  DS CS SS ES 64 KB 64 KB 64 KB 8086 Memory 64 KB
  • 9. Flag Register 9  Flag register determines the current status of the microprocessor.  It is modified automatically by CPU after mathematical operations.  This allows to determine the type of the result.  8086 has 16-bit Flag register.  There are two kinds of flags: Status Flags and Control Flags
  • 10. Flag Register (contd.) 10 Status Flags Control Flags Carry Flag (CF) Trap Flag Auxiliary-carry Flag (AF) Interrupt Flag Zero Flag (ZF) Directional Flag Sign Flag (SF) Parity Flag (PF) Overflow Flag (OF)
  • 11. Flag Register (contd.) 11 Flag Purpose Carry (CF) CF = 1 if there is a carry out from the MSB on addition or there is a Borrow into the MSB on subtraction. Parity (PF) PF=1 if the low byte of a result has an even number of one bits (even parity). Auxiliary (AF) Holds the carry (half–carry) after addition or borrow after subtraction between bit positions 3 and 4 of the result (for example, in BCD addition or subtraction.) Zero (ZF) Shows the result of the arithmetic or logic operation. Z=1; result is zero. Z=0; The result is 0 Sign (SF) Holds the sign of the result after an arithmetic/logic instruction execution. SF=1 if the MSB of a result is 1.
  • 12. Flag Register (contd.) 12 Flag Purpose Trap (TF) Enables the trapping through an on-chip debugging feature. Interrupt (IF) Controls the operation of the INTR (interrupt request) IF = 0 if the INTR pin is disabled IF = 1, if the INTR pin isenabled. Direction (DF) Selects either the increment or decrement mode for DI and /or SI registers during the string instructions. Overflow (OF) Overflow occurs when signed numbers are added or subtracted. An overflow indicates the result has exceeded the capacity of the machine.
  • 13. 13  Stack Pointer (SP)  A 16-bit register pointing to program stack  Base Pointer (BP)  A 16-bit register used to access data in stack segment  Usually used for based indexed or register indirect addressing  Source Index (SI) & Destination Index (DI)  16-bit registers  Used to point to memory locations in the data segment Pointer and Index Registers
  • 14. Any Questions? Thank You April ,2015. Department of Computer Science & Engineering (CSE), United International University (UIU).