SlideShare a Scribd company logo
1 of 20
1
2
A FEW BASICA FEW BASIC
INSTRUCTIONSINSTRUCTIONS
Presented By
Contents
There are over a hundred instructions in
the instruction set for the 8086 CPU.
Here we discuss 7 of the most useful
instructions for transferring data and
doing arithmetic.
The discussed instructions are……..
MOV,XCHG,ADD,SUB,INC,DEC,NEG.
5
IntroductionIntroduction
MOVMOV
 Transfer data
◦ Between registers
◦ Between register and a memory location
◦ Move a no. directly to a register or a
memory location
 Syntax
MOV destination, source
 Example
MOV AX, WORD1
6
How?
XCHG
 Exchange the contents of
◦ Two registers
◦ Register and a memory location
 Syntax
XCHG destination, source
 Example
XCHG AH, BL
7
AL
BL
00 1A
05 00
AH AL
BH BL
How?
Legal Combinations of Operands forLegal Combinations of Operands for
MOV And XCHGMOV And XCHG
Destina
tion
Operan
d
Source
Opera
nd
Legal
General
Register
General
Register
YES
General
Register
Memory
Locatio
n
YES
Memory
Location
General
Register
YES
Memory
Location
Memory
Locatio
n
NO
Destination
Operand
Source
Operand
Legal
General
Register
General
Register
YES
General
Register
Memory
Location
YES
General
Register
Segment
Register
YES
General
Register
Constant YES
Memory
Location
General
Register
YES
Memory
Location
Memory
Location
NO
Memory
Location
Segment
Register
YES
Memory Constant YES
MOV
XCHG
ADD InstructionADD Instruction
To add contents of:
◦ Two registers
◦ A register and a memory location
◦ A number to a register
◦ A number to a memory location
Example
ADD WORD1, AX
9
How?
SUB InstructionSUB Instruction
To subtract the contents of:
◦ Two registers
◦ A register and a memory location
◦ A number from a register
◦ A number from a memory location
 Example
SUB AX, DX
10
How?
Legal Combinations of Operands forLegal Combinations of Operands for
ADD & SUB instructionsADD & SUB instructions
11
Destination Operand Source Operand Legal
General Register General Register YES
General Register Memory Location YES
General Register Constant YES
Memory Location General Register YES
Memory Location Memory Location NO
Memory Location Constant YES
INC & DECINC & DEC
 INC (increment) instruction is used to add 1 to
the contents of a register or memory location.
◦ Syntax: INC destination
◦ Example: INC WORD1
 DEC (decrement) instruction is used to subtract 1
from the contents of a register or memory
location.
◦ Syntax: DEC destination
◦ Example: DEC BYTE1
12
Destination can be 8-bit or 16-bits wide.
Destination can be a register or a memory
location.
13
INC WORD1
DEC BYTE1
INC & DECINC & DEC
How?
How?
NEGNEG
 Used to negate the contents of destination.
 Replace the contents by its 2’s complement.
 Syntax:
NEG destination
 Example:
NEG BX
14How?
ExamplesExamples
 Consider instructions: MOV, ADD, SUB,
INC, DEC, NEG
 A and B are two word variables
 Translate statements into assembly language:
15
Statement Translation
A =-( A+1)
MOV AX,A
INC AX
NEG AX
MOV A,AX
B= 3B-7
MOV AX,B
ADD AX,B
ADD AX,B
SUB AX,7
MOV B,AX
Example:1
Example:2
Statem
ent
Translation
A = B –
A-1
MOV AX,B
SUB AX,A
DEC AX
MOV A,AX
Example:3
16
ApplicationApplication
.data
msg1 DB 'Input Any number From
1 To 9:$' ; Data segment
msg2 DB 'The Series Summation
Is:$'
.code
main proc
mov AX,@DATA ; Data
segment
mov DS,AX
lea dx,msg1 ;showing
msg1
mov ah,9
int 21h
mov ah,1 ;taking input
int 21h
xor ah,ah
sub al,30h
XOR CX,CX ;loop same as
input
mov cx,ax
XOR bx,bx
## A series
summation
of n numbers
where
1<=n<=9
17
sub bx,0Ah
add ax,1 ;counter=ax=3
CMP bx ,39h ;bx<39h
JL DISPLAY
sub bx,0Ah
add ax,1 ;counter=ax=4
CMP bx ,39h ;bx<39h
JL DISPLAY
DISPLAY:
add al,30h
mov cl,al
lea dx,msg2 ;showing msg2
mov ah,9
int 21h
mov ah,2
mov dl,cl
int 21h
mov dl,bl
int 21h
ApplicationApplication
TOP:
add bx,cx ;adding
LOOP TOP
mov ah,2
mov dl,0Dh
int 21h ;printing new
line
mov dl,0Ah
int 21h
xor ax,ax
add bx,30h
CMP bx ,39h ;bx<39h
JL DISPLAY
sub bx,0Ah
add ax,1 ;counter=ax=1
CMP bx ,39h ;bx<39h
JL DISPLAY
sub bx,0Ah
add ax,1 ;counter=ax=2
CMP bx ,39h ;bx<39h
JL DISPLAY
18
? ?
<
Assembly

