SlideShare una empresa de Scribd logo
1 de 10
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.

Más contenido relacionado

La actualidad más candente

Page replacement algorithms
Page replacement algorithmsPage replacement algorithms
Page replacement algorithms
Piyush Rochwani
 
Cache memory
Cache memoryCache memory
Cache memory
Anuj Modi
 

La actualidad más candente (20)

Array Processor
Array ProcessorArray Processor
Array Processor
 
Computer architecture
Computer architectureComputer architecture
Computer architecture
 
ROM(Read Only Memory )
ROM(Read Only Memory )ROM(Read Only Memory )
ROM(Read Only Memory )
 
CISC & RISC Architecture
CISC & RISC Architecture CISC & RISC Architecture
CISC & RISC Architecture
 
Memory Hierarchy
Memory HierarchyMemory Hierarchy
Memory Hierarchy
 
Register Transfer Language,Bus and Memory Transfer
Register Transfer Language,Bus and Memory TransferRegister Transfer Language,Bus and Memory Transfer
Register Transfer Language,Bus and Memory Transfer
 
Instruction cycle
Instruction cycleInstruction cycle
Instruction cycle
 
Computer Organization and Architecture.
Computer Organization and Architecture.Computer Organization and Architecture.
Computer Organization and Architecture.
 
Machine Level Language
Machine Level LanguageMachine Level Language
Machine Level Language
 
Unit 4-booth algorithm
Unit 4-booth algorithmUnit 4-booth algorithm
Unit 4-booth algorithm
 
Page replacement algorithms
Page replacement algorithmsPage replacement algorithms
Page replacement algorithms
 
Assembly level language
Assembly level languageAssembly level language
Assembly level language
 
Cache memory
Cache memoryCache memory
Cache memory
 
operating system lecture notes
operating system lecture notesoperating system lecture notes
operating system lecture notes
 
Syntax Analysis in Compiler Design
Syntax Analysis in Compiler Design Syntax Analysis in Compiler Design
Syntax Analysis in Compiler Design
 
Regular expressions
Regular expressionsRegular expressions
Regular expressions
 
Instruction Set Architecture (ISA)
Instruction Set Architecture (ISA)Instruction Set Architecture (ISA)
Instruction Set Architecture (ISA)
 
Asymptotic Notation
Asymptotic NotationAsymptotic Notation
Asymptotic Notation
 
Interpreter
InterpreterInterpreter
Interpreter
 
Introduction to Computer Architecture and Organization
Introduction to Computer Architecture and OrganizationIntroduction to Computer Architecture and Organization
Introduction to Computer Architecture and Organization
 

Similar a Assembly language

1 Describe different types of Assemblers.Assembly language.docx
 1 Describe different types of Assemblers.Assembly language.docx 1 Describe different types of Assemblers.Assembly language.docx
1 Describe different types of Assemblers.Assembly language.docx
aryan532920
 
Assembly language programming(unit 4)
Assembly language programming(unit 4)Assembly language programming(unit 4)
Assembly language programming(unit 4)
Ashim Saha
 
Assembly Langauge Assembly Langauge Assembly Langauge
Assembly Langauge Assembly Langauge Assembly LangaugeAssembly Langauge Assembly Langauge Assembly Langauge
Assembly Langauge Assembly Langauge Assembly Langauge
mustafkhalid
 
Perfect papers software
Perfect papers   softwarePerfect papers   software
Perfect papers software
guest0a1ce99
 
Language translators
Language translatorsLanguage translators
Language translators
Aditya Sharat
 

Similar a Assembly language (20)

Lec 01 basic concepts
Lec 01 basic conceptsLec 01 basic concepts
Lec 01 basic concepts
 
ASSEMBLY LANGUAGE.pptx
ASSEMBLY LANGUAGE.pptxASSEMBLY LANGUAGE.pptx
ASSEMBLY LANGUAGE.pptx
 
microprocesser-140306112352-phpapp01.pdf
microprocesser-140306112352-phpapp01.pdfmicroprocesser-140306112352-phpapp01.pdf
microprocesser-140306112352-phpapp01.pdf
 
Assembly chapter One.pptx
Assembly chapter One.pptxAssembly chapter One.pptx
Assembly chapter One.pptx
 
Assembly
AssemblyAssembly
Assembly
 
Introduction to Assembly Language Programming
Introduction to Assembly Language ProgrammingIntroduction to Assembly Language Programming
Introduction to Assembly Language Programming
 
1 Describe different types of Assemblers.Assembly language.docx
 1 Describe different types of Assemblers.Assembly language.docx 1 Describe different types of Assemblers.Assembly language.docx
1 Describe different types of Assemblers.Assembly language.docx
 
Insight into progam execution ppt
Insight into progam execution pptInsight into progam execution ppt
Insight into progam execution ppt
 
Assembly language programming(unit 4)
Assembly language programming(unit 4)Assembly language programming(unit 4)
Assembly language programming(unit 4)
 
Assembly Langauge Assembly Langauge Assembly Langauge
Assembly Langauge Assembly Langauge Assembly LangaugeAssembly Langauge Assembly Langauge Assembly Langauge
Assembly Langauge Assembly Langauge Assembly Langauge
 
Chapter1.pdf
Chapter1.pdfChapter1.pdf
Chapter1.pdf
 
