SlideShare a Scribd company logo
Free Powerpoint TemplatesFree Powerpoint Templates
Assembly Language -I
Submitted to : Ms. Indu Chabbra
Submitted by : Devika Rangnekar
Rupam
Jaspreet Kaur
MCA – I (Morning)
Rollno : 9
30
15
Free Powerpoint Templates
Assembly Language
• A Language that allows instruction and
storage locations to be represented by letters
and symbols instead of binary numbers is
called Assembly Language or Symbolic
Language.
Free Powerpoint Templates
Free Powerpoint Templates
Instruction Set
• DIRECTIVE:
 Also called Pseudo- Instruction
 Tells assembler to perform specific action.
• INSTRUCTION: A set of statements that assembler
translates into object code.
• FORMAT for INSTRUCTION
[Identifier] Operation [Operand(s)] [;Comment]
Free Powerpoint Templates
Format for Instruction
• IDENTFIER: Name or Label that you give to a data item or an
instruction.
• OPERATION: reserved symbols that correspond to
instructions
• ex: ADD, MOV,SUB,AND, LD, LDR, …
• OPERAND : Data on which the operation is to be
performed.
 Registers -- specified by Rn, where n is the register number
 Numbers -- indicated by # (decimal) or x (hex)
 Label -- symbolic name of memory locations
• ex: ADD R1,R1,#3
Free Powerpoint Templates
Source and Destination
• Source operands can be:
– Register/Memory reference/Immediate value
• Destination operands can be:
– Register/Memory reference
• Note:
– The Intel CPU does NOT allow both source and
destination operands to be memory references
Free Powerpoint Templates
Examples of Instruction Set
• DIRECTIVE:
COUNT DB 1;
• INSTRUCTION:
– MOV AX, [0x00040222h]
– Can also have register names instead of hex
addresses e.g. MOV AX, [EBX]
Contents of memory
location 0x00040222
Refers to the contents of
register EBX
COUNT will define a byte with initial value 1
Free Powerpoint Templates
Types of Instructions
Data Transfer Instruction
Arithmetic Instruction
Logic Instruction
Shift Instruction
Rotate instruction
Free Powerpoint Templates
Data Transfer Instruction
PURPOSE:
to move data from source to destination
between internal register
b/w internal register and storage location in
memory
Free Powerpoint Templates
MNUEMONIC MEANING FORMAT OPERATION FLAGS
AFFEC
TED
MOV Move byte/word from
source operand to
destination operand
MOV D,S (S)(D) None
XCHG Swap data b/w 2 general
purpose reg .or a storage
location.
XCHG D,S (D) ↔ (S) None
LEA Load Effective Address
directly from memory
LEA Reg16,EA
LEA CX,label
(EA) (Reg16) None
LDS Load Register and Data
Segment(DS)
LDS
Reg16,Mem32
Mem32Reg
16
None
Data Transfer Instructions
Free Powerpoint Templates
Arithmetic Instructions
PURPOSE:
• Addition
• Subtraction
• Multiplication
• Division
Results
are stored
in flags
Following
formats
• Unsigned binary
bytes or word
• Signed binary
bytes or words
Free Powerpoint Templates
Arithmetic Instructions
Symbol Meaning Format Operation Flags
ADD Add byte or word ADD D,S (S) + (D)  (D)
Carry  (CF)
OF,SF,ZF,AF,PF,
CF
ADC Add byte or word with
carry
ADC D,S (S) + (D) + (CF)  (D)
Carry  (CF)
OF,SF,ZF,AF,PF,
CF
INC Increment byte or word
by 1
INC D (D) + 1  (D) OF,SF,ZF,AF,PF
SUB Subtract SUB D,S (D) – (S)  (D) OF,SF,ZF,AF,PF,
CF
SBB Subtract with borrow SBB D,S (D) – (S) – (CF)  (D) OF,SF,ZF,AF,PF,
CF
DEC Decrement by 1 DEC D (D) – 1  (D) OF,SF,ZF,AF,PF
Free Powerpoint Templates
Contd…
Symbol Meaning Format Operation Flag
NEG Negation NEG D (O) – (D)  (D) OF,SF,ZF,AF,PF,
CF
MUL Multiply unsigned
bytes
MUL S (AL) . (S8)  (AX)
(AX) . (S16)  (DX),(AX)
OF,SF,ZF,AF,PF,
CF
Undefined
IMUL Multiplication of
signed integers
IMUL S (AL) . (S8)  (AX)
(AX) . (S16) (DX),(AX)
OF,SF,ZF,AF,PF,
CF
Undefined
DIV Divide unsigned
bytes
DIV S • Q((AX) / (S8) ) (AL)
R((AX) / (S8) ) (AH)
• Q((DX, AX) / (S16) ) (AX)
R((DX, AX) / (S16) ) (DX)
OF,SF,ZF,AF,PF,
CF
Undefined
IDIV Division of signed
integers
IDIV S • Q((AX) / (S8) ) (AX)
R((AX) / (S8) ) (AH)
• Q((DX, AX) / (S16) ) (AX)
R((DX, AX) / (S16) ) (DX)
OF,SF,ZF,AF,PF,
CF
Undefined
Free Powerpoint Templates
Logic Instruction
Free Powerpoint Templates
Logic instructions
Symbol Meaning Format Operation
AND Logical AND AND D,S (S) . (D)  (D)
OR Logical Inclusive OR OR D,S (S) + (D)  (D)
XOR Logical Exclusive OR XOR D,S (S) + (D)  (D)
NOT Logical NOT NOT D (D)  (D)
EXAMPLE: Let AX=1010 BX=0111
AND BX,AX
BX=0010
1010
.0111
0010
Free Powerpoint Templates
Shift Instrun. Rotate Instrun.
Mnemonic Meaning Format
ROL Rotate left ROL D, count
ROR Rotate Right ROR D, count
Mnemonic Meaning Format
SAL/SHL Shift
arithmetic
left/Logical
left
SAL/SHL D,
count
SHR Shift logical
Right
SHR D, count
Free Powerpoint Templates
EXAMPLES
• SHIFT INSTUCTION
• SHL BH,1 ;shift 1 bit left
• BH :00001010
• OUTPUT:
• ROTATE INSTRUCTION
• ROL BH,1 ; rotate 1 bit left
• BH: 10110111
• OUTPUT:
0 0 0 0 1 0 1 0
0 0 0 1 0 1 0 0
1 0 1 1 0 1 1 1
0 1 1 0 1 1 1 1
LOST
INCLUDED
Free Powerpoint Templates
Free Powerpoint Templates
ARITHMETIC OPERATORS
These operators include the arithmetic signs and perform arithmetic
during the assembly.
SIGN TYPE EXAMPLE EFFECT
+ Positive +FLDA Treats FLDA as positive
- Negation -FLDA Reverses sign of FLDA
+ Addition FLDA+25 Adds 25 to address of FLDA
- Subtraction FLDB-FLDA Calculates difference between
two offset address
* Multiplication Value*3 Multiplies value by 3
/ Division Value/3 Divides value by 3
MOD Remainder Value1 MOD value2 Delivers remainder for
value1/value2
Free Powerpoint Templates
The LOGICAL operators process the bits in an
expression.
LOGICAL OPERATORS
OPERATOR USED AS EFFECT
AND EXPR1 AND EXPR2 ANDs the bits
OR EXPR1 OR EXPR2 Ors the bits
XOR EXPR1 XOR EXPR2 Exclusive Ors the
bits
NOT EXPR1 NOT EXPR2 Reverses the bits
EXAMPLE:
MOV CL,00111100B AND 01010101B ; CL= 00010100B
MOV DL,NOT 01010101B ; CL=10101010B
Free Powerpoint Templates
High/Highword & Low/Lowword
Operators
HIGH and HIGHWORD
OPERATORS
HIGH operator returns
the high(leftmost) byte of
an expression.
HIGHWORD Operator
returns the high word of an
expression.
Example : EQUVAL EQU 1234H
Mov CL,HIGH EQUVAL
EFFECT : Load 12H in CL
LOW and LOWWORD
OPERATORS
LOW operator returns
the low(rightmost) byte of
an expression.
LOWWORD operator
returns the low word of an
expression.
Example : EQUVAL EQU 1234H
MOV CL,LOW EQUVAL
EFFECT : Load 34H in CL
Free Powerpoint Templates
Free Powerpoint Templates
SHL and SHR Operators
 The operators SHL(shift left) and SHR (shift
right) shift an expression during an assembly.
 FORMAT:
