SlideShare a Scribd company logo
Introduction to Assembly Language
Programming
By – Apeksha Shinde
From- Mucchala Polytechnic
Email – shndapeksha23@gmail.com
Introduction
 Each personal computer has a microprocessor that manages the computer’s
arithmetical, logical, and control activities .
 Each family of processor has its own set of instructions for handling various
operations.
 getting input from keyboard- displaying information on screen – performing
various other jobs.
 These sets of instructions are called “ Machine Language Instruction”
 Processor understands only machine language instructions which are strings of
1s and 0s .
 The low-level assembly language is designed for a specific family of processors
that represents various instructions in symbolic code and more understandable
form.
What is Assembly Language
 An assembly language is low-level programming language for a computer, or other
programmable device.
 It requires less memory and execution time.
 It allows hardware-specific complex jobs in an easier way.
 An understanding of assembly lang provides knowledge of :
i. Interface of programs with OS, processor and BIOS.
ii. Representation of data in memory and other external devices.
iii. How processor accesses and executes instruction.
iv. How instruction accesses and process data.
Assembly Language Development Tools
Editor:
 It is a program which is used to construct the assembly language program in
correct format so that the Assembler will translate it correctly to machine
language.
 An Editor is a program which allows us to create a file containing the assembly
language statement for the program.
 If any typing mistake is done editor will alert us to correct it.
 If we leave out a program statement an editor will let you move everything down
and insert a line.
 After typing all the program we have to save the program for a hard disk.
 This we call it as source file.
 The next step is to process the source file with an assembler.
 While using TASM or MASM we should give a file name and extension .ASM.
 Ex: Sample. Asm
Editors are EDIT,Word Star,Norton Edit
Assembler:
 An Assembler is used to translate the assembly language mnemonics into machine
language( i.e binary codes).
 When you run the assembler it reads the source file of your program from where
you have saved it.
 The assembler generates two files . The first file is the Object file with the
extension .OBJ.
 The object file consists of the binary codes for the instructions and information
about the addresses of the instructions.
 After further processing, the contents of the file will be loaded in to memory and
run. The second file is the assembler list file with the extension .LST.
 Assemblers are TASM(Borland’s Turbo Assembler) MASM(Microsoft Macro Assembler)
Linker :
 A linker is a program used to connect several object files into one large object
file.
 While writing large programs it is better to divide the large program into smaller
modules.
 Each module can be individually written, tested and debugged.
 Then all the object modules are linked together to form one, functioning
program.
 These object modules can also be kept in library file and linked into other
programs as needed. A linker produces a link file which contains the binary codes
for all the combined modules.
 The linker also produces a link map file which contains the address information
about the linked files.
 The linkers which come with TASM or MASM assemblers produce link files with the
.EXE extension.
 Linkers are TLINK(Borland’s Turbo Linker) LINK (Microsoft’s Linker)
Debugger:
 A debugger is a program which allows to load your object code program into
system memory, execute the program, and troubleshoot or debug it.
 Debuggers allows to stop the program after each instruction so that you can check
or alter memory and register contents. This is called single step debug.
 The debugger allows to look into the contents of registers and memory locations
after the program runs. We can also change the contents of registers and memory
locations and rerun the program.
 A debugger also allows to set a breakpoint at any point in the program.
 If we insert a break point, the debugger will run the program up to the instruction
where the breakpoint is put and then stop the execution.
 Debuggers are Borland’s Turbo Debugger TD, Microsoft Debugger Code View(CV).