More Related Content

What's hot

1327 Addressing Modes Of 8086
1327 Addressing Modes Of 80861327 Addressing Modes Of 8086
1327 Addressing Modes Of 8086techbed
 
Instruction set of 8086
Instruction set of 8086Instruction set of 8086
Instruction set of 80869840596838
 
Backus Naur and Chomsky Normal Forms
Backus Naur and Chomsky Normal FormsBackus Naur and Chomsky Normal Forms
Backus Naur and Chomsky Normal FormsAshutosh Pandey
 
8086 assembly language
8086 assembly language8086 assembly language
8086 assembly languageMir Majid
 
Unit 3 – assembly language programming
Unit 3 – assembly language programmingUnit 3 – assembly language programming
Unit 3 – assembly language programmingKartik Sharma
 
10 8086 instruction set
10 8086 instruction set10 8086 instruction set
10 8086 instruction setShivam Singhal
 
8086 arch instns
8086 arch instns8086 arch instns
8086 arch instnsRam Babu
 
Pack/Unpack: manipulate binary data
Pack/Unpack: manipulate binary dataPack/Unpack: manipulate binary data
Pack/Unpack: manipulate binary dataLambert Lum
 
Instruction Set of 8086 Microprocessor
Instruction Set of 8086 MicroprocessorInstruction Set of 8086 Microprocessor
Instruction Set of 8086 MicroprocessorAshita Agrawal
 
Instructionset8085
Instructionset8085Instructionset8085
Instructionset8085Fawad Pathan
 
Instruction set of 8086
Instruction set of 8086Instruction set of 8086
Instruction set of 8086aviban
 
Unit 2 assembly language programming
Unit 2   assembly language programmingUnit 2   assembly language programming
Unit 2 assembly language programmingKartik Sharma
 
Fixed Field Values By Horizon Name
Fixed Field Values By Horizon NameFixed Field Values By Horizon Name
Fixed Field Values By Horizon NameLowell Ashley
 
instruction set of 8086
instruction set of 8086instruction set of 8086
instruction set of 8086muneer.k
 
Instruction set of 8086
Instruction set of 8086Instruction set of 8086
Instruction set of 8086Akhila Rahul
 

What's hot (20)

1327 Addressing Modes Of 8086
1327 Addressing Modes Of 80861327 Addressing Modes Of 8086
1327 Addressing Modes Of 8086
 
Instruction set of 8086
Instruction set of 8086Instruction set of 8086
Instruction set of 8086
 
Assembly Language -I
Assembly Language -IAssembly Language -I
Assembly Language -I
 
Backus Naur and Chomsky Normal Forms
Backus Naur and Chomsky Normal FormsBackus Naur and Chomsky Normal Forms
Backus Naur and Chomsky Normal Forms
 
8086 assembly language
8086 assembly language8086 assembly language
8086 assembly language
 
Unit 3 – assembly language programming
Unit 3 – assembly language programmingUnit 3 – assembly language programming
Unit 3 – assembly language programming
 
10 8086 instruction set
10 8086 instruction set10 8086 instruction set
10 8086 instruction set
 
8086 arch instns
8086 arch instns8086 arch instns
8086 arch instns
 
8086 instruction set
8086 instruction set8086 instruction set
8086 instruction set
 
Pack/Unpack: manipulate binary data
Pack/Unpack: manipulate binary dataPack/Unpack: manipulate binary data
Pack/Unpack: manipulate binary data
 
Instruction Set of 8086 Microprocessor
Instruction Set of 8086 MicroprocessorInstruction Set of 8086 Microprocessor
Instruction Set of 8086 Microprocessor
 
8086 add mod
8086 add mod8086 add mod
8086 add mod
 
8086 instruction set
8086 instruction set8086 instruction set
8086 instruction set
 
Instructionset8085
Instructionset8085Instructionset8085
Instructionset8085
 
Instruction set of 8086
Instruction set of 8086Instruction set of 8086
Instruction set of 8086
 
Unit 2 assembly language programming
Unit 2   assembly language programmingUnit 2   assembly language programming
Unit 2 assembly language programming
 
Fixed Field Values By Horizon Name
Fixed Field Values By Horizon NameFixed Field Values By Horizon Name
Fixed Field Values By Horizon Name
 
instruction set of 8086
instruction set of 8086instruction set of 8086
instruction set of 8086
 
Instruction set of 8086
Instruction set of 8086Instruction set of 8086
Instruction set of 8086
 
8085 is details
8085 is details8085 is details
8085 is details
 