expression SHL/SHR count
 EXAMPLE:
MOV BL,01011101B SHR 3 ; Load 00001011B
Free Powerpoint Templates
OFFSET OPERATOR
 The OFFSET operator returns the offset address
of a variable or label.
 OFFSET : the distance in bytes from the segment
address to another location within the segment.
 CODED AS :
offset variable/label
 EXAMPLE:
MOV DX,OFFSET PART_TBL ; return offset address of part_tbl
Free Powerpoint Templates
PTR OPERATOR
 Provides flexibility to access part of a variable.
 Can also be used to combine elements of smaller type.
 Used to override the default type of variable.
SYNTAX:
type ptr expression
Example :
.data
Dval dword 12345678h |<------ DVAL ------- |  -----------ARRAY-----
Array byte 00h,10h,20h,30h
.code
Mov al,dval ;error
Mov al, byte ptr dval ;al=78h
Mov ax, dval ;error
Mov ax, word ptr dval ;ax=5678h
Mov eax ,array ;error
Mov eax, dword ptr array ;eax=30201000h
78 56 34 12 00 10 20 30 40
Free Powerpoint Templates
DUP OPERATOR
 USED: to generate multiple bytes or words with known as well
as un-initialized values.
 PURPOSE: to tell the assembler to duplicate or repeat the data
definition directive a specific number of times.
 EXAMPLE:
var1 BYTE 20 DUP(0) ; 20 bytes of zero
var2 BYTE 20 DUP(?) ; 20 bytes uninitialized
var3 BYTE 10, 3DUP(0) , 20 ; 5 bytes 10,0,0,0,20
 The (?) with the dup means that storage allocated by the directive
is uninitialized or undefined.
 The assembler allocates the space but does not write in it. Use ?
for buffer areas or variables your program will initialize at run
time.
Free Powerpoint Templates
SEG OPERATOR
 The seg operator does two things :
1) Returns the address of the segment in which a
specified variable or label is placed.
2) It converts the type of the specified expression from
address to constant.
 Coded As:
seg variable/label
 Example :
MOV AX,SEG WORDA ; Get address of data seg
MOV AX,SEG A10BEGIN ; Get address of code seg
Free Powerpoint Templates
INDEX OPERATOR
 Add a constant to a register to generate an offset.
 Allows to reference a members in an array.
 Uses square brackets[ ] and acts like a plus(+) sign.
 Two equivalent forms:
– constant[ reg ]
– [constant + reg ]
EXAMPLE:
part_tbl DB 25 DUP(?) ;Defined table
MOV CL<PART_TBL[4] ;accessing 5th entry
MOV DX,[BX] ; offset address in base reg DS:BX
MOV[BX+SI+4],AX ;base+index+constant
Free Powerpoint Templates
The LENGTH operator returns the number of
entries defined by a DUP operator.
EXAMPLE :
PART_TBL DW 10 DUP(?)
MOV DX,LENGTH PART_TBL
If the referenced operand does not contain a
DUP entry, the operator returns the value 01.
LENGTH OPERATOR
Free Powerpoint Templates
TYPE OPERATOR
 The TYPE operator returns the number of bytes,
according to the definition of the referenced variable.
 CODED AS:
TYPE variable/label
DEFINITION NO. OF BYTES FOR NUMERIC VARIABLE
DB/BYTE 1
DW/WORD 2
DD/DWORD 4
DF/FWORD 8
DT/TWORD 10
STRUC/STRUCT No> of bytes defined by structure
NEAR label FFFFH
FAR label FFFFH
Free Powerpoint Templates
SIZE OPERATOR
 Returns the number of bytes taken up by a structure
 Basically, LENGTH * TYPE
 Coded As:
SIZE variable
 Example :
BYTEA DB? ;Define one byte
PART_TBL DW 10 DUP(?) ;Define 10 words
MOV AX,TYPE BYTEA ;AX=0001H
MOV AX,TYPE PART_TBL ;AX=0002H
MOV CX,LENGTH PART_TBL ;CX=000AH(10)
MOV DX,SIZE PART_TBL ;DX=0014H(20)
Free Powerpoint Templates
Free Powerpoint Templates
Execution of an Assembly Lang. Program
Assembling
Linking
Execution
Includes following steps:
Free Powerpoint Templates
ASSEMBLING, LINKING AND
EXECUTING
SOURCE CODE:
The symbolic
instructions that we
code in assembly
language.
OBJECT CODE:
We use an assembler
program to translate
the source program
into machine code.
EXECUTABLE
MODULE:
Finally, using a linker,
execution of object
code.
Free Powerpoint Templates
EDIT
PROG.
ASM
ASSEMBLE
PROG.
OBJ
LINK
PROG.
EXE
EXECUTE
EDITOR
ASSEMBLER
LINKER
Free Powerpoint Templates
EDITING A PROGRAM
After writing our program we will save it with .ASM
extension.
Although spacing is not important to the assembler, but a
program is more readable if we keep data properly aligned.
For this we can use any editor or word processing program
that produces a standard unformatted ASCII file.
Free Powerpoint Templates
ASSEMBLING SOURCE PROGRAM
Assembler converts source statements
into machine code and displays error
messages on the screen if any.
Typical errors include a name that
violates naming conventions, an
operation i.e. spelled incorrectly.
Optional output files from the assembly
step are OBJECT(.OBJ), LISTING(.LST)
and CROSS REFERNCE(.CRF or .SBR).
Free Powerpoint Templates
LINKING AN OBJECT PROGRAM
When our
program is free
from errors next
step is to link
the object
module
produced by
the assembler
and that
contains only
machine code.
Linker
combines, if
requested,
more than one
separately
assembled
module into
one executable
program.
Generates an
.EXE module
and initializes it
with special
instructions to
facilitate its
subsequent
loading for
execution.
Output files
from this step
are
EXECUTABLE(.EX
E), MAP(.MAP)
and
LIBRARY(.LIB)
Free Powerpoint Templates
EXECUTING A PROGRAM
• Having assembled and linked a program, we
can now execute it .
• If the .EXE file is in the default drive, you could
ask the loader to read it into memory for
execution by typing
• C:TASMBIN>PROG.EXE
Free Powerpoint Templates
STEPS TO CREATE AND RUN A
PROGRAM
Write the
source code
in a notepad
file.
Save it in
tasmbin with
.asm
extension.
Now , go to
DOS prompt.
Set the path
to tasmbin.
Write tlink
filename.asm
to link the
file.
Type filename
to run the
program.
Give the
required
input.
Free Powerpoint Templates

