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

DOCX
8086 addressing modes
PPTX
Addressing Modes Of 8086
DOCX
Addressing modes of 8086
DOCX
Notes 8086 instruction format
PPTX
Logical Instructions used in 8086 microprocessor
PPTX
Instruction sets of 8086
PPTX
Assembly language (addition and subtraction)
PPT
Assembly Language Lecture 4
8086 addressing modes
Addressing Modes Of 8086
Addressing modes of 8086
Notes 8086 instruction format
Logical Instructions used in 8086 microprocessor
Instruction sets of 8086
Assembly language (addition and subtraction)
Assembly Language Lecture 4

What's hot (20)

PPT
1327 Addressing Modes Of 8086
PPTX
Instruction set of 8086
PPTX
Assembly Language -I
PPTX
Backus Naur and Chomsky Normal Forms
PPT
8086 assembly language
PDF
Unit 3 – assembly language programming
PPT
10 8086 instruction set
PPT
8086 arch instns
PDF
8086 instruction set
ODP
Pack/Unpack: manipulate binary data
PPTX
Instruction Set of 8086 Microprocessor
PPT
8086 add mod
PPTX
8086 instruction set
PDF
Instructionset8085
PPTX
Instruction set of 8086
PDF
Unit 2 assembly language programming
DOCX
Fixed Field Values By Horizon Name
PDF
instruction set of 8086
PDF
Instruction set of 8086
PDF
8085 is details
1327 Addressing Modes Of 8086
Instruction set of 8086
Assembly Language -I
Backus Naur and Chomsky Normal Forms
8086 assembly language
Unit 3 – assembly language programming
10 8086 instruction set
8086 arch instns
8086 instruction set
Pack/Unpack: manipulate binary data
Instruction Set of 8086 Microprocessor
8086 add mod
8086 instruction set
Instructionset8085
Instruction set of 8086
Unit 2 assembly language programming
Fixed Field Values By Horizon Name
instruction set of 8086
Instruction set of 8086
8085 is details
Ad

Viewers also liked (19)

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

Similar to Assembly (20)