Viewers also liked

Assembly Language Lecture 2
Assembly Language Lecture 2Assembly Language Lecture 2
Assembly Language Lecture 2Motaz Saad
 
ข้อสอบการงานอาชีพและเทคโนโลยี O-net ม.6
ข้อสอบการงานอาชีพและเทคโนโลยี O-net ม.6ข้อสอบการงานอาชีพและเทคโนโลยี O-net ม.6
ข้อสอบการงานอาชีพและเทคโนโลยี O-net ม.6Thanawat Boontan
 
Sweet spot
Sweet spotSweet spot
Sweet spott7260678
 
Cat p5 diary power point
Cat p5 diary power pointCat p5 diary power point
Cat p5 diary power pointTLeeTSIS
 
Enhancing employability through enterprise education - Maureen Tibby
Enhancing employability through enterprise education - Maureen TibbyEnhancing employability through enterprise education - Maureen Tibby
Enhancing employability through enterprise education - Maureen TibbyHEA_AH
 
World Usability Day 2014 - David Lai — Stakeholders!
World Usability Day 2014 - David Lai — Stakeholders!World Usability Day 2014 - David Lai — Stakeholders!
World Usability Day 2014 - David Lai — Stakeholders!UXPALA
 
Effecive Project Management Leadership as a Project Success
Effecive Project Management Leadership as a Project SuccessEffecive Project Management Leadership as a Project Success
Effecive Project Management Leadership as a Project SuccessSam muwanei
 
Engagement through partnership: students as partners in learning and teaching...
Engagement through partnership: students as partners in learning and teaching...Engagement through partnership: students as partners in learning and teaching...
Engagement through partnership: students as partners in learning and teaching...HEA_AH
 
Zasięg blogosfery w Polsce
Zasięg blogosfery w PolsceZasięg blogosfery w Polsce
Zasięg blogosfery w Polsceblogifirmowe.com
 
ANC 1C presentation-Kalorama Park Plaza-Dec 3 2014
ANC 1C presentation-Kalorama Park Plaza-Dec 3 2014ANC 1C presentation-Kalorama Park Plaza-Dec 3 2014
ANC 1C presentation-Kalorama Park Plaza-Dec 3 2014Cynthia Pols
 
Nandan’s Diary - 18 November 2014
Nandan’s Diary - 18 November 2014Nandan’s Diary - 18 November 2014
Nandan’s Diary - 18 November 2014TLeeTSIS
 
Storyboard First Draft
Storyboard First DraftStoryboard First Draft
Storyboard First Draftkatyevans25
 
ข้อสอบการงานอาชีพและเทคโนโลยี O-net ม.6
ข้อสอบการงานอาชีพและเทคโนโลยี O-net ม.6ข้อสอบการงานอาชีพและเทคโนโลยี O-net ม.6
ข้อสอบการงานอาชีพและเทคโนโลยี O-net ม.6Thanawat Boontan
 

Viewers also liked (19)

Assembly Language Lecture 2
Assembly Language Lecture 2Assembly Language Lecture 2
Assembly Language Lecture 2
 
ข้อสอบการงานอาชีพและเทคโนโลยี O-net ม.6
ข้อสอบการงานอาชีพและเทคโนโลยี O-net ม.6ข้อสอบการงานอาชีพและเทคโนโลยี O-net ม.6
ข้อสอบการงานอาชีพและเทคโนโลยี O-net ม.6
 
DP UMROH 3,5 JT
DP UMROH 3,5 JTDP UMROH 3,5 JT
DP UMROH 3,5 JT
 
Sweet spot
Sweet spotSweet spot
Sweet spot
 
Cat p5 diary power point
Cat p5 diary power pointCat p5 diary power point
Cat p5 diary power point
 
Enhancing employability through enterprise education - Maureen Tibby
Enhancing employability through enterprise education - Maureen TibbyEnhancing employability through enterprise education - Maureen Tibby
Enhancing employability through enterprise education - Maureen Tibby
 
World Usability Day 2014 - David Lai — Stakeholders!
World Usability Day 2014 - David Lai — Stakeholders!World Usability Day 2014 - David Lai — Stakeholders!
World Usability Day 2014 - David Lai — Stakeholders!
 
EFFECT OF ILLUMINATION INTENSITY ON THE PERFORMANCE OF PHOTOELECTRO CHEMICAL ...
EFFECT OF ILLUMINATION INTENSITY ON THE PERFORMANCE OF PHOTOELECTRO CHEMICAL ...EFFECT OF ILLUMINATION INTENSITY ON THE PERFORMANCE OF PHOTOELECTRO CHEMICAL ...
EFFECT OF ILLUMINATION INTENSITY ON THE PERFORMANCE OF PHOTOELECTRO CHEMICAL ...
 
