SlideShare uma empresa Scribd logo
1 de 43
Intro to Assembly
Language
MUHAMMAD TASNIM MOHIUDDIN
LECTURER, CSE, UIU
1
Levels of Programming Languages
1) Machine Language
2) Assembly Language (Low Level Language)
3) High Level Languages
2
Machine Language
 Set of fundamental instructions
 Native to a processor: executed directly by hardware
 Expressed as a pattern of 1’s and 0’s
Here’s what a program-fragment looks like:
10100001 10111100 10010011 00000100
00001000 00000011 00000101 11000000
10010011 00000100 00001000 10100011
11000000 10010100 00000100 00001000
It means: z = x + y;
3
Assembly Language
 One step up from machine language
 Designed for a specific family of processors (different processor groups/family
has different Assembly Language)
 Consists of symbolic instructions directly related to machine language
instructions one-for-one and are assembled into machine language.
 Alphanumeric equivalent of machine language
 Mnemonics more human-oriented than 1’s and 0’s
 Example: for A = A + 4
MOV AX, A
ADD AX, 4
MOV A, AX
4
High Level Languages
 Similar to Natural language.
 Designed to eliminate the technicalities of a particular computer.
 Statements compiled in a high level language typically generate many low-
level instructions.
 Example: C, Java, Python etc
5
Advantages of High-Level Languages
 Program development is faster
 High-level statements: fewer instructions to code
 Program maintenance is easier
 For the same above reasons
 Programs are portable
6
Why Assembly Language?
 Accessibility to system hardware
 Assembly Language is useful for implementing system software
 Also useful for small embedded system applications
 Faster and shorter programs.
 Compilers do not always generate optimum code.
 Resident programs (that reside in memory while other program execute)
and interrupt service routines (that handle input and output) are almost
always develop in Assembly Language.
 Instruction set knowledge is important for machine designers.
 Compiler writers must be familiar with details of machine language.
7
Advantages of Assembly Language
 Shows how program interfaces with the processor, operating system, and
BIOS.
 Shows how data is represented and stored in memory and on external
devices.
 Clarifies how processor accesses and executes instructions and how
instructions access and process data.
8
Assembler
 An assembler is a program that converts source-code programs written in
assembly language into object files in machine language
 Popular assemblers have emerged over the years for the Intel family of
processors. These include …
 TASM (Turbo Assembler from Borland)
 NASM (Netwide Assembler for both Windows and Linux), and
 GNU assembler distributed by the free software foundation
9
Compiler and Assembler 10
Computer Architecture
CPU
I/O Devices
Memory
11
Computer Architecture
Control Bus
CPU Memory I/O
Address Bus
Data Bus
12
Organization of 8086 Processor
 16 bit Processor
 16 bit data bus
 16 bit registers
 20 bit Address bus
13
Organization of 8086 Processor
CPU Memory
Address Bus
Data Bus
20
16
CPU-Memory Interface
16-bit
Control Bus
14
Bytes and Words
 Information processed by computer is stored in its memory
 A memory element can store one bit of data
 Group of 8 bits forms one byte
 Group of 16 bits or 2 bytes forms one word
15
RAM and ROM
 Random-Access Memory (RAM)
 Can be performed read and write operation
 Program instruction and data are loaded into RAM
 Contents are lost when the machine is turned off
 ROM (Read-Only-Memory)
 Once initialized can’t be changed, can only be read
 Retain values event the machine is turned off
 Hence used to store system programs
16
Address Space of 8086 17
Number System
18
Number System
• Consists of TWO Things:
– A BASE or RADIX Value
– A SET of DIGITS
• Digits are symbols representing all values
less than the radix value.
• Example is the Common Decimal System:
– RADIX (BASE) = 10
– Digit Set = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9}
19
Decimal Number Systems
 Consider: 5032.21
