SlideShare a Scribd company logo
2
Most read
9
Most read
10
Most read
Assembly language
What is Assembly Language?
Each personal computer has a microprocessor that manages the
computer's arithmetical, logical, and control activities.
Each family of processors has its own set of instructions for
handling various operations such as getting input from keyboard,
displaying information on screen and performing various other jobs.
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.
Assembly language
Why is ASM useful?
Machine language is just a series of numbers, which is not easy for
humans to read. Using ASM, programmers can write human-
readable programs that correspond almost exactly to machine
language.
The disadvantage is that everything the computer does must be
described explicitly, in precise detail. The advantage is that the
programmer has maximum control over what the computer is
doing.
Why is ASM a "low-level" language?
Assembly is called a low-level programming language because
there is (nearly) a one-to-one relationship between what it tells
the computer to do, and what the computer does. In general, one
line of an assembly program contains a maximum of one
instruction for the computer.
Assembly language
How is ASM different from a "high-level" language?
High-level languages provide abstractions of low-level operations
which allow the programmer to focus more on describing what
they want to do, and less on how it should be done. Programming
this way is more convenient and makes programs easier to read at
the sacrifice of low-level control.
Is ASM portable?
No. Because assembly languages are tied to one specific computer
architecture, they are not portable. A program written in one
assembly language would need to be completely rewritten for it to
run on another type of machine.
Assembly language
Advantages of Assembly Language
Having an understanding of assembly language makes one
aware of −
How programs interface with OS, processor, and BIOS;
How data is represented in memory and other external devices;
How the processor accesses and executes instruction;
How instructions access and process data;
How a program accesses external devices.
Other advantages of using assembly language are −
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
An assembly language program can be divided into 3 sections:-
The data section
The bss section
The text section
The data Section
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 syntax for declaring data section is −
section.data
The bss Section
The bss section is used for declaring variables. The syntax for
declaring bss section is −
section.bss
Assembly language
The text section
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.
The syntax for declaring text section is −
section.text global _start _start:
how it works:
Most computers come with a specified set of very basic
instructions that correspond to the basic machine operations that
the computer can perform. For example, a "Load" instruction
causes the processor to move a string of bits from a location in the
processor's memory to a special holding place called a register.
Assembly language
Assuming the processor has at least eight registers, each
numbered, the following instruction would move the value (string
of bits of a certain length) at memory location 3000 into the
holding place called register 8:
 The programmer can write a program using a sequence of these
assembler instructions.
This sequence of assembler instructions, known as the
source code or source program, is then specified to the assembler
program when that program is started.
The assembler program takes each program statement in the
source program and generates a corresponding bit stream or
pattern (a series of 0's and 1's of a given length).
L 8,3000
Assembly language
The output of the assembler program is called the object code or
object program relative to the input source program. The
sequence of 0's and 1's that constitute the object program is
sometimes called machine code.
The object program can then be run (or executed) whenever
desired.
Assembler
An assembler is a program that takes basic computer instructions
and converts them into a pattern of bits that the
computer's processor can use to perform its basic operations.
Some people call these instructions assembler language and
others use the term assembly language.
Assembly language
While assembly languages differ between processor architectures, they often
include similar instructions and operators. Below are some examples of
instructions supported by x86 processors.
• MOV - move data from one location to another
• ADD - add two values
• SUB - subtract a value from another value
• PUSH - push data onto a stack
• POP - pop data from a stack
• JMP - jump to another location
• INT - interrupt a process
the following assembly language can be used to add the numbers 3 and 4:
mov eax, 3 - loads 3 into the register "eax"
mov ebx, 4 - loads 4 into the register "ebx"
add eax, ebx, ecx - adds "eax" and "ebx" and stores the result (7) in "ecx"
Assembly language
limitations of assembly language
• No Symbolic names for memory locations. You need to keep track of the exact
memory location that a piece of data is stored. That is, you must manipulate
memory locations directly.
• Hard to read. Although we've made a few improvements by eliminating hex
code, the command names are not always clear.
• Code is still machine dependent. We haven't really moved that far away from
the machine language - just put psuedo-English labels on it. We still need to
rewrite every piece of code for every machine.
• Hard to maintain and debug. Finding mistakes in machine code is difficult.
Correcting them or adding new features can also be a challenge.
• Code must be heavily documented. It's very difficult (if not impossible) to figure
out what a program does by reading the code. Detailed explanation must be
prepared for future coders (including the original programmer) who need to
modify or use the code.

