SlideShare a Scribd company logo
Assembly Language for x86 Processors
Assembly Language for x86 Processors
7th Edition
7th Edition
Chapter 3: Assembly Language
Fundamentals
Kip Irvine
Irvine, Kip R. Assembly Language for x86 Processors 7/e, 2015.
2
Chapter Overview
Chapter Overview
• Basic Elements of Assembly Language
• Example: Adding and Subtracting Integers
• Assembling, Linking, and Running Programs
• Defining Data
• Symbolic Constants
• 64-Bit Programming
Irvine, Kip R. Assembly Language for x86 Processors 7/e, 2015.
3
Basic Elements of Assembly Language
Basic Elements of Assembly Language
• Integer constants
• Integer expressions
• Character and string constants
• Reserved words and identifiers
• Directives and instructions
• Labels
• Mnemonics and Operands
• Comments
• Examples
Irvine, Kip R. Assembly Language for x86 Processors 7/e, 2015.
4
Integer Constants
Integer Constants
• Optional leading + or – sign
• binary, decimal, hexadecimal, or octal digits
• Common radix characters:
• h – hexadecimal
• d – decimal
• b – binary
• r – encoded real
Examples: 30d, 6Ah, 42, 1101b
Hexadecimal beginning with letter: 0A5h
Irvine, Kip R. Assembly Language for x86 Processors 7/e, 2015.
5
Integer Expressions
Integer Expressions
• Operators and precedence levels:
• Examples:
Irvine, Kip R. Assembly Language for x86 Processors 7/e, 2015.
6
Character and String Constants
Character and String Constants
• Enclose character in single or double quotes
• 'A', "x"
• ASCII character = 1 byte
• Enclose strings in single or double quotes
• "ABC"
• 'xyz'
• Each character occupies a single byte
• Embedded quotes:
• 'Say "Goodnight," Gracie'
Irvine, Kip R. Assembly Language for x86 Processors 7/e, 2015.
7
Reserved Words and Identifiers
Reserved Words and Identifiers
• Reserved words cannot be used as identifiers
• Instruction mnemonics, directives, type attributes,
operators, predefined symbols
• See MASM reference in Appendix A
• Microsoft Macro Assembler Reference
• Identifiers
• 1-247 characters, including digits
• not case sensitive
• first character must be a letter, _, @, ?, or $
Irvine, Kip R. Assembly Language for x86 Processors 7/e, 2015.
8
Directives
Directives
• Commands that are recognized and acted
upon by the assembler
• Not part of the Intel instruction set
• Used to declare code, data areas, select
memory model, declare procedures, etc.
• not case sensitive
• Different assemblers have different directives
• NASM not the same as MASM, for example
Irvine, Kip R. Assembly Language for x86 Processors 6/e, 2010.
9
Instructions
Instructions
• Assembled into machine code by assembler
• Executed at runtime by the CPU
• We use the Intel IA-32 instruction set
• An instruction contains:
• Label (optional)
• Mnemonic (required)
• Operand (depends on the instruction)
• Comment (optional)
[Label:] Mnemonic Operand(s) [; Comment]
Irvine, Kip R. Assembly Language for x86 Processors 7/e, 2015.
10
Labels
Labels
• Act as place markers
• marks the address (offset) of code and data
• Follow identifer rules
• Data label
• must be unique
• example: myArray (not followed by colon)
• Code label
• target of jump and loop instructions
• example: L1: (followed by colon)

More Related Content

PPT
chap3lec5.pptgfhgfhghghgfhgfhgfhfghgfhfg
PPT
Chapter 3 Assembly Language Fundamentals 6th edition.ppt
PDF
Basics of C Prog Lang.pdf
PDF
C PROGRAMMING p-1.pdf
PPTX
Unit ii
PPT
compiler construvtion aaaaaaaaaaaaaaaaaads
PPTX
C LANGUAGE UNIT-1 PREPARED BY M V BRAHMANANDA REDDY
PPTX
chap3lec5.pptgfhgfhghghgfhgfhgfhfghgfhfg
Chapter 3 Assembly Language Fundamentals 6th edition.ppt
Basics of C Prog Lang.pdf
C PROGRAMMING p-1.pdf
Unit ii
compiler construvtion aaaaaaaaaaaaaaaaaads
C LANGUAGE UNIT-1 PREPARED BY M V BRAHMANANDA REDDY

Similar to chap3intro.ppt(assembly language fundamentals) (20)