210123
10
)10(1)10(2)10(2)10(3)10(0)10(5
01.02.023005000)21.5032(


5032.21
20
Commonly Occurring Bases
• Binary
– Radix = (2)10
– Digit Set = {0,1}
• Octal
– Radix = (8)10
– Digit Set = {0,1,2,3,4,5,6,7}
• Hexadecimal
– Radix = (16)10
– Digit Set = {0,1,2,3,4,5,6,7,8,9,A,B,C,D,E,F}
21
Any Base to Decimal
 A number with radix r is represented by a string of
digits:
An - 1An - 2 … A1A0 . A- 1 A- 2 … A- m  1 A- m
The string of digits represents the power series:
(Number)r
=
 
j = - 1
j
j
i
i = 0
i rArA
(Integer Portion) + (Fractional Portion)
i = n - 1 j = - m
22
Hexadecimal
 16-base number system
 16 symbols (0—9, A, B, C, D, E, F)
 Again radix is power of 2
 4 bits to represent a hexadecimal number
23
Hexadecimal to Binary
Restate the hexadecimal as four binary digits starting
at the radix point and going both ways.
24
Binary to Hexadecimal
Group the binary digits into four bits groups starting at
the radix point and going both ways, padding with
zeros as needed in the fractional part.
Convert each group of three bits to an hexadecimal
digit.
25
Binary to Hexadecimal 26
Binary Negative Numbers
• In decimal we are quite familiar with placing a
“-” sign in front of a number to denote that it is negative
• But for binary numbers a computer won’t understand
that
• What happens in memory then?
27
Binary Negative Numbers
There are several representations
- Signed magnitude
- One’s complement
- Two’s complement
28
Signed Magnitude
 Left bit (MSB) used as the sign bit
29
One’s Complement
 Invert the ones and zeros
30
Subtraction with One's Complement
 Steps for subtracting x from y with an n-bit 1's
complement representation:
 Negate x using 1's complement.
 Add -x and y.
 If the sum exceeds n bits, add the extra bit to the result.
 If the sum does not exceed n bits, leave the result as it is.
The result will be in 1's complement form
31
Example: subtracting 1 from 7 using 1's
complement
First, we need to convert 0001 to its negative equivalent in 1's complement.
Next we perform addition of 7 and our computed 1's complement of -1.
Notice that our addition caused an overflow bit. Whenever we have an overflow
bit in 1's complement, we add this bit to our sum to get the correct answer. If
there is no overflow bit, then we leave the sum as it is.
32
Another Example 33
Two’s Complement
Take 1’s complement then add 1
OR
Toggle all bits to the left of the first ‘1’ from the right
Example:
0 1 0 1 0 0 0 0
1 0 1 1 0 0 0 0
0 1 0 0 1 1 1 1
+ 1
1 0 1 1 0 0 0 0
00001010
34
Two’s Complement 35
Subtraction with Two’s Complement
Steps for subtracting x from y with an n-bit 2's
complement representation:
Negate x using 2's complement.
 Reverse all the bits in x.
 Add 1 to form -x.
Add -x and y.
Discard any bits greater than n.
The result will be in 2's complement form
36
Example: subtracting 1 from 7 using 2's
complement
First, we need to convert 00012 to its negative equivalent in 2's complement.
Next we perform addition of 7 and our computed 2's complement of -1.
Notice that our addition caused an overflow bit. Whenever we have an overflow
bit in 2's complement, we discard the extra bit. This gives us a final answer of
01102 (or 610)
37
Another Example
 1 -7 = 1 + (-7)
0001
+1001
1010
2’s complement of -7
1010 is the 2’s complement of -6
38
Registers of 8086
Intel 8086 contains following registers:
General Purpose Registers
Pointer and Index Registers
Segment Registers
Instruction Pointer
Status Flags
39
General Purpose Registers
There are four 16-bit general purpose registers:
Accumulator Register (AX)
Base Register (BX)
Count Register (CX)
Data Register (DX)
40
Following four 16-bit registers are under this
category:
Stack Pointer (SP)
Base Pointer (BP)
Source Index (SI)
 Destination Index (DI).
Pointer & Index Register 41
Segment Register
There are four 16-bit segment registers in Intel
8086:
 Code Segment Register (CS),
 Data Segment Register (DS),
 Stack Segment Register (SS),
 Extra Segment Register (ES).
42
Rest 2 Registers
Instruction Pointer
Status Flag Register
43

Mais conteúdo relacionado

Mais procurados

Assembly level language
Assembly level languageAssembly level language
Assembly level languagePDFSHARE
 
Basic programming concepts
Basic programming conceptsBasic programming concepts
Basic programming conceptssalmankhan570
 
Binary Arithmetic
Binary ArithmeticBinary Arithmetic
Binary Arithmeticgavhays
 
Computer instructions
Computer instructionsComputer instructions
Computer instructionsAnuj Modi
 
Chapt 01 Assembly Language
Chapt 01 Assembly LanguageChapt 01 Assembly Language
Chapt 01 Assembly LanguageHamza Akram
 
Assembly language programming(unit 4)
Assembly language programming(unit 4)Assembly language programming(unit 4)
Assembly language programming(unit 4)Ashim Saha
 
Registers and-common-bus
Registers and-common-busRegisters and-common-bus
Registers and-common-busAnuj Modi
 
Instruction Set Architecture
Instruction Set ArchitectureInstruction Set Architecture
Instruction Set ArchitectureDilum Bandara
 
Number system in Digital Electronics
Number system in Digital ElectronicsNumber system in Digital Electronics
Number system in Digital ElectronicsJanki Shah
 
Register transfer and micro-operation
Register transfer and micro-operationRegister transfer and micro-operation
Register transfer and micro-operationNikhil Pandit
 
Assembler directives and basic steps ALP of 8086
Assembler directives and basic steps ALP of 8086Assembler directives and basic steps ALP of 8086
Assembler directives and basic steps ALP of 8086Urvashi Singh
 
Assembly language
Assembly languageAssembly language
Assembly languagegaurav jain
 
Programming languages
Programming languagesProgramming languages
Programming languagesSimon Mui
 
Assembly Language Basics
Assembly Language BasicsAssembly Language Basics
Assembly Language BasicsEducation Front
 
Stack organization
Stack organizationStack organization
Stack organizationchauhankapil
 
Chapter 03 arithmetic for computers
Chapter 03   arithmetic for computersChapter 03   arithmetic for computers
Chapter 03 arithmetic for computersBảo Hoang
 
Assembly Language and microprocessor
Assembly Language and microprocessorAssembly Language and microprocessor
Assembly Language and microprocessorKhaled Sany
 

Mais procurados (20)

Assembly level language
Assembly level languageAssembly level language
Assembly level language
 
Basic programming concepts
Basic programming conceptsBasic programming concepts
Basic programming concepts
 
Binary Arithmetic
Binary ArithmeticBinary Arithmetic
Binary Arithmetic
 
Computer instructions
Computer instructionsComputer instructions
Computer instructions
 
Conversion of number system
Conversion of number systemConversion of number system
Conversion of number system
 
Chapt 01 Assembly Language
Chapt 01 Assembly LanguageChapt 01 Assembly Language
Chapt 01 Assembly Language
 
Assembly language programming(unit 4)
Assembly language programming(unit 4)Assembly language programming(unit 4)
Assembly language programming(unit 4)
 
Registers and-common-bus
Registers and-common-busRegisters and-common-bus
Registers and-common-bus
 
Instruction Set Architecture
Instruction Set ArchitectureInstruction Set Architecture
Instruction Set Architecture
 
Number system in Digital Electronics
Number system in Digital ElectronicsNumber system in Digital Electronics
Number system in Digital Electronics
 
Register transfer and micro-operation
Register transfer and micro-operationRegister transfer and micro-operation
Register transfer and micro-operation
 
Data Representation
Data RepresentationData Representation
Data Representation
 
Assembler directives and basic steps ALP of 8086
Assembler directives and basic steps ALP of 8086Assembler directives and basic steps ALP of 8086
Assembler directives and basic steps ALP of 8086
 
Assembly language
Assembly languageAssembly language
Assembly language
 
C++ How to program
C++ How to programC++ How to program
C++ How to program
 
Programming languages
Programming languagesProgramming languages
Programming languages
 
Assembly Language Basics
Assembly Language BasicsAssembly Language Basics
Assembly Language Basics
 
Stack organization
Stack organizationStack organization
Stack organization
 
Chapter 03 arithmetic for computers
Chapter 03   arithmetic for computersChapter 03   arithmetic for computers
Chapter 03 arithmetic for computers
 
Assembly Language and microprocessor
Assembly Language and microprocessorAssembly Language and microprocessor
Assembly Language and microprocessor
 

Destaque

Introduction to Assembly Language
Introduction to Assembly LanguageIntroduction to Assembly Language
Introduction to Assembly LanguageMotaz Saad
 
Assembly Language Lecture 5
Assembly Language Lecture 5Assembly Language Lecture 5
Assembly Language Lecture 5Motaz Saad
 
Assembly language programming
Assembly language programmingAssembly language programming
Assembly language programminghimhk
 
.NET Framework Projet with C#
.NET Framework Projet with C#.NET Framework Projet with C#
.NET Framework Projet with C#eclumson
 
Assembly Language Tanka - SAKAI Hiroaki
Assembly Language Tanka - SAKAI HiroakiAssembly Language Tanka - SAKAI Hiroaki
Assembly Language Tanka - SAKAI Hiroakiasmtanka
 
Assembly Language Programming By Ytha Yu, Charles Marut Chap 4 (Introduction ...
Assembly Language Programming By Ytha Yu, Charles Marut Chap 4 (Introduction ...Assembly Language Programming By Ytha Yu, Charles Marut Chap 4 (Introduction ...
Assembly Language Programming By Ytha Yu, Charles Marut Chap 4 (Introduction ...Bilal Amjad
 
Lec 01 basic concepts
Lec 01 basic conceptsLec 01 basic concepts
Lec 01 basic conceptsAbdul Khan
 
Assembly Language Lecture 4
Assembly Language Lecture 4Assembly Language Lecture 4
Assembly Language Lecture 4Motaz Saad
 
Assembly Language Lecture 2
Assembly Language Lecture 2Assembly Language Lecture 2
Assembly Language Lecture 2Motaz Saad
 
Math Puzzle Game By Assembly Language
Math Puzzle Game By Assembly LanguageMath Puzzle Game By Assembly Language
Math Puzzle Game By Assembly LanguageSanzid Kawsar
 
Chp6 assembly language programming for pic copy
Chp6 assembly language programming for pic   copyChp6 assembly language programming for pic   copy
Chp6 assembly language programming for pic copymkazree
 

Destaque (20)

Introduction to Assembly Language
Introduction to Assembly LanguageIntroduction to Assembly Language
Introduction to Assembly Language
 
Assembly Language -I
Assembly Language -IAssembly Language -I
Assembly Language -I
 
Assembly Language Lecture 5
Assembly Language Lecture 5Assembly Language Lecture 5
Assembly Language Lecture 5
 
Assembly language programming
Assembly language programmingAssembly language programming
Assembly language programming
 
Assembly
AssemblyAssembly
Assembly
 
.NET Framework Projet with C#
.NET Framework Projet with C#.NET Framework Projet with C#
.NET Framework Projet with C#
 
Assembly fundamentals
Assembly fundamentalsAssembly fundamentals
Assembly fundamentals
 
Assembly Language Tanka - SAKAI Hiroaki
Assembly Language Tanka - SAKAI HiroakiAssembly Language Tanka - SAKAI Hiroaki
Assembly Language Tanka - SAKAI Hiroaki
 
Assembly language part I
Assembly language part IAssembly language part I
Assembly language part I
 
Chapt 01 basic concepts
Chapt 01   basic conceptsChapt 01   basic concepts
Chapt 01 basic concepts
 
Processor Basics
Processor BasicsProcessor Basics
Processor Basics
 
Assembly Language Programming By Ytha Yu, Charles Marut Chap 4 (Introduction ...
Assembly Language Programming By Ytha Yu, Charles Marut Chap 4 (Introduction ...Assembly Language Programming By Ytha Yu, Charles Marut Chap 4 (Introduction ...
Assembly Language Programming By Ytha Yu, Charles Marut Chap 4 (Introduction ...
 
Chapter 1
Chapter 1Chapter 1
Chapter 1
 
Lec 01 basic concepts
Lec 01 basic conceptsLec 01 basic concepts
Lec 01 basic concepts
 
[ASM] Lab1
[ASM] Lab1[ASM] Lab1
[ASM] Lab1
 
Assembly Language Lecture 4
Assembly Language Lecture 4Assembly Language Lecture 4
Assembly Language Lecture 4
 
Assembly Language Lecture 2
Assembly Language Lecture 2Assembly Language Lecture 2
Assembly Language Lecture 2
 
Math Puzzle Game By Assembly Language
Math Puzzle Game By Assembly LanguageMath Puzzle Game By Assembly Language
Math Puzzle Game By Assembly Language
 
Chp6 assembly language programming for pic copy
Chp6 assembly language programming for pic   copyChp6 assembly language programming for pic   copy
Chp6 assembly language programming for pic copy
 
08. Numeral Systems
08. Numeral Systems08. Numeral Systems
08. Numeral Systems
 

Semelhante a Intro to Assembly Language

Gsp 215 Future Our Mission/newtonhelp.com
Gsp 215 Future Our Mission/newtonhelp.comGsp 215 Future Our Mission/newtonhelp.com
Gsp 215 Future Our Mission/newtonhelp.comamaranthbeg8
 
GSP 215 Become Exceptional/newtonhelp.com
GSP 215 Become Exceptional/newtonhelp.comGSP 215 Become Exceptional/newtonhelp.com
GSP 215 Become Exceptional/newtonhelp.combellflower148
 
GSP 215 Perfect Education/newtonhelp.com
GSP 215 Perfect Education/newtonhelp.comGSP 215 Perfect Education/newtonhelp.com
GSP 215 Perfect Education/newtonhelp.combellflower169
 
GSP 215 Doing by learn/newtonhelp.com
GSP 215 Doing by learn/newtonhelp.comGSP 215 Doing by learn/newtonhelp.com
GSP 215 Doing by learn/newtonhelp.combellflower126
 
6_2018_11_23!09_24_56_PM (1).pptx
6_2018_11_23!09_24_56_PM (1).pptx6_2018_11_23!09_24_56_PM (1).pptx
6_2018_11_23!09_24_56_PM (1).pptxHebaEng
 
data representation
 data representation data representation
data representationHaroon_007
 
Data representation moris mano ch 03
Data representation   moris mano ch  03Data representation   moris mano ch  03
Data representation moris mano ch 03thearticlenow
 
6_2020_12_23!08_00_40_AM.pdf
6_2020_12_23!08_00_40_AM.pdf6_2020_12_23!08_00_40_AM.pdf
6_2020_12_23!08_00_40_AM.pdfHebaEng
 
Computers numbering systems
Computers   numbering systemsComputers   numbering systems
Computers numbering systemssld1950
 
Introduction to computers
Introduction to computersIntroduction to computers
Introduction to computersNishant Munjal
 
GSP 215 Enhance teaching/tutorialrank.com
 GSP 215 Enhance teaching/tutorialrank.com GSP 215 Enhance teaching/tutorialrank.com
GSP 215 Enhance teaching/tutorialrank.comjonhson300
 
GSP 215 Inspiring Innovation/tutorialrank.com
GSP 215 Inspiring Innovation/tutorialrank.comGSP 215 Inspiring Innovation/tutorialrank.com
GSP 215 Inspiring Innovation/tutorialrank.comjonhson129
 
Introduction to digital computers and Number systems.pptx
Introduction to digital computers and Number systems.pptxIntroduction to digital computers and Number systems.pptx
Introduction to digital computers and Number systems.pptxBhawaniShankarSahu1
 

Semelhante a Intro to Assembly Language (20)

Gsp 215 Future Our Mission/newtonhelp.com
Gsp 215 Future Our Mission/newtonhelp.comGsp 215 Future Our Mission/newtonhelp.com
Gsp 215 Future Our Mission/newtonhelp.com
 
GSP 215 Become Exceptional/newtonhelp.com
GSP 215 Become Exceptional/newtonhelp.comGSP 215 Become Exceptional/newtonhelp.com
GSP 215 Become Exceptional/newtonhelp.com
 
GSP 215 Perfect Education/newtonhelp.com
GSP 215 Perfect Education/newtonhelp.comGSP 215 Perfect Education/newtonhelp.com
GSP 215 Perfect Education/newtonhelp.com
 
GSP 215 Doing by learn/newtonhelp.com
GSP 215 Doing by learn/newtonhelp.comGSP 215 Doing by learn/newtonhelp.com
GSP 215 Doing by learn/newtonhelp.com
 
6_2018_11_23!09_24_56_PM (1).pptx
6_2018_11_23!09_24_56_PM (1).pptx6_2018_11_23!09_24_56_PM (1).pptx
6_2018_11_23!09_24_56_PM (1).pptx
 
Process.org
Process.orgProcess.org
Process.org
 
data representation
 data representation data representation
data representation
 
C programming part2
C programming part2C programming part2
C programming part2
 
C programming part2
C programming part2C programming part2
C programming part2
 
C programming part2
C programming part2C programming part2
C programming part2
 
Data representation moris mano ch 03
Data representation   moris mano ch  03Data representation   moris mano ch  03
Data representation moris mano ch 03
 
Datarepresentation2
Datarepresentation2Datarepresentation2
Datarepresentation2
 
6_2020_12_23!08_00_40_AM.pdf
6_2020_12_23!08_00_40_AM.pdf6_2020_12_23!08_00_40_AM.pdf
6_2020_12_23!08_00_40_AM.pdf
 
Computers numbering systems
Computers   numbering systemsComputers   numbering systems
Computers numbering systems
 
Introduction to computers
Introduction to computersIntroduction to computers
Introduction to computers
 
Ch3
Ch3Ch3
Ch3
 
GSP 215 Enhance teaching/tutorialrank.com
 GSP 215 Enhance teaching/tutorialrank.com GSP 215 Enhance teaching/tutorialrank.com
GSP 215 Enhance teaching/tutorialrank.com
 
GSP 215 Inspiring Innovation/tutorialrank.com
GSP 215 Inspiring Innovation/tutorialrank.comGSP 215 Inspiring Innovation/tutorialrank.com
GSP 215 Inspiring Innovation/tutorialrank.com
 
DATA REPRESENTATION
DATA  REPRESENTATIONDATA  REPRESENTATION
DATA REPRESENTATION
 
Introduction to digital computers and Number systems.pptx
Introduction to digital computers and Number systems.pptxIntroduction to digital computers and Number systems.pptx
Introduction to digital computers and Number systems.pptx
 

Último

Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...roncy bisnoi
 
MANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLS
MANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLSMANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLS
MANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLSSIVASHANKAR N
 
College Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service NashikCollege Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service NashikCall Girls in Nagpur High Profile
 
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICSAPPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICSKurinjimalarL3
 
Top Rated Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated  Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...Top Rated  Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...Call Girls in Nagpur High Profile
 
Coefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptxCoefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptxAsutosh Ranjan
 
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...ranjana rawat
 
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICS
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICSHARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICS
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICSRajkumarAkumalla
 
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...Dr.Costas Sachpazis
 
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escortsranjana rawat
 
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...Christo Ananth
 
Call Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service Nashik
Call Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service NashikCall Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service Nashik
Call Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service NashikCall Girls in Nagpur High Profile
 
Microscopic Analysis of Ceramic Materials.pptx
Microscopic Analysis of Ceramic Materials.pptxMicroscopic Analysis of Ceramic Materials.pptx
Microscopic Analysis of Ceramic Materials.pptxpurnimasatapathy1234
 
247267395-1-Symmetric-and-distributed-shared-memory-architectures-ppt (1).ppt
247267395-1-Symmetric-and-distributed-shared-memory-architectures-ppt (1).ppt247267395-1-Symmetric-and-distributed-shared-memory-architectures-ppt (1).ppt
247267395-1-Symmetric-and-distributed-shared-memory-architectures-ppt (1).pptssuser5c9d4b1
 
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130Suhani Kapoor
 
result management system report for college project
result management system report for college projectresult management system report for college project
result management system report for college projectTonystark477637
 
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Serviceranjana rawat
 
Software Development Life Cycle By Team Orange (Dept. of Pharmacy)
Software Development Life Cycle By  Team Orange (Dept. of Pharmacy)Software Development Life Cycle By  Team Orange (Dept. of Pharmacy)
Software Development Life Cycle By Team Orange (Dept. of Pharmacy)Suman Mia
 
SPICE PARK APR2024 ( 6,793 SPICE Models )
SPICE PARK APR2024 ( 6,793 SPICE Models )SPICE PARK APR2024 ( 6,793 SPICE Models )
SPICE PARK APR2024 ( 6,793 SPICE Models )Tsuyoshi Horigome
 

Último (20)

Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...
 
MANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLS
MANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLSMANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLS
MANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLS
 
College Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service NashikCollege Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
 
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICSAPPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
 
Top Rated Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated  Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...Top Rated  Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
 
Coefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptxCoefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptx
 
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
 
Roadmap to Membership of RICS - Pathways and Routes
Roadmap to Membership of RICS - Pathways and RoutesRoadmap to Membership of RICS - Pathways and Routes
Roadmap to Membership of RICS - Pathways and Routes
 
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICS
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICSHARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICS
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICS
 
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
 
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts
 
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
 
Call Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service Nashik
Call Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service NashikCall Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service Nashik
Call Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service Nashik
 
Microscopic Analysis of Ceramic Materials.pptx
Microscopic Analysis of Ceramic Materials.pptxMicroscopic Analysis of Ceramic Materials.pptx
Microscopic Analysis of Ceramic Materials.pptx
 
247267395-1-Symmetric-and-distributed-shared-memory-architectures-ppt (1).ppt
247267395-1-Symmetric-and-distributed-shared-memory-architectures-ppt (1).ppt247267395-1-Symmetric-and-distributed-shared-memory-architectures-ppt (1).ppt
247267395-1-Symmetric-and-distributed-shared-memory-architectures-ppt (1).ppt
 
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
 
result management system report for college project
result management system report for college projectresult management system report for college project
result management system report for college project
 
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service
 
Software Development Life Cycle By Team Orange (Dept. of Pharmacy)
Software Development Life Cycle By  Team Orange (Dept. of Pharmacy)Software Development Life Cycle By  Team Orange (Dept. of Pharmacy)
Software Development Life Cycle By Team Orange (Dept. of Pharmacy)
 
SPICE PARK APR2024 ( 6,793 SPICE Models )
SPICE PARK APR2024 ( 6,793 SPICE Models )SPICE PARK APR2024 ( 6,793 SPICE Models )
SPICE PARK APR2024 ( 6,793 SPICE Models )
 

Intro to Assembly Language

  • 1. Intro to Assembly Language MUHAMMAD TASNIM MOHIUDDIN LECTURER, CSE, UIU 1
  • 2. Levels of Programming Languages 1) Machine Language 2) Assembly Language (Low Level Language) 3) High Level Languages 2
  • 3. Machine Language  Set of fundamental instructions  Native to a processor: executed directly by hardware  Expressed as a pattern of 1’s and 0’s Here’s what a program-fragment looks like: 10100001 10111100 10010011 00000100 00001000 00000011 00000101 11000000 10010011 00000100 00001000 10100011 11000000 10010100 00000100 00001000 It means: z = x + y; 3
  • 4. Assembly Language  One step up from machine language  Designed for a specific family of processors (different processor groups/family has different Assembly Language)  Consists of symbolic instructions directly related to machine language instructions one-for-one and are assembled into machine language.  Alphanumeric equivalent of machine language  Mnemonics more human-oriented than 1’s and 0’s  Example: for A = A + 4 MOV AX, A ADD AX, 4 MOV A, AX 4
  • 5. High Level Languages  Similar to Natural language.  Designed to eliminate the technicalities of a particular computer.  Statements compiled in a high level language typically generate many low- level instructions.  Example: C, Java, Python etc 5
  • 6. Advantages of High-Level Languages  Program development is faster  High-level statements: fewer instructions to code  Program maintenance is easier  For the same above reasons  Programs are portable 6
  • 7. Why Assembly Language?  Accessibility to system hardware  Assembly Language is useful for implementing system software  Also useful for small embedded system applications  Faster and shorter programs.  Compilers do not always generate optimum code.  Resident programs (that reside in memory while other program execute) and interrupt service routines (that handle input and output) are almost always develop in Assembly Language.  Instruction set knowledge is important for machine designers.  Compiler writers must be familiar with details of machine language. 7
  • 8. Advantages of Assembly Language  Shows how program interfaces with the processor, operating system, and BIOS.  Shows how data is represented and stored in memory and on external devices.  Clarifies how processor accesses and executes instructions and how instructions access and process data. 8
  • 9. Assembler  An assembler is a program that converts source-code programs written in assembly language into object files in machine language  Popular assemblers have emerged over the years for the Intel family of processors. These include …  TASM (Turbo Assembler from Borland)  NASM (Netwide Assembler for both Windows and Linux), and  GNU assembler distributed by the free software foundation 9
  • 12. Computer Architecture Control Bus CPU Memory I/O Address Bus Data Bus 12
  • 13. Organization of 8086 Processor  16 bit Processor  16 bit data bus  16 bit registers  20 bit Address bus 13
  • 14. Organization of 8086 Processor CPU Memory Address Bus Data Bus 20 16 CPU-Memory Interface 16-bit Control Bus 14
  • 15. Bytes and Words  Information processed by computer is stored in its memory  A memory element can store one bit of data  Group of 8 bits forms one byte  Group of 16 bits or 2 bytes forms one word 15
  • 16. RAM and ROM  Random-Access Memory (RAM)  Can be performed read and write operation  Program instruction and data are loaded into RAM  Contents are lost when the machine is turned off  ROM (Read-Only-Memory)  Once initialized can’t be changed, can only be read  Retain values event the machine is turned off  Hence used to store system programs 16
  • 17. Address Space of 8086 17
  • 19. Number System • Consists of TWO Things: – A BASE or RADIX Value – A SET of DIGITS • Digits are symbols representing all values less than the radix value. • Example is the Common Decimal System: – RADIX (BASE) = 10 – Digit Set = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9} 19
  • 20. Decimal Number Systems  Consider: 5032.21 210123 10 )10(1)10(2)10(2)10(3)10(0)10(5 01.02.023005000)21.5032(   5032.21 20
  • 21. Commonly Occurring Bases • Binary – Radix = (2)10 – Digit Set = {0,1} • Octal – Radix = (8)10 – Digit Set = {0,1,2,3,4,5,6,7} • Hexadecimal – Radix = (16)10 – Digit Set = {0,1,2,3,4,5,6,7,8,9,A,B,C,D,E,F} 21
  • 22. Any Base to Decimal  A number with radix r is represented by a string of digits: An - 1An - 2 … A1A0 . A- 1 A- 2 … A- m  1 A- m The string of digits represents the power series: (Number)r =   j = - 1 j j i i = 0 i rArA (Integer Portion) + (Fractional Portion) i = n - 1 j = - m 22
  • 23. Hexadecimal  16-base number system  16 symbols (0—9, A, B, C, D, E, F)  Again radix is power of 2  4 bits to represent a hexadecimal number 23
  • 24. Hexadecimal to Binary Restate the hexadecimal as four binary digits starting at the radix point and going both ways. 24
  • 25. Binary to Hexadecimal Group the binary digits into four bits groups starting at the radix point and going both ways, padding with zeros as needed in the fractional part. Convert each group of three bits to an hexadecimal digit. 25
  • 27. Binary Negative Numbers • In decimal we are quite familiar with placing a “-” sign in front of a number to denote that it is negative • But for binary numbers a computer won’t understand that • What happens in memory then? 27
  • 28. Binary Negative Numbers There are several representations - Signed magnitude - One’s complement - Two’s complement 28
  • 29. Signed Magnitude  Left bit (MSB) used as the sign bit 29
  • 30. One’s Complement  Invert the ones and zeros 30
  • 31. Subtraction with One's Complement  Steps for subtracting x from y with an n-bit 1's complement representation:  Negate x using 1's complement.  Add -x and y.  If the sum exceeds n bits, add the extra bit to the result.  If the sum does not exceed n bits, leave the result as it is. The result will be in 1's complement form 31
  • 32. Example: subtracting 1 from 7 using 1's complement First, we need to convert 0001 to its negative equivalent in 1's complement. Next we perform addition of 7 and our computed 1's complement of -1. Notice that our addition caused an overflow bit. Whenever we have an overflow bit in 1's complement, we add this bit to our sum to get the correct answer. If there is no overflow bit, then we leave the sum as it is. 32
  • 34. Two’s Complement Take 1’s complement then add 1 OR Toggle all bits to the left of the first ‘1’ from the right Example: 0 1 0 1 0 0 0 0 1 0 1 1 0 0 0 0 0 1 0 0 1 1 1 1 + 1 1 0 1 1 0 0 0 0 00001010 34
  • 36. Subtraction with Two’s Complement Steps for subtracting x from y with an n-bit 2's complement representation: Negate x using 2's complement.  Reverse all the bits in x.  Add 1 to form -x. Add -x and y. Discard any bits greater than n. The result will be in 2's complement form 36
  • 37. Example: subtracting 1 from 7 using 2's complement First, we need to convert 00012 to its negative equivalent in 2's complement. Next we perform addition of 7 and our computed 2's complement of -1. Notice that our addition caused an overflow bit. Whenever we have an overflow bit in 2's complement, we discard the extra bit. This gives us a final answer of 01102 (or 610) 37
  • 38. Another Example  1 -7 = 1 + (-7) 0001 +1001 1010 2’s complement of -7 1010 is the 2’s complement of -6 38
  • 39. Registers of 8086 Intel 8086 contains following registers: General Purpose Registers Pointer and Index Registers Segment Registers Instruction Pointer Status Flags 39
  • 40. General Purpose Registers There are four 16-bit general purpose registers: Accumulator Register (AX) Base Register (BX) Count Register (CX) Data Register (DX) 40
  • 41. Following four 16-bit registers are under this category: Stack Pointer (SP) Base Pointer (BP) Source Index (SI)  Destination Index (DI). Pointer & Index Register 41
  • 42. Segment Register There are four 16-bit segment registers in Intel 8086:  Code Segment Register (CS),  Data Segment Register (DS),  Stack Segment Register (SS),  Extra Segment Register (ES). 42
  • 43. Rest 2 Registers Instruction Pointer Status Flag Register 43