More Related Content

PPTX
Assembly Language
PPTX
Computer architecture virtual memory
PPTX
Newton’s Forward & backward interpolation
PPT
Time management
PPTX
Time management
PPTX
Time Management
PPT
Unit 1 introduction to data structure
PPT
High level and Low level Language
Assembly Language
Computer architecture virtual memory
Newton’s Forward & backward interpolation
Time management
Time management
Time Management
Unit 1 introduction to data structure
High level and Low level Language

What's hot (20)

PDF
Computer organization memory
PPTX
Basic Computer Organization and Design
PPTX
The Basic Organization of Computers
PPTX
Part I:Introduction to assembly language
PPTX
computer Architecture
PPTX
Cache memory and virtual memory
PPTX
Architecture of 8085 microprocessor
PPTX
Computer organization
PPTX
Program control instructions
PPTX
Computer registers
PPTX
Presentation on Transmission Media
PPTX
DMA and DMA controller
PPT
Functional units of computer
PPTX
Memory organization (Computer architecture)
PPTX
Assembly language
PPT
mano.ppt
PPTX
Flag Registers (Assembly Language)
PPTX
Magnetic Disk
PDF
Introduction to Bus | Address, Data, Control Bus
PPTX
RISC - Reduced Instruction Set Computing
Computer organization memory
Basic Computer Organization and Design
The Basic Organization of Computers
Part I:Introduction to assembly language
computer Architecture
Cache memory and virtual memory
Architecture of 8085 microprocessor
Computer organization
Program control instructions
Computer registers
Presentation on Transmission Media
DMA and DMA controller
Functional units of computer
Memory organization (Computer architecture)
Assembly language
mano.ppt
Flag Registers (Assembly Language)
Magnetic Disk
Introduction to Bus | Address, Data, Control Bus
RISC - Reduced Instruction Set Computing
Ad

Similar to Assembly language (20)

PPT
Lec 01 basic concepts
PPTX
ASSEMBLY LANGUAGE.pptx
PDF
microprocesser-140306112352-phpapp01.pdf
PPTX
2ProgrammerViewOfComputerAndInstructionCycle.pptx
PPTX
Assembly chapter One.pptx
PPT
Assembly
PPTX
Introduction to Assembly Language Programming
DOCX
1 Describe different types of Assemblers.Assembly language.docx
PPTX
Insight into progam execution ppt
PPT
Assembly language programming(unit 4)
PPT
Assembly Langauge Assembly Langauge Assembly Langauge
PDF
Module4.pdf ,...................................
PDF
Chapter1.pdf
PPTX
PDF
2 Programming Language.pdf
PPT
Perfect papers software
PPT
Computer languages
DOCX
64-bit Assembly language program to Accept and display numbers.docx
PPTX
02_Intro to Programming Language.pptx
PPTX
Block diagram (computer programming & utilization)
Lec 01 basic concepts
ASSEMBLY LANGUAGE.pptx
microprocesser-140306112352-phpapp01.pdf
2ProgrammerViewOfComputerAndInstructionCycle.pptx
Assembly chapter One.pptx
Assembly
Introduction to Assembly Language Programming
1 Describe different types of Assemblers.Assembly language.docx
Insight into progam execution ppt
Assembly language programming(unit 4)
Assembly Langauge Assembly Langauge Assembly Langauge
Module4.pdf ,...................................
Chapter1.pdf
2 Programming Language.pdf
Perfect papers software
Computer languages
64-bit Assembly language program to Accept and display numbers.docx
02_Intro to Programming Language.pptx
Block diagram (computer programming & utilization)
Ad

More from gaurav jain (20)

