SlideShare uma empresa Scribd logo
1 de 31
ASSEMBLY LANGUAGE
Introduction
 Assembly language is a low-level programming language
for a computer or other programmable device specific
to a particular computer architecture in contrast to
most high-level programming languages, which are
generally portable across multiple systems.
 Assembly language is converted into executable
machine code by a utility program referred to as an
assembler like NASM, MASM, etc.
Introduction
 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'.
Introduction
 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.
 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
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.
Advantages of
Assembly Language
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.
Basic Features of PC Hardware
 The main internal hardware of a PC consists of
processor, memory, and registers.
 Registers are processor components that hold data and
address. To execute a program, the system copies it
from the external device into the internal memory.
The processor executes the program instructions.
 The fundamental unit of computer storage is a bit; it
could be ON (1) or OFF (0) and a group of 8 related
bits makes a byte on most of the modern computers.
Basic Features of PC Hardware
The processor supports the following data sizes −
 Word: a 2-byte data item
 Doubleword: a 4-byte (32 bit) data item
 Quadword: an 8-byte (64 bit) data item
 Paragraph: a 16-byte (128 bit) area
 Kilobyte: 1024 bytes
 Megabyte: 1,048,576 bytes
Assembly Language Parts
An assembly program can be divided into three sections −
The data section,
The bss section, and
The text section.
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
bss section
 The bss section is used for declaring variables.
 The syntax for declaring bss section is −
section.bss
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:
Comments
 Assembly language comment begins with a
semicolon (;). It may contain any printable
character including blank. It can appear on a line
by itself, like −
 ; This program displays a message on screen
or, on the same line along with an instruction, like
−
add eax, ebx ; adds ebx to eax
Assembly Language Statements
Assembly language programs consist of three types of
statements −
 Executable instructions or instructions,
 Assembler directives or pseudo-ops, and
 Macros.
Assembly Language Statements
 The executable instructions or
simply instructions tell the processor what to do.
 Each instruction consists of an operation
code (opcode).
 Each executable instruction generates one
machine language instruction.
Assembly Language Statements
 The assembler directives or pseudo-ops tell the
assembler about the various aspects of the
assembly process.
 These are non-executable and do not generate
machine language instructions.
 Macros are basically a text substitution
mechanism.
.
Syntax of Assembly Language
Statements
 Assembly language statements are entered one statement
per line. Each statement follows the following format −
[label] mnemonic [operands] [;comment]
 The fields in the square brackets are optional. A basic
instruction has two parts, the first one is the name of the
instruction (or the mnemonic), which is to be executed,
and the second are the operands or the parameters of
the command.
Syntax of Assembly Language
Statements
Structure of a NASM Program
 NASM is line-based. Most programs consist
of directives followed by one or more sections.
 Lines can have an optional label. Most lines have
an instruction followed by zero or more operands.
 This is the project webpage for the Netwide Assembler
(NASM), an assembler for the x86 CPU architecture portable
to nearly every modern platform, and with code generation
for many platforms old and new
Structure of a NASM Program
Memory Segments
 A segmented memory model divides the system
memory into groups of independent segments
referenced by pointers located in the segment
registers.
 Each segment is used to contain a specific type of
data.
 One segment is used to contain instruction codes,
another segment stores the data elements, and a
third segment keeps the program stack.
Memory Segments
In the light of the above discussion, we can specify
various memory segments as −
 Data segment − It is represented by .data section and
the .bss. The .data section is used to declare the
memory region, where data elements are stored for
the program. This section cannot be expanded after
the data elements are declared, and it remains static
throughout the program.
 The .bss section is also a static memory section that
contains buffers for data to be declared later in the
program. This buffer memory is zero-filled.
Memory Segments
 Code segment − It is represented
by .text section. This defines an area in memory
that stores the instruction codes. This is also a
fixed area.
 Stack − This segment contains data values passed
