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

Recommended

Assembly Language Basics
Assembly Language Basics
Education Front
 
Advanced procedures in assembly language Full chapter ppt
Advanced procedures in assembly language Full chapter ppt
Muhammad Sikandar Mustafa
 
Assembly language programming
Assembly language programming
Gaurav Takrani
 
Lecture 4 assembly language
Lecture 4 assembly language
Pradeep Kumar TS
 
Assembly language part I
Assembly language part I
Mohammed A. Imran
 
Assembly Language -I
Assembly Language -I
Devika Rangnekar
 
Lec 04 intro assembly
Lec 04 intro assembly
Abdul Khan
 
Assembly 8086
Assembly 8086
Mustafa Salah
 
8086 assembly language
8086 assembly language
Mir Majid
 
system software 16 marks
system software 16 marks
vvcetit
 
Chapter 5 programming concepts iv
Chapter 5 programming concepts iv
SHREEHARI WADAWADAGI
 
Arrays and addressing modes
Arrays and addressing modes
Bilal Amjad
 
Two pass Assembler
Two pass Assembler
Satyamevjayte Haxor
 
Assembly language programming_fundamentals 8086
Assembly language programming_fundamentals 8086
Shehrevar Davierwala
 
Intermediate code- generation
Intermediate code- generation
rawan_z
 
8086 assembly
8086 assembly
Shehrevar Davierwala
 
Chapter 4 programming concepts III
Chapter 4 programming concepts III
SHREEHARI WADAWADAGI
 
Microprocessor 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 8086
Urvashi Singh
 
Addressing modes
Addressing modes
karthiga selvaraju
 
Code 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 ...
Bilal Amjad
 
Computer architecture instruction formats
Computer architecture instruction formats
Mazin Alwaaly
 
Chapter 1 archietecture of 8086
Chapter 1 archietecture of 8086
SHREEHARI WADAWADAGI
 
Chapter 2 programming concepts - I
Chapter 2 programming concepts - I
SHREEHARI WADAWADAGI
 
Compiler unit 4
Compiler unit 4
BBDITM LUCKNOW
 
Examinable Question and answer system programming
Examinable Question and answer system programming
Makerere university
 
MASM -UNIT-III
MASM -UNIT-III
Dr.YNM
 
Complement
Complement
Sudheesh S Madhav
 
Complements
Complements
Sudheesh S Madhav
 

More Related Content

What's hot (20)

8086 assembly language
8086 assembly language
Mir Majid
 
system software 16 marks
system software 16 marks
vvcetit
 
Chapter 5 programming concepts iv
Chapter 5 programming concepts iv
SHREEHARI WADAWADAGI
 
Arrays and addressing modes
Arrays and addressing modes
Bilal Amjad
 
Two pass Assembler
Two pass Assembler
Satyamevjayte Haxor
 
Assembly language programming_fundamentals 8086
Assembly language programming_fundamentals 8086
Shehrevar Davierwala
 
Intermediate code- generation
Intermediate code- generation
rawan_z
 
8086 assembly
8086 assembly
Shehrevar Davierwala
 
Chapter 4 programming concepts III
Chapter 4 programming concepts III
SHREEHARI WADAWADAGI
 
Microprocessor 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 8086
Urvashi Singh
 
Addressing modes
Addressing modes
karthiga selvaraju
 
Code 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 ...
Bilal Amjad
 
Computer architecture instruction formats
Computer architecture instruction formats
Mazin Alwaaly
 
Chapter 1 archietecture of 8086
Chapter 1 archietecture of 8086
SHREEHARI WADAWADAGI
 
Chapter 2 programming concepts - I
Chapter 2 programming concepts - I
SHREEHARI WADAWADAGI
 
Compiler unit 4
Compiler unit 4
BBDITM LUCKNOW
 
Examinable Question and answer system programming
Examinable Question and answer system programming
Makerere university
 
MASM -UNIT-III
MASM -UNIT-III
Dr.YNM
 