PPT
High level languages representation
PPT
Basic ops concept of comp
PPT
Stored program concept
PPT
Programming languages
PPTX
Comprehensive interventions
PPTX
Personal intervention
PPTX
Od interventions
PPTX
Interpersonal and group process interventions
PPTX
Organizational effectiveness
PPTX
Organizational change and development
PPTX
Definition and nature of organizational development
PPTX
Change agent
PPTX
Service sector and economic, growth
PPTX
Service concept, characteristic and classification
PPTX
Relationship marketing concept, process and importance
PPTX
Marketing for non profit organizations
PPTX
Creating and delivering services
PPTX
Securing the e marketing site
PPTX
Ongoing customer communication in e marketing
PPTX
Ethics of electronic marketing
High level languages representation
Basic ops concept of comp
Stored program concept
Programming languages
Comprehensive interventions
Personal intervention
Od interventions
Interpersonal and group process interventions
Organizational effectiveness
Organizational change and development
Definition and nature of organizational development
Change agent
Service sector and economic, growth
Service concept, characteristic and classification
Relationship marketing concept, process and importance
Marketing for non profit organizations
Creating and delivering services
Securing the e marketing site
Ongoing customer communication in e marketing
Ethics of electronic marketing

Recently uploaded (20)

PDF
2.FourierTransform-ShortQuestionswithAnswers.pdf
PPTX
IMMUNITY IMMUNITY refers to protection against infection, and the immune syst...
PPTX
Week 4 Term 3 Study Techniques revisited.pptx
PDF
Anesthesia in Laparoscopic Surgery in India
PDF
O5-L3 Freight Transport Ops (International) V1.pdf
PDF
Chapter 2 Heredity, Prenatal Development, and Birth.pdf
PPTX
GDM (1) (1).pptx small presentation for students
PPTX
PPH.pptx obstetrics and gynecology in nursing
PDF
The Final Stretch: How to Release a Game and Not Die in the Process.
PPTX
Open Quiz Monsoon Mind Game Prelims.pptx
PPTX
human mycosis Human fungal infections are called human mycosis..pptx
PDF
Insiders guide to clinical Medicine.pdf
PPTX
Open Quiz Monsoon Mind Game Final Set.pptx
PDF
Abdominal Access Techniques with Prof. Dr. R K Mishra
PDF
Business Ethics Teaching Materials for college
PDF
Microbial disease of the cardiovascular and lymphatic systems
PDF
Basic Mud Logging Guide for educational purpose
PPTX
Renaissance Architecture: A Journey from Faith to Humanism
PPTX
Pharmacology of Heart Failure /Pharmacotherapy of CHF
PDF
O7-L3 Supply Chain Operations - ICLT Program
2.FourierTransform-ShortQuestionswithAnswers.pdf
IMMUNITY IMMUNITY refers to protection against infection, and the immune syst...
Week 4 Term 3 Study Techniques revisited.pptx
Anesthesia in Laparoscopic Surgery in India
O5-L3 Freight Transport Ops (International) V1.pdf
Chapter 2 Heredity, Prenatal Development, and Birth.pdf
GDM (1) (1).pptx small presentation for students
PPH.pptx obstetrics and gynecology in nursing
The Final Stretch: How to Release a Game and Not Die in the Process.
Open Quiz Monsoon Mind Game Prelims.pptx
human mycosis Human fungal infections are called human mycosis..pptx
Insiders guide to clinical Medicine.pdf
Open Quiz Monsoon Mind Game Final Set.pptx
Abdominal Access Techniques with Prof. Dr. R K Mishra
Business Ethics Teaching Materials for college
Microbial disease of the cardiovascular and lymphatic systems
Basic Mud Logging Guide for educational purpose
Renaissance Architecture: A Journey from Faith to Humanism
Pharmacology of Heart Failure /Pharmacotherapy of CHF
O7-L3 Supply Chain Operations - ICLT Program

