SlideShare a Scribd company logo
5
Most read
13
Most read
14
Most read
Assembly Language
Introduction
 Each family of processors has its own set of instructions,
These set of instructions are called 'machine language
instructions.
 A processor understands only machine language
instructions, which are strings of 1's and 0's. However,
machine language is too obscure and complex for using in
software development. So, the low-level ASSEMBLY
LANGUAGE is designed for a specific family of processors
that represents various instructions in symbolic code and a
more understandable form.
Advantages of using Assembly Language
 It requires less memory and execution time;
 It allows hardware-specific complex jobs in an easier way
 It is suitable for time-critical jobs
 It is most suitable for writing interrupt service routines
and other memory resident programs.
Assembly Language - Basic Syntax
An assembly program can be divided into three sections:
 The DATA section is used for declaring initialized data or constants.
This data does not change at runtime. You can declare various
constant values, file names, or buffer size, etc., in this section.
 The BSS section is used for declaring variables.
 The TEXT section is used for keeping the actual code. This section
must begin with the declaration global _start, which tells the kernel
where the program execution begins.
Syntax of Assembly Language Statements
Assembly language statements are entered one statement per line. Each
statement follows the following format:
Following are some examples of typical assembly language statements:
Registers
 General registers
 Control registers
 Segment registers
 Data registers
 Pointer registers
 Index registers
Data Register
 AX is the primary accumulator − It is used in input/output and most
arithmetic instructions. For example, in multiplication operation, one
operand is stored in EAX or AX or AL register according to the size of
the operand.
 BX is known as the base register − As it could be used in indexed
addressing.
 CX is known as the count register − As the ECX, CX registers store
the loop count in iterative operations.
 DX is known as the data register − It is also used in input/output
operations. It is also used with AX register along with DX for multiply
and divide operations involving large values.
Pointer Registers
 Instruction Pointer (IP) − The 16-bit IP register stores the offset
address of the next instruction to be executed.
 Stack Pointer (SP) − The 16-bit SP register provides the offset value
within the program stack.
 Base Pointer (BP) − The 16-bit BP register mainly helps in referencing
the parameter variables passed to a subroutine.
Index Registers
 Source Index (SI) − It is used as source index for string operations.
 Destination Index (DI) − It is used as destination index for string
operations.
Flag Registers
The FLAGs register is the status register in microprocessors that contains the
current state of the processor:
 Overflow Flag (OF) - It indicates the overflow of a high-order bit
(leftmost bit) of data after a signed arithmetic operation.
 Direction Flag (DF) - It determines left or right direction for moving or
comparing string data
 Interrupt Flag (IF) - It determines whether the external interrupts like
keyboard entry, etc., are to be ignored or processed.
 Sign Flag (SF) - It shows the sign of the result of an arithmetic operation
Flag Registers Continue…
 Zero Flag (ZF) - It indicates the result of an arithmetic or comparison
operation
 Auxiliary Carry Flag (AF) - It contains the carry from bit 3 to bit 4 following
an arithmetic operation; used for specialized arithmetic
 Parity Flag (PF) - It indicates the total number of 1-bits in the result
obtained from an arithmetic operation
 Carry Flag (CF) - It contains the carry of 0 or 1 from a high-order bit
(leftmost) after an arithmetic operation.
Assembly - Conditions
 Unconditional jump − This is performed by the JMP instruction.
Conditional execution often involves a transfer of control to the
address of an instruction that does not follow the currently executing
instruction. Transfer of control may be forward, to execute a new set
of instructions or backward, to re-execute the same steps.
 Conditional jump − This is performed by a set of jump instructions
j<condition> depending upon the condition. The conditional
instructions transfer the control by breaking the sequential flow and
they do it by changing the offset value in IP.
Example
C++ language Code
Assembly language Code
Example
English Term: Assigned the Result of sum of A multiplied by B plus 10.
High-Level Language: Result = A * B + 10
Intel Assembly Language:
mov eax, A
mul B
add eax, 10
mov Result, eax
Intel Machine Language:
A1 00404000
F7 25 00404004
83 C0 0A
A3 00404008
Thank You !!!

More Related Content

PPTX
Types Of Buses
PPTX
Assembly Language
PPTX
Assembly language
PPTX
Computer Organisation & Architecture (chapter 1)
PPTX
arithmetic logic unit
PPTX
Memory interfacing
PPT
8086 pin details
PPTX
Input Output Organization
Types Of Buses
Assembly Language
Assembly language
Computer Organisation & Architecture (chapter 1)
arithmetic logic unit
Memory interfacing
8086 pin details
Input Output Organization

What's hot (20)