More Related Content

What's hot

Segmentation in operating systems
Segmentation in operating systemsSegmentation in operating systems
Segmentation in operating systems
Dr. Jasmine Beulah Gnanadurai
 
OSI Network model ppt
OSI Network model pptOSI Network model ppt
OSI Network model ppt
extraganesh
 
Dag representation of basic blocks
Dag representation of basic blocksDag representation of basic blocks
Dag representation of basic blocks
Jothi Lakshmi
 
Parsing in Compiler Design
Parsing in Compiler DesignParsing in Compiler Design
Parsing in Compiler Design
Akhil Kaushik
 
Register transfer language
Register transfer languageRegister transfer language
Register transfer language
Sanjeev Patel
 
Number System.pdf
Number System.pdfNumber System.pdf
Number System.pdf
Sweta Kumari Barnwal
 
Number system and codes
Number system and codesNumber system and codes
Number system and codes
Abhiraj Bohra
 
Introduction to Compiler design
Introduction to Compiler design Introduction to Compiler design
Introduction to Compiler design
Dr. C.V. Suresh Babu
 
OS - Process Concepts
OS - Process ConceptsOS - Process Concepts
OS - Process Concepts
Mukesh Chinta
 
Lecture 2 role of algorithms in computing
Lecture 2   role of algorithms in computingLecture 2   role of algorithms in computing
Lecture 2 role of algorithms in computing
jayavignesh86
 
Multimedia software tools
Multimedia software toolsMultimedia software tools
Multimedia software tools
Jay Patel
 
Logical and shift micro operations
Logical and shift micro operationsLogical and shift micro operations
Logical and shift micro operations
Sanjeev Patel
 
Parallel architecture
Parallel architectureParallel architecture
Parallel architecture
Mr SMAK
 
Ch11 file system implementation
Ch11 file system implementationCh11 file system implementation
Ch11 file system implementation
Abdullah Al Shiam
 
Compilers Design
Compilers DesignCompilers Design
Compilers Design
Akshaya Arunan
 
Buddy Memory Allocation system
Buddy Memory Allocation systemBuddy Memory Allocation system
Buddy Memory Allocation system
Kumod Kumar Sah
 
IPV4 Frame Format
IPV4 Frame FormatIPV4 Frame Format
IPV4 Frame Format
Aditya Rawat
 
Peterson Critical Section Problem Solution
Peterson Critical Section Problem SolutionPeterson Critical Section Problem Solution
Peterson Critical Section Problem Solution
Bipul Chandra Kar
 
register
registerregister
register
Taimoor Ashraf
 
Mapping
MappingMapping

What's hot (20)

Segmentation in operating systems
Segmentation in operating systemsSegmentation in operating systems
Segmentation in operating systems
 
OSI Network model ppt
OSI Network model pptOSI Network model ppt
OSI Network model ppt
 
Dag representation of basic blocks
Dag representation of basic blocksDag representation of basic blocks
Dag representation of basic blocks
 
Parsing in Compiler Design
Parsing in Compiler DesignParsing in Compiler Design
Parsing in Compiler Design
 
Register transfer language
Register transfer languageRegister transfer language
Register transfer language
 
Number System.pdf
Number System.pdfNumber System.pdf
Number System.pdf
 
Number system and codes
Number system and codesNumber system and codes
Number system and codes
 
Introduction to Compiler design
Introduction to Compiler design Introduction to Compiler design
Introduction to Compiler design
 
OS - Process Concepts
OS - Process ConceptsOS - Process Concepts
OS - Process Concepts
 
Lecture 2 role of algorithms in computing
Lecture 2   role of algorithms in computingLecture 2   role of algorithms in computing
Lecture 2 role of algorithms in computing
 
Multimedia software tools
Multimedia software toolsMultimedia software tools
Multimedia software tools
 
Logical and shift micro operations
Logical and shift micro operationsLogical and shift micro operations
Logical and shift micro operations
 
Parallel architecture
Parallel architectureParallel architecture
Parallel architecture
 
Ch11 file system implementation
Ch11 file system implementationCh11 file system implementation
Ch11 file system implementation
 
Compilers Design
Compilers DesignCompilers Design
Compilers Design
 
Buddy Memory Allocation system
Buddy Memory Allocation systemBuddy Memory Allocation system
Buddy Memory Allocation system
 
IPV4 Frame Format
IPV4 Frame FormatIPV4 Frame Format
IPV4 Frame Format
 
Peterson Critical Section Problem Solution
Peterson Critical Section Problem SolutionPeterson Critical Section Problem Solution
Peterson Critical Section Problem Solution
 
register
registerregister
register
 
Mapping
MappingMapping
Mapping
 

Viewers also liked

Shift rotate
Shift rotateShift rotate
Shift rotate
fika sweety
 
Logic, shift and rotate instruction
Logic, shift and rotate instructionLogic, shift and rotate instruction
Logic, shift and rotate instruction
kashif Shafqat
 
Intro to assembly language
Intro to assembly languageIntro to assembly language
Intro to assembly language
United International University
 
Assembly Language Basics
Assembly Language BasicsAssembly Language Basics
Assembly Language Basics
Education Front
 
Abelardo Alaan profile
Abelardo Alaan profileAbelardo Alaan profile
Abelardo Alaan profile
Abelardo Alaan
 
arithmetic ins in 8051
arithmetic ins in 8051arithmetic ins in 8051
arithmetic ins in 8051
VJ Aiswaryadevi
 
logic shift and rotate instruction
logic shift and rotate instructionlogic shift and rotate instruction
logic shift and rotate instruction
JiaahRajpout123
 