Effecive Project Management Leadership as a Project Success
Effecive Project Management Leadership as a Project SuccessEffecive Project Management Leadership as a Project Success
Effecive Project Management Leadership as a Project Success
 
лямблиоз
лямблиозлямблиоз
лямблиоз
 
вгв+д
вгв+двгв+д
вгв+д
 
Engagement through partnership: students as partners in learning and teaching...
Engagement through partnership: students as partners in learning and teaching...Engagement through partnership: students as partners in learning and teaching...
Engagement through partnership: students as partners in learning and teaching...
 
Zasięg blogosfery w Polsce
Zasięg blogosfery w PolsceZasięg blogosfery w Polsce
Zasięg blogosfery w Polsce
 
MUET
MUETMUET
MUET
 
ANC 1C presentation-Kalorama Park Plaza-Dec 3 2014
ANC 1C presentation-Kalorama Park Plaza-Dec 3 2014ANC 1C presentation-Kalorama Park Plaza-Dec 3 2014
ANC 1C presentation-Kalorama Park Plaza-Dec 3 2014
 
Nandan’s Diary - 18 November 2014
Nandan’s Diary - 18 November 2014Nandan’s Diary - 18 November 2014
Nandan’s Diary - 18 November 2014
 
Storyboard First Draft
Storyboard First DraftStoryboard First Draft
Storyboard First Draft
 
ข้อสอบการงานอาชีพและเทคโนโลยี O-net ม.6
ข้อสอบการงานอาชีพและเทคโนโลยี O-net ม.6ข้อสอบการงานอาชีพและเทคโนโลยี O-net ม.6
ข้อสอบการงานอาชีพและเทคโนโลยี O-net ม.6
 
RMCN Credentials
RMCN CredentialsRMCN Credentials
RMCN Credentials
 

Similar to Assembly

Assembly Language Basics
Assembly Language BasicsAssembly Language Basics
Assembly Language BasicsEducation Front
 
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
 
4. Instruction Set Of MP 8085.pptx
4. Instruction Set Of MP 8085.pptx4. Instruction Set Of MP 8085.pptx
4. Instruction Set Of MP 8085.pptxISMT College
 
Types of instruction in 8085 microprocessor
Types of instruction in 8085 microprocessorTypes of instruction in 8085 microprocessor
Types of instruction in 8085 microprocessorsamarthpawar9890
 
instruction-set-of-8085 (1).ppt
instruction-set-of-8085 (1).pptinstruction-set-of-8085 (1).ppt
instruction-set-of-8085 (1).pptssuserb448e2
 
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.pdfAnonymous611358
 
itft-Instruction set-of-8085
itft-Instruction set-of-8085itft-Instruction set-of-8085
itft-Instruction set-of-8085Shifali Sharma
 
Instruction set-of-8085
Instruction set-of-8085Instruction set-of-8085
Instruction set-of-8085saleForce
 
Microprocessor system - summarize
Microprocessor system - summarizeMicroprocessor system - summarize
Microprocessor system - summarizeHisham Mat Hussin
 
Chap 3_2.ppt
Chap 3_2.pptChap 3_2.ppt
Chap 3_2.pptinian2
 
Https _doc-0o-c4-apps-viewer.googleusercontent
Https  _doc-0o-c4-apps-viewer.googleusercontent Https  _doc-0o-c4-apps-viewer.googleusercontent
Https _doc-0o-c4-apps-viewer.googleusercontent vijaydeepakg
 
8051 instruction set
8051 instruction set8051 instruction set
8051 instruction setStefan Oprea
 
8085 DATA TRANSFER INSTRUCTIONS
8085 DATA TRANSFER INSTRUCTIONS8085 DATA TRANSFER INSTRUCTIONS
8085 DATA TRANSFER INSTRUCTIONSRamaPrabha24
 
Introduction to Assembly Language & various basic things
Introduction to Assembly Language & various basic thingsIntroduction to Assembly Language & various basic things
Introduction to Assembly Language & various basic thingsishitasabrincse
 

Similar to Assembly (20)

Assembly Language Basics
Assembly Language BasicsAssembly Language Basics
Assembly Language Basics
 