PPTX
Interrupts
PDF
CS4109 Computer System Architecture
PPTX
Von neumann architecture
PPTX
Timing and control
PPTX
priority interrupt computer organization
PPTX
Types of rom
PPTX
8155 Basic Concepts
PPT
Data transfer instruction set of 8085 micro processor
PPT
Fetch decode-execute presentation
PPTX
bus and memory tranfer (computer organaization)
PPT
Computer function-and-interconnection 3
PDF
Von Neumann Architecture
PPTX
Instruction cycle presentation
PPT
Virtual memory
PPTX
Instruction Set Architecture
PPTX
Timing Diagram.pptx
PPTX
Microprocessor Presentation
PPTX
Memory Organization
PPT
Program control
PPTX
Microprocessor based software developnent
Interrupts
CS4109 Computer System Architecture
Von neumann architecture
Timing and control
priority interrupt computer organization
Types of rom
8155 Basic Concepts
Data transfer instruction set of 8085 micro processor
Fetch decode-execute presentation
bus and memory tranfer (computer organaization)
Computer function-and-interconnection 3
Von Neumann Architecture
Instruction cycle presentation
Virtual memory
Instruction Set Architecture
Timing Diagram.pptx
Microprocessor Presentation
Memory Organization
Program control
Microprocessor based software developnent
Ad

Similar to Assembly language (Example with mapping from C++ to Assembly) (20)

DOCX
Microprocessor
PPT
Unit 3 assembler and processor
DOCX
Introduction to CPU registers
PDF
N_Asm Assembly registers (sol)
PPTX
Introduction to Operating Systems
PPT
intel 8086 introduction
PPTX
2ProgrammerViewOfComputerAndInstructionCycle.pptx
DOCX
Assembly language
PPTX
Lecture_about spm and related issues 3_COAL.pptx
PPT
Assembly language programming(unit 4)
PPT
microprocessor
PPTX
Register introduction
PPTX
Coal (1)
DOCX
Computer Organization and 8085 microprocessor notes
PPTX
Lecture_3.1 Registers.pptx....................
PPTX
Introduction to Assembly Language
PPTX
Microprocessor 8086 and Microcontoller
PPTX
Assembly language.pptx
PPTX
X86 operation types
PPTX
Microprocessor
Unit 3 assembler and processor
Introduction to CPU registers
N_Asm Assembly registers (sol)
Introduction to Operating Systems
intel 8086 introduction
2ProgrammerViewOfComputerAndInstructionCycle.pptx
Assembly language
Lecture_about spm and related issues 3_COAL.pptx
Assembly language programming(unit 4)
microprocessor
Register introduction
Coal (1)
Computer Organization and 8085 microprocessor notes
Lecture_3.1 Registers.pptx....................
Introduction to Assembly Language
Microprocessor 8086 and Microcontoller
Assembly language.pptx
X86 operation types
Ad

More from Tish997 (10)

PPTX
2 3 Trees Algorithm - Data Structure
PPTX
Assembly language (Example with mapping from C++ to Assembly)
PPTX
Hermes 2.1 Ransomware (Malware)
PPTX
JS Bank (Evaluation of the Performance Appraisal System)
PPTX
Energy Core Ecx - 2000 Processor
PPT
Transition words - English
PPT
Parts of Report - English Presentation
PPTX
Theory of expectancy
PPTX
Online vehicle showroom DB project
PPTX
Bayes rule (Bayes Law)
2 3 Trees Algorithm - Data Structure
Assembly language (Example with mapping from C++ to Assembly)
Hermes 2.1 Ransomware (Malware)
JS Bank (Evaluation of the Performance Appraisal System)
Energy Core Ecx - 2000 Processor
Transition words - English
Parts of Report - English Presentation
Theory of expectancy
Online vehicle showroom DB project
Bayes rule (Bayes Law)

Recently uploaded (20)

PPTX
Microbial diseases, their pathogenesis and prophylaxis
PDF
102 student loan defaulters named and shamed – Is someone you know on the list?
PDF
Origin of periodic table-Mendeleev’s Periodic-Modern Periodic table
PDF
Saundersa Comprehensive Review for the NCLEX-RN Examination.pdf
PPTX
Pharmacology of Heart Failure /Pharmacotherapy of CHF
PPTX
Week 4 Term 3 Study Techniques revisited.pptx
PDF
Pre independence Education in Inndia.pdf
PPTX
Pharma ospi slides which help in ospi learning
PPTX
The Healthy Child – Unit II | Child Health Nursing I | B.Sc Nursing 5th Semester
PPTX
Cell Types and Its function , kingdom of life
PDF
Business Ethics Teaching Materials for college
PDF
01-Introduction-to-Information-Management.pdf
PDF
RMMM.pdf make it easy to upload and study
PDF
STATICS OF THE RIGID BODIES Hibbelers.pdf
PDF
Module 4: Burden of Disease Tutorial Slides S2 2025
PDF
Chapter 2 Heredity, Prenatal Development, and Birth.pdf
PDF
Abdominal Access Techniques with Prof. Dr. R K Mishra
PDF
Anesthesia in Laparoscopic Surgery in India
PDF
Basic Mud Logging Guide for educational purpose
PPTX
Final Presentation General Medicine 03-08-2024.pptx
Microbial diseases, their pathogenesis and prophylaxis
102 student loan defaulters named and shamed – Is someone you know on the list?
Origin of periodic table-Mendeleev’s Periodic-Modern Periodic table
Saundersa Comprehensive Review for the NCLEX-RN Examination.pdf
Pharmacology of Heart Failure /Pharmacotherapy of CHF
Week 4 Term 3 Study Techniques revisited.pptx
Pre independence Education in Inndia.pdf
Pharma ospi slides which help in ospi learning
The Healthy Child – Unit II | Child Health Nursing I | B.Sc Nursing 5th Semester
Cell Types and Its function , kingdom of life
Business Ethics Teaching Materials for college
01-Introduction-to-Information-Management.pdf
RMMM.pdf make it easy to upload and study
STATICS OF THE RIGID BODIES Hibbelers.pdf
Module 4: Burden of Disease Tutorial Slides S2 2025
Chapter 2 Heredity, Prenatal Development, and Birth.pdf
Abdominal Access Techniques with Prof. Dr. R K Mishra
Anesthesia in Laparoscopic Surgery in India
Basic Mud Logging Guide for educational purpose
Final Presentation General Medicine 03-08-2024.pptx