Arithmetic instructions
Arithmetic instructionsArithmetic instructions
Arithmetic instructions
Robert Almazan
 
Arithmetic and logical instructions set
Arithmetic and logical instructions setArithmetic and logical instructions set
Arithmetic and logical instructions set
Robert Almazan
 
Software AND its Types & CASE toolS
Software  AND     its   Types   &    CASE toolSSoftware  AND     its   Types   &    CASE toolS
Software AND its Types & CASE toolS
kashif Shafqat
 
[ASM]Lab7
[ASM]Lab7[ASM]Lab7
[ASM]Lab7
Nora Youssef
 
Assembly
AssemblyAssembly
Assembly
nick333y
 
.NET Framework Projet with C#
.NET Framework Projet with C#.NET Framework Projet with C#
.NET Framework Projet with C#
eclumson
 
1.arithmetic & logical operations
1.arithmetic & logical operations1.arithmetic & logical operations
1.arithmetic & logical operations
mukesh bhardwaj
 
Assembly fundamentals
Assembly fundamentalsAssembly fundamentals
Assembly fundamentals
Syed Zaid Irshad
 
Assembly language part I
Assembly language part IAssembly language part I
Assembly language part I
Mohammed A. Imran
 
Assembly Language Tanka - SAKAI Hiroaki
Assembly Language Tanka - SAKAI HiroakiAssembly Language Tanka - SAKAI Hiroaki
Assembly Language Tanka - SAKAI Hiroaki
asmtanka
 
Introduction to Assembly Language
Introduction to Assembly LanguageIntroduction to Assembly Language
Introduction to Assembly Language
Motaz Saad
 
Chapt 01 basic concepts
Chapt 01   basic conceptsChapt 01   basic concepts
Chapt 01 basic concepts
bushrakainat214
 
Processor Basics
Processor BasicsProcessor Basics
Processor Basics
Education Front
 

Viewers also liked (20)

Shift rotate
Shift rotateShift rotate
Shift rotate
 
Logic, shift and rotate instruction
Logic, shift and rotate instructionLogic, shift and rotate instruction
Logic, shift and rotate instruction
 
Intro to assembly language
Intro to assembly languageIntro to assembly language
Intro to assembly language
 
Assembly Language Basics
Assembly Language BasicsAssembly Language Basics
Assembly Language Basics
 
Abelardo Alaan profile
Abelardo Alaan profileAbelardo Alaan profile
Abelardo Alaan profile
 
arithmetic ins in 8051
arithmetic ins in 8051arithmetic ins in 8051
arithmetic ins in 8051
 
logic shift and rotate instruction
logic shift and rotate instructionlogic shift and rotate instruction
logic shift and rotate instruction
 
Arithmetic instructions
Arithmetic instructionsArithmetic instructions
Arithmetic instructions
 
Arithmetic and logical instructions set
Arithmetic and logical instructions setArithmetic and logical instructions set
Arithmetic and logical instructions set
 
Software AND its Types & CASE toolS
Software  AND     its   Types   &    CASE toolSSoftware  AND     its   Types   &    CASE toolS
Software AND its Types & CASE toolS
 
[ASM]Lab7
[ASM]Lab7[ASM]Lab7
[ASM]Lab7
 
Assembly
AssemblyAssembly
Assembly
 
.NET Framework Projet with C#
.NET Framework Projet with C#.NET Framework Projet with C#
.NET Framework Projet with C#
 
1.arithmetic & logical operations
1.arithmetic & logical operations1.arithmetic & logical operations
1.arithmetic & logical operations
 
Assembly fundamentals
Assembly fundamentalsAssembly fundamentals
Assembly fundamentals
 
Assembly language part I
Assembly language part IAssembly language part I
Assembly language part I
 
Assembly Language Tanka - SAKAI Hiroaki
Assembly Language Tanka - SAKAI HiroakiAssembly Language Tanka - SAKAI Hiroaki
Assembly Language Tanka - SAKAI Hiroaki
 
Introduction to Assembly Language
Introduction to Assembly LanguageIntroduction to Assembly Language
Introduction to Assembly Language
 
Chapt 01 basic concepts
Chapt 01   basic conceptsChapt 01   basic concepts
Chapt 01 basic concepts
 
Processor Basics
Processor BasicsProcessor Basics
Processor Basics
 

Similar to Assembly Language -I

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
 
8086 instruction set (with simulator)
8086 instruction set (with simulator)8086 instruction set (with simulator)
8086 instruction set (with simulator)
Aswini Dharmaraj
 
Part III: Assembly Language
Part III: Assembly LanguagePart III: Assembly Language
Part III: Assembly Language
Ahmed M. Abed
 
Assembly Language Compiler Implementation
Assembly Language Compiler ImplementationAssembly Language Compiler Implementation
Assembly Language Compiler Implementation
RAVI TEJA KOMMA
 
12 mt06ped008
12 mt06ped008 12 mt06ped008
12 mt06ped008
vijaydeepakg
 
Instruction formats-in-8086
Instruction formats-in-8086Instruction formats-in-8086
Instruction formats-in-8086
MNM Jain Engineering College
 
Instruction sets of 8086
Instruction sets of 8086Instruction sets of 8086
Instruction sets of 8086
Mahalakshmiv11
 
Wk1to4
Wk1to4Wk1to4
Wk1to4
raymondmy08
 
Al2ed chapter4
Al2ed chapter4Al2ed chapter4
Al2ed chapter4
Abdullelah Al-Fahad
 
Mastering Assembly Language: Programming with 8086
Mastering Assembly Language: Programming with 8086Mastering Assembly Language: Programming with 8086
Mastering Assembly Language: Programming with 8086
sravanithonta79
 
Assembly Language Lecture 4
Assembly Language Lecture 4Assembly Language Lecture 4
Assembly Language Lecture 4
Motaz Saad
 
8086 Instruction set
8086 Instruction set8086 Instruction set
8086 Instruction set
karthiga selvaraju
 
8086-instruction-set-ppt
 8086-instruction-set-ppt 8086-instruction-set-ppt
8086-instruction-set-ppt
jemimajerome
 
Microprocessor Based Design and operations
Microprocessor Based Design and operationsMicroprocessor Based Design and operations
Microprocessor Based Design and operations
zelalem2022
 
Intel8086_Flags_Addr_Modes_sample_pgms.pdf
Intel8086_Flags_Addr_Modes_sample_pgms.pdfIntel8086_Flags_Addr_Modes_sample_pgms.pdf
Intel8086_Flags_Addr_Modes_sample_pgms.pdf
Anonymous611358
 
Addressing modes
Addressing modesAddressing modes
Addressing modes
karthiga selvaraju
 
Assembler - System Programming
Assembler - System ProgrammingAssembler - System Programming
Assembler - System Programming
Radhika Talaviya
 
Lecture6
Lecture6Lecture6
Instruction set of 8086
Instruction set of 8086Instruction set of 8086
Instruction set of 8086
Tirumalesh Nizampatnam
 
