SlideShare a Scribd company logo
ASSEMBLY
LANGUAGE
PROGRAMMING
Why we use Assembly Language?
 We use it for better understanding of interaction
between hardware and software and vice versa.
 We use it for optimization of processing time.
 It is used for embedded programming.
Origin of Assembly:-
 The word “assembly” comes from the point that in
older computers,every part of computer is
programmed and programmers assemble the code
of all parts and then compile it for doing some
specific task.
What is Assembly Language?
 It is a low level computer programming language, in
which mnemonics are used.
 For e.g. :- ADD,SUB,MOV etc.
Why we use Registers?
CPU
Hard disk RAM Cache CPURegisters
What is Register?
 Fastest storage area or location (for quickly
accessing by CPU)
 Derived from register which means record or
collection.
 Intel 4004 in 1971,registers were first used.
Types of Registers(General Purpose):-
1. Accumulator Register:-
Used for input and output operations basically. Also
used for mathematical and logical operations.
A=8 bits.
Ax=16 bits.
Eax=32 bits.
Rax=64 bits.
2. Base Register:-
Holds addresses of data present in the RAM.
B=8 bits.
Bx=16 bits.
EBx=32 bits.
RBx=64 bits.
Types of Registers(General Purpose):-
3. Counter Register:-
Used for counting or loop instructions.
C=8 bits.
Cx=16 bits.
ECx=32 bits.
RCx=64 bits.
4. Data Register:-
Holds data for output.
D=8 bits.
Dx=16 bits.
EDx=32 bits.
RDx=64 bits.
Types of Registers(Segment Registers):-
5. Code Segment:-
Hold address of code segment which is in RAM.
6. Data Segment:-
Holds address of data segment.
7. Stack Segment:-
Holds address of stack segment.
8. Extra Segment:-
Holds address extra code in the code segment.
Types of Registers(Index Registers):-
9. Source Index:-
Points to the source address.
10. Destination Index:-
Points to the destination operand.
Types of Registers(Special Purpose):-
9. Stack Pointer:-
Points the current top of stack.
10. Instruction Pointer:-
Holds the next instruction.
11. Flag Register:-
Hold current status of program.
12. Base pointer:-
Points base of top of stack.
Addressing Modes:-
 Ways to access data or How to access data from address.
For e.g:-
2+5
1. Register addressing:-
If both operands are assigned to a register.
E.g:- Add dl,bl
2. Immediate addressing:-
If one operand is assigned to a register and other is constant.
E.g:-Add dl,2
3. Memory addressing:-
Access static data directly from RAM.
E.g:-Add dl,address
Operands
Opcode
Data Transfer Instruction & Service Routine:-
 How data comes to a register.
MOV Dl,2
For Printing 2
MOV Ah,2
 Some service routines:-
1=input a character with echo.
2=output/print a single character.
8=input characters without echo.
9=Print string
4ch=Exit.
Service Routine
Interrupt:-
 Stop the current program and allow microprocessor to access hardware
to take input or give output.
For e.g:-
INT 21H=Interrupt for text handling
INT 20H=Interrupt for Video/Graphics handling.
For output:-
Mov ah,2
INT 21H
For input:-
Mov ah,1
INT 21H
ASCII:-
 Character encoding scheme.
 American standards association.
 1963.
A=65 to Z=90
A=91 to Z=122
0=48
Nextline =10
Carriage return=13.
Structure of Program in Assembly?
 Dosseg Manages the arrangements of segments of a
program.
 .model small (Click to understand).
model directive  How much space a program will reserve in
RAM.
 .stack 100h
stack segment directive  Specifies storage for stack.
 .data
data segment directive  Variables are defined here.
 .code
code segment directive Instructions
 Main proc
proc can be any name.
 Main endp
 End main
Model sizes….
Ram
Code + data<=64kbtiny
Code<=64kb , data<=64kb small
Code<=Any size , data<=64kb medium
Code<=64kb ,data<=any size compact
Code<=any size , data<=any size large
Code<=any size , data<=any size Huge
data
Code
Stack
General Rules for Assembly:-
1. Both operands must be of same size.
Mov Ax,Bl illegal
Mov Al,Bl legal
2. Both operands can not be memory operands simultaneously.
Mov i,j illegal
Mov Ax,j legal
3. First operand can not be an immediate value.
Mov 2,Ax illegal
Mov Ax,2 legal
Variables, Data types, Offset and LEA:-
 Data type=Data size