to functions and procedures within the program.
TASM
 Turbo Assembler (sometimes shortened to
the name of the executable, TASM) is an
assembler for software development
published by Borland in 1989. It runs on and
produces code for 16- or 32-bit x86 MS-DOS
and compatible on Microsoft Windows
MASM
 The Microsoft Macro Assembler (MASM) is an
x86 assembler that uses the Intel syntax for
MS-DOS and Microsoft Windows.
 Beginning with MASM 8.0, there are two
versions of the assembler: One for 16-bit &
32-bit assembly sources, and another for
64-bit sources only.
 Assemblers expect either the original syntax used
in the Intel instruction set documentation - the
Intel syntax - or the so-called AT&T syntax
developed at the AT&T Bell Labs.
 AT&T uses mov src, dest, Intel uses mov dest, src,
amongst other differences.
 Windows assemblers prefer Intel syntax (TASM,
MASM), most Linux/UNIX assemblers use AT&T.
NASM uses a variant of the Intel syntax.
 Assemblers have their own syntax for directives
affecting the assembly process, macros and
comments. These usually differ from assembler to
assembler
QUIZ
______________1. What symbol defines Comments in Assembly Language?
______________2. This section is used to declare the memory region,
where data elements are stored for the program.
______________3. This defines an area in memory that stores the
instruction codes. This is also a fixed area.
______________4. Which part of the assembly language tells the kernel
where the program execution begins?
______________5. Which tells the assembler about the various aspects of
the assembly process. These are non-executable and do not generate
machine language instructions.
______________6. What is the syntax in declaring data section?
______________7. This segment contains data values passed to functions
and procedures within the program.
______________8. What is the fundamental unit of computer storage?
_____9_______10. Advantages of understanding Assembly language
1. Semicolon
2. Data segment
3. Code segment
4. global _start,
5. assembler directives
6. section.data
7. Stack
8. bit
 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.

Mais conteúdo relacionado

Mais procurados

Data manipulation instructions
Data manipulation instructionsData manipulation instructions
Data manipulation instructions
Mahesh Kumar Attri
 
Part I:Introduction to assembly language
Part I:Introduction to assembly languagePart I:Introduction to assembly language
Part I:Introduction to assembly language
Ahmed M. Abed
 

Mais procurados (20)

Assembly language
Assembly languageAssembly language
Assembly language
 
Data manipulation instructions
Data manipulation instructionsData manipulation instructions
Data manipulation instructions
 
Assembly Langauge Chap 1
Assembly Langauge Chap 1Assembly Langauge Chap 1
Assembly Langauge Chap 1
 
Introduction to Computer Architecture
Introduction to Computer ArchitectureIntroduction to Computer Architecture
Introduction to Computer Architecture
 
1D Array in Assembly Language
1D Array in Assembly Language1D Array in Assembly Language
1D Array in Assembly Language
 
Part I:Introduction to assembly language
Part I:Introduction to assembly languagePart I:Introduction to assembly language
Part I:Introduction to assembly language
 
Interfacing With High Level Programming Language
Interfacing With High Level Programming Language Interfacing With High Level Programming Language
Interfacing With High Level Programming Language
 
Introduction to ibm pc assembly language
Introduction to ibm pc assembly languageIntroduction to ibm pc assembly language
Introduction to ibm pc assembly language
 
Flow control instructions
Flow control instructionsFlow control instructions
Flow control instructions
 
Assembly Language -I
Assembly Language -IAssembly Language -I
Assembly Language -I
 
loaders and linkers
 loaders and linkers loaders and linkers
loaders and linkers
 
Assembly language progarmming
Assembly language progarmmingAssembly language progarmming
Assembly language progarmming
 
Peephole optimization techniques
Peephole optimization techniquesPeephole optimization techniques
Peephole optimization techniques
 
Memory Reference Instructions
Memory Reference InstructionsMemory Reference Instructions
Memory Reference Instructions
 