8086 Microprocessor and its feature
a. 8086 has 16-bit ALU
b. It has 16-bit data bus , so it can read data or write data to memory or I/O ports
either 16 bits or 8 bits at a time .
c. It has 20 address lines , so it can address up to 1048576 = 1Mbytes of memory
d. 8086 includes few features , which enhance multiprocessing capability.
e. Operates on +5v supply and single phase (single line) clock frequency .(Clock is
generated by separate peripheral chip 8284)
f. 8086 comes with different versions. 8086 runs at 5 MHz, 8086-2 runs at 8 MHz, 8086-
1 runs at 10 MHz.
g. It comes in 40-pin configuration with HMOS technology having around 20,000
transistors in its circuitry.
Addressing modes of 8086
Every instruction of a program has to operate on a date. The different ways in
which a source operand is denoted in any instruction are known as addressing
modes.
There are different types of addressing modes
1. Immediate Addressing eg: MOV DL, 08H
2. Register Addressing eg: MOV (CL), (DH)
3. Direct Addressing eg: MOV BX, [1354H]
4. Register Indirect Addressing eg: MOV AX, [BX + 08H]
5. Register relative addressing eg: MOV AX, [BX + 44]
6. Based Indexed addressing eg: MOV CX , [SI + BX]
7. Relative Based Index Addressing eg: MOV DX, [BX + SI + 0AH]
8. Implied / Implicit Addressing eg: CLC
Instruction Sets
8086 supports 8 types of instruction types of instructions
1. Data Transfer Instructions :
Instructions that are used to transfer data/ address in to registers, memory
locations and I/O ports.
Generally involve two operands: Source operand and Destination operand of the
same size.
Mnemonics: MOV, XCHG, PUSH, POP, IN, OUT
2. Arithmetic Instructions :
• ADD , ADC , INC , AAA , DAA , SBB , SUB , DEC , NEG , CMP , AAS , DAS , MUL
IMUL , AAM , DIV, IDIV , AAD , CBW , CDW
3. Bit Manipulation Instruction :
i. AND - Used for adding each bit in a byte/word with the corresponding bit in
another byte/word.
ii. OR - Used to multiply each bit in a byte/word with the corresponding bit in another
byte/word.
iii. NOT - Used to invert each bit of a byte or word.
iv. XOR - Used to perform Exclusive-OR operation over each bit in a byte/word with
the corresponding bit in another byte/ word.
v. TEST - Used to add operands to update flags, without affecting operands.
vi. SHR - Used to shift bits of a byte/word towards the right and put zero(S) in MSBs.
vii. SHL/SAL - Used to shift bits of a byte/word towards left and put zero(S) in LSBs.
viii. ROR - Used to rotate bits of byte/word towards the right, i.e. LSB to MSB and to
Carry Flag [CF].
ix. ROL - Used to rotate bits of byte/word towards the left, i.e. MSB to LSB and to
Carry Flag [CF].
x. RCR - Used to rotate bits of byte/word towards the right, i.e. LSB to CF and CF to
MSB.
xi. RCL - Used to rotate bits of byte/word towards the left, i.e. MSB to CF and CF to
LSB.
4. String Instructions :
String is a group of bytes/words and their memory is always allocated in a sequential
order.
Following is the list of instructions under this group –
•REP − Used to repeat the given instruction till CX ≠ 0.
•REPE/REPZ − Used to repeat the given instruction until CX = 0 or zero flag ZF = 1.
•REPNE/REPNZ − Used to repeat the given instruction until CX = 0 or zero flag ZF = 1.
•MOVS/MOVSB/MOVSW − Used to move the byte/word from one string to another.
•COMS/COMPSB/COMPSW − Used to compare two string bytes/words.
•INS/INSB/INSW − Used as an input string/byte/word from the I/O port to the provided
memory location.
•OUTS/OUTSB/OUTSW − Used as an output string/byte/word from the provided memory
location to the I/O port.
•SCAS/SCASB/SCASW − Used to scan a string and compare its byte with a byte in AL or
string word with a word in AX.
•LODS/LODSB/LODSW − Used to store the string byte into AL or string word into AX.
5. Program Execution Transfer Instructions (Branch and Loop Instructions)
These instructions are used to transfer/branch the instructions during an
execution. It includes the following instructions −
•CALL − Used to call a procedure and save their return address to the stack.
•RET − Used to return from the procedure to the main program.
•JMP − Used to jump to the provvided address to proceed to the next instruction.
•JA/JNBE − Used to jump if above/not below/equal instruction satisfies.
•JAE/JNB − Used to jump if above/not below instruction satisfies.
•JBE/JNA − Used to jump if below/equal/ not above instruction satisfies.
•JC − Used to jump if carry flag CF = 1
•JE/JZ − Used to jump if equal/zero flag ZF = 1
•JG/JNLE − Used to jump if greater/not less than/equal instruction satisfies.
•JGE/JNL − Used to jump if greater than/equal/not less than instruction satisfies.
•JL/JNGE − Used to jump if less than/not greater than/equal instruction satisfies.
•JLE/JNG − Used to jump if less than/equal/if not greater than instruction satisfies.
•JNC − Used to jump if no carry flag (CF = 0)
•JNE/JNZ − Used to jump if not equal/zero flag ZF = 0
•JNO − Used to jump if no overflow flag OF = 0
6. Processor Control Instruction
These instructions are used to control the processor action by
setting/resetting the flag values.
Following are the instructions under this group −
•STC − Used to set carry flag CF to 1
•CLC − Used to clear/reset carry flag CF to 0
•CMC − Used to put complement at the state of carry flag CF.
•STD − Used to set the direction flag DF to 1
•CLD − Used to clear/reset the direction flag DF = 0
•STI − Used to set the interrupt enable flag to 1, i.e., enable INTR input.
•CLI − Used to clear the interrupt enable flag to 0, i.e., disable INTR input.
WAIT - Wait for TEST pin active
7. Iteration Control Instruction
These instructions are used to execute the given instructions for number of times.
Following is the list of instructions under this group −
•LOOP − Used to loop a group of instructions until the condition satisfies, i.e., CX = 0
•LOOPE/LOOPZ − Used to loop a group of instructions till it satisfies ZF = 1 & CX =
0
•LOOPNE/LOOPNZ − Used to loop a group of instructions till it satisfies ZF = 0 & CX
= 0
•JCXZ − Used to jump to the provided address if CX = 0
Interrupt Instructions
8. Interrupt Instructions :
These instructions are used to call the interrupt during program execution.
•INT − Used to interrupt the program during execution and calling service
specified.
•INTO − Used to interrupt the program during execution if OF = 1
•IRET − Used to return from interrupt service to the main program
Assembler Directive
Assembler Directives are the statement that give hint or direction to the Assembler to
perform the task. The Assembler Directives are also known as ‘Pseudo instructions’
because they are not translated into machine codes.
• Used to : › specify the start and end of a program › attach value to variables ›
allocate storage locations to input/ output data › define start and end of segments,
procedures, macros, etc.
The Art of Assembly Language
Programming
Program Development Steps
1. Defining the program
2. Algorithm
3. Initialization checklist
4. Choosing instruction
5. Converting algorithm to assembly language program
Defining the problem: The first step in program developing is the careful analysis of
problem. The objective of the program should be clear to the user.
Algorithm: It is the step by step procedure designed to perform or sovle the task.
Initialization of checklist: Initialize variables, constants etc also initialize various
segments.
Choosing Instruction: It is important to select the proper instruction that will perform
the desired task.
Converting algorithm to assembly language program: In this step instructions are
arranged in the proper sequence according to algorithm and then converting into
machine language.
Here’s a example of an assembly language program
 8 bit numbers subtraction