8086 assembly language
8086 assembly language
Mir Majid
 
system software 16 marks
system software 16 marks
vvcetit
 
Arrays and addressing modes
Arrays and addressing modes
Bilal Amjad
 
Assembly language programming_fundamentals 8086
Assembly language programming_fundamentals 8086
Shehrevar Davierwala
 
Intermediate code- generation
Intermediate code- generation
rawan_z
 
Chapter 4 programming concepts III
Chapter 4 programming concepts III
SHREEHARI WADAWADAGI
 
Microprocessor 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 8086
Urvashi Singh
 
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 formats
Mazin Alwaaly
 
Chapter 2 programming concepts - I
Chapter 2 programming concepts - I
SHREEHARI WADAWADAGI
 
Examinable Question and answer system programming
Examinable Question and answer system programming
Makerere university
 
MASM -UNIT-III
MASM -UNIT-III
Dr.YNM
 

Viewers also liked (20)

Complement
Complement
Sudheesh S Madhav
 
Complements
Complements
Sudheesh S Madhav
 
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 2015
An Ariyan
 
Binary arithmetic
Binary arithmetic
Elizabeth de Leon Aler
 
binary arithmetic rules
binary arithmetic rules
student
 
Introduction number systems and conversion
Introduction number systems and conversion
kanyuma jitjumnong
 
Arithmetic & logical operations in 8051
Arithmetic & logical operations in 8051
Jay Patel
 
Logic gates
Logic gates
prasanna chitra
 
Conversion of number system
Conversion of number system
University of Potsdam
 
Conversion binary to decimal
Conversion binary to decimal
Marizza Dizon Magallanes Jimenez
 
1s and 2s complement
1s and 2s complement
Then Murugeshwari
 
BINARY NUMBER SYSTEM
BINARY NUMBER SYSTEM
Zaheer Abbasi
 
Number System
Number System
itutor
 
08. Numeral Systems
08. Numeral Systems
Intro C# Book
 
Number system
Number system
Palash Sachan
 
number system
number system
virly dwe
 
Logic gates
Logic gates
School of Design Engineering Fashion & Technology (DEFT), University of Wales, Newport
 
Decimal to binary number
Decimal to binary number
guestd8696a
 
Number System
Number System
samarthagrawal
 
Ad

Similar to Assembly language programming intro (20)

Assembly language (Example with mapping from C++ to Assembly)
Assembly language (Example with mapping from C++ to Assembly)
Tish997
 
8086 Microprocessor
8086 Microprocessor
Md.Galib Hossain
 
programmer model and registers of 8086.ppt
programmer model and registers of 8086.ppt
shamimnasrin
 
Assembly Language and microprocessor
Assembly Language and microprocessor
Khaled Sany
 
8086 architecture
8086 architecture
karthiga selvaraju
 
Chapter 2
Chapter 2
Ramesh Rangaswamy
 
Microprocessor 8086 and Microcontoller
Microprocessor 8086 and Microcontoller
Saad Tanvir
 
N_Asm Assembly registers (sol)
N_Asm Assembly registers (sol)
Selomon birhane
 
Lecture_3.1 Registers.pptx....................
Lecture_3.1 Registers.pptx....................
XEON14
 
SAQIB ALI.pptx
SAQIB ALI.pptx
astik11
 
Microprocessor and assambly language programming
Microprocessor and assambly language programming
Shami Al Rahad
 
Introduction of 8086 micro processor .
Introduction of 8086 micro processor .
Siraj Ahmed
 
Arch 8086
Arch 8086
Mohansonale1
 
Register Organisation of 8086 Microprocessor
Register Organisation of 8086 Microprocessor
Nikhil Kumar
 
Register introduction
Register introduction
maamir farooq
 
8086 Microprocessor
8086 Microprocessor
Vijay Kumar
 
Introduction to CPU registers
Introduction to CPU registers
Muhammad Waqas
 
Flag registers (assembly language) with types and examples
Flag registers (assembly language) with types and examples
Computer_ at_home
 