.Data
Note:-Don’t use reserved keywords like add,sub,mov etc.
Different data sizes:-
Variable Name Data Size Value
Var1 Db 49
Var2 Db ‘1’
Var3 Dw ‘12345$’
DB Define Byte 1 byte,8 bits
DW Define Word 2 Bytes,16bits
DD Define double word 4 bytes,32bits
DQ Define Quad word 7 bytes,64bits
DT Define ten bytes 10 bytes,80 bits
$ for terminating string
Continued…
 In code segment, we have to follow some steps to access the
data elements. Below is shown:-
1. We need the address of data segment and address contains
16 bits so we need 16 bit register to hold that address.
.code
Mov ax, @data
2. We need to access data from any variable so we need heap
memory(Fast access to data from any variable).So we need
“Ds” register which is way to create heap memory. So ax
which contains address of data should be moved to ds
register for address contained by ax to be converted to heap
memory .
Mov ds,ax.
Accumulator used for input and output of data
Continued…
 If we have an string and wanted to move it to a
register we use offset(which holds the beginning
address of variable) or lea(an in directed instruction
used as a pointer in which first variable points to the
address of second variable).
 As follows
mov dx,offset var3
Or
Lea dx,var3 .

More Related Content

What's hot

Operating system services 9
Operating system services 9Operating system services 9
Operating system services 9myrajendra
 
Memory organization (Computer architecture)
Memory organization (Computer architecture)Memory organization (Computer architecture)
Memory organization (Computer architecture)
Sandesh Jonchhe
 
Von-Neumann machine and IAS architecture
Von-Neumann machine and  IAS architectureVon-Neumann machine and  IAS architecture
Von-Neumann machine and IAS architecture
Shishir Aryal
 
Thrashing allocation frames.43
Thrashing allocation frames.43Thrashing allocation frames.43
Thrashing allocation frames.43myrajendra
 
Memory Management in OS
Memory Management in OSMemory Management in OS
Memory Management in OS
vampugani
 
Basic Computer Organization and Design
Basic  Computer  Organization  and  DesignBasic  Computer  Organization  and  Design
Basic Computer Organization and Design
Aksum Institute of Technology(AIT, @Letsgo)
 
Instruction pipeline: Computer Architecture
Instruction pipeline: Computer ArchitectureInstruction pipeline: Computer Architecture
Instruction pipeline: Computer Architecture
InteX Research Lab
 
pipelining
pipeliningpipelining
pipelining
Siddique Ibrahim
 
Computer architecture input output organization
Computer architecture input output organizationComputer architecture input output organization
Computer architecture input output organization
Mazin Alwaaly
 
Memory Addressing
Memory AddressingMemory Addressing
Memory Addressing
chauhankapil
 
Computer Organization and Architecture.
Computer Organization and Architecture.Computer Organization and Architecture.
Computer Organization and Architecture.
CS_GDRCST
 
Processor organization &amp; register organization
Processor organization &amp; register organizationProcessor organization &amp; register organization
Processor organization &amp; register organization
Ghanshyam Patel
 
Segmentation in Operating Systems.
Segmentation in Operating Systems.Segmentation in Operating Systems.
Segmentation in Operating Systems.
Muhammad SiRaj Munir
 
Multithreading computer architecture
 Multithreading computer architecture  Multithreading computer architecture
Multithreading computer architecture
Haris456
 
Instruction Cycle in Computer Organization.pptx
Instruction Cycle in Computer Organization.pptxInstruction Cycle in Computer Organization.pptx
Instruction Cycle in Computer Organization.pptx
Yash346903
 
Basic Computer Organization and Design
Basic Computer Organization and DesignBasic Computer Organization and Design
Basic Computer Organization and Design
Kamal Acharya
 
Instruction Set Architecture (ISA)
Instruction Set Architecture (ISA)Instruction Set Architecture (ISA)
Instruction Set Architecture (ISA)
Gaditek
 
Computer Architecture – An Introduction
Computer Architecture – An IntroductionComputer Architecture – An Introduction
Computer Architecture – An Introduction
Dilum Bandara
 

What's hot (20)

Operating system services 9
Operating system services 9Operating system services 9
Operating system services 9
 
Memory organization (Computer architecture)
Memory organization (Computer architecture)Memory organization (Computer architecture)
Memory organization (Computer architecture)
 