data segment
a db 09h
b db 05h
c dw ?
data ends
code segment
assume cs:code, ds:data
start:
mov ax, data
mov ds, ax
mov al, a
mov bl, b
sub al, bl
mov c, ax
int 3
code ends
end start o/p = al = 09 , bl = 02
al = 07
Thank you

More Related Content

What's hot

8255
82558255
Memory Addressing
Memory AddressingMemory Addressing
Memory Addressing
chauhankapil
 
Interrupts
InterruptsInterrupts
Interrupts
Albin Panakkal
 
Parallel Processing & Pipelining in Computer Architecture_Prof.Sumalatha.pptx
Parallel Processing & Pipelining in Computer Architecture_Prof.Sumalatha.pptxParallel Processing & Pipelining in Computer Architecture_Prof.Sumalatha.pptx
Parallel Processing & Pipelining in Computer Architecture_Prof.Sumalatha.pptx
Sumalatha A
 
Superscalar processor
Superscalar processorSuperscalar processor
Superscalar processor
noor ul ain
 
8051 data types and directives
8051 data types and directives8051 data types and directives
8051 data types and directives
SARITHA REDDY
 
Mips
MipsMips
Pipeline and data hazard
Pipeline and data hazardPipeline and data hazard
Pipeline and data hazard
Waed Shagareen
 
Computer organization and architecture
Computer organization and architectureComputer organization and architecture
Computer organization and architecture
Subesh Kumar Yadav
 
Modes of transfer
Modes of transferModes of transfer
Modes of transfer
Andhra University
 
Cpu performance matrix
Cpu performance matrixCpu performance matrix
Cpu performance matrix
Rehman baig
 
Input output interface
Input output interfaceInput output interface
Input output interface
Christ University
 
Instruction Set Architecture
Instruction  Set ArchitectureInstruction  Set Architecture
Instruction Set Architecture
Haris456
 
Pipelining
PipeliningPipelining
Pipelining
Shubham Bammi
 
8086 assembly language
8086 assembly language8086 assembly language
8086 assembly language
Mir Majid
 
Computer system architecture
Computer system architectureComputer system architecture
Computer system architecture
Kumar
 
Register transfer language
Register  transfer languageRegister  transfer language
Register transfer language
hamza munir
 
Direct memory access (dma)
Direct memory access (dma)Direct memory access (dma)
Direct memory access (dma)
Zubair Khalid
 
Classification of debuggers sp
Classification of debuggers spClassification of debuggers sp
Classification of debuggers sp
ShaishavShah8
 
Micro Programmed Control Unit
Micro Programmed Control UnitMicro Programmed Control Unit
Micro Programmed Control Unit
Kamal Acharya
 

What's hot (20)

8255
82558255
8255
 
Memory Addressing
Memory AddressingMemory Addressing
Memory Addressing
 
Interrupts
InterruptsInterrupts
Interrupts
 
Parallel Processing & Pipelining in Computer Architecture_Prof.Sumalatha.pptx
Parallel Processing & Pipelining in Computer Architecture_Prof.Sumalatha.pptxParallel Processing & Pipelining in Computer Architecture_Prof.Sumalatha.pptx
Parallel Processing & Pipelining in Computer Architecture_Prof.Sumalatha.pptx
 
Superscalar processor
Superscalar processorSuperscalar processor
Superscalar processor
 
8051 data types and directives
8051 data types and directives8051 data types and directives
8051 data types and directives
 
Mips
MipsMips
Mips
 
Pipeline and data hazard
Pipeline and data hazardPipeline and data hazard
Pipeline and data hazard
 
Computer organization and architecture
Computer organization and architectureComputer organization and architecture
Computer organization and architecture
 
Modes of transfer
Modes of transferModes of transfer
Modes of transfer
 
Cpu performance matrix
Cpu performance matrixCpu performance matrix
Cpu performance matrix
 
Input output interface
Input output interfaceInput output interface
Input output interface
 
Instruction Set Architecture
Instruction  Set ArchitectureInstruction  Set Architecture
Instruction Set Architecture
 
Pipelining
PipeliningPipelining
Pipelining
 
8086 assembly language
8086 assembly language8086 assembly language
8086 assembly language
 
Computer system architecture
Computer system architectureComputer system architecture
Computer system architecture
 
Register transfer language
Register  transfer languageRegister  transfer language
Register transfer language
 
Direct memory access (dma)
Direct memory access (dma)Direct memory access (dma)
Direct memory access (dma)
 
Classification of debuggers sp
Classification of debuggers spClassification of debuggers sp
Classification of debuggers sp
 
Micro Programmed Control Unit
Micro Programmed Control UnitMicro Programmed Control Unit
Micro Programmed Control Unit
 

Similar to Introduction to Assembly Language

Microprocessor
MicroprocessorMicroprocessor
Microprocessor
Bathshebaparimala
 
Assembly language
Assembly languageAssembly language
Assembly language
Bathshebaparimala
 
Reversing & Malware Analysis Training Part 4 - Assembly Programming Basics
Reversing & Malware Analysis Training Part 4 - Assembly Programming BasicsReversing & Malware Analysis Training Part 4 - Assembly Programming Basics
Reversing & Malware Analysis Training Part 4 - Assembly Programming Basics
securityxploded
 
Design
DesignDesign
microprocessor
 microprocessor microprocessor