Assembly language

  • 1. Assembly language What is Assembly Language? Each personal computer has a microprocessor that manages the computer's arithmetical, logical, and control activities. Each family of processors has its own set of instructions for handling various operations such as getting input from keyboard, displaying information on screen and performing various other jobs. 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.
  • 2. Assembly language Why is ASM useful? Machine language is just a series of numbers, which is not easy for humans to read. Using ASM, programmers can write human- readable programs that correspond almost exactly to machine language. The disadvantage is that everything the computer does must be described explicitly, in precise detail. The advantage is that the programmer has maximum control over what the computer is doing. Why is ASM a "low-level" language? Assembly is called a low-level programming language because there is (nearly) a one-to-one relationship between what it tells the computer to do, and what the computer does. In general, one line of an assembly program contains a maximum of one instruction for the computer.
  • 3. Assembly language How is ASM different from a "high-level" language? High-level languages provide abstractions of low-level operations which allow the programmer to focus more on describing what they want to do, and less on how it should be done. Programming this way is more convenient and makes programs easier to read at the sacrifice of low-level control. Is ASM portable? No. Because assembly languages are tied to one specific computer architecture, they are not portable. A program written in one assembly language would need to be completely rewritten for it to run on another type of machine.
  • 4. Assembly language Advantages of Assembly Language Having an understanding of assembly language makes one aware of − How programs interface with OS, processor, and BIOS; How data is represented in memory and other external devices; How the processor accesses and executes instruction; How instructions access and process data; How a program accesses external devices. Other advantages of using assembly language are − 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.
  • 5. Assembly language An assembly language program can be divided into 3 sections:- The data section The bss section The text section The data Section 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 syntax for declaring data section is − section.data The bss Section The bss section is used for declaring variables. The syntax for declaring bss section is − section.bss
  • 6. Assembly language The text section 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. The syntax for declaring text section is − section.text global _start _start: how it works: Most computers come with a specified set of very basic instructions that correspond to the basic machine operations that the computer can perform. For example, a "Load" instruction causes the processor to move a string of bits from a location in the processor's memory to a special holding place called a register.
  • 7. Assembly language Assuming the processor has at least eight registers, each numbered, the following instruction would move the value (string of bits of a certain length) at memory location 3000 into the holding place called register 8:  The programmer can write a program using a sequence of these assembler instructions. This sequence of assembler instructions, known as the source code or source program, is then specified to the assembler program when that program is started. The assembler program takes each program statement in the source program and generates a corresponding bit stream or pattern (a series of 0's and 1's of a given length). L 8,3000
  • 8. Assembly language The output of the assembler program is called the object code or object program relative to the input source program. The sequence of 0's and 1's that constitute the object program is sometimes called machine code. The object program can then be run (or executed) whenever desired. Assembler An assembler is a program that takes basic computer instructions and converts them into a pattern of bits that the computer's processor can use to perform its basic operations. Some people call these instructions assembler language and others use the term assembly language.
  • 9. Assembly language While assembly languages differ between processor architectures, they often include similar instructions and operators. Below are some examples of instructions supported by x86 processors. • MOV - move data from one location to another • ADD - add two values • SUB - subtract a value from another value • PUSH - push data onto a stack • POP - pop data from a stack • JMP - jump to another location • INT - interrupt a process the following assembly language can be used to add the numbers 3 and 4: mov eax, 3 - loads 3 into the register "eax" mov ebx, 4 - loads 4 into the register "ebx" add eax, ebx, ecx - adds "eax" and "ebx" and stores the result (7) in "ecx"
  • 10. Assembly language limitations of assembly language • No Symbolic names for memory locations. You need to keep track of the exact memory location that a piece of data is stored. That is, you must manipulate memory locations directly. • Hard to read. Although we've made a few improvements by eliminating hex code, the command names are not always clear. • Code is still machine dependent. We haven't really moved that far away from the machine language - just put psuedo-English labels on it. We still need to rewrite every piece of code for every machine. • Hard to maintain and debug. Finding mistakes in machine code is difficult. Correcting them or adding new features can also be a challenge. • Code must be heavily documented. It's very difficult (if not impossible) to figure out what a program does by reading the code. Detailed explanation must be prepared for future coders (including the original programmer) who need to modify or use the code.