Assembly Language
Assembly LanguageAssembly Language
Assembly Language
 
Von-Neumann machine and IAS architecture
Von-Neumann machine and  IAS architectureVon-Neumann machine and  IAS architecture
Von-Neumann machine and IAS architecture
 
Thrashing allocation frames.43
Thrashing allocation frames.43Thrashing allocation frames.43
Thrashing allocation frames.43
 
Memory Management in OS
Memory Management in OSMemory Management in OS
Memory Management in OS
 
Basic Computer Organization and Design
Basic  Computer  Organization  and  DesignBasic  Computer  Organization  and  Design
Basic Computer Organization and Design
 
Instruction cycle
Instruction cycleInstruction cycle
Instruction cycle
 
Instruction pipeline: Computer Architecture
Instruction pipeline: Computer ArchitectureInstruction pipeline: Computer Architecture
Instruction pipeline: Computer Architecture
 
pipelining
pipeliningpipelining
pipelining
 
Computer architecture input output organization
Computer architecture input output organizationComputer architecture input output organization
Computer architecture input output organization
 
Memory Addressing
Memory AddressingMemory Addressing
Memory Addressing
 
Computer Organization and Architecture.
Computer Organization and Architecture.Computer Organization and Architecture.
Computer Organization and Architecture.
 
Processor organization &amp; register organization
Processor organization &amp; register organizationProcessor organization &amp; register organization
Processor organization &amp; register organization
 
Segmentation in Operating Systems.
Segmentation in Operating Systems.Segmentation in Operating Systems.
Segmentation in Operating Systems.
 
Multithreading computer architecture
 Multithreading computer architecture  Multithreading computer architecture
Multithreading computer architecture
 
Instruction Cycle in Computer Organization.pptx
Instruction Cycle in Computer Organization.pptxInstruction Cycle in Computer Organization.pptx
Instruction Cycle in Computer Organization.pptx
 
Basic Computer Organization and Design
Basic Computer Organization and DesignBasic Computer Organization and Design
Basic Computer Organization and Design
 
Instruction Set Architecture (ISA)
Instruction Set Architecture (ISA)Instruction Set Architecture (ISA)
Instruction Set Architecture (ISA)
 
Computer Architecture – An Introduction
Computer Architecture – An IntroductionComputer Architecture – An Introduction
Computer Architecture – An Introduction
 

Similar to Assembly language progarmming

Introduction to Processor Design and ARM Processor
Introduction to Processor Design and ARM ProcessorIntroduction to Processor Design and ARM Processor
Introduction to Processor Design and ARM Processor
Darling Jemima
 
Assembly Language
Assembly LanguageAssembly Language
Assembly Language
Vijay Kumar
 
Lect05 Prog Model
Lect05 Prog ModelLect05 Prog Model
Lect05 Prog Model
anoosdomain
 
Part III: Assembly Language
Part III: Assembly LanguagePart III: Assembly Language
Part III: Assembly LanguageAhmed M. Abed
 
module-3.pptx
module-3.pptxmodule-3.pptx
module-3.pptx
Ambika Naik
 
Instruction codes
Instruction codesInstruction codes
Instruction codes
pradeepa velmurugan
 
System concept and hardware
System concept and hardwareSystem concept and hardware
System concept and hardware
fiza1975
 
CS520 Computer Architecture Project 2 � Spring 2023 Due date 0326.pdf
CS520 Computer Architecture Project 2 � Spring 2023 Due date 0326.pdfCS520 Computer Architecture Project 2 � Spring 2023 Due date 0326.pdf
CS520 Computer Architecture Project 2 � Spring 2023 Due date 0326.pdf
ameerandsons
 
Session01_Intro.pdf
Session01_Intro.pdfSession01_Intro.pdf
Session01_Intro.pdf
RahnerJames
 
C from hello world to 010101
C from hello world to 010101C from hello world to 010101
C from hello world to 010101
Bellaj Badr
 
Patt patelch04
Patt patelch04Patt patelch04
Patt patelch04
Sadawimala Rathnapure
 
Systemsoftwarenotes 100929171256-phpapp02 2
Systemsoftwarenotes 100929171256-phpapp02 2Systemsoftwarenotes 100929171256-phpapp02 2
Systemsoftwarenotes 100929171256-phpapp02 2Khaja Dileef
 