microprocessor
ATTO RATHORE
 
Mp lab manual
Mp lab manualMp lab manual
Mp lab manual
Pradeep Kumar
 
Assembly language programming(unit 4)
Assembly language programming(unit 4)Assembly language programming(unit 4)
Assembly language programming(unit 4)
Ashim Saha
 
Workshop Assembler
Workshop AssemblerWorkshop Assembler
Workshop Assembler
Tuhin_Das
 
Assembly language
Assembly languageAssembly language
Assembly language
gaurav jain
 
Reversing malware analysis training part4 assembly programming basics
Reversing malware analysis training part4 assembly programming basicsReversing malware analysis training part4 assembly programming basics
Reversing malware analysis training part4 assembly programming basics
Cysinfo Cyber Security Community
 
ASSEMBLY LANGUAGE.pptx
ASSEMBLY LANGUAGE.pptxASSEMBLY LANGUAGE.pptx
ASSEMBLY LANGUAGE.pptx
EdFeranil
 
Introduction to debugging linux applications
Introduction to debugging linux applicationsIntroduction to debugging linux applications
Introduction to debugging linux applications
commiebstrd
 
Assembly level language
Assembly level languageAssembly level language
Assembly level language
PDFSHARE
 
Malware Analysis - x86 Disassembly
Malware Analysis - x86 DisassemblyMalware Analysis - x86 Disassembly
Malware Analysis - x86 Disassembly
Natraj G
 
SP Solutions -Adi.pdf
SP Solutions -Adi.pdfSP Solutions -Adi.pdf
SP Solutions -Adi.pdf
AdiseshaK
 
SP_Solutions_-Adi.pdf
SP_Solutions_-Adi.pdfSP_Solutions_-Adi.pdf
SP_Solutions_-Adi.pdf
AdiseshaK
 
SP_Solutions_-Adi.pdf
SP_Solutions_-Adi.pdfSP_Solutions_-Adi.pdf
SP_Solutions_-Adi.pdf
Prof. Dr. K. Adisesha
 
POLITEKNIK MALAYSIA
POLITEKNIK MALAYSIAPOLITEKNIK MALAYSIA
POLITEKNIK MALAYSIA
Aiman Hud
 
7986-lect 7.pdf
7986-lect 7.pdf7986-lect 7.pdf
7986-lect 7.pdf
RiazAhmad521284
 
Introduction to Assembly Language Programming
Introduction to Assembly Language ProgrammingIntroduction to Assembly Language Programming
Introduction to Assembly Language Programming
Rahul P
 

Similar to Introduction to Assembly Language (20)

Microprocessor
MicroprocessorMicroprocessor
Microprocessor
 
Assembly language
Assembly languageAssembly language
Assembly language
 
Reversing & Malware Analysis Training Part 4 - Assembly Programming Basics
Reversing & Malware Analysis Training Part 4 - Assembly Programming BasicsReversing & Malware Analysis Training Part 4 - Assembly Programming Basics
Reversing & Malware Analysis Training Part 4 - Assembly Programming Basics
 
Design
DesignDesign
Design
 
microprocessor
 microprocessor microprocessor
microprocessor
 
Mp lab manual
Mp lab manualMp lab manual
Mp lab manual
 
Assembly language programming(unit 4)
Assembly language programming(unit 4)Assembly language programming(unit 4)
Assembly language programming(unit 4)
 
Workshop Assembler
Workshop AssemblerWorkshop Assembler
Workshop Assembler
 
Assembly language
Assembly languageAssembly language
Assembly language
 
Reversing malware analysis training part4 assembly programming basics
Reversing malware analysis training part4 assembly programming basicsReversing malware analysis training part4 assembly programming basics
Reversing malware analysis training part4 assembly programming basics
 
ASSEMBLY LANGUAGE.pptx
ASSEMBLY LANGUAGE.pptxASSEMBLY LANGUAGE.pptx
ASSEMBLY LANGUAGE.pptx
 
Introduction to debugging linux applications
Introduction to debugging linux applicationsIntroduction to debugging linux applications
Introduction to debugging linux applications
 
Assembly level language
Assembly level languageAssembly level language
Assembly level language
 
Malware Analysis - x86 Disassembly
Malware Analysis - x86 DisassemblyMalware Analysis - x86 Disassembly
Malware Analysis - x86 Disassembly
 
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
 
POLITEKNIK MALAYSIA
POLITEKNIK MALAYSIAPOLITEKNIK MALAYSIA
POLITEKNIK MALAYSIA
 
7986-lect 7.pdf
7986-lect 7.pdf7986-lect 7.pdf
7986-lect 7.pdf
 
Introduction to Assembly Language Programming
Introduction to Assembly Language ProgrammingIntroduction to Assembly Language Programming
Introduction to Assembly Language Programming
 

Recently uploaded

"Choosing proper type of scaling", Olena Syrota
"Choosing proper type of scaling", Olena Syrota"Choosing proper type of scaling", Olena Syrota
"Choosing proper type of scaling", Olena Syrota
Fwdays
 
Generating privacy-protected synthetic data using Secludy and Milvus
Generating privacy-protected synthetic data using Secludy and MilvusGenerating privacy-protected synthetic data using Secludy and Milvus
Generating privacy-protected synthetic data using Secludy and Milvus
Zilliz
 
Public CyberSecurity Awareness Presentation 2024.pptx
Public CyberSecurity Awareness Presentation 2024.pptxPublic CyberSecurity Awareness Presentation 2024.pptx
Public CyberSecurity Awareness Presentation 2024.pptx
marufrahmanstratejm
 