Assembly language (Example with mapping from C++ to Assembly)

  • 2. Introduction  Each family of processors has its own set of instructions, These set of instructions are called 'machine language instructions.  A processor understands only machine language instructions, which are strings of 1's and 0's. However, machine language is too obscure and complex for using in software development. So, the low-level ASSEMBLY LANGUAGE is designed for a specific family of processors that represents various instructions in symbolic code and a more understandable form.
  • 3. Advantages of using Assembly Language  It requires less memory and execution time;  It allows hardware-specific complex jobs in an easier way  It is suitable for time-critical jobs  It is most suitable for writing interrupt service routines and other memory resident programs.
  • 4. Assembly Language - Basic Syntax An assembly program can be divided into three sections:  The DATA section is used for declaring initialized data or constants. This data does not change at runtime. You can declare various constant values, file names, or buffer size, etc., in this section.  The BSS section is used for declaring variables.  The TEXT section is used for keeping the actual code. This section must begin with the declaration global _start, which tells the kernel where the program execution begins.
  • 5. Syntax of Assembly Language Statements Assembly language statements are entered one statement per line. Each statement follows the following format: Following are some examples of typical assembly language statements:
  • 6. Registers  General registers  Control registers  Segment registers  Data registers  Pointer registers  Index registers
  • 7. Data Register  AX is the primary accumulator − It is used in input/output and most arithmetic instructions. For example, in multiplication operation, one operand is stored in EAX or AX or AL register according to the size of the operand.  BX is known as the base register − As it could be used in indexed addressing.  CX is known as the count register − As the ECX, CX registers store the loop count in iterative operations.  DX is known as the data register − It is also used in input/output operations. It is also used with AX register along with DX for multiply and divide operations involving large values.
  • 8. Pointer Registers  Instruction Pointer (IP) − The 16-bit IP register stores the offset address of the next instruction to be executed.  Stack Pointer (SP) − The 16-bit SP register provides the offset value within the program stack.  Base Pointer (BP) − The 16-bit BP register mainly helps in referencing the parameter variables passed to a subroutine.
  • 9. Index Registers  Source Index (SI) − It is used as source index for string operations.  Destination Index (DI) − It is used as destination index for string operations.
  • 10. Flag Registers The FLAGs register is the status register in microprocessors that contains the current state of the processor:  Overflow Flag (OF) - It indicates the overflow of a high-order bit (leftmost bit) of data after a signed arithmetic operation.  Direction Flag (DF) - It determines left or right direction for moving or comparing string data  Interrupt Flag (IF) - It determines whether the external interrupts like keyboard entry, etc., are to be ignored or processed.  Sign Flag (SF) - It shows the sign of the result of an arithmetic operation
  • 11. Flag Registers Continue…  Zero Flag (ZF) - It indicates the result of an arithmetic or comparison operation  Auxiliary Carry Flag (AF) - It contains the carry from bit 3 to bit 4 following an arithmetic operation; used for specialized arithmetic  Parity Flag (PF) - It indicates the total number of 1-bits in the result obtained from an arithmetic operation  Carry Flag (CF) - It contains the carry of 0 or 1 from a high-order bit (leftmost) after an arithmetic operation.
  • 12. Assembly - Conditions  Unconditional jump − This is performed by the JMP instruction. Conditional execution often involves a transfer of control to the address of an instruction that does not follow the currently executing instruction. Transfer of control may be forward, to execute a new set of instructions or backward, to re-execute the same steps.  Conditional jump − This is performed by a set of jump instructions j<condition> depending upon the condition. The conditional instructions transfer the control by breaking the sequential flow and they do it by changing the offset value in IP.
  • 14. Example English Term: Assigned the Result of sum of A multiplied by B plus 10. High-Level Language: Result = A * B + 10 Intel Assembly Language: mov eax, A mul B add eax, 10 mov Result, eax Intel Machine Language: A1 00404000 F7 25 00404004 83 C0 0A A3 00404008

Editor's Notes

  • #3: Each personal computer has a microprocessor that manages the computer's arithmetical, logical, and control activities. for handling various operations such as getting input from keyboard, displaying information on screen and performing various other jobs.