Unit-1_Digital Computers, number systemCOA[1].pptx
Unit-1_Digital Computers, number systemCOA[1].pptxUnit-1_Digital Computers, number systemCOA[1].pptx
Unit-1_Digital Computers, number systemCOA[1].pptx
VanshJain322212
 
LECTURE2 td 2 sue les theories de graphes
LECTURE2 td 2 sue les theories de graphesLECTURE2 td 2 sue les theories de graphes
LECTURE2 td 2 sue les theories de graphes
AhmedMahjoub15
 
Computer architecture instruction formats
Computer architecture instruction formatsComputer architecture instruction formats
Computer architecture instruction formats
Mazin Alwaaly
 
Introduction to Assembly Language
Introduction to Assembly Language Introduction to Assembly Language
Introduction to Assembly Language
ApekshaShinde6
 
Introduction to programming concepts
Introduction to programming conceptsIntroduction to programming concepts
Introduction to programming conceptshermiraguilar
 
Introduction to programming concepts
Introduction to programming conceptsIntroduction to programming concepts
Introduction to programming conceptshermiraguilar
 

Similar to Assembly language progarmming (20)

Introduction to Processor Design and ARM Processor
Introduction to Processor Design and ARM ProcessorIntroduction to Processor Design and ARM Processor
Introduction to Processor Design and ARM Processor
 
Assembly Language
Assembly LanguageAssembly Language
Assembly Language
 
Lect05 Prog Model
Lect05 Prog ModelLect05 Prog Model
Lect05 Prog Model
 
Part III: Assembly Language
Part III: Assembly LanguagePart III: Assembly Language
Part III: Assembly Language
 
module-3.pptx
module-3.pptxmodule-3.pptx
module-3.pptx
 
Instruction codes
Instruction codesInstruction codes
Instruction codes
 
System concept and hardware
System concept and hardwareSystem concept and hardware
System concept and hardware
 
CS520 Computer Architecture Project 2 � Spring 2023 Due date 0326.pdf
CS520 Computer Architecture Project 2 � Spring 2023 Due date 0326.pdfCS520 Computer Architecture Project 2 � Spring 2023 Due date 0326.pdf
CS520 Computer Architecture Project 2 � Spring 2023 Due date 0326.pdf
 
Ui disk & terminal drivers
Ui disk & terminal driversUi disk & terminal drivers
Ui disk & terminal drivers
 
Session01_Intro.pdf
Session01_Intro.pdfSession01_Intro.pdf
Session01_Intro.pdf
 
C from hello world to 010101
C from hello world to 010101C from hello world to 010101
C from hello world to 010101
 
Patt patelch04
Patt patelch04Patt patelch04
Patt patelch04
 
Systemsoftwarenotes 100929171256-phpapp02 2
Systemsoftwarenotes 100929171256-phpapp02 2Systemsoftwarenotes 100929171256-phpapp02 2
Systemsoftwarenotes 100929171256-phpapp02 2
 
Unit-1_Digital Computers, number systemCOA[1].pptx
Unit-1_Digital Computers, number systemCOA[1].pptxUnit-1_Digital Computers, number systemCOA[1].pptx
Unit-1_Digital Computers, number systemCOA[1].pptx
 
מצגת פרויקט
מצגת פרויקטמצגת פרויקט
מצגת פרויקט
 
LECTURE2 td 2 sue les theories de graphes
LECTURE2 td 2 sue les theories de graphesLECTURE2 td 2 sue les theories de graphes
LECTURE2 td 2 sue les theories de graphes
 
Computer architecture instruction formats
Computer architecture instruction formatsComputer architecture instruction formats
Computer architecture instruction formats
 
Introduction to Assembly Language
Introduction to Assembly Language Introduction to Assembly Language
Introduction to Assembly Language
 
Introduction to programming concepts
Introduction to programming conceptsIntroduction to programming concepts
Introduction to programming concepts
 
Introduction to programming concepts
Introduction to programming conceptsIntroduction to programming concepts
Introduction to programming concepts
 

Recently uploaded

PHP Frameworks: I want to break free (IPC Berlin 2024)
PHP Frameworks: I want to break free (IPC Berlin 2024)PHP Frameworks: I want to break free (IPC Berlin 2024)
PHP Frameworks: I want to break free (IPC Berlin 2024)
Ralf Eggert
 
Key Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdfKey Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdf
Cheryl Hung
 
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Ramesh Iyer
 
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdfFIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance
 