Translators(Compiler, Assembler) and interpreter
Translators(Compiler, Assembler) and interpreterTranslators(Compiler, Assembler) and interpreter
Translators(Compiler, Assembler) and interpreter
 
Instruction Set Architecture (ISA)
Instruction Set Architecture (ISA)Instruction Set Architecture (ISA)
Instruction Set Architecture (ISA)
 
Cobol programming language
Cobol programming languageCobol programming language
Cobol programming language
 
Introduction to Assembly Language Programming
Introduction to Assembly Language ProgrammingIntroduction to Assembly Language Programming
Introduction to Assembly Language Programming
 
Lecture 01 introduction to compiler
Lecture 01 introduction to compilerLecture 01 introduction to compiler
Lecture 01 introduction to compiler
 
Assembly Language and microprocessor
Assembly Language and microprocessorAssembly Language and microprocessor
Assembly Language and microprocessor
 

Semelhante a ASSEMBLY LANGUAGE.pptx

Assembly language programming(unit 4)
Assembly language programming(unit 4)Assembly language programming(unit 4)
Assembly language programming(unit 4)
Ashim Saha
 
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
 
System programming note
System programming noteSystem programming note
System programming note
SANTOSH RATH
 
Please send the answers to my email. Mirre06@hotmail.comSomeone se.pdf
Please send the answers to my email. Mirre06@hotmail.comSomeone se.pdfPlease send the answers to my email. Mirre06@hotmail.comSomeone se.pdf
Please send the answers to my email. Mirre06@hotmail.comSomeone se.pdf
ebrahimbadushata00
 

Semelhante a ASSEMBLY LANGUAGE.pptx (20)

System Programming- Unit I
System Programming- Unit ISystem Programming- Unit I
System Programming- Unit I
 
Assembly language
Assembly languageAssembly language
Assembly language
 
Cao 2012
Cao 2012Cao 2012
Cao 2012
 
Assembly language programming(unit 4)
Assembly language programming(unit 4)Assembly language programming(unit 4)
Assembly language programming(unit 4)
 
N_Asm Assembly basic syntax (sol)
N_Asm Assembly basic syntax (sol)N_Asm Assembly basic syntax (sol)
N_Asm Assembly basic syntax (sol)
 
SP Solutions -Adi.pdf
SP Solutions -Adi.pdfSP Solutions -Adi.pdf
SP Solutions -Adi.pdf
 
SP_Solutions_-Adi.pdf
SP_Solutions_-Adi.pdfSP_Solutions_-Adi.pdf
SP_Solutions_-Adi.pdf
 
SP_Solutions_-Adi.pdf
SP_Solutions_-Adi.pdfSP_Solutions_-Adi.pdf
SP_Solutions_-Adi.pdf
 
Lecture 1
Lecture 1Lecture 1
Lecture 1
 
Assembly
AssemblyAssembly
Assembly
 
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
 
Lec 01 basic concepts
Lec 01 basic conceptsLec 01 basic concepts
Lec 01 basic concepts
 
Chapter1a
Chapter1aChapter1a
Chapter1a
 
Computer architecture instruction formats
Computer architecture instruction formatsComputer architecture instruction formats
Computer architecture instruction formats
 
System programming note
System programming noteSystem programming note
System programming note
 
UNIT 2_ESD.pdf
UNIT 2_ESD.pdfUNIT 2_ESD.pdf
UNIT 2_ESD.pdf
 
CISY 105 Chapter 1
CISY 105 Chapter 1CISY 105 Chapter 1
CISY 105 Chapter 1
 
microprocesser-140306112352-phpapp01.pdf
microprocesser-140306112352-phpapp01.pdfmicroprocesser-140306112352-phpapp01.pdf
microprocesser-140306112352-phpapp01.pdf
 
Assembly Language
Assembly LanguageAssembly Language
Assembly Language
 
Please send the answers to my email. Mirre06@hotmail.comSomeone se.pdf
Please send the answers to my email. Mirre06@hotmail.comSomeone se.pdfPlease send the answers to my email. Mirre06@hotmail.comSomeone se.pdf
Please send the answers to my email. Mirre06@hotmail.comSomeone se.pdf
 

