SlideShare a Scribd company logo
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 marks
vvcetit
 
Chapter 5 programming concepts iv
Chapter 5  programming concepts ivChapter 5  programming concepts iv
Chapter 5 programming concepts iv
SHREEHARI WADAWADAGI
 
Arrays and addressing modes
Arrays and addressing modesArrays and addressing modes
Arrays and addressing modes
Bilal Amjad
 
Two pass Assembler
Two pass AssemblerTwo pass Assembler
Two pass Assembler
Satyamevjayte Haxor
 
Assembly language programming_fundamentals 8086
Assembly language programming_fundamentals 8086Assembly language programming_fundamentals 8086
Assembly language programming_fundamentals 8086
Shehrevar 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 III
SHREEHARI WADAWADAGI
 
Microprocessor chapter 9 - assembly language programming
Microprocessor  chapter 9 - assembly language programmingMicroprocessor  chapter 9 - assembly language programming
Microprocessor chapter 9 - assembly language programming
Wondeson 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 8086
Urvashi Singh
 
Addressing modes
Addressing modesAddressing modes
Addressing modes
karthiga selvaraju
 
Code generation
Code generationCode generation
Code generation
Aparna Nayak
 
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 formats
Mazin Alwaaly
 
Chapter 1 archietecture of 8086
Chapter 1 archietecture of 8086Chapter 1 archietecture of 8086
Chapter 1 archietecture of 8086
SHREEHARI WADAWADAGI
 
Chapter 2 programming concepts - I
Chapter 2  programming concepts - IChapter 2  programming concepts - I
Chapter 2 programming concepts - I
SHREEHARI WADAWADAGI
 
Compiler unit 4
Compiler unit 4Compiler unit 4
Compiler unit 4
BBDITM LUCKNOW
 
Examinable Question and answer system programming
Examinable Question and answer system programmingExaminable Question and answer system programming
Examinable Question and answer system programming
Makerere university
 
MASM -UNIT-III
MASM -UNIT-IIIMASM -UNIT-III
MASM -UNIT-III
Dr.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

Complement
ComplementComplement
Complement
Sudheesh S Madhav
 
Complements
ComplementsComplements
Complements
Sudheesh S Madhav
 
1's and 2's complement
1's and 2's complement 1's and 2's complement
1's and 2's complement
Shiraz Azeem
 
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
An Ariyan
 
binary arithmetic rules
binary arithmetic rulesbinary arithmetic rules
binary arithmetic rules
student
 
Introduction number systems and conversion
 Introduction number systems and conversion Introduction number systems and conversion
Introduction number systems and conversionkanyuma jitjumnong
 
Arithmetic & logical operations in 8051
Arithmetic & logical operations in 8051Arithmetic & logical operations in 8051
Arithmetic & logical operations in 8051Jay Patel
 
Logic gates
Logic gatesLogic gates
Logic gates
prasanna chitra
 
Conversion of number system
Conversion of number systemConversion of number system
Conversion of number system
University of Potsdam
 
1s and 2s complement
1s and 2s complement1s and 2s complement
1s and 2s complement
Then Murugeshwari
 
BINARY NUMBER SYSTEM
BINARY NUMBER SYSTEMBINARY NUMBER SYSTEM
BINARY NUMBER SYSTEM
Zaheer Abbasi
 
Number System
Number SystemNumber System
Number Systemitutor
 
08. Numeral Systems
08. Numeral Systems08. Numeral Systems
08. Numeral Systems
Intro C# Book
 
Number system
Number systemNumber system
Number system
Palash Sachan
 
number system
number systemnumber system
number systemvirly dwe
 
Logic gates
Logic gatesLogic gates
Decimal to binary number
Decimal to binary numberDecimal to binary number
Decimal to binary numberguestd8696a
 
Number System
Number SystemNumber System
Number System
samarthagrawal
 

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 intro

Introduction to CPU registers
Introduction to CPU registersIntroduction to CPU registers
Introduction to CPU registers
Muhammad Waqas
 
Register introduction
Register introductionRegister introduction
Register introduction
maamir farooq
 
SAQIB ALI.pptx
SAQIB ALI.pptxSAQIB ALI.pptx
SAQIB ALI.pptx
astik11
 
Registers
RegistersRegisters
Registers
waqar bashir
 
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
 
Register & flags
Register & flagsRegister & flags
Register & flags
fazli khaliq
 
Advanced micro -processor
Advanced micro -processorAdvanced micro -processor
Advanced micro -processor
Hinal Lunagariya
 
Microprocessor 8086 and Microcontoller
Microprocessor 8086 and MicrocontollerMicroprocessor 8086 and Microcontoller
Microprocessor 8086 and Microcontoller
Saad Tanvir
 