Assembly Language Programming By Ytha Yu, Charles Marut Chap 4 (Introduction ...
Assembly Language Programming By Ytha Yu, Charles Marut Chap 4 (Introduction ...Assembly Language Programming By Ytha Yu, Charles Marut Chap 4 (Introduction ...
Assembly Language Programming By Ytha Yu, Charles Marut Chap 4 (Introduction ...
 
Instruction set of 8085
Instruction set of 8085Instruction set of 8085
Instruction set of 8085
 
4. Instruction Set Of MP 8085.pptx
4. Instruction Set Of MP 8085.pptx4. Instruction Set Of MP 8085.pptx
4. Instruction Set Of MP 8085.pptx
 
8085 Instructions.pdf
8085 Instructions.pdf8085 Instructions.pdf
8085 Instructions.pdf
 
Lecture5
Lecture5Lecture5
Lecture5
 
Lecture5(1)
Lecture5(1)Lecture5(1)
Lecture5(1)
 
Types of instruction in 8085 microprocessor
Types of instruction in 8085 microprocessorTypes of instruction in 8085 microprocessor
Types of instruction in 8085 microprocessor
 
instruction-set-of-8085 (1).ppt
instruction-set-of-8085 (1).pptinstruction-set-of-8085 (1).ppt
instruction-set-of-8085 (1).ppt
 
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
 
itft-Instruction set-of-8085
itft-Instruction set-of-8085itft-Instruction set-of-8085
itft-Instruction set-of-8085
 
Instruction set-of-8085
Instruction set-of-8085Instruction set-of-8085
Instruction set-of-8085
 
Microprocessor system - summarize
Microprocessor system - summarizeMicroprocessor system - summarize
Microprocessor system - summarize
 
Chap 3_2.ppt
Chap 3_2.pptChap 3_2.ppt
Chap 3_2.ppt
 
Coal (1)
Coal (1)Coal (1)
Coal (1)
 
Https _doc-0o-c4-apps-viewer.googleusercontent
Https  _doc-0o-c4-apps-viewer.googleusercontent Https  _doc-0o-c4-apps-viewer.googleusercontent
Https _doc-0o-c4-apps-viewer.googleusercontent
 
8051 instruction set
8051 instruction set8051 instruction set
8051 instruction set
 
8085 DATA TRANSFER INSTRUCTIONS
8085 DATA TRANSFER INSTRUCTIONS8085 DATA TRANSFER INSTRUCTIONS
8085 DATA TRANSFER INSTRUCTIONS
 
Introduction to Assembly Language & various basic things
Introduction to Assembly Language & various basic thingsIntroduction to Assembly Language & various basic things
Introduction to Assembly Language & various basic things
 
8085 instruction set
8085 instruction set8085 instruction set
8085 instruction set
 

More from Umme habiba

Compiler lab final report writing
Compiler lab final report writingCompiler lab final report writing
Compiler lab final report writingUmme habiba
 
online bus ticket booking system
online bus ticket booking systemonline bus ticket booking system
online bus ticket booking systemUmme habiba
 
online bus ticket booking system
online bus ticket booking systemonline bus ticket booking system
online bus ticket booking systemUmme habiba
 
online bus ticket booking system
online bus ticket booking systemonline bus ticket booking system
online bus ticket booking systemUmme habiba
 
Accounting adjusting
Accounting adjustingAccounting adjusting
Accounting adjustingUmme habiba
 
Economic.assignment
Economic.assignmentEconomic.assignment
Economic.assignmentUmme habiba
 
Major economic problems of bangladesh
Major economic problems of bangladeshMajor economic problems of bangladesh
Major economic problems of bangladeshUmme habiba
 
Overview of various types of operating system
Overview of various types of operating systemOverview of various types of operating system
Overview of various types of operating systemUmme habiba
 
Os lab report(shell coding)
Os lab report(shell coding)Os lab report(shell coding)
Os lab report(shell coding)Umme habiba
 
Ecommerce(online Shopping)
Ecommerce(online Shopping)Ecommerce(online Shopping)
Ecommerce(online Shopping)Umme habiba
 
Different types of Addressing.cao
Different types of Addressing.caoDifferent types of Addressing.cao
Different types of Addressing.caoUmme habiba
 
2nd generation of computer
2nd generation of computer2nd generation of computer
2nd generation of computerUmme habiba
 
Art_of_living assignment
Art_of_living assignmentArt_of_living assignment
Art_of_living assignmentUmme habiba
 
Informationsecurity
InformationsecurityInformationsecurity
InformationsecurityUmme habiba
 
SQL Joinning.Database
SQL Joinning.DatabaseSQL Joinning.Database
SQL Joinning.DatabaseUmme habiba
 
WLAN of networking.ppt
WLAN of networking.pptWLAN of networking.ppt
WLAN of networking.pptUmme habiba
 
simpson's in numerical method
simpson's in numerical methodsimpson's in numerical method
simpson's in numerical methodUmme habiba
 
Error detection in Data comunication
 Error detection in Data comunication Error detection in Data comunication
Error detection in Data comunicationUmme habiba
 
microsoft word & powerpoint
 microsoft word & powerpoint microsoft word & powerpoint
microsoft word & powerpointUmme habiba
 

More from Umme habiba (20)

Compiler lab final report writing
Compiler lab final report writingCompiler lab final report writing
Compiler lab final report writing
 
online bus ticket booking system
online bus ticket booking systemonline bus ticket booking system
online bus ticket booking system
 
online bus ticket booking system
online bus ticket booking systemonline bus ticket booking system
online bus ticket booking system
 
online bus ticket booking system
online bus ticket booking systemonline bus ticket booking system
online bus ticket booking system
 
Accounting adjusting
Accounting adjustingAccounting adjusting
Accounting adjusting
 
Economic.assignment
Economic.assignmentEconomic.assignment
Economic.assignment
 
Major economic problems of bangladesh
Major economic problems of bangladeshMajor economic problems of bangladesh
Major economic problems of bangladesh
 
Overview of various types of operating system
Overview of various types of operating systemOverview of various types of operating system
Overview of various types of operating system
 
Os lab report(shell coding)
Os lab report(shell coding)Os lab report(shell coding)
Os lab report(shell coding)
 
Ecommerce(online Shopping)
Ecommerce(online Shopping)Ecommerce(online Shopping)
Ecommerce(online Shopping)
 
Different types of Addressing.cao
Different types of Addressing.caoDifferent types of Addressing.cao
Different types of Addressing.cao
 
2nd generation of computer
2nd generation of computer2nd generation of computer
2nd generation of computer
 
Art_of_living assignment
Art_of_living assignmentArt_of_living assignment
Art_of_living assignment
 
Art_of_living
Art_of_livingArt_of_living
Art_of_living
 
Informationsecurity
InformationsecurityInformationsecurity
Informationsecurity
 
SQL Joinning.Database
SQL Joinning.DatabaseSQL Joinning.Database
SQL Joinning.Database
 
WLAN of networking.ppt
WLAN of networking.pptWLAN of networking.ppt
WLAN of networking.ppt
 
simpson's in numerical method
simpson's in numerical methodsimpson's in numerical method
simpson's in numerical method
 
Error detection in Data comunication
 Error detection in Data comunication Error detection in Data comunication
Error detection in Data comunication
 
microsoft word & powerpoint
 microsoft word & powerpoint microsoft word & powerpoint
microsoft word & powerpoint
 

Recently uploaded

Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptxDecoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptxJoão Esperancinha
 
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...Soham Mondal
 
complete construction, environmental and economics information of biomass com...
complete construction, environmental and economics information of biomass com...complete construction, environmental and economics information of biomass com...
complete construction, environmental and economics information of biomass com...asadnawaz62
 
Heart Disease Prediction using machine learning.pptx
Heart Disease Prediction using machine learning.pptxHeart Disease Prediction using machine learning.pptx
Heart Disease Prediction using machine learning.pptxPoojaBan
 
Current Transformer Drawing and GTP for MSETCL
Current Transformer Drawing and GTP for MSETCLCurrent Transformer Drawing and GTP for MSETCL
Current Transformer Drawing and GTP for MSETCLDeelipZope
 
Call Girls Narol 7397865700 Independent Call Girls
Call Girls Narol 7397865700 Independent Call GirlsCall Girls Narol 7397865700 Independent Call Girls
Call Girls Narol 7397865700 Independent Call Girlsssuser7cb4ff
 
SPICE PARK APR2024 ( 6,793 SPICE Models )
SPICE PARK APR2024 ( 6,793 SPICE Models )SPICE PARK APR2024 ( 6,793 SPICE Models )
SPICE PARK APR2024 ( 6,793 SPICE Models )Tsuyoshi Horigome
 
chaitra-1.pptx fake news detection using machine learning
chaitra-1.pptx  fake news detection using machine learningchaitra-1.pptx  fake news detection using machine learning
chaitra-1.pptx fake news detection using machine learningmisbanausheenparvam
 
GDSC ASEB Gen AI study jams presentation
GDSC ASEB Gen AI study jams presentationGDSC ASEB Gen AI study jams presentation
GDSC ASEB Gen AI study jams presentationGDSCAESB
 
Biology for Computer Engineers Course Handout.pptx
Biology for Computer Engineers Course Handout.pptxBiology for Computer Engineers Course Handout.pptx
Biology for Computer Engineers Course Handout.pptxDeepakSakkari2
 
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdf
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdfCCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdf
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdfAsst.prof M.Gokilavani
 
Sachpazis Costas: Geotechnical Engineering: A student's Perspective Introduction
Sachpazis Costas: Geotechnical Engineering: A student's Perspective IntroductionSachpazis Costas: Geotechnical Engineering: A student's Perspective Introduction
Sachpazis Costas: Geotechnical Engineering: A student's Perspective IntroductionDr.Costas Sachpazis
 
Electronically Controlled suspensions system .pdf
Electronically Controlled suspensions system .pdfElectronically Controlled suspensions system .pdf
Electronically Controlled suspensions system .pdfme23b1001
 
Call Girls Delhi {Jodhpur} 9711199012 high profile service
Call Girls Delhi {Jodhpur} 9711199012 high profile serviceCall Girls Delhi {Jodhpur} 9711199012 high profile service
Call Girls Delhi {Jodhpur} 9711199012 high profile servicerehmti665
 
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube Exchanger
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube ExchangerStudy on Air-Water & Water-Water Heat Exchange in a Finned Tube Exchanger
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube ExchangerAnamika Sarkar
 
Concrete Mix Design - IS 10262-2019 - .pptx
Concrete Mix Design - IS 10262-2019 - .pptxConcrete Mix Design - IS 10262-2019 - .pptx
Concrete Mix Design - IS 10262-2019 - .pptxKartikeyaDwivedi3
 

Recently uploaded (20)

Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptxDecoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
 
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
 
complete construction, environmental and economics information of biomass com...
complete construction, environmental and economics information of biomass com...complete construction, environmental and economics information of biomass com...
complete construction, environmental and economics information of biomass com...
 
9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf
9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf
9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf
 
Heart Disease Prediction using machine learning.pptx
Heart Disease Prediction using machine learning.pptxHeart Disease Prediction using machine learning.pptx
Heart Disease Prediction using machine learning.pptx
 
Current Transformer Drawing and GTP for MSETCL
Current Transformer Drawing and GTP for MSETCLCurrent Transformer Drawing and GTP for MSETCL
Current Transformer Drawing and GTP for MSETCL
 
Call Girls Narol 7397865700 Independent Call Girls
Call Girls Narol 7397865700 Independent Call GirlsCall Girls Narol 7397865700 Independent Call Girls
Call Girls Narol 7397865700 Independent Call Girls
 
SPICE PARK APR2024 ( 6,793 SPICE Models )
SPICE PARK APR2024 ( 6,793 SPICE Models )SPICE PARK APR2024 ( 6,793 SPICE Models )
SPICE PARK APR2024 ( 6,793 SPICE Models )
 
chaitra-1.pptx fake news detection using machine learning
chaitra-1.pptx  fake news detection using machine learningchaitra-1.pptx  fake news detection using machine learning
chaitra-1.pptx fake news detection using machine learning
 
GDSC ASEB Gen AI study jams presentation
GDSC ASEB Gen AI study jams presentationGDSC ASEB Gen AI study jams presentation
GDSC ASEB Gen AI study jams presentation
 
Biology for Computer Engineers Course Handout.pptx
Biology for Computer Engineers Course Handout.pptxBiology for Computer Engineers Course Handout.pptx
Biology for Computer Engineers Course Handout.pptx
 
🔝9953056974🔝!!-YOUNG call girls in Rajendra Nagar Escort rvice Shot 2000 nigh...
🔝9953056974🔝!!-YOUNG call girls in Rajendra Nagar Escort rvice Shot 2000 nigh...🔝9953056974🔝!!-YOUNG call girls in Rajendra Nagar Escort rvice Shot 2000 nigh...
🔝9953056974🔝!!-YOUNG call girls in Rajendra Nagar Escort rvice Shot 2000 nigh...
 
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdf
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdfCCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdf
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdf
 
Exploring_Network_Security_with_JA3_by_Rakesh Seal.pptx
Exploring_Network_Security_with_JA3_by_Rakesh Seal.pptxExploring_Network_Security_with_JA3_by_Rakesh Seal.pptx
Exploring_Network_Security_with_JA3_by_Rakesh Seal.pptx
 
young call girls in Green Park🔝 9953056974 🔝 escort Service
young call girls in Green Park🔝 9953056974 🔝 escort Serviceyoung call girls in Green Park🔝 9953056974 🔝 escort Service
young call girls in Green Park🔝 9953056974 🔝 escort Service
 
Sachpazis Costas: Geotechnical Engineering: A student's Perspective Introduction
Sachpazis Costas: Geotechnical Engineering: A student's Perspective IntroductionSachpazis Costas: Geotechnical Engineering: A student's Perspective Introduction
Sachpazis Costas: Geotechnical Engineering: A student's Perspective Introduction
 
Electronically Controlled suspensions system .pdf
Electronically Controlled suspensions system .pdfElectronically Controlled suspensions system .pdf
Electronically Controlled suspensions system .pdf
 
Call Girls Delhi {Jodhpur} 9711199012 high profile service
Call Girls Delhi {Jodhpur} 9711199012 high profile serviceCall Girls Delhi {Jodhpur} 9711199012 high profile service
Call Girls Delhi {Jodhpur} 9711199012 high profile service
 
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube Exchanger
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube ExchangerStudy on Air-Water & Water-Water Heat Exchange in a Finned Tube Exchanger
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube Exchanger
 
Concrete Mix Design - IS 10262-2019 - .pptx
Concrete Mix Design - IS 10262-2019 - .pptxConcrete Mix Design - IS 10262-2019 - .pptx
Concrete Mix Design - IS 10262-2019 - .pptx
 

Assembly

  • 1. 1
  • 2. 2 A FEW BASICA FEW BASIC INSTRUCTIONSINSTRUCTIONS
  • 5. There are over a hundred instructions in the instruction set for the 8086 CPU. Here we discuss 7 of the most useful instructions for transferring data and doing arithmetic. The discussed instructions are…….. MOV,XCHG,ADD,SUB,INC,DEC,NEG. 5 IntroductionIntroduction
  • 6. MOVMOV  Transfer data ◦ Between registers ◦ Between register and a memory location ◦ Move a no. directly to a register or a memory location  Syntax MOV destination, source  Example MOV AX, WORD1 6 How?
  • 7. XCHG  Exchange the contents of ◦ Two registers ◦ Register and a memory location  Syntax XCHG destination, source  Example XCHG AH, BL 7 AL BL 00 1A 05 00 AH AL BH BL How?
  • 8. Legal Combinations of Operands forLegal Combinations of Operands for MOV And XCHGMOV And XCHG Destina tion Operan d Source Opera nd Legal General Register General Register YES General Register Memory Locatio n YES Memory Location General Register YES Memory Location Memory Locatio n NO Destination Operand Source Operand Legal General Register General Register YES General Register Memory Location YES General Register Segment Register YES General Register Constant YES Memory Location General Register YES Memory Location Memory Location NO Memory Location Segment Register YES Memory Constant YES MOV XCHG
  • 9. ADD InstructionADD Instruction To add contents of: ◦ Two registers ◦ A register and a memory location ◦ A number to a register ◦ A number to a memory location Example ADD WORD1, AX 9 How?
  • 10. SUB InstructionSUB Instruction To subtract the contents of: ◦ Two registers ◦ A register and a memory location ◦ A number from a register ◦ A number from a memory location  Example SUB AX, DX 10 How?
  • 11. Legal Combinations of Operands forLegal Combinations of Operands for ADD & SUB instructionsADD & SUB instructions 11 Destination Operand Source Operand Legal General Register General Register YES General Register Memory Location YES General Register Constant YES Memory Location General Register YES Memory Location Memory Location NO Memory Location Constant YES
  • 12. INC & DECINC & DEC  INC (increment) instruction is used to add 1 to the contents of a register or memory location. ◦ Syntax: INC destination ◦ Example: INC WORD1  DEC (decrement) instruction is used to subtract 1 from the contents of a register or memory location. ◦ Syntax: DEC destination ◦ Example: DEC BYTE1 12 Destination can be 8-bit or 16-bits wide. Destination can be a register or a memory location.
  • 13. 13 INC WORD1 DEC BYTE1 INC & DECINC & DEC How? How?
  • 14. NEGNEG  Used to negate the contents of destination.  Replace the contents by its 2’s complement.  Syntax: NEG destination  Example: NEG BX 14How?
  • 15. ExamplesExamples  Consider instructions: MOV, ADD, SUB, INC, DEC, NEG  A and B are two word variables  Translate statements into assembly language: 15 Statement Translation A =-( A+1) MOV AX,A INC AX NEG AX MOV A,AX B= 3B-7 MOV AX,B ADD AX,B ADD AX,B SUB AX,7 MOV B,AX Example:1 Example:2 Statem ent Translation A = B – A-1 MOV AX,B SUB AX,A DEC AX MOV A,AX Example:3
  • 16. 16 ApplicationApplication .data msg1 DB 'Input Any number From 1 To 9:$' ; Data segment msg2 DB 'The Series Summation Is:$' .code main proc mov AX,@DATA ; Data segment mov DS,AX lea dx,msg1 ;showing msg1 mov ah,9 int 21h mov ah,1 ;taking input int 21h xor ah,ah sub al,30h XOR CX,CX ;loop same as input mov cx,ax XOR bx,bx ## A series summation of n numbers where 1<=n<=9
  • 17. 17 sub bx,0Ah add ax,1 ;counter=ax=3 CMP bx ,39h ;bx<39h JL DISPLAY sub bx,0Ah add ax,1 ;counter=ax=4 CMP bx ,39h ;bx<39h JL DISPLAY DISPLAY: add al,30h mov cl,al lea dx,msg2 ;showing msg2 mov ah,9 int 21h mov ah,2 mov dl,cl int 21h mov dl,bl int 21h ApplicationApplication TOP: add bx,cx ;adding LOOP TOP mov ah,2 mov dl,0Dh int 21h ;printing new line mov dl,0Ah int 21h xor ax,ax add bx,30h CMP bx ,39h ;bx<39h JL DISPLAY sub bx,0Ah add ax,1 ;counter=ax=1 CMP bx ,39h ;bx<39h JL DISPLAY sub bx,0Ah add ax,1 ;counter=ax=2 CMP bx ,39h ;bx<39h JL DISPLAY
  • 18. 18
  • 19. ? ? <

Editor's Notes

  1. Other e.g. XCHG AX, WORD1
  2. Source contents remain unchanged!