Mais de EdFeranil (12)

The Contemporary World (Movement and Sys
The Contemporary World (Movement and SysThe Contemporary World (Movement and Sys
The Contemporary World (Movement and Sys
 
Example quiz on sets laws discrete math
Example quiz on sets laws  discrete mathExample quiz on sets laws  discrete math
Example quiz on sets laws discrete math
 
Mathematical Logic.pptx
Mathematical Logic.pptxMathematical Logic.pptx
Mathematical Logic.pptx
 
Arrays in Reading.pptx
Arrays in Reading.pptxArrays in Reading.pptx
Arrays in Reading.pptx
 
Law and Ethics in Information Security.pptx
Law and Ethics in Information Security.pptxLaw and Ethics in Information Security.pptx
Law and Ethics in Information Security.pptx
 
OOP -interface and objects.pptx
OOP -interface and objects.pptxOOP -interface and objects.pptx
OOP -interface and objects.pptx
 
The Evolution of Computing.pptx
The Evolution of Computing.pptxThe Evolution of Computing.pptx
The Evolution of Computing.pptx
 
Java Basics.pdf
Java Basics.pdfJava Basics.pdf
Java Basics.pdf
 
ERD Activity.pptx
ERD Activity.pptxERD Activity.pptx
ERD Activity.pptx
 
Boolean Expression.pptx
Boolean Expression.pptxBoolean Expression.pptx
Boolean Expression.pptx
 
intro to assembly language.pptx
intro to assembly language.pptxintro to assembly language.pptx
intro to assembly language.pptx
 
lecture7.ppt
lecture7.pptlecture7.ppt
lecture7.ppt
 

Último

Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
Joaquim Jorge
 

Último (20)

Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Top 10 Most Downloaded Games on Play Store in 2024
Top 10 Most Downloaded Games on Play Store in 2024Top 10 Most Downloaded Games on Play Store in 2024
Top 10 Most Downloaded Games on Play Store in 2024
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsTop 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 

ASSEMBLY LANGUAGE.pptx

  • 2.
  • 3. Introduction  Assembly language is a low-level programming language for a computer or other programmable device specific to a particular computer architecture in contrast to most high-level programming languages, which are generally portable across multiple systems.  Assembly language is converted into executable machine code by a utility program referred to as an assembler like NASM, MASM, etc.
  • 4. Introduction  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'.
  • 5. Introduction  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.  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.
  • 6. 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.
  • 7. Advantages of Assembly Language 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.
  • 8. Basic Features of PC Hardware  The main internal hardware of a PC consists of processor, memory, and registers.  Registers are processor components that hold data and address. To execute a program, the system copies it from the external device into the internal memory. The processor executes the program instructions.  The fundamental unit of computer storage is a bit; it could be ON (1) or OFF (0) and a group of 8 related bits makes a byte on most of the modern computers.
  • 9. Basic Features of PC Hardware The processor supports the following data sizes −  Word: a 2-byte data item  Doubleword: a 4-byte (32 bit) data item  Quadword: an 8-byte (64 bit) data item  Paragraph: a 16-byte (128 bit) area  Kilobyte: 1024 bytes  Megabyte: 1,048,576 bytes
  • 10. Assembly Language Parts An assembly program can be divided into three sections − The data section, The bss section, and The text section.
  • 11. 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
  • 12. bss section  The bss section is used for declaring variables.  The syntax for declaring bss section is − section.bss
  • 13. 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:
  • 14. Comments  Assembly language comment begins with a semicolon (;). It may contain any printable character including blank. It can appear on a line by itself, like −  ; This program displays a message on screen or, on the same line along with an instruction, like − add eax, ebx ; adds ebx to eax
  • 15. Assembly Language Statements Assembly language programs consist of three types of statements −  Executable instructions or instructions,  Assembler directives or pseudo-ops, and  Macros.
  • 16. Assembly Language Statements  The executable instructions or simply instructions tell the processor what to do.  Each instruction consists of an operation code (opcode).  Each executable instruction generates one machine language instruction.
  • 17. Assembly Language Statements  The assembler directives or pseudo-ops tell the assembler about the various aspects of the assembly process.  These are non-executable and do not generate machine language instructions.  Macros are basically a text substitution mechanism. .
  • 18. Syntax of Assembly Language Statements  Assembly language statements are entered one statement per line. Each statement follows the following format − [label] mnemonic [operands] [;comment]  The fields in the square brackets are optional. A basic instruction has two parts, the first one is the name of the instruction (or the mnemonic), which is to be executed, and the second are the operands or the parameters of the command.
  • 19. Syntax of Assembly Language Statements
  • 20. Structure of a NASM Program  NASM is line-based. Most programs consist of directives followed by one or more sections.  Lines can have an optional label. Most lines have an instruction followed by zero or more operands.  This is the project webpage for the Netwide Assembler (NASM), an assembler for the x86 CPU architecture portable to nearly every modern platform, and with code generation for many platforms old and new
  • 21. Structure of a NASM Program
  • 22. Memory Segments  A segmented memory model divides the system memory into groups of independent segments referenced by pointers located in the segment registers.  Each segment is used to contain a specific type of data.  One segment is used to contain instruction codes, another segment stores the data elements, and a third segment keeps the program stack.
  • 23. Memory Segments In the light of the above discussion, we can specify various memory segments as −  Data segment − It is represented by .data section and the .bss. The .data section is used to declare the memory region, where data elements are stored for the program. This section cannot be expanded after the data elements are declared, and it remains static throughout the program.  The .bss section is also a static memory section that contains buffers for data to be declared later in the program. This buffer memory is zero-filled.
  • 24. Memory Segments  Code segment − It is represented by .text section. This defines an area in memory that stores the instruction codes. This is also a fixed area.  Stack − This segment contains data values passed to functions and procedures within the program.
  • 25. TASM  Turbo Assembler (sometimes shortened to the name of the executable, TASM) is an assembler for software development published by Borland in 1989. It runs on and produces code for 16- or 32-bit x86 MS-DOS and compatible on Microsoft Windows
  • 26. MASM  The Microsoft Macro Assembler (MASM) is an x86 assembler that uses the Intel syntax for MS-DOS and Microsoft Windows.  Beginning with MASM 8.0, there are two versions of the assembler: One for 16-bit & 32-bit assembly sources, and another for 64-bit sources only.
  • 27.  Assemblers expect either the original syntax used in the Intel instruction set documentation - the Intel syntax - or the so-called AT&T syntax developed at the AT&T Bell Labs.  AT&T uses mov src, dest, Intel uses mov dest, src, amongst other differences.
  • 28.  Windows assemblers prefer Intel syntax (TASM, MASM), most Linux/UNIX assemblers use AT&T. NASM uses a variant of the Intel syntax.  Assemblers have their own syntax for directives affecting the assembly process, macros and comments. These usually differ from assembler to assembler
  • 29. QUIZ
  • 30. ______________1. What symbol defines Comments in Assembly Language? ______________2. This section is used to declare the memory region, where data elements are stored for the program. ______________3. This defines an area in memory that stores the instruction codes. This is also a fixed area. ______________4. Which part of the assembly language tells the kernel where the program execution begins? ______________5. Which tells the assembler about the various aspects of the assembly process. These are non-executable and do not generate machine language instructions. ______________6. What is the syntax in declaring data section? ______________7. This segment contains data values passed to functions and procedures within the program. ______________8. What is the fundamental unit of computer storage? _____9_______10. Advantages of understanding Assembly language
  • 31. 1. Semicolon 2. Data segment 3. Code segment 4. global _start, 5. assembler directives 6. section.data 7. Stack 8. bit  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.