Ayushi
AyushiAyushi
Ayushi
 
2 Programming Language.pdf
2 Programming Language.pdf2 Programming Language.pdf
2 Programming Language.pdf
 
Perfect papers software
Perfect papers   softwarePerfect papers   software
Perfect papers software
 
Computer languages
Computer languagesComputer languages
Computer languages
 
02_Intro to Programming Language.pptx
02_Intro to Programming Language.pptx02_Intro to Programming Language.pptx
02_Intro to Programming Language.pptx
 
Block diagram (computer programming & utilization)
Block diagram (computer programming & utilization)Block diagram (computer programming & utilization)
Block diagram (computer programming & utilization)
 
a1.pptx.pdf
a1.pptx.pdfa1.pptx.pdf
a1.pptx.pdf
 
Language translators
Language translatorsLanguage translators
Language translators
 
Software Concepts Notes
Software Concepts NotesSoftware Concepts Notes
Software Concepts Notes
 

Más de gaurav jain

Relationship marketing concept, process and importance
Relationship marketing concept, process and importanceRelationship marketing concept, process and importance
Relationship marketing concept, process and importance
gaurav jain
 

Más de gaurav jain (20)

High level languages representation
High level languages representationHigh level languages representation
High level languages representation
 
Basic ops concept of comp
Basic ops  concept of compBasic ops  concept of comp
Basic ops concept of comp
 
Functional units of computer
Functional units of computerFunctional units of computer
Functional units of computer
 
Stored program concept
Stored program conceptStored program concept
Stored program concept
 
Programming languages
Programming languagesProgramming languages
Programming languages
 
Comprehensive interventions
Comprehensive interventionsComprehensive interventions
Comprehensive interventions
 
Personal intervention
Personal interventionPersonal intervention
Personal intervention
 
Od interventions
Od interventionsOd interventions
Od interventions
 
Interpersonal and group process interventions
Interpersonal and group process interventionsInterpersonal and group process interventions
Interpersonal and group process interventions
 
Organizational effectiveness
Organizational effectivenessOrganizational effectiveness
Organizational effectiveness
 
Organizational change and development
Organizational change and developmentOrganizational change and development
Organizational change and development
 
Definition and nature of organizational development
Definition and nature of organizational developmentDefinition and nature of organizational development
Definition and nature of organizational development
 
Change agent
Change agentChange agent
Change agent
 
Service sector and economic, growth
Service sector and economic, growthService sector and economic, growth
Service sector and economic, growth
 
Service concept, characteristic and classification
Service concept, characteristic and classificationService concept, characteristic and classification
Service concept, characteristic and classification
 
Relationship marketing concept, process and importance
Relationship marketing concept, process and importanceRelationship marketing concept, process and importance
Relationship marketing concept, process and importance
 
Marketing for non profit organizations
Marketing for non profit organizationsMarketing for non profit organizations
Marketing for non profit organizations
 
Creating and delivering services
Creating and delivering servicesCreating and delivering services
Creating and delivering services
 
Securing the e marketing site
Securing  the e marketing siteSecuring  the e marketing site
Securing the e marketing site
 
Ongoing customer communication in e marketing
Ongoing customer communication in e marketingOngoing customer communication in e marketing
Ongoing customer communication in e marketing
 

Último

Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
ciinovamais
 
Vishram Singh - Textbook of Anatomy Upper Limb and Thorax.. Volume 1 (1).pdf
Vishram Singh - Textbook of Anatomy  Upper Limb and Thorax.. Volume 1 (1).pdfVishram Singh - Textbook of Anatomy  Upper Limb and Thorax.. Volume 1 (1).pdf
Vishram Singh - Textbook of Anatomy Upper Limb and Thorax.. Volume 1 (1).pdf
ssuserdda66b
 
Salient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functionsSalient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functions
KarakKing
 

Último (20)

Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024
 
Single or Multiple melodic lines structure
Single or Multiple melodic lines structureSingle or Multiple melodic lines structure
Single or Multiple melodic lines structure
 
Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17  How to Extend Models Using Mixin ClassesMixin Classes in Odoo 17  How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
 
SOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning PresentationSOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning Presentation
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdf
 
ComPTIA Overview | Comptia Security+ Book SY0-701
ComPTIA Overview | Comptia Security+ Book SY0-701ComPTIA Overview | Comptia Security+ Book SY0-701
ComPTIA Overview | Comptia Security+ Book SY0-701
 
Micro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdfMicro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdf
 
Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
 
Vishram Singh - Textbook of Anatomy Upper Limb and Thorax.. Volume 1 (1).pdf
Vishram Singh - Textbook of Anatomy  Upper Limb and Thorax.. Volume 1 (1).pdfVishram Singh - Textbook of Anatomy  Upper Limb and Thorax.. Volume 1 (1).pdf
Vishram Singh - Textbook of Anatomy Upper Limb and Thorax.. Volume 1 (1).pdf
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdf
 
How to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POSHow to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POS
 
Unit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptxUnit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptx
 
Python Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxPython Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docx
 
Food safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdfFood safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdf
 
ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.
 
Salient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functionsSalient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functions
 
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdfUGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
 
FSB Advising Checklist - Orientation 2024
FSB Advising Checklist - Orientation 2024FSB Advising Checklist - Orientation 2024
FSB Advising Checklist - Orientation 2024
 
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
 

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.