8085 instruction set
8085 instruction set8085 instruction set

Similar to Assembly Language -I (20)

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 ...
 
8086 instruction set (with simulator)
8086 instruction set (with simulator)8086 instruction set (with simulator)
8086 instruction set (with simulator)
 
Part III: Assembly Language
Part III: Assembly LanguagePart III: Assembly Language
Part III: Assembly Language
 
Assembly Language Compiler Implementation
Assembly Language Compiler ImplementationAssembly Language Compiler Implementation
Assembly Language Compiler Implementation
 
12 mt06ped008
12 mt06ped008 12 mt06ped008
12 mt06ped008
 
Instruction formats-in-8086
Instruction formats-in-8086Instruction formats-in-8086
Instruction formats-in-8086
 
Instruction sets of 8086
Instruction sets of 8086Instruction sets of 8086
Instruction sets of 8086
 
Wk1to4
Wk1to4Wk1to4
Wk1to4
 
Al2ed chapter4
Al2ed chapter4Al2ed chapter4
Al2ed chapter4
 
Mastering Assembly Language: Programming with 8086
Mastering Assembly Language: Programming with 8086Mastering Assembly Language: Programming with 8086
Mastering Assembly Language: Programming with 8086
 
Assembly Language Lecture 4
Assembly Language Lecture 4Assembly Language Lecture 4
Assembly Language Lecture 4
 
8086 Instruction set
8086 Instruction set8086 Instruction set
8086 Instruction set
 
8086-instruction-set-ppt
 8086-instruction-set-ppt 8086-instruction-set-ppt
8086-instruction-set-ppt
 
Microprocessor Based Design and operations
Microprocessor Based Design and operationsMicroprocessor Based Design and operations
Microprocessor Based Design and operations
 
Intel8086_Flags_Addr_Modes_sample_pgms.pdf
Intel8086_Flags_Addr_Modes_sample_pgms.pdfIntel8086_Flags_Addr_Modes_sample_pgms.pdf
Intel8086_Flags_Addr_Modes_sample_pgms.pdf
 
Addressing modes
Addressing modesAddressing modes
Addressing modes
 
Assembler - System Programming
Assembler - System ProgrammingAssembler - System Programming
Assembler - System Programming
 
Lecture6
Lecture6Lecture6
Lecture6
 
Instruction set of 8086
Instruction set of 8086Instruction set of 8086
Instruction set of 8086
 
8085 instruction set
8085 instruction set8085 instruction set
8085 instruction set
 

More from Devika Rangnekar

Case study
Case studyCase study
Case study
Devika Rangnekar
 
Business plan
Business planBusiness plan
Business plan
Devika Rangnekar
 
Project Report on Marketing Information System
Project Report on Marketing Information SystemProject Report on Marketing Information System
Project Report on Marketing Information System
Devika Rangnekar
 
Final mkis
Final mkisFinal mkis
Final mkis
Devika Rangnekar
 
Working of input and output devices
Working of input and output devicesWorking of input and output devices
Working of input and output devices
Devika Rangnekar
 
Difference between ascii and ebdic
Difference between ascii and ebdicDifference between ascii and ebdic
Difference between ascii and ebdic
Devika Rangnekar
 
Operating system
Operating systemOperating system
Operating system
Devika Rangnekar
 
Classification of computers
Classification of computersClassification of computers
Classification of computers
Devika Rangnekar
 
Generations of computer
Generations of computerGenerations of computer
Generations of computer
Devika Rangnekar
 
working of Projector
working of Projectorworking of Projector
working of Projector
Devika Rangnekar
 
Difference between internet and www
Difference between internet and wwwDifference between internet and www
Difference between internet and www
Devika Rangnekar
 
Raster Scan And Random Scan
Raster Scan And Random ScanRaster Scan And Random Scan
Raster Scan And Random Scan
Devika Rangnekar
 
Transmission Media
Transmission MediaTransmission Media
Transmission Media
Devika Rangnekar
 

More from Devika Rangnekar (13)

Case study
Case studyCase study
Case study
 
Business plan
Business planBusiness plan
Business plan
 
Project Report on Marketing Information System
Project Report on Marketing Information SystemProject Report on Marketing Information System
Project Report on Marketing Information System
 
Final mkis
Final mkisFinal mkis
Final mkis
 
Working of input and output devices
Working of input and output devicesWorking of input and output devices
Working of input and output devices
 
Difference between ascii and ebdic
Difference between ascii and ebdicDifference between ascii and ebdic
Difference between ascii and ebdic
 
Operating system
Operating systemOperating system
Operating system
 
Classification of computers
Classification of computersClassification of computers
Classification of computers
 
Generations of computer
Generations of computerGenerations of computer
Generations of computer
 
working of Projector
working of Projectorworking of Projector
working of Projector
 
Difference between internet and www
Difference between internet and wwwDifference between internet and www
Difference between internet and www
 
Raster Scan And Random Scan
Raster Scan And Random ScanRaster Scan And Random Scan
Raster Scan And Random Scan
 
Transmission Media
Transmission MediaTransmission Media
Transmission Media
 

Recently uploaded

Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with SlackLet's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
shyamraj55
 
AI 101: An Introduction to the Basics and Impact of Artificial Intelligence
AI 101: An Introduction to the Basics and Impact of Artificial IntelligenceAI 101: An Introduction to the Basics and Impact of Artificial Intelligence
AI 101: An Introduction to the Basics and Impact of Artificial Intelligence
IndexBug
 
OpenID AuthZEN Interop Read Out - Authorization
OpenID AuthZEN Interop Read Out - AuthorizationOpenID AuthZEN Interop Read Out - Authorization
OpenID AuthZEN Interop Read Out - Authorization
David Brossard
 
TrustArc Webinar - 2024 Global Privacy Survey
TrustArc Webinar - 2024 Global Privacy SurveyTrustArc Webinar - 2024 Global Privacy Survey
TrustArc Webinar - 2024 Global Privacy Survey
TrustArc
 
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
 
WeTestAthens: Postman's AI & Automation Techniques
WeTestAthens: Postman's AI & Automation TechniquesWeTestAthens: Postman's AI & Automation Techniques
WeTestAthens: Postman's AI & Automation Techniques
Postman
 
HCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAU
HCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAUHCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAU
HCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAU
panagenda
 
Mariano G Tinti - Decoding SpaceX
Mariano G Tinti - Decoding SpaceXMariano G Tinti - Decoding SpaceX
Mariano G Tinti - Decoding SpaceX
Mariano Tinti
 
5th LF Energy Power Grid Model Meet-up Slides
5th LF Energy Power Grid Model Meet-up Slides5th LF Energy Power Grid Model Meet-up Slides
5th LF Energy Power Grid Model Meet-up Slides
DanBrown980551
 