Bits & Pixels using AI for Good.........
Bits & Pixels using AI for Good.........Bits & Pixels using AI for Good.........
Bits & Pixels using AI for Good.........
Alison B. Lowndes
 
When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...
Elena Simperl
 
The Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and SalesThe Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and Sales
Laura Byrne
 
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered QualitySoftware Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Inflectra
 
Leading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdfLeading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdf
OnBoard
 
Knowledge engineering: from people to machines and back
Knowledge engineering: from people to machines and backKnowledge engineering: from people to machines and back
Knowledge engineering: from people to machines and back
Elena Simperl
 
Assuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyesAssuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyes
ThousandEyes
 
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
BookNet Canada
 
JMeter webinar - integration with InfluxDB and Grafana
JMeter webinar - integration with InfluxDB and GrafanaJMeter webinar - integration with InfluxDB and Grafana
JMeter webinar - integration with InfluxDB and Grafana
RTTS
 
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Product School
 
ODC, Data Fabric and Architecture User Group
ODC, Data Fabric and Architecture User GroupODC, Data Fabric and Architecture User Group
ODC, Data Fabric and Architecture User Group
CatarinaPereira64715
 
Search and Society: Reimagining Information Access for Radical Futures
Search and Society: Reimagining Information Access for Radical FuturesSearch and Society: Reimagining Information Access for Radical Futures
Search and Society: Reimagining Information Access for Radical Futures
Bhaskar Mitra
 
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
DanBrown980551
 
The Future of Platform Engineering
The Future of Platform EngineeringThe Future of Platform Engineering
The Future of Platform Engineering
Jemma Hussein Allen
 
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
James Anderson
 
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
Product School
 

Recently uploaded (20)

PHP Frameworks: I want to break free (IPC Berlin 2024)
PHP Frameworks: I want to break free (IPC Berlin 2024)PHP Frameworks: I want to break free (IPC Berlin 2024)
PHP Frameworks: I want to break free (IPC Berlin 2024)
 
Key Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdfKey Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdf
 
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
 
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdfFIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
 
Bits & Pixels using AI for Good.........
Bits & Pixels using AI for Good.........Bits & Pixels using AI for Good.........
Bits & Pixels using AI for Good.........
 
When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...
 
The Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and SalesThe Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and Sales
 
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered QualitySoftware Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
 
Leading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdfLeading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdf
 
Knowledge engineering: from people to machines and back
Knowledge engineering: from people to machines and backKnowledge engineering: from people to machines and back
Knowledge engineering: from people to machines and back
 
Assuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyesAssuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyes
 
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
 
JMeter webinar - integration with InfluxDB and Grafana
JMeter webinar - integration with InfluxDB and GrafanaJMeter webinar - integration with InfluxDB and Grafana
JMeter webinar - integration with InfluxDB and Grafana
 
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
 
ODC, Data Fabric and Architecture User Group
ODC, Data Fabric and Architecture User GroupODC, Data Fabric and Architecture User Group
ODC, Data Fabric and Architecture User Group
 
Search and Society: Reimagining Information Access for Radical Futures
Search and Society: Reimagining Information Access for Radical FuturesSearch and Society: Reimagining Information Access for Radical Futures
Search and Society: Reimagining Information Access for Radical Futures
 
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
 
The Future of Platform Engineering
The Future of Platform EngineeringThe Future of Platform Engineering
The Future of Platform Engineering
 
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
 
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
 