Unit 3 assembler and processor
Unit 3 assembler and processor
Abha Damani
 
microprocessor and its application with practical gaining.ppt
microprocessor and its application with practical gaining.ppt
Prashantyelekar
 
Assembly language (Example with mapping from C++ to Assembly)
Assembly language (Example with mapping from C++ to Assembly)
Tish997
 
programmer model and registers of 8086.ppt
programmer model and registers of 8086.ppt
shamimnasrin
 
Assembly Language and microprocessor
Assembly Language and microprocessor
Khaled Sany
 
Microprocessor 8086 and Microcontoller
Microprocessor 8086 and Microcontoller
Saad Tanvir
 
N_Asm Assembly registers (sol)
N_Asm Assembly registers (sol)
Selomon birhane
 
Lecture_3.1 Registers.pptx....................
Lecture_3.1 Registers.pptx....................
XEON14
 
SAQIB ALI.pptx
SAQIB ALI.pptx
astik11
 
Microprocessor and assambly language programming
Microprocessor and assambly language programming
Shami Al Rahad
 
Introduction of 8086 micro processor .
Introduction of 8086 micro processor .
Siraj Ahmed
 
Register Organisation of 8086 Microprocessor
Register Organisation of 8086 Microprocessor
Nikhil Kumar
 
Register introduction
Register introduction
maamir farooq
 
8086 Microprocessor
8086 Microprocessor
Vijay Kumar
 
Introduction to CPU registers
Introduction to CPU registers
Muhammad Waqas
 
Flag registers (assembly language) with types and examples
Flag registers (assembly language) with types and examples
Computer_ at_home
 
Unit 3 assembler and processor
Unit 3 assembler and processor
Abha Damani
 
microprocessor and its application with practical gaining.ppt
microprocessor and its application with practical gaining.ppt
Prashantyelekar
 
Ad

Recently uploaded (20)

Introduction to sensing and Week-1.pptx
Introduction to sensing and Week-1.pptx
KNaveenKumarECE
 
MATERIAL SCIENCE LECTURE NOTES FOR DIPLOMA STUDENTS
MATERIAL SCIENCE LECTURE NOTES FOR DIPLOMA STUDENTS
SAMEER VISHWAKARMA
 
دراسة حاله لقرية تقع في جنوب غرب السودان
دراسة حاله لقرية تقع في جنوب غرب السودان
محمد قصص فتوتة
 
Rapid Prototyping for XR: Lecture 3 - Video and Paper Prototyping
Rapid Prototyping for XR: Lecture 3 - Video and Paper Prototyping
Mark Billinghurst
 
Deep Learning for Image Processing on 16 June 2025 MITS.pptx
Deep Learning for Image Processing on 16 June 2025 MITS.pptx
resming1
 
20CE404-Soil Mechanics - Slide Share PPT
20CE404-Soil Mechanics - Slide Share PPT
saravananr808639
 
Modern multi-proposer consensus implementations
Modern multi-proposer consensus implementations
François Garillot
 
Structured Programming with C++ :: Kjell Backman
Structured Programming with C++ :: Kjell Backman
Shabista Imam
 
System design handwritten notes guidance
System design handwritten notes guidance
Shabista Imam
 
Rapid Prototyping for XR: Lecture 1 Introduction to Prototyping
Rapid Prototyping for XR: Lecture 1 Introduction to Prototyping
Mark Billinghurst
 
Rapid Prototyping for XR: Lecture 4 - High Level Prototyping.
Rapid Prototyping for XR: Lecture 4 - High Level Prototyping.
Mark Billinghurst
 
Call For Papers - 17th International Conference on Wireless & Mobile Networks...
Call For Papers - 17th International Conference on Wireless & Mobile Networks...
hosseinihamid192023
 
machine learning is a advance technology
machine learning is a advance technology
ynancy893
 
Complete University of Calculus :: 2nd edition
Complete University of Calculus :: 2nd edition
Shabista Imam
 