Recommendation System using RAG Architecture
Recommendation System using RAG ArchitectureRecommendation System using RAG Architecture
Recommendation System using RAG Architecture
fredae14
 
Skybuffer SAM4U tool for SAP license adoption
Skybuffer SAM4U tool for SAP license adoptionSkybuffer SAM4U tool for SAP license adoption
Skybuffer SAM4U tool for SAP license adoption
Tatiana Kojar
 
Artificial Intelligence for XMLDevelopment
Artificial Intelligence for XMLDevelopmentArtificial Intelligence for XMLDevelopment
Artificial Intelligence for XMLDevelopment
Octavian Nadolu
 
GenAI Pilot Implementation in the organizations
GenAI Pilot Implementation in the organizationsGenAI Pilot Implementation in the organizations
GenAI Pilot Implementation in the organizations
kumardaparthi1024
 
Building Production Ready Search Pipelines with Spark and Milvus
Building Production Ready Search Pipelines with Spark and MilvusBuilding Production Ready Search Pipelines with Spark and Milvus
Building Production Ready Search Pipelines with Spark and Milvus
Zilliz
 
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdf
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdfUnlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdf
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdf
Malak Abu Hammad
 
Ocean lotus Threat actors project by John Sitima 2024 (1).pptx
Ocean lotus Threat actors project by John Sitima 2024 (1).pptxOcean lotus Threat actors project by John Sitima 2024 (1).pptx
Ocean lotus Threat actors project by John Sitima 2024 (1).pptx
SitimaJohn
 
Project Management Semester Long Project - Acuity
Project Management Semester Long Project - AcuityProject Management Semester Long Project - Acuity
Project Management Semester Long Project - Acuity
jpupo2018
 
20240609 QFM020 Irresponsible AI Reading List May 2024
20240609 QFM020 Irresponsible AI Reading List May 202420240609 QFM020 Irresponsible AI Reading List May 2024
20240609 QFM020 Irresponsible AI Reading List May 2024
Matthew Sinclair
 
UI5 Controls simplified - UI5con2024 presentation
UI5 Controls simplified - UI5con2024 presentationUI5 Controls simplified - UI5con2024 presentation
UI5 Controls simplified - UI5con2024 presentation
Wouter Lemaire
 
Presentation of the OECD Artificial Intelligence Review of Germany
Presentation of the OECD Artificial Intelligence Review of GermanyPresentation of the OECD Artificial Intelligence Review of Germany
Presentation of the OECD Artificial Intelligence Review of Germany
innovationoecd
 

Recently uploaded (20)

Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with SlackLet's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
 
AI 101: An Introduction to the Basics and Impact of Artificial Intelligence
AI 101: An Introduction to the Basics and Impact of Artificial IntelligenceAI 101: An Introduction to the Basics and Impact of Artificial Intelligence
AI 101: An Introduction to the Basics and Impact of Artificial Intelligence
 
OpenID AuthZEN Interop Read Out - Authorization
OpenID AuthZEN Interop Read Out - AuthorizationOpenID AuthZEN Interop Read Out - Authorization
OpenID AuthZEN Interop Read Out - Authorization
 
TrustArc Webinar - 2024 Global Privacy Survey
TrustArc Webinar - 2024 Global Privacy SurveyTrustArc Webinar - 2024 Global Privacy Survey
TrustArc Webinar - 2024 Global Privacy Survey
 
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
 
WeTestAthens: Postman's AI & Automation Techniques
WeTestAthens: Postman's AI & Automation TechniquesWeTestAthens: Postman's AI & Automation Techniques
WeTestAthens: Postman's AI & Automation Techniques
 
HCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAU
HCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAUHCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAU
HCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAU
 
Mariano G Tinti - Decoding SpaceX
Mariano G Tinti - Decoding SpaceXMariano G Tinti - Decoding SpaceX
Mariano G Tinti - Decoding SpaceX
 
5th LF Energy Power Grid Model Meet-up Slides
5th LF Energy Power Grid Model Meet-up Slides5th LF Energy Power Grid Model Meet-up Slides
5th LF Energy Power Grid Model Meet-up Slides
 
Recommendation System using RAG Architecture
Recommendation System using RAG ArchitectureRecommendation System using RAG Architecture
Recommendation System using RAG Architecture
 
Skybuffer SAM4U tool for SAP license adoption
Skybuffer SAM4U tool for SAP license adoptionSkybuffer SAM4U tool for SAP license adoption
Skybuffer SAM4U tool for SAP license adoption
 
Artificial Intelligence for XMLDevelopment
Artificial Intelligence for XMLDevelopmentArtificial Intelligence for XMLDevelopment
Artificial Intelligence for XMLDevelopment
 
GenAI Pilot Implementation in the organizations
GenAI Pilot Implementation in the organizationsGenAI Pilot Implementation in the organizations
GenAI Pilot Implementation in the organizations
 
Building Production Ready Search Pipelines with Spark and Milvus
Building Production Ready Search Pipelines with Spark and MilvusBuilding Production Ready Search Pipelines with Spark and Milvus
Building Production Ready Search Pipelines with Spark and Milvus
 
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdf
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdfUnlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdf
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdf
 
Ocean lotus Threat actors project by John Sitima 2024 (1).pptx
Ocean lotus Threat actors project by John Sitima 2024 (1).pptxOcean lotus Threat actors project by John Sitima 2024 (1).pptx
Ocean lotus Threat actors project by John Sitima 2024 (1).pptx
 
Project Management Semester Long Project - Acuity
Project Management Semester Long Project - AcuityProject Management Semester Long Project - Acuity
Project Management Semester Long Project - Acuity
 
20240609 QFM020 Irresponsible AI Reading List May 2024
20240609 QFM020 Irresponsible AI Reading List May 202420240609 QFM020 Irresponsible AI Reading List May 2024
20240609 QFM020 Irresponsible AI Reading List May 2024
 
UI5 Controls simplified - UI5con2024 presentation
UI5 Controls simplified - UI5con2024 presentationUI5 Controls simplified - UI5con2024 presentation
UI5 Controls simplified - UI5con2024 presentation
 
Presentation of the OECD Artificial Intelligence Review of Germany
Presentation of the OECD Artificial Intelligence Review of GermanyPresentation of the OECD Artificial Intelligence Review of Germany
Presentation of the OECD Artificial Intelligence Review of Germany
 