Chapter 2
Chapter 2Chapter 2
INTEL 8086 MP Architecture
INTEL 8086 MP ArchitectureINTEL 8086 MP Architecture
INTEL 8086 MP Architecture
Md. 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 Documentation
Adeel Rasheed
 
intel 8086 introduction
intel 8086 introductionintel 8086 introduction
intel 8086 introduction
Homoud Alsohaibi
 
Amp
AmpAmp
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-architecture
prasadpawaskar
 
8086 microprocessor
8086 microprocessor8086 microprocessor
8086 microprocessor
VEERA BOOPATHY E
 

Similar to Assembly language programming intro (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

Investor-Presentation-Q1FY2024 investor presentation document.pptx
Investor-Presentation-Q1FY2024 investor presentation document.pptxInvestor-Presentation-Q1FY2024 investor presentation document.pptx
Investor-Presentation-Q1FY2024 investor presentation document.pptx
AmarGB2
 
ML for identifying fraud using open blockchain data.pptx
ML for identifying fraud using open blockchain data.pptxML for identifying fraud using open blockchain data.pptx
ML for identifying fraud using open blockchain data.pptx
Vijay Dialani, PhD
 
Gen AI Study Jams _ For the GDSC Leads in India.pdf
Gen AI Study Jams _ For the GDSC Leads in India.pdfGen AI Study Jams _ For the GDSC Leads in India.pdf
Gen AI Study Jams _ For the GDSC Leads in India.pdf
gdsczhcet
 
Standard Reomte Control Interface - Neometrix
Standard Reomte Control Interface - NeometrixStandard Reomte Control Interface - Neometrix
Standard Reomte Control Interface - Neometrix
Neometrix_Engineering_Pvt_Ltd
 
DESIGN A COTTON SEED SEPARATION MACHINE.docx
DESIGN A COTTON SEED SEPARATION MACHINE.docxDESIGN A COTTON SEED SEPARATION MACHINE.docx
DESIGN A COTTON SEED SEPARATION MACHINE.docx
FluxPrime1
 
Final project report on grocery store management system..pdf
Final project report on grocery store management system..pdfFinal project report on grocery store management system..pdf
Final project report on grocery store management system..pdf
Kamal Acharya
 
Pile Foundation by Venkatesh Taduvai (Sub Geotechnical Engineering II)-conver...
Pile Foundation by Venkatesh Taduvai (Sub Geotechnical Engineering II)-conver...Pile Foundation by Venkatesh Taduvai (Sub Geotechnical Engineering II)-conver...
Pile Foundation by Venkatesh Taduvai (Sub Geotechnical Engineering II)-conver...
AJAYKUMARPUND1
 
一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单专业办理
一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单专业办理一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单专业办理
一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单专业办理
zwunae
 
power quality voltage fluctuation UNIT - I.pptx
power quality voltage fluctuation UNIT - I.pptxpower quality voltage fluctuation UNIT - I.pptx
power quality voltage fluctuation UNIT - I.pptx
ViniHema
 
Runway Orientation Based on the Wind Rose Diagram.pptx
Runway Orientation Based on the Wind Rose Diagram.pptxRunway Orientation Based on the Wind Rose Diagram.pptx
Runway Orientation Based on the Wind Rose Diagram.pptx
SupreethSP4
 
Nuclear Power Economics and Structuring 2024
Nuclear Power Economics and Structuring 2024Nuclear Power Economics and Structuring 2024
Nuclear Power Economics and Structuring 2024
Massimo Talia
 
Architectural Portfolio Sean Lockwood
Architectural Portfolio Sean LockwoodArchitectural Portfolio Sean Lockwood
Architectural Portfolio Sean Lockwood
seandesed
 
Hierarchical Digital Twin of a Naval Power System
Hierarchical Digital Twin of a Naval Power SystemHierarchical Digital Twin of a Naval Power System
Hierarchical Digital Twin of a Naval Power System
Kerry Sado
 
block diagram and signal flow graph representation
block diagram and signal flow graph representationblock diagram and signal flow graph representation
block diagram and signal flow graph representation
Divya Somashekar
 
Fundamentals of Electric Drives and its applications.pptx
Fundamentals of Electric Drives and its applications.pptxFundamentals of Electric Drives and its applications.pptx
Fundamentals of Electric Drives and its applications.pptx
manasideore6
 
CME397 Surface Engineering- Professional Elective
CME397 Surface Engineering- Professional ElectiveCME397 Surface Engineering- Professional Elective
CME397 Surface Engineering- Professional Elective
karthi keyan
 
The Benefits and Techniques of Trenchless Pipe Repair.pdf
The Benefits and Techniques of Trenchless Pipe Repair.pdfThe Benefits and Techniques of Trenchless Pipe Repair.pdf
The Benefits and Techniques of Trenchless Pipe Repair.pdf
Pipe Restoration Solutions
 
ethical hacking-mobile hacking methods.ppt
ethical hacking-mobile hacking methods.pptethical hacking-mobile hacking methods.ppt
ethical hacking-mobile hacking methods.ppt
Jayaprasanna4
 
AKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdf
AKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdfAKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdf
AKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdf
SamSarthak3
 
Railway Signalling Principles Edition 3.pdf
Railway Signalling Principles Edition 3.pdfRailway Signalling Principles Edition 3.pdf
Railway Signalling Principles Edition 3.pdf
TeeVichai
 

Recently uploaded (20)

Investor-Presentation-Q1FY2024 investor presentation document.pptx
Investor-Presentation-Q1FY2024 investor presentation document.pptxInvestor-Presentation-Q1FY2024 investor presentation document.pptx
Investor-Presentation-Q1FY2024 investor presentation document.pptx
 
ML for identifying fraud using open blockchain data.pptx
ML for identifying fraud using open blockchain data.pptxML for identifying fraud using open blockchain data.pptx
ML for identifying fraud using open blockchain data.pptx
 
Gen AI Study Jams _ For the GDSC Leads in India.pdf
Gen AI Study Jams _ For the GDSC Leads in India.pdfGen AI Study Jams _ For the GDSC Leads in India.pdf
Gen AI Study Jams _ For the GDSC Leads in India.pdf
 
Standard Reomte Control Interface - Neometrix
Standard Reomte Control Interface - NeometrixStandard Reomte Control Interface - Neometrix
Standard Reomte Control Interface - Neometrix
 
DESIGN A COTTON SEED SEPARATION MACHINE.docx
DESIGN A COTTON SEED SEPARATION MACHINE.docxDESIGN A COTTON SEED SEPARATION MACHINE.docx
DESIGN A COTTON SEED SEPARATION MACHINE.docx
 
Final project report on grocery store management system..pdf
Final project report on grocery store management system..pdfFinal project report on grocery store management system..pdf
Final project report on grocery store management system..pdf
 
Pile Foundation by Venkatesh Taduvai (Sub Geotechnical Engineering II)-conver...
Pile Foundation by Venkatesh Taduvai (Sub Geotechnical Engineering II)-conver...Pile Foundation by Venkatesh Taduvai (Sub Geotechnical Engineering II)-conver...
Pile Foundation by Venkatesh Taduvai (Sub Geotechnical Engineering II)-conver...
 
一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单专业办理
一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单专业办理一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单专业办理
一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单专业办理
 
power quality voltage fluctuation UNIT - I.pptx
power quality voltage fluctuation UNIT - I.pptxpower quality voltage fluctuation UNIT - I.pptx
power quality voltage fluctuation UNIT - I.pptx
 
Runway Orientation Based on the Wind Rose Diagram.pptx
Runway Orientation Based on the Wind Rose Diagram.pptxRunway Orientation Based on the Wind Rose Diagram.pptx
Runway Orientation Based on the Wind Rose Diagram.pptx
 
Nuclear Power Economics and Structuring 2024
Nuclear Power Economics and Structuring 2024Nuclear Power Economics and Structuring 2024
Nuclear Power Economics and Structuring 2024
 
Architectural Portfolio Sean Lockwood
Architectural Portfolio Sean LockwoodArchitectural Portfolio Sean Lockwood
Architectural Portfolio Sean Lockwood
 
Hierarchical Digital Twin of a Naval Power System
Hierarchical Digital Twin of a Naval Power SystemHierarchical Digital Twin of a Naval Power System
Hierarchical Digital Twin of a Naval Power System
 
block diagram and signal flow graph representation
block diagram and signal flow graph representationblock diagram and signal flow graph representation
block diagram and signal flow graph representation
 
Fundamentals of Electric Drives and its applications.pptx
Fundamentals of Electric Drives and its applications.pptxFundamentals of Electric Drives and its applications.pptx
Fundamentals of Electric Drives and its applications.pptx
 
CME397 Surface Engineering- Professional Elective
CME397 Surface Engineering- Professional ElectiveCME397 Surface Engineering- Professional Elective
CME397 Surface Engineering- Professional Elective
 
The Benefits and Techniques of Trenchless Pipe Repair.pdf
The Benefits and Techniques of Trenchless Pipe Repair.pdfThe Benefits and Techniques of Trenchless Pipe Repair.pdf
The Benefits and Techniques of Trenchless Pipe Repair.pdf
 
ethical hacking-mobile hacking methods.ppt
ethical hacking-mobile hacking methods.pptethical hacking-mobile hacking methods.ppt
ethical hacking-mobile hacking methods.ppt
 
AKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdf
AKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdfAKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdf
AKS UNIVERSITY Satna Final Year Project By OM Hardaha.pdf
 
Railway Signalling Principles Edition 3.pdf
Railway Signalling Principles Edition 3.pdfRailway Signalling Principles Edition 3.pdf
Railway Signalling Principles Edition 3.pdf
 

Assembly language programming intro

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