PPTX
PPTX
Compiler design
PPTX
CHARACTERISTICS OF C (1).pptxtejwueghhehe
PPTX
Compiler Construction
PPT
Assembler
PPTX
CSE 1201: Structured Programming Language
PPTX
FPL - Part 1 (Sem - I 2013 )
PPTX
MAtlab Installation Procedure using the licensed version (desktop)
PPTX
C# language
PPTX
Best_of_438343817-A-PPT-on-C-language.pptx
PDF
Module_1_Introduction-to-Problem-Solving.pdf
PPTX
Compilers.pptx
PPTX
Introduction to C#.pptx for all BSIT students
PPTX
Part II: Assembly Fundamentals
PDF
Class 11 Python Fundame fgghf ghntals CS 083.pdf
PPT
Cs111 ch01 v4
PPT
8844632.ppt
PDF
EC2311-Data Structures and C Programming
PPTX
Introduction to fundamentaals of computing.pptx
PPTX
C Programming Lecture 3 - Elements of C.pptx
Compiler design
CHARACTERISTICS OF C (1).pptxtejwueghhehe
Compiler Construction
Assembler
CSE 1201: Structured Programming Language
FPL - Part 1 (Sem - I 2013 )
MAtlab Installation Procedure using the licensed version (desktop)
C# language
Best_of_438343817-A-PPT-on-C-language.pptx
Module_1_Introduction-to-Problem-Solving.pdf
Compilers.pptx
Introduction to C#.pptx for all BSIT students
Part II: Assembly Fundamentals
Class 11 Python Fundame fgghf ghntals CS 083.pdf
Cs111 ch01 v4
8844632.ppt
EC2311-Data Structures and C Programming
Introduction to fundamentaals of computing.pptx
C Programming Lecture 3 - Elements of C.pptx
Ad

More from YumnaShahzaad (18)

PPT
ML-Topic1A.ppteeweqeqeqeqeqeqwewqqwwqeeqeqw
PPT
311introductiontomachinelearningweeqwq.ppt
PPT
Networking Devices15.PPTSADSADSADSADSADSAD
PPT
ch01.pptssadsaadsadsadsadsadsadsasadsads
PPT
CH02.PPTdfsffdsffsdffsdfdfsdfsddsfsdfdsffdsf
PPT
CCNA1_Ch08.pptxffdsfdfdsfdsfdsfdsfsdfdsfsdfsdf
PPT
leclast.pptDDSADASDSDSADSADSADSADSDASADSDD
PPT
lecpp.pptSADADASDADSDASDSAADASDASDDDSADSDSA
PPT
class3(105119).pptsdffsfdsfdffsffsfssdsds
PPT
chapt_08.pptdsfdfdfdsffsdffsdfsdfsdfsdfsdfsdfsdf
PPT
chap7.pptasalslASKLa;ssASASSSasASssASaSa
PPT
dss lec1.pptLECTURE 1 DOWNLOADable yougurt
PPT
Turbanchap02discription material require.ppt
PPTX
chap5.pptxasasasasadfdfdfdfdfddffdfdfdfdd
PPT
data transfers, addressing and arithmetic
PPT
Lecture4.ppt
PPT
osi.ppt
PPT
03_Karnaugh_Maps.ppt
ML-Topic1A.ppteeweqeqeqeqeqeqwewqqwwqeeqeqw
311introductiontomachinelearningweeqwq.ppt
Networking Devices15.PPTSADSADSADSADSADSAD
ch01.pptssadsaadsadsadsadsadsadsasadsads
CH02.PPTdfsffdsffsdffsdfdfsdfsddsfsdfdsffdsf
CCNA1_Ch08.pptxffdsfdfdsfdsfdsfdsfsdfdsfsdfsdf
leclast.pptDDSADASDSDSADSADSADSADSDASADSDD
lecpp.pptSADADASDADSDASDSAADASDASDDDSADSDSA
class3(105119).pptsdffsfdsfdffsffsfssdsds
chapt_08.pptdsfdfdfdsffsdffsdfsdfsdfsdfsdfsdfsdf
chap7.pptasalslASKLa;ssASASSSasASssASaSa
dss lec1.pptLECTURE 1 DOWNLOADable yougurt
Turbanchap02discription material require.ppt
chap5.pptxasasasasadfdfdfdfdfddffdfdfdfdd
data transfers, addressing and arithmetic
Lecture4.ppt
osi.ppt
03_Karnaugh_Maps.ppt
Ad

Recently uploaded (20)