TrustArc Webinar - 2024 Global Privacy Survey
TrustArc Webinar - 2024 Global Privacy SurveyTrustArc Webinar - 2024 Global Privacy Survey
TrustArc Webinar - 2024 Global Privacy Survey
TrustArc
 
Monitoring and Managing Anomaly Detection on OpenShift.pdf
Monitoring and Managing Anomaly Detection on OpenShift.pdfMonitoring and Managing Anomaly Detection on OpenShift.pdf
Monitoring and Managing Anomaly Detection on OpenShift.pdf
Tosin Akinosho
 
Energy Efficient Video Encoding for Cloud and Edge Computing Instances
Energy Efficient Video Encoding for Cloud and Edge Computing InstancesEnergy Efficient Video Encoding for Cloud and Edge Computing Instances
Energy Efficient Video Encoding for Cloud and Edge Computing Instances
Alpen-Adria-Universität
 
“How Axelera AI Uses Digital Compute-in-memory to Deliver Fast and Energy-eff...
“How Axelera AI Uses Digital Compute-in-memory to Deliver Fast and Energy-eff...“How Axelera AI Uses Digital Compute-in-memory to Deliver Fast and Energy-eff...
“How Axelera AI Uses Digital Compute-in-memory to Deliver Fast and Energy-eff...
Edge AI and Vision Alliance
 
Dandelion Hashtable: beyond billion requests per second on a commodity server
Dandelion Hashtable: beyond billion requests per second on a commodity serverDandelion Hashtable: beyond billion requests per second on a commodity server
Dandelion Hashtable: beyond billion requests per second on a commodity server
Antonios Katsarakis
 
Apps Break Data
Apps Break DataApps Break Data
Apps Break Data
Ivo Velitchkov
 
HCL Notes and Domino License Cost Reduction in the World of DLAU
HCL Notes and Domino License Cost Reduction in the World of DLAUHCL Notes and Domino License Cost Reduction in the World of DLAU
HCL Notes and Domino License Cost Reduction in the World of DLAU
panagenda
 
Deep Dive: AI-Powered Marketing to Get More Leads and Customers with HyperGro...
Deep Dive: AI-Powered Marketing to Get More Leads and Customers with HyperGro...Deep Dive: AI-Powered Marketing to Get More Leads and Customers with HyperGro...
Deep Dive: AI-Powered Marketing to Get More Leads and Customers with HyperGro...
saastr
 
June Patch Tuesday
June Patch TuesdayJune Patch Tuesday
June Patch Tuesday
Ivanti
 
“Temporal Event Neural Networks: A More Efficient Alternative to the Transfor...
“Temporal Event Neural Networks: A More Efficient Alternative to the Transfor...“Temporal Event Neural Networks: A More Efficient Alternative to the Transfor...
“Temporal Event Neural Networks: A More Efficient Alternative to the Transfor...
Edge AI and Vision Alliance
 
Freshworks Rethinks NoSQL for Rapid Scaling & Cost-Efficiency
Freshworks Rethinks NoSQL for Rapid Scaling & Cost-EfficiencyFreshworks Rethinks NoSQL for Rapid Scaling & Cost-Efficiency
Freshworks Rethinks NoSQL for Rapid Scaling & Cost-Efficiency
ScyllaDB
 
Leveraging the Graph for Clinical Trials and Standards
Leveraging the Graph for Clinical Trials and StandardsLeveraging the Graph for Clinical Trials and Standards
Leveraging the Graph for Clinical Trials and Standards
Neo4j
 
Digital Banking in the Cloud: How Citizens Bank Unlocked Their Mainframe
Digital Banking in the Cloud: How Citizens Bank Unlocked Their MainframeDigital Banking in the Cloud: How Citizens Bank Unlocked Their Mainframe
Digital Banking in the Cloud: How Citizens Bank Unlocked Their Mainframe
Precisely
 
WeTestAthens: Postman's AI & Automation Techniques
WeTestAthens: Postman's AI & Automation TechniquesWeTestAthens: Postman's AI & Automation Techniques
WeTestAthens: Postman's AI & Automation Techniques
Postman
 
Best 20 SEO Techniques To Improve Website Visibility In SERP
Best 20 SEO Techniques To Improve Website Visibility In SERPBest 20 SEO Techniques To Improve Website Visibility In SERP
Best 20 SEO Techniques To Improve Website Visibility In SERP
Pixlogix Infotech
 
The Microsoft 365 Migration Tutorial For Beginner.pptx
The Microsoft 365 Migration Tutorial For Beginner.pptxThe Microsoft 365 Migration Tutorial For Beginner.pptx
The Microsoft 365 Migration Tutorial For Beginner.pptx
operationspcvita
 
Connector Corner: Seamlessly power UiPath Apps, GenAI with prebuilt connectors
Connector Corner: Seamlessly power UiPath Apps, GenAI with prebuilt connectorsConnector Corner: Seamlessly power UiPath Apps, GenAI with prebuilt connectors
Connector Corner: Seamlessly power UiPath Apps, GenAI with prebuilt connectors
DianaGray10
 

Recently uploaded (20)

"Choosing proper type of scaling", Olena Syrota
"Choosing proper type of scaling", Olena Syrota"Choosing proper type of scaling", Olena Syrota
"Choosing proper type of scaling", Olena Syrota
 