Assembly language progarmming

  • 2. Why we use Assembly Language?  We use it for better understanding of interaction between hardware and software and vice versa.  We use it for optimization of processing time.  It is used for embedded programming.
  • 3. Origin of Assembly:-  The word “assembly” comes from the point that in older computers,every part of computer is programmed and programmers assemble the code of all parts and then compile it for doing some specific task.
  • 4. What is Assembly Language?  It is a low level computer programming language, in which mnemonics are used.  For e.g. :- ADD,SUB,MOV etc.
  • 5. Why we use Registers? CPU Hard disk RAM Cache CPURegisters
  • 6. What is Register?  Fastest storage area or location (for quickly accessing by CPU)  Derived from register which means record or collection.  Intel 4004 in 1971,registers were first used.
  • 7. Types of Registers(General Purpose):- 1. Accumulator Register:- Used for input and output operations basically. Also used for mathematical and logical operations. A=8 bits. Ax=16 bits. Eax=32 bits. Rax=64 bits. 2. Base Register:- Holds addresses of data present in the RAM. B=8 bits. Bx=16 bits. EBx=32 bits. RBx=64 bits.
  • 8. Types of Registers(General Purpose):- 3. Counter Register:- Used for counting or loop instructions. C=8 bits. Cx=16 bits. ECx=32 bits. RCx=64 bits. 4. Data Register:- Holds data for output. D=8 bits. Dx=16 bits. EDx=32 bits. RDx=64 bits.
  • 9. Types of Registers(Segment Registers):- 5. Code Segment:- Hold address of code segment which is in RAM. 6. Data Segment:- Holds address of data segment. 7. Stack Segment:- Holds address of stack segment. 8. Extra Segment:- Holds address extra code in the code segment.
  • 10. Types of Registers(Index Registers):- 9. Source Index:- Points to the source address. 10. Destination Index:- Points to the destination operand.
  • 11. Types of Registers(Special Purpose):- 9. Stack Pointer:- Points the current top of stack. 10. Instruction Pointer:- Holds the next instruction. 11. Flag Register:- Hold current status of program. 12. Base pointer:- Points base of top of stack.
  • 12. Addressing Modes:-  Ways to access data or How to access data from address. For e.g:- 2+5 1. Register addressing:- If both operands are assigned to a register. E.g:- Add dl,bl 2. Immediate addressing:- If one operand is assigned to a register and other is constant. E.g:-Add dl,2 3. Memory addressing:- Access static data directly from RAM. E.g:-Add dl,address Operands Opcode
  • 13. Data Transfer Instruction & Service Routine:-  How data comes to a register. MOV Dl,2 For Printing 2 MOV Ah,2  Some service routines:- 1=input a character with echo. 2=output/print a single character. 8=input characters without echo. 9=Print string 4ch=Exit. Service Routine
  • 14. Interrupt:-  Stop the current program and allow microprocessor to access hardware to take input or give output. For e.g:- INT 21H=Interrupt for text handling INT 20H=Interrupt for Video/Graphics handling. For output:- Mov ah,2 INT 21H For input:- Mov ah,1 INT 21H
  • 15. ASCII:-  Character encoding scheme.  American standards association.  1963. A=65 to Z=90 A=91 to Z=122 0=48 Nextline =10 Carriage return=13.
  • 16. Structure of Program in Assembly?  Dosseg Manages the arrangements of segments of a program.  .model small (Click to understand). model directive  How much space a program will reserve in RAM.  .stack 100h stack segment directive  Specifies storage for stack.  .data data segment directive  Variables are defined here.  .code code segment directive Instructions  Main proc proc can be any name.  Main endp  End main
  • 17. Model sizes…. Ram Code + data<=64kbtiny Code<=64kb , data<=64kb small Code<=Any size , data<=64kb medium Code<=64kb ,data<=any size compact Code<=any size , data<=any size large Code<=any size , data<=any size Huge data Code Stack
  • 18. General Rules for Assembly:- 1. Both operands must be of same size. Mov Ax,Bl illegal Mov Al,Bl legal 2. Both operands can not be memory operands simultaneously. Mov i,j illegal Mov Ax,j legal 3. First operand can not be an immediate value. Mov 2,Ax illegal Mov Ax,2 legal
  • 19. Variables, Data types, Offset and LEA:-  Data type=Data size .Data Note:-Don’t use reserved keywords like add,sub,mov etc. Different data sizes:- Variable Name Data Size Value Var1 Db 49 Var2 Db ‘1’ Var3 Dw ‘12345$’ DB Define Byte 1 byte,8 bits DW Define Word 2 Bytes,16bits DD Define double word 4 bytes,32bits DQ Define Quad word 7 bytes,64bits DT Define ten bytes 10 bytes,80 bits $ for terminating string
  • 20. Continued…  In code segment, we have to follow some steps to access the data elements. Below is shown:- 1. We need the address of data segment and address contains 16 bits so we need 16 bit register to hold that address. .code Mov ax, @data 2. We need to access data from any variable so we need heap memory(Fast access to data from any variable).So we need “Ds” register which is way to create heap memory. So ax which contains address of data should be moved to ds register for address contained by ax to be converted to heap memory . Mov ds,ax. Accumulator used for input and output of data
  • 21. Continued…  If we have an string and wanted to move it to a register we use offset(which holds the beginning address of variable) or lea(an in directed instruction used as a pointer in which first variable points to the address of second variable).  As follows mov dx,offset var3 Or Lea dx,var3 .