PPTX
Lecture Notes Electrical Wiring System Components
PPTX
CH1 Production IntroductoryConcepts.pptx
PDF
Well-logging-methods_new................
PPTX
Sustainable Sites - Green Building Construction
PPTX
CYBER-CRIMES AND SECURITY A guide to understanding
PPTX
Safety Seminar civil to be ensured for safe working.
PPTX
OOP with Java - Java Introduction (Basics)
PDF
PPT on Performance Review to get promotions
PPT
Introduction, IoT Design Methodology, Case Study on IoT System for Weather Mo...
PPTX
web development for engineering and engineering
PPTX
Internet of Things (IOT) - A guide to understanding
PDF
Evaluating the Democratization of the Turkish Armed Forces from a Normative P...
DOCX
ASol_English-Language-Literature-Set-1-27-02-2023-converted.docx
PPTX
Engineering Ethics, Safety and Environment [Autosaved] (1).pptx
PPTX
UNIT 4 Total Quality Management .pptx
PDF
composite construction of structures.pdf
PPTX
CARTOGRAPHY AND GEOINFORMATION VISUALIZATION chapter1 NPTE (2).pptx
PPT
Mechanical Engineering MATERIALS Selection
PDF
BMEC211 - INTRODUCTION TO MECHATRONICS-1.pdf
PDF
Model Code of Practice - Construction Work - 21102022 .pdf
Lecture Notes Electrical Wiring System Components
CH1 Production IntroductoryConcepts.pptx
Well-logging-methods_new................
Sustainable Sites - Green Building Construction
CYBER-CRIMES AND SECURITY A guide to understanding
Safety Seminar civil to be ensured for safe working.
OOP with Java - Java Introduction (Basics)
PPT on Performance Review to get promotions
Introduction, IoT Design Methodology, Case Study on IoT System for Weather Mo...
web development for engineering and engineering
Internet of Things (IOT) - A guide to understanding
Evaluating the Democratization of the Turkish Armed Forces from a Normative P...
ASol_English-Language-Literature-Set-1-27-02-2023-converted.docx
Engineering Ethics, Safety and Environment [Autosaved] (1).pptx
UNIT 4 Total Quality Management .pptx
composite construction of structures.pdf
CARTOGRAPHY AND GEOINFORMATION VISUALIZATION chapter1 NPTE (2).pptx
Mechanical Engineering MATERIALS Selection
BMEC211 - INTRODUCTION TO MECHATRONICS-1.pdf
Model Code of Practice - Construction Work - 21102022 .pdf

chap3intro.ppt(assembly language fundamentals)

  • 1. Assembly Language for x86 Processors Assembly Language for x86 Processors 7th Edition 7th Edition Chapter 3: Assembly Language Fundamentals Kip Irvine
  • 2. Irvine, Kip R. Assembly Language for x86 Processors 7/e, 2015. 2 Chapter Overview Chapter Overview • Basic Elements of Assembly Language • Example: Adding and Subtracting Integers • Assembling, Linking, and Running Programs • Defining Data • Symbolic Constants • 64-Bit Programming
  • 3. Irvine, Kip R. Assembly Language for x86 Processors 7/e, 2015. 3 Basic Elements of Assembly Language Basic Elements of Assembly Language • Integer constants • Integer expressions • Character and string constants • Reserved words and identifiers • Directives and instructions • Labels • Mnemonics and Operands • Comments • Examples
  • 4. Irvine, Kip R. Assembly Language for x86 Processors 7/e, 2015. 4 Integer Constants Integer Constants • Optional leading + or – sign • binary, decimal, hexadecimal, or octal digits • Common radix characters: • h – hexadecimal • d – decimal • b – binary • r – encoded real Examples: 30d, 6Ah, 42, 1101b Hexadecimal beginning with letter: 0A5h
  • 5. Irvine, Kip R. Assembly Language for x86 Processors 7/e, 2015. 5 Integer Expressions Integer Expressions • Operators and precedence levels: • Examples:
  • 6. Irvine, Kip R. Assembly Language for x86 Processors 7/e, 2015. 6 Character and String Constants Character and String Constants • Enclose character in single or double quotes • 'A', "x" • ASCII character = 1 byte • Enclose strings in single or double quotes • "ABC" • 'xyz' • Each character occupies a single byte • Embedded quotes: • 'Say "Goodnight," Gracie'
  • 7. Irvine, Kip R. Assembly Language for x86 Processors 7/e, 2015. 7 Reserved Words and Identifiers Reserved Words and Identifiers • Reserved words cannot be used as identifiers • Instruction mnemonics, directives, type attributes, operators, predefined symbols • See MASM reference in Appendix A • Microsoft Macro Assembler Reference • Identifiers • 1-247 characters, including digits • not case sensitive • first character must be a letter, _, @, ?, or $
  • 8. Irvine, Kip R. Assembly Language for x86 Processors 7/e, 2015. 8 Directives Directives • Commands that are recognized and acted upon by the assembler • Not part of the Intel instruction set • Used to declare code, data areas, select memory model, declare procedures, etc. • not case sensitive • Different assemblers have different directives • NASM not the same as MASM, for example
  • 9. Irvine, Kip R. Assembly Language for x86 Processors 6/e, 2010. 9 Instructions Instructions • Assembled into machine code by assembler • Executed at runtime by the CPU • We use the Intel IA-32 instruction set • An instruction contains: • Label (optional) • Mnemonic (required) • Operand (depends on the instruction) • Comment (optional) [Label:] Mnemonic Operand(s) [; Comment]
  • 10. Irvine, Kip R. Assembly Language for x86 Processors 7/e, 2015. 10 Labels Labels • Act as place markers • marks the address (offset) of code and data • Follow identifer rules • Data label • must be unique • example: myArray (not followed by colon) • Code label • target of jump and loop instructions • example: L1: (followed by colon)