Generating privacy-protected synthetic data using Secludy and Milvus
Generating privacy-protected synthetic data using Secludy and MilvusGenerating privacy-protected synthetic data using Secludy and Milvus
Generating privacy-protected synthetic data using Secludy and Milvus
 
Public CyberSecurity Awareness Presentation 2024.pptx
Public CyberSecurity Awareness Presentation 2024.pptxPublic CyberSecurity Awareness Presentation 2024.pptx
Public CyberSecurity Awareness Presentation 2024.pptx
 
TrustArc Webinar - 2024 Global Privacy Survey
TrustArc Webinar - 2024 Global Privacy SurveyTrustArc Webinar - 2024 Global Privacy Survey
TrustArc Webinar - 2024 Global Privacy Survey
 
Monitoring and Managing Anomaly Detection on OpenShift.pdf
Monitoring and Managing Anomaly Detection on OpenShift.pdfMonitoring and Managing Anomaly Detection on OpenShift.pdf
Monitoring and Managing Anomaly Detection on OpenShift.pdf
 
Energy Efficient Video Encoding for Cloud and Edge Computing Instances
Energy Efficient Video Encoding for Cloud and Edge Computing InstancesEnergy Efficient Video Encoding for Cloud and Edge Computing Instances
Energy Efficient Video Encoding for Cloud and Edge Computing Instances
 
“How Axelera AI Uses Digital Compute-in-memory to Deliver Fast and Energy-eff...
“How Axelera AI Uses Digital Compute-in-memory to Deliver Fast and Energy-eff...“How Axelera AI Uses Digital Compute-in-memory to Deliver Fast and Energy-eff...
“How Axelera AI Uses Digital Compute-in-memory to Deliver Fast and Energy-eff...
 
Dandelion Hashtable: beyond billion requests per second on a commodity server
Dandelion Hashtable: beyond billion requests per second on a commodity serverDandelion Hashtable: beyond billion requests per second on a commodity server
Dandelion Hashtable: beyond billion requests per second on a commodity server
 
Apps Break Data
Apps Break DataApps Break Data
Apps Break Data
 
HCL Notes and Domino License Cost Reduction in the World of DLAU
HCL Notes and Domino License Cost Reduction in the World of DLAUHCL Notes and Domino License Cost Reduction in the World of DLAU
HCL Notes and Domino License Cost Reduction in the World of DLAU
 
Deep Dive: AI-Powered Marketing to Get More Leads and Customers with HyperGro...
Deep Dive: AI-Powered Marketing to Get More Leads and Customers with HyperGro...Deep Dive: AI-Powered Marketing to Get More Leads and Customers with HyperGro...
Deep Dive: AI-Powered Marketing to Get More Leads and Customers with HyperGro...
 
June Patch Tuesday
June Patch TuesdayJune Patch Tuesday
June Patch Tuesday
 
“Temporal Event Neural Networks: A More Efficient Alternative to the Transfor...
“Temporal Event Neural Networks: A More Efficient Alternative to the Transfor...“Temporal Event Neural Networks: A More Efficient Alternative to the Transfor...
“Temporal Event Neural Networks: A More Efficient Alternative to the Transfor...
 
Freshworks Rethinks NoSQL for Rapid Scaling & Cost-Efficiency
Freshworks Rethinks NoSQL for Rapid Scaling & Cost-EfficiencyFreshworks Rethinks NoSQL for Rapid Scaling & Cost-Efficiency
Freshworks Rethinks NoSQL for Rapid Scaling & Cost-Efficiency
 
Leveraging the Graph for Clinical Trials and Standards
Leveraging the Graph for Clinical Trials and StandardsLeveraging the Graph for Clinical Trials and Standards
Leveraging the Graph for Clinical Trials and Standards
 
Digital Banking in the Cloud: How Citizens Bank Unlocked Their Mainframe
Digital Banking in the Cloud: How Citizens Bank Unlocked Their MainframeDigital Banking in the Cloud: How Citizens Bank Unlocked Their Mainframe
Digital Banking in the Cloud: How Citizens Bank Unlocked Their Mainframe
 
WeTestAthens: Postman's AI & Automation Techniques
WeTestAthens: Postman's AI & Automation TechniquesWeTestAthens: Postman's AI & Automation Techniques
WeTestAthens: Postman's AI & Automation Techniques
 
Best 20 SEO Techniques To Improve Website Visibility In SERP
Best 20 SEO Techniques To Improve Website Visibility In SERPBest 20 SEO Techniques To Improve Website Visibility In SERP
Best 20 SEO Techniques To Improve Website Visibility In SERP
 
The Microsoft 365 Migration Tutorial For Beginner.pptx
The Microsoft 365 Migration Tutorial For Beginner.pptxThe Microsoft 365 Migration Tutorial For Beginner.pptx
The Microsoft 365 Migration Tutorial For Beginner.pptx
 
Connector Corner: Seamlessly power UiPath Apps, GenAI with prebuilt connectors
Connector Corner: Seamlessly power UiPath Apps, GenAI with prebuilt connectorsConnector Corner: Seamlessly power UiPath Apps, GenAI with prebuilt connectors
Connector Corner: Seamlessly power UiPath Apps, GenAI with prebuilt connectors
 