PPT
Assembly Language Basics
PDF
Chapter 4 instruction set of 8086 microprocessor.pdf
PDF
Chapter 5 and 6 instructions and program control instructions.pdf
PPTX
Assembly Language Programming By Ytha Yu, Charles Marut Chap 4 (Introduction ...
PPT
Instruction set of 8085
PPTX
4. Instruction Set Of MP 8085.pptx
PDF
8085 Instructions.pdf
PDF
PDF
Lecture5(1)
PPTX
Types of instruction in 8085 microprocessor
PPT
instruction-set-of-8085 (1).ppt
PPT
An instruction is a binary pattern designed inside a microprocessor to perfor...
PPTX
MPMC PPT-INSTRUCTION SET, totally 76 instructions set explained
PPTX
instructionsetsofjdtufgmictfgfjh8086.pptx
PDF
Intel8086_Flags_Addr_Modes_sample_pgms.pdf
PDF
itft-Instruction set-of-8085
PPT
Instruction set-of-8085
PPTX
microprocesser Chapter three and foure.pptx
PPTX
MODULE- 3-CO-Instructions and Programs.pptx
PPT
Microprocessor system - summarize
Assembly Language Basics
Chapter 4 instruction set of 8086 microprocessor.pdf
Chapter 5 and 6 instructions and program control instructions.pdf
Assembly Language Programming By Ytha Yu, Charles Marut Chap 4 (Introduction ...
Instruction set of 8085
4. Instruction Set Of MP 8085.pptx
8085 Instructions.pdf
Lecture5(1)
Types of instruction in 8085 microprocessor
instruction-set-of-8085 (1).ppt
An instruction is a binary pattern designed inside a microprocessor to perfor...
MPMC PPT-INSTRUCTION SET, totally 76 instructions set explained
instructionsetsofjdtufgmictfgfjh8086.pptx
Intel8086_Flags_Addr_Modes_sample_pgms.pdf
itft-Instruction set-of-8085
Instruction set-of-8085
microprocesser Chapter three and foure.pptx
MODULE- 3-CO-Instructions and Programs.pptx
Microprocessor system - summarize

More from Umme habiba (20)

DOCX
Compiler lab final report writing
PPTX
online bus ticket booking system
PPTX
online bus ticket booking system
PPTX
online bus ticket booking system
PPT
Accounting adjusting
DOCX
Economic.assignment
DOCX
Major economic problems of bangladesh
PPT
Overview of various types of operating system
DOCX
Os lab report(shell coding)
PPTX
Ecommerce(online Shopping)
DOCX
Different types of Addressing.cao
PPTX
2nd generation of computer
DOCX
Art_of_living assignment
PPTX
Art_of_living
DOCX
Informationsecurity
PPT
SQL Joinning.Database
PPTX
WLAN of networking.ppt
PPTX
simpson's in numerical method
PPTX
Error detection in Data comunication
PPTX
microsoft word & powerpoint
Compiler lab final report writing
online bus ticket booking system
online bus ticket booking system
online bus ticket booking system
Accounting adjusting
Economic.assignment
Major economic problems of bangladesh
Overview of various types of operating system
Os lab report(shell coding)
Ecommerce(online Shopping)
Different types of Addressing.cao
2nd generation of computer
Art_of_living assignment
Art_of_living
Informationsecurity
SQL Joinning.Database
WLAN of networking.ppt
simpson's in numerical method
Error detection in Data comunication
microsoft word & powerpoint

Recently uploaded (20)

PDF
Applications of Equal_Area_Criterion.pdf
PDF
MLpara ingenieira CIVIL, meca Y AMBIENTAL
PDF
August 2025 - Top 10 Read Articles in Network Security & Its Applications
PPTX
Measurement Uncertainty and Measurement System analysis
PDF
Computer organization and architecuture Digital Notes....pdf
PPTX
A Brief Introduction to IoT- Smart Objects: The "Things" in IoT
PDF
UEFA_Carbon_Footprint_Calculator_Methology_2.0.pdf
PPTX
ASME PCC-02 TRAINING -DESKTOP-NLE5HNP.pptx
PPT
Chapter 1 - Introduction to Manufacturing Technology_2.ppt
PDF
LOW POWER CLASS AB SI POWER AMPLIFIER FOR WIRELESS MEDICAL SENSOR NETWORK
PPTX
"Array and Linked List in Data Structures with Types, Operations, Implementat...
PPTX
Feature types and data preprocessing steps
PDF
Computer System Architecture 3rd Edition-M Morris Mano.pdf
PDF
UEFA_Embodied_Carbon_Emissions_Football_Infrastructure.pdf
PDF
Design of Material Handling Equipment Lecture Note
PPTX
Information Storage and Retrieval Techniques Unit III
PPTX
PRASUNET_20240614003_231416_0000[1].pptx
PDF
Exploratory_Data_Analysis_Fundamentals.pdf
PDF
Soil Improvement Techniques Note - Rabbi
PDF
Unit1 - AIML Chapter 1 concept and ethics
Applications of Equal_Area_Criterion.pdf
MLpara ingenieira CIVIL, meca Y AMBIENTAL
August 2025 - Top 10 Read Articles in Network Security & Its Applications
Measurement Uncertainty and Measurement System analysis
Computer organization and architecuture Digital Notes....pdf
A Brief Introduction to IoT- Smart Objects: The "Things" in IoT
UEFA_Carbon_Footprint_Calculator_Methology_2.0.pdf
ASME PCC-02 TRAINING -DESKTOP-NLE5HNP.pptx
Chapter 1 - Introduction to Manufacturing Technology_2.ppt
LOW POWER CLASS AB SI POWER AMPLIFIER FOR WIRELESS MEDICAL SENSOR NETWORK
"Array and Linked List in Data Structures with Types, Operations, Implementat...
Feature types and data preprocessing steps
Computer System Architecture 3rd Edition-M Morris Mano.pdf
UEFA_Embodied_Carbon_Emissions_Football_Infrastructure.pdf
Design of Material Handling Equipment Lecture Note
Information Storage and Retrieval Techniques Unit III
PRASUNET_20240614003_231416_0000[1].pptx
Exploratory_Data_Analysis_Fundamentals.pdf
Soil Improvement Techniques Note - Rabbi
Unit1 - AIML Chapter 1 concept and ethics

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

  • #8: Other e.g. XCHG AX, WORD1
  • #10: Source contents remain unchanged!