Assembly Language -I

  • 1. Free Powerpoint TemplatesFree Powerpoint Templates Assembly Language -I Submitted to : Ms. Indu Chabbra Submitted by : Devika Rangnekar Rupam Jaspreet Kaur MCA – I (Morning) Rollno : 9 30 15
  • 2. Free Powerpoint Templates Assembly Language • A Language that allows instruction and storage locations to be represented by letters and symbols instead of binary numbers is called Assembly Language or Symbolic Language.
  • 4. Free Powerpoint Templates Instruction Set • DIRECTIVE:  Also called Pseudo- Instruction  Tells assembler to perform specific action. • INSTRUCTION: A set of statements that assembler translates into object code. • FORMAT for INSTRUCTION [Identifier] Operation [Operand(s)] [;Comment]
  • 5. Free Powerpoint Templates Format for Instruction • IDENTFIER: Name or Label that you give to a data item or an instruction. • OPERATION: reserved symbols that correspond to instructions • ex: ADD, MOV,SUB,AND, LD, LDR, … • OPERAND : Data on which the operation is to be performed.  Registers -- specified by Rn, where n is the register number  Numbers -- indicated by # (decimal) or x (hex)  Label -- symbolic name of memory locations • ex: ADD R1,R1,#3
  • 6. Free Powerpoint Templates Source and Destination • Source operands can be: – Register/Memory reference/Immediate value • Destination operands can be: – Register/Memory reference • Note: – The Intel CPU does NOT allow both source and destination operands to be memory references
  • 7. Free Powerpoint Templates Examples of Instruction Set • DIRECTIVE: COUNT DB 1; • INSTRUCTION: – MOV AX, [0x00040222h] – Can also have register names instead of hex addresses e.g. MOV AX, [EBX] Contents of memory location 0x00040222 Refers to the contents of register EBX COUNT will define a byte with initial value 1
  • 8. Free Powerpoint Templates Types of Instructions Data Transfer Instruction Arithmetic Instruction Logic Instruction Shift Instruction Rotate instruction
  • 9. Free Powerpoint Templates Data Transfer Instruction PURPOSE: to move data from source to destination between internal register b/w internal register and storage location in memory
  • 10. Free Powerpoint Templates MNUEMONIC MEANING FORMAT OPERATION FLAGS AFFEC TED MOV Move byte/word from source operand to destination operand MOV D,S (S)(D) None XCHG Swap data b/w 2 general purpose reg .or a storage location. XCHG D,S (D) ↔ (S) None LEA Load Effective Address directly from memory LEA Reg16,EA LEA CX,label (EA) (Reg16) None LDS Load Register and Data Segment(DS) LDS Reg16,Mem32 Mem32Reg 16 None Data Transfer Instructions
  • 11. Free Powerpoint Templates Arithmetic Instructions PURPOSE: • Addition • Subtraction • Multiplication • Division Results are stored in flags Following formats • Unsigned binary bytes or word • Signed binary bytes or words
  • 12. Free Powerpoint Templates Arithmetic Instructions Symbol Meaning Format Operation Flags ADD Add byte or word ADD D,S (S) + (D)  (D) Carry  (CF) OF,SF,ZF,AF,PF, CF ADC Add byte or word with carry ADC D,S (S) + (D) + (CF)  (D) Carry  (CF) OF,SF,ZF,AF,PF, CF INC Increment byte or word by 1 INC D (D) + 1  (D) OF,SF,ZF,AF,PF SUB Subtract SUB D,S (D) – (S)  (D) OF,SF,ZF,AF,PF, CF SBB Subtract with borrow SBB D,S (D) – (S) – (CF)  (D) OF,SF,ZF,AF,PF, CF DEC Decrement by 1 DEC D (D) – 1  (D) OF,SF,ZF,AF,PF
  • 13. Free Powerpoint Templates Contd… Symbol Meaning Format Operation Flag NEG Negation NEG D (O) – (D)  (D) OF,SF,ZF,AF,PF, CF MUL Multiply unsigned bytes MUL S (AL) . (S8)  (AX) (AX) . (S16)  (DX),(AX) OF,SF,ZF,AF,PF, CF Undefined IMUL Multiplication of signed integers IMUL S (AL) . (S8)  (AX) (AX) . (S16) (DX),(AX) OF,SF,ZF,AF,PF, CF Undefined DIV Divide unsigned bytes DIV S • Q((AX) / (S8) ) (AL) R((AX) / (S8) ) (AH) • Q((DX, AX) / (S16) ) (AX) R((DX, AX) / (S16) ) (DX) OF,SF,ZF,AF,PF, CF Undefined IDIV Division of signed integers IDIV S • Q((AX) / (S8) ) (AX) R((AX) / (S8) ) (AH) • Q((DX, AX) / (S16) ) (AX) R((DX, AX) / (S16) ) (DX) OF,SF,ZF,AF,PF, CF Undefined
  • 15. Free Powerpoint Templates Logic instructions Symbol Meaning Format Operation AND Logical AND AND D,S (S) . (D)  (D) OR Logical Inclusive OR OR D,S (S) + (D)  (D) XOR Logical Exclusive OR XOR D,S (S) + (D)  (D) NOT Logical NOT NOT D (D)  (D) EXAMPLE: Let AX=1010 BX=0111 AND BX,AX BX=0010 1010 .0111 0010
  • 16. Free Powerpoint Templates Shift Instrun. Rotate Instrun. Mnemonic Meaning Format ROL Rotate left ROL D, count ROR Rotate Right ROR D, count Mnemonic Meaning Format SAL/SHL Shift arithmetic left/Logical left SAL/SHL D, count SHR Shift logical Right SHR D, count
  • 17. Free Powerpoint Templates EXAMPLES • SHIFT INSTUCTION • SHL BH,1 ;shift 1 bit left • BH :00001010 • OUTPUT: • ROTATE INSTRUCTION • ROL BH,1 ; rotate 1 bit left • BH: 10110111 • OUTPUT: 0 0 0 0 1 0 1 0 0 0 0 1 0 1 0 0 1 0 1 1 0 1 1 1 0 1 1 0 1 1 1 1 LOST INCLUDED
  • 19. Free Powerpoint Templates ARITHMETIC OPERATORS These operators include the arithmetic signs and perform arithmetic during the assembly. SIGN TYPE EXAMPLE EFFECT + Positive +FLDA Treats FLDA as positive - Negation -FLDA Reverses sign of FLDA + Addition FLDA+25 Adds 25 to address of FLDA - Subtraction FLDB-FLDA Calculates difference between two offset address * Multiplication Value*3 Multiplies value by 3 / Division Value/3 Divides value by 3 MOD Remainder Value1 MOD value2 Delivers remainder for value1/value2
  • 20. Free Powerpoint Templates The LOGICAL operators process the bits in an expression. LOGICAL OPERATORS OPERATOR USED AS EFFECT AND EXPR1 AND EXPR2 ANDs the bits OR EXPR1 OR EXPR2 Ors the bits XOR EXPR1 XOR EXPR2 Exclusive Ors the bits NOT EXPR1 NOT EXPR2 Reverses the bits EXAMPLE: MOV CL,00111100B AND 01010101B ; CL= 00010100B MOV DL,NOT 01010101B ; CL=10101010B
  • 21. Free Powerpoint Templates High/Highword & Low/Lowword Operators HIGH and HIGHWORD OPERATORS HIGH operator returns the high(leftmost) byte of an expression. HIGHWORD Operator returns the high word of an expression. Example : EQUVAL EQU 1234H Mov CL,HIGH EQUVAL EFFECT : Load 12H in CL LOW and LOWWORD OPERATORS LOW operator returns the low(rightmost) byte of an expression. LOWWORD operator returns the low word of an expression. Example : EQUVAL EQU 1234H MOV CL,LOW EQUVAL EFFECT : Load 34H in CL
  • 23. Free Powerpoint Templates SHL and SHR Operators  The operators SHL(shift left) and SHR (shift right) shift an expression during an assembly.  FORMAT: expression SHL/SHR count  EXAMPLE: MOV BL,01011101B SHR 3 ; Load 00001011B
  • 24. Free Powerpoint Templates OFFSET OPERATOR  The OFFSET operator returns the offset address of a variable or label.  OFFSET : the distance in bytes from the segment address to another location within the segment.  CODED AS : offset variable/label  EXAMPLE: MOV DX,OFFSET PART_TBL ; return offset address of part_tbl
  • 25. Free Powerpoint Templates PTR OPERATOR  Provides flexibility to access part of a variable.  Can also be used to combine elements of smaller type.  Used to override the default type of variable. SYNTAX: type ptr expression Example : .data Dval dword 12345678h |<------ DVAL ------- |  -----------ARRAY----- Array byte 00h,10h,20h,30h .code Mov al,dval ;error Mov al, byte ptr dval ;al=78h Mov ax, dval ;error Mov ax, word ptr dval ;ax=5678h Mov eax ,array ;error Mov eax, dword ptr array ;eax=30201000h 78 56 34 12 00 10 20 30 40
  • 26. Free Powerpoint Templates DUP OPERATOR  USED: to generate multiple bytes or words with known as well as un-initialized values.  PURPOSE: to tell the assembler to duplicate or repeat the data definition directive a specific number of times.  EXAMPLE: var1 BYTE 20 DUP(0) ; 20 bytes of zero var2 BYTE 20 DUP(?) ; 20 bytes uninitialized var3 BYTE 10, 3DUP(0) , 20 ; 5 bytes 10,0,0,0,20  The (?) with the dup means that storage allocated by the directive is uninitialized or undefined.  The assembler allocates the space but does not write in it. Use ? for buffer areas or variables your program will initialize at run time.
  • 27. Free Powerpoint Templates SEG OPERATOR  The seg operator does two things : 1) Returns the address of the segment in which a specified variable or label is placed. 2) It converts the type of the specified expression from address to constant.  Coded As: seg variable/label  Example : MOV AX,SEG WORDA ; Get address of data seg MOV AX,SEG A10BEGIN ; Get address of code seg
  • 28. Free Powerpoint Templates INDEX OPERATOR  Add a constant to a register to generate an offset.  Allows to reference a members in an array.  Uses square brackets[ ] and acts like a plus(+) sign.  Two equivalent forms: – constant[ reg ] – [constant + reg ] EXAMPLE: part_tbl DB 25 DUP(?) ;Defined table MOV CL<PART_TBL[4] ;accessing 5th entry MOV DX,[BX] ; offset address in base reg DS:BX MOV[BX+SI+4],AX ;base+index+constant
  • 29. Free Powerpoint Templates The LENGTH operator returns the number of entries defined by a DUP operator. EXAMPLE : PART_TBL DW 10 DUP(?) MOV DX,LENGTH PART_TBL If the referenced operand does not contain a DUP entry, the operator returns the value 01. LENGTH OPERATOR
  • 30. Free Powerpoint Templates TYPE OPERATOR  The TYPE operator returns the number of bytes, according to the definition of the referenced variable.  CODED AS: TYPE variable/label DEFINITION NO. OF BYTES FOR NUMERIC VARIABLE DB/BYTE 1 DW/WORD 2 DD/DWORD 4 DF/FWORD 8 DT/TWORD 10 STRUC/STRUCT No> of bytes defined by structure NEAR label FFFFH FAR label FFFFH
  • 31. Free Powerpoint Templates SIZE OPERATOR  Returns the number of bytes taken up by a structure  Basically, LENGTH * TYPE  Coded As: SIZE variable  Example : BYTEA DB? ;Define one byte PART_TBL DW 10 DUP(?) ;Define 10 words MOV AX,TYPE BYTEA ;AX=0001H MOV AX,TYPE PART_TBL ;AX=0002H MOV CX,LENGTH PART_TBL ;CX=000AH(10) MOV DX,SIZE PART_TBL ;DX=0014H(20)
  • 33. Free Powerpoint Templates Execution of an Assembly Lang. Program Assembling Linking Execution Includes following steps:
  • 34. Free Powerpoint Templates ASSEMBLING, LINKING AND EXECUTING SOURCE CODE: The symbolic instructions that we code in assembly language. OBJECT CODE: We use an assembler program to translate the source program into machine code. EXECUTABLE MODULE: Finally, using a linker, execution of object code.
  • 36. Free Powerpoint Templates EDITING A PROGRAM After writing our program we will save it with .ASM extension. Although spacing is not important to the assembler, but a program is more readable if we keep data properly aligned. For this we can use any editor or word processing program that produces a standard unformatted ASCII file.
  • 37. Free Powerpoint Templates ASSEMBLING SOURCE PROGRAM Assembler converts source statements into machine code and displays error messages on the screen if any. Typical errors include a name that violates naming conventions, an operation i.e. spelled incorrectly. Optional output files from the assembly step are OBJECT(.OBJ), LISTING(.LST) and CROSS REFERNCE(.CRF or .SBR).
  • 38. Free Powerpoint Templates LINKING AN OBJECT PROGRAM When our program is free from errors next step is to link the object module produced by the assembler and that contains only machine code. Linker combines, if requested, more than one separately assembled module into one executable program. Generates an .EXE module and initializes it with special instructions to facilitate its subsequent loading for execution. Output files from this step are EXECUTABLE(.EX E), MAP(.MAP) and LIBRARY(.LIB)
  • 39. Free Powerpoint Templates EXECUTING A PROGRAM • Having assembled and linked a program, we can now execute it . • If the .EXE file is in the default drive, you could ask the loader to read it into memory for execution by typing • C:TASMBIN>PROG.EXE
  • 40. Free Powerpoint Templates STEPS TO CREATE AND RUN A PROGRAM Write the source code in a notepad file. Save it in tasmbin with .asm extension. Now , go to DOS prompt. Set the path to tasmbin. Write tlink filename.asm to link the file. Type filename to run the program. Give the required input.

Editor's Notes

  1. Name : refers to address of data item e.g. : COUNTER DB 0 which tells that whenever COUNTER word strikes, memory will “define Byte” with initial value 0 Label: refers to address of instruction, procedure, or segment e.g. : B30: ADD BL,25
  2. MOV : Internally, it cannot transfer data directly b/w source and destination that both resides in external memory. Ask mam that how it operates.
  3. Write down operations from other ppts