Introduction to Assembly Language

  • 1. Introduction to Assembly Language Programming By – Apeksha Shinde From- Mucchala Polytechnic Email – shndapeksha23@gmail.com
  • 2. Introduction  Each personal computer has a microprocessor that manages the computer’s arithmetical, logical, and control activities .  Each family of processor has its own set of instructions for handling various operations.  getting input from keyboard- displaying information on screen – performing various other jobs.  These sets of instructions are called “ Machine Language Instruction”  Processor understands only machine language instructions which are strings of 1s and 0s .  The low-level assembly language is designed for a specific family of processors that represents various instructions in symbolic code and more understandable form.
  • 3. What is Assembly Language  An assembly language is low-level programming language for a computer, or other programmable device.  It requires less memory and execution time.  It allows hardware-specific complex jobs in an easier way.  An understanding of assembly lang provides knowledge of : i. Interface of programs with OS, processor and BIOS. ii. Representation of data in memory and other external devices. iii. How processor accesses and executes instruction. iv. How instruction accesses and process data.
  • 4. Assembly Language Development Tools Editor:  It is a program which is used to construct the assembly language program in correct format so that the Assembler will translate it correctly to machine language.  An Editor is a program which allows us to create a file containing the assembly language statement for the program.  If any typing mistake is done editor will alert us to correct it.  If we leave out a program statement an editor will let you move everything down and insert a line.  After typing all the program we have to save the program for a hard disk.  This we call it as source file.  The next step is to process the source file with an assembler.  While using TASM or MASM we should give a file name and extension .ASM.  Ex: Sample. Asm Editors are EDIT,Word Star,Norton Edit
  • 5. Assembler:  An Assembler is used to translate the assembly language mnemonics into machine language( i.e binary codes).  When you run the assembler it reads the source file of your program from where you have saved it.  The assembler generates two files . The first file is the Object file with the extension .OBJ.  The object file consists of the binary codes for the instructions and information about the addresses of the instructions.  After further processing, the contents of the file will be loaded in to memory and run. The second file is the assembler list file with the extension .LST.  Assemblers are TASM(Borland’s Turbo Assembler) MASM(Microsoft Macro Assembler)
  • 6. Linker :  A linker is a program used to connect several object files into one large object file.  While writing large programs it is better to divide the large program into smaller modules.  Each module can be individually written, tested and debugged.  Then all the object modules are linked together to form one, functioning program.  These object modules can also be kept in library file and linked into other programs as needed. A linker produces a link file which contains the binary codes for all the combined modules.  The linker also produces a link map file which contains the address information about the linked files.  The linkers which come with TASM or MASM assemblers produce link files with the .EXE extension.  Linkers are TLINK(Borland’s Turbo Linker) LINK (Microsoft’s Linker)
  • 7. Debugger:  A debugger is a program which allows to load your object code program into system memory, execute the program, and troubleshoot or debug it.  Debuggers allows to stop the program after each instruction so that you can check or alter memory and register contents. This is called single step debug.  The debugger allows to look into the contents of registers and memory locations after the program runs. We can also change the contents of registers and memory locations and rerun the program.  A debugger also allows to set a breakpoint at any point in the program.  If we insert a break point, the debugger will run the program up to the instruction where the breakpoint is put and then stop the execution.  Debuggers are Borland’s Turbo Debugger TD, Microsoft Debugger Code View(CV).
  • 8. 8086 Microprocessor and its feature a. 8086 has 16-bit ALU b. It has 16-bit data bus , so it can read data or write data to memory or I/O ports either 16 bits or 8 bits at a time . c. It has 20 address lines , so it can address up to 1048576 = 1Mbytes of memory d. 8086 includes few features , which enhance multiprocessing capability. e. Operates on +5v supply and single phase (single line) clock frequency .(Clock is generated by separate peripheral chip 8284) f. 8086 comes with different versions. 8086 runs at 5 MHz, 8086-2 runs at 8 MHz, 8086- 1 runs at 10 MHz. g. It comes in 40-pin configuration with HMOS technology having around 20,000 transistors in its circuitry.
  • 9.
  • 10. Addressing modes of 8086 Every instruction of a program has to operate on a date. The different ways in which a source operand is denoted in any instruction are known as addressing modes. There are different types of addressing modes 1. Immediate Addressing eg: MOV DL, 08H 2. Register Addressing eg: MOV (CL), (DH) 3. Direct Addressing eg: MOV BX, [1354H] 4. Register Indirect Addressing eg: MOV AX, [BX + 08H] 5. Register relative addressing eg: MOV AX, [BX + 44] 6. Based Indexed addressing eg: MOV CX , [SI + BX] 7. Relative Based Index Addressing eg: MOV DX, [BX + SI + 0AH] 8. Implied / Implicit Addressing eg: CLC
  • 11. Instruction Sets 8086 supports 8 types of instruction types of instructions 1. Data Transfer Instructions : Instructions that are used to transfer data/ address in to registers, memory locations and I/O ports. Generally involve two operands: Source operand and Destination operand of the same size. Mnemonics: MOV, XCHG, PUSH, POP, IN, OUT 2. Arithmetic Instructions : • ADD , ADC , INC , AAA , DAA , SBB , SUB , DEC , NEG , CMP , AAS , DAS , MUL IMUL , AAM , DIV, IDIV , AAD , CBW , CDW
  • 12. 3. Bit Manipulation Instruction : i. AND - Used for adding each bit in a byte/word with the corresponding bit in another byte/word. ii. OR - Used to multiply each bit in a byte/word with the corresponding bit in another byte/word. iii. NOT - Used to invert each bit of a byte or word. iv. XOR - Used to perform Exclusive-OR operation over each bit in a byte/word with the corresponding bit in another byte/ word. v. TEST - Used to add operands to update flags, without affecting operands. vi. SHR - Used to shift bits of a byte/word towards the right and put zero(S) in MSBs. vii. SHL/SAL - Used to shift bits of a byte/word towards left and put zero(S) in LSBs. viii. ROR - Used to rotate bits of byte/word towards the right, i.e. LSB to MSB and to Carry Flag [CF]. ix. ROL - Used to rotate bits of byte/word towards the left, i.e. MSB to LSB and to Carry Flag [CF]. x. RCR - Used to rotate bits of byte/word towards the right, i.e. LSB to CF and CF to MSB. xi. RCL - Used to rotate bits of byte/word towards the left, i.e. MSB to CF and CF to LSB.
  • 13. 4. String Instructions : String is a group of bytes/words and their memory is always allocated in a sequential order. Following is the list of instructions under this group – •REP − Used to repeat the given instruction till CX ≠ 0. •REPE/REPZ − Used to repeat the given instruction until CX = 0 or zero flag ZF = 1. •REPNE/REPNZ − Used to repeat the given instruction until CX = 0 or zero flag ZF = 1. •MOVS/MOVSB/MOVSW − Used to move the byte/word from one string to another. •COMS/COMPSB/COMPSW − Used to compare two string bytes/words. •INS/INSB/INSW − Used as an input string/byte/word from the I/O port to the provided memory location. •OUTS/OUTSB/OUTSW − Used as an output string/byte/word from the provided memory location to the I/O port. •SCAS/SCASB/SCASW − Used to scan a string and compare its byte with a byte in AL or string word with a word in AX. •LODS/LODSB/LODSW − Used to store the string byte into AL or string word into AX.
  • 14. 5. Program Execution Transfer Instructions (Branch and Loop Instructions) These instructions are used to transfer/branch the instructions during an execution. It includes the following instructions − •CALL − Used to call a procedure and save their return address to the stack. •RET − Used to return from the procedure to the main program. •JMP − Used to jump to the provvided address to proceed to the next instruction. •JA/JNBE − Used to jump if above/not below/equal instruction satisfies. •JAE/JNB − Used to jump if above/not below instruction satisfies. •JBE/JNA − Used to jump if below/equal/ not above instruction satisfies. •JC − Used to jump if carry flag CF = 1 •JE/JZ − Used to jump if equal/zero flag ZF = 1 •JG/JNLE − Used to jump if greater/not less than/equal instruction satisfies. •JGE/JNL − Used to jump if greater than/equal/not less than instruction satisfies. •JL/JNGE − Used to jump if less than/not greater than/equal instruction satisfies. •JLE/JNG − Used to jump if less than/equal/if not greater than instruction satisfies. •JNC − Used to jump if no carry flag (CF = 0) •JNE/JNZ − Used to jump if not equal/zero flag ZF = 0 •JNO − Used to jump if no overflow flag OF = 0
  • 15. 6. Processor Control Instruction These instructions are used to control the processor action by setting/resetting the flag values. Following are the instructions under this group − •STC − Used to set carry flag CF to 1 •CLC − Used to clear/reset carry flag CF to 0 •CMC − Used to put complement at the state of carry flag CF. •STD − Used to set the direction flag DF to 1 •CLD − Used to clear/reset the direction flag DF = 0 •STI − Used to set the interrupt enable flag to 1, i.e., enable INTR input. •CLI − Used to clear the interrupt enable flag to 0, i.e., disable INTR input. WAIT - Wait for TEST pin active
  • 16. 7. Iteration Control Instruction These instructions are used to execute the given instructions for number of times. Following is the list of instructions under this group − •LOOP − Used to loop a group of instructions until the condition satisfies, i.e., CX = 0 •LOOPE/LOOPZ − Used to loop a group of instructions till it satisfies ZF = 1 & CX = 0 •LOOPNE/LOOPNZ − Used to loop a group of instructions till it satisfies ZF = 0 & CX = 0 •JCXZ − Used to jump to the provided address if CX = 0 Interrupt Instructions
  • 17. 8. Interrupt Instructions : These instructions are used to call the interrupt during program execution. •INT − Used to interrupt the program during execution and calling service specified. •INTO − Used to interrupt the program during execution if OF = 1 •IRET − Used to return from interrupt service to the main program
  • 18. Assembler Directive Assembler Directives are the statement that give hint or direction to the Assembler to perform the task. The Assembler Directives are also known as ‘Pseudo instructions’ because they are not translated into machine codes. • Used to : › specify the start and end of a program › attach value to variables › allocate storage locations to input/ output data › define start and end of segments, procedures, macros, etc.
  • 19.
  • 20.
  • 21.
  • 22.
  • 23.
  • 24. The Art of Assembly Language Programming Program Development Steps 1. Defining the program 2. Algorithm 3. Initialization checklist 4. Choosing instruction 5. Converting algorithm to assembly language program
  • 25. Defining the problem: The first step in program developing is the careful analysis of problem. The objective of the program should be clear to the user. Algorithm: It is the step by step procedure designed to perform or sovle the task. Initialization of checklist: Initialize variables, constants etc also initialize various segments. Choosing Instruction: It is important to select the proper instruction that will perform the desired task. Converting algorithm to assembly language program: In this step instructions are arranged in the proper sequence according to algorithm and then converting into machine language.
  • 26. Here’s a example of an assembly language program  8 bit numbers subtraction data segment a db 09h b db 05h c dw ? data ends code segment assume cs:code, ds:data start: mov ax, data mov ds, ax mov al, a mov bl, b sub al, bl mov c, ax int 3 code ends end start o/p = al = 09 , bl = 02 al = 07