Generative AI & Scientific Research : Catalyst for Innovation, Ethics & Impact
Generative AI & Scientific Research : Catalyst for Innovation, Ethics & Impact
AlqualsaDIResearchGr
 
Tally.ERP 9 at a Glance.book - Tally Solutions .pdf
Tally.ERP 9 at a Glance.book - Tally Solutions .pdf
Shabista Imam
 
Proposal for folders structure division in projects.pdf
Proposal for folders structure division in projects.pdf
Mohamed Ahmed
 
Structural Wonderers_new and ancient.pptx
Structural Wonderers_new and ancient.pptx
nikopapa113
 
Microwatt: Open Tiny Core, Big Possibilities
Microwatt: Open Tiny Core, Big Possibilities
IBM
 
Data Structures Module 3 Binary Trees Binary Search Trees Tree Traversals AVL...
Data Structures Module 3 Binary Trees Binary Search Trees Tree Traversals AVL...
resming1
 
Introduction to sensing and Week-1.pptx
Introduction to sensing and Week-1.pptx
KNaveenKumarECE
 
MATERIAL SCIENCE LECTURE NOTES FOR DIPLOMA STUDENTS
MATERIAL SCIENCE LECTURE NOTES FOR DIPLOMA STUDENTS
SAMEER VISHWAKARMA
 
دراسة حاله لقرية تقع في جنوب غرب السودان
دراسة حاله لقرية تقع في جنوب غرب السودان
محمد قصص فتوتة
 
Rapid Prototyping for XR: Lecture 3 - Video and Paper Prototyping
Rapid Prototyping for XR: Lecture 3 - Video and Paper Prototyping
Mark Billinghurst
 
Deep Learning for Image Processing on 16 June 2025 MITS.pptx
Deep Learning for Image Processing on 16 June 2025 MITS.pptx
resming1
 
20CE404-Soil Mechanics - Slide Share PPT
20CE404-Soil Mechanics - Slide Share PPT
saravananr808639
 
Modern multi-proposer consensus implementations
Modern multi-proposer consensus implementations
François Garillot
 
Structured Programming with C++ :: Kjell Backman
Structured Programming with C++ :: Kjell Backman
Shabista Imam
 
System design handwritten notes guidance
System design handwritten notes guidance
Shabista Imam
 
Rapid Prototyping for XR: Lecture 1 Introduction to Prototyping
Rapid Prototyping for XR: Lecture 1 Introduction to Prototyping
Mark Billinghurst
 
Rapid Prototyping for XR: Lecture 4 - High Level Prototyping.
Rapid Prototyping for XR: Lecture 4 - High Level Prototyping.
Mark Billinghurst
 
Call For Papers - 17th International Conference on Wireless & Mobile Networks...
Call For Papers - 17th International Conference on Wireless & Mobile Networks...
hosseinihamid192023
 
machine learning is a advance technology
machine learning is a advance technology
ynancy893
 
Complete University of Calculus :: 2nd edition
Complete University of Calculus :: 2nd edition
Shabista Imam
 
Generative AI & Scientific Research : Catalyst for Innovation, Ethics & Impact
Generative AI & Scientific Research : Catalyst for Innovation, Ethics & Impact
AlqualsaDIResearchGr
 
Tally.ERP 9 at a Glance.book - Tally Solutions .pdf
Tally.ERP 9 at a Glance.book - Tally Solutions .pdf
Shabista Imam
 
Proposal for folders structure division in projects.pdf
Proposal for folders structure division in projects.pdf
Mohamed Ahmed
 
Structural Wonderers_new and ancient.pptx
Structural Wonderers_new and ancient.pptx
nikopapa113
 
Microwatt: Open Tiny Core, Big Possibilities
Microwatt: Open Tiny Core, Big Possibilities
IBM
 
Data Structures Module 3 Binary Trees Binary Search Trees Tree Traversals AVL...
Data Structures Module 3 Binary Trees Binary Search Trees Tree Traversals AVL...
resming1
 

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