SlideShare a Scribd company logo
1 of 15
Microprocessor And Assembly Language
Daffodil International University, Dhaka, Bangladesh
Presentation On Some Instruction Over Chapter 9
GROUP MEMBERS
2
Name ID
Shamol Chandra Bhowmik 152-15-6180
Tonmoy Chandra Dhar 152-15-6181
Shahin Ahmed 152-15-6197
Jakarea 152-15-6200
Moniruzzaman 152-15-6201
3
MUL instruction
• The MUL (unsigned multiply) instruction
multiplies an 8-, 16-, or 32-bit operand by
either AL, AX, or EAX.
• The instruction formats are:
MUL r/m8
MUL r/m16
MUL r/m32 Implied operands:
4
MUL examples
100h * 2000h, using 16-bit operands:
.data
val1 WORD 2000h
val2 WORD 100h
.code
mov ax,val1
mul val2 ; DX:AX=00200000h, CF=1
The Carry flag indicates
whether or not the upper
half of the product
contains significant digits.
mov eax,12345h
mov ebx,1000h
mul ebx ; EDX:EAX=0000000012345000h, CF=0
12345h * 1000h, using 32-bit operands:
5
IMUL instruction
• IMUL (signed integer multiply) multiplies an 8-,
16-, or 32-bit signed operand by either AL, AX,
or EAX (there are one/two/three operand
format)
• Preserves the sign of the product by sign-
extending it into the upper half of the
destination register
Example: multiply 48 * 4, using 8-bit operands:
mov al,48
mov bl,4
imul bl ; AX = 00C0h, OF=1
OF=1 because AH is not a sign extension of AL.
6
DIV instruction
• The DIV (unsigned divide) instruction performs
8-bit, 16-bit, and 32-bit division on unsigned
integers
• A single operand is supplied (register or
memory operand), which is assumed to be the
divisor
• Instruction formats:
DIV r/m8
DIV r/m16
DIV r/m32
Default Operands:
7
DIV examples
Divide 8003h by 100h, using 16-bit operands:
mov dx,0 ; clear dividend, high
mov ax,8003h ; dividend, low
mov cx,100h ; divisor
div cx ; AX = 0080h, DX = 3
Same division, using 32-bit operands:
mov edx,0 ; clear dividend, high
mov eax,8003h ; dividend, low
mov ecx,100h ; divisor
div ecx ; EAX=00000080h,EDX=3
8
Signed integer division
• Signed integers must be sign-extended before
division takes place
– fill high byte/word/doubleword with a copy of the
low byte/word/doubleword's sign bit
• For example, the high byte contains a copy of
the sign bit from the low byte:
9
CBW, CWD, CDQ instructions
• The CBW, CWD, and CDQ instructions
provide important sign-extension
operations:
– CBW (convert byte to word) extends AL into AH
– CWD (convert word to doubleword) extends AX into DX
– CDQ (convert doubleword to quadword) extends EAX
into EDX
• For example:
mov eax,0FFFFFF9Bh ; -101 (32 bits)
cdq ; EDX:EAX = FFFFFFFFFFFFFF9Bh
; -101 (64 bits)
10
IDIV instruction
• IDIV (signed divide) performs signed integer
division
• Uses same operands as DIV
Example: 8-bit division of –48 by 5
mov al,-48
cbw ; extend AL into AH
mov bl,5
idiv bl ; AL = -9, AH = -3
11
IDIV examples
Example: 32-bit division of –48 by 5
mov eax,-48
cdq ; extend EAX into EDX
mov ebx,5
idiv ebx ; EAX = -9, EDX = -3
Example: 16-bit division of –48 by 5
mov ax,-48
cwd ; extend AX into DX
mov bx,5
idiv bx ; AX = -9, DX = -3
12
Divide overflow
• Divide overflow happens when the quotient is
too large to fit into the destination.
mov ax, 1000h
mov bl, 10h
div bl
It causes a CPU interrupt and halts the program.
(divided by zero cause similar results)
INDEC & OUTDEC
OUTDEC used for, output an unsigned decimal
number to the screen.
13
INDEC used for, input an unsigned decimal number from the
keyboard.
Example:
.MODEL SMALL
.STACK 100H
.DATA
PROMPT_1 DB 'Enter a Decimal number (-32767 to 32767) : $'
PROMPT_2 DB 0DH,0AH,'The given Decimal number is : $'
.CODE
MAIN PROC
MOV AX, @DATA ; initialize DS
MOV DS, AX
LEA DX, PROMPT_1 ; load and display the string PROMPT_1
MOV AH, 9
INT 21H
CALL INDEC ; call the procedure INDEC
PUSH AX ; push AX onto the STACK
LEA DX, PROMPT_2 ; load and display the string PROMPT_2
MOV AH, 9
INT 21H
POP AX ; pop a value from STACK into AX
CALL OUTDEC ; call the procedure OUTDEC
MOV AH, 4CH ; return control to DOS
INT 21H
MAIN ENDP
INCLUDE INDEC.ASM
INCLUDE OUTDEC.ASM
END MAIN
14
END
THANK YOU
15

More Related Content

Similar to Microprocessor Instruction Guide

Similar to Microprocessor Instruction Guide (20)

[ASM]Lab4
[ASM]Lab4[ASM]Lab4
[ASM]Lab4
 
Micro unit 3
Micro unit 3Micro unit 3
Micro unit 3
 
8086 alp
8086 alp8086 alp
8086 alp
 
Instruction set of 8086
Instruction set of 8086Instruction set of 8086
Instruction set of 8086
 
8086 Instruction set
8086 Instruction set8086 Instruction set
8086 Instruction set
 
Assembly Language Compiler Implementation
Assembly Language Compiler ImplementationAssembly Language Compiler Implementation
Assembly Language Compiler Implementation
 
8086 Micro-processor and MDA 8086 Trainer Kit
8086 Micro-processor and MDA 8086 Trainer Kit8086 Micro-processor and MDA 8086 Trainer Kit
8086 Micro-processor and MDA 8086 Trainer Kit
 
Part III: Assembly Language
Part III: Assembly LanguagePart III: Assembly Language
Part III: Assembly Language
 
Keyboard interrupt
Keyboard interruptKeyboard interrupt
Keyboard interrupt
 
Exp 03
Exp 03Exp 03
Exp 03
 
15CS44 MP & MC Module 2
15CS44 MP & MC Module  215CS44 MP & MC Module  2
15CS44 MP & MC Module 2
 
knowledge in daily life.ppt
knowledge in daily life.pptknowledge in daily life.ppt
knowledge in daily life.ppt
 
Sample paper i.p
Sample paper i.pSample paper i.p
Sample paper i.p
 
EMBEDDED SYSTEMS 4&5
EMBEDDED SYSTEMS 4&5EMBEDDED SYSTEMS 4&5
EMBEDDED SYSTEMS 4&5
 
Stack and subroutine
Stack and subroutineStack and subroutine
Stack and subroutine
 
chapter 7 Logic, shift and rotate instructions
chapter 7 Logic, shift and rotate instructionschapter 7 Logic, shift and rotate instructions
chapter 7 Logic, shift and rotate instructions
 
8086 instructions
8086 instructions8086 instructions
8086 instructions
 
Assembly Language Basics
Assembly Language BasicsAssembly Language Basics
Assembly Language Basics
 
Lec06
Lec06Lec06
Lec06
 
CombVerilog.pdf
CombVerilog.pdfCombVerilog.pdf
CombVerilog.pdf
 

Recently uploaded

Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Krashi Coaching
 
Web & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfWeb & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfJayanti Pande
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactdawncurless
 
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in DelhiRussian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhikauryashika82
 
Student login on Anyboli platform.helpin
Student login on Anyboli platform.helpinStudent login on Anyboli platform.helpin
Student login on Anyboli platform.helpinRaunakKeshri1
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingTechSoup
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdfSoniaTolstoy
 
A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformChameera Dedduwage
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeThiyagu K
 
Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..Disha Kariya
 
Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3JemimahLaneBuaron
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxiammrhaywood
 
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...fonyou31
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfsanyamsingh5019
 
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...Sapna Thakur
 

Recently uploaded (20)

Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
 
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptxINDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
 
Web & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfWeb & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdf
 
Advance Mobile Application Development class 07
Advance Mobile Application Development class 07Advance Mobile Application Development class 07
Advance Mobile Application Development class 07
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impact
 
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
 
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in DelhiRussian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
 
Student login on Anyboli platform.helpin
Student login on Anyboli platform.helpinStudent login on Anyboli platform.helpin
Student login on Anyboli platform.helpin
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy Consulting
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
 
Mattingly "AI & Prompt Design: The Basics of Prompt Design"
Mattingly "AI & Prompt Design: The Basics of Prompt Design"Mattingly "AI & Prompt Design: The Basics of Prompt Design"
Mattingly "AI & Prompt Design: The Basics of Prompt Design"
 
A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy Reform
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and Mode
 
Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..
 
Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3
 
Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
 
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdf
 
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
 

Microprocessor Instruction Guide

  • 1. Microprocessor And Assembly Language Daffodil International University, Dhaka, Bangladesh Presentation On Some Instruction Over Chapter 9
  • 2. GROUP MEMBERS 2 Name ID Shamol Chandra Bhowmik 152-15-6180 Tonmoy Chandra Dhar 152-15-6181 Shahin Ahmed 152-15-6197 Jakarea 152-15-6200 Moniruzzaman 152-15-6201
  • 3. 3 MUL instruction • The MUL (unsigned multiply) instruction multiplies an 8-, 16-, or 32-bit operand by either AL, AX, or EAX. • The instruction formats are: MUL r/m8 MUL r/m16 MUL r/m32 Implied operands:
  • 4. 4 MUL examples 100h * 2000h, using 16-bit operands: .data val1 WORD 2000h val2 WORD 100h .code mov ax,val1 mul val2 ; DX:AX=00200000h, CF=1 The Carry flag indicates whether or not the upper half of the product contains significant digits. mov eax,12345h mov ebx,1000h mul ebx ; EDX:EAX=0000000012345000h, CF=0 12345h * 1000h, using 32-bit operands:
  • 5. 5 IMUL instruction • IMUL (signed integer multiply) multiplies an 8-, 16-, or 32-bit signed operand by either AL, AX, or EAX (there are one/two/three operand format) • Preserves the sign of the product by sign- extending it into the upper half of the destination register Example: multiply 48 * 4, using 8-bit operands: mov al,48 mov bl,4 imul bl ; AX = 00C0h, OF=1 OF=1 because AH is not a sign extension of AL.
  • 6. 6 DIV instruction • The DIV (unsigned divide) instruction performs 8-bit, 16-bit, and 32-bit division on unsigned integers • A single operand is supplied (register or memory operand), which is assumed to be the divisor • Instruction formats: DIV r/m8 DIV r/m16 DIV r/m32 Default Operands:
  • 7. 7 DIV examples Divide 8003h by 100h, using 16-bit operands: mov dx,0 ; clear dividend, high mov ax,8003h ; dividend, low mov cx,100h ; divisor div cx ; AX = 0080h, DX = 3 Same division, using 32-bit operands: mov edx,0 ; clear dividend, high mov eax,8003h ; dividend, low mov ecx,100h ; divisor div ecx ; EAX=00000080h,EDX=3
  • 8. 8 Signed integer division • Signed integers must be sign-extended before division takes place – fill high byte/word/doubleword with a copy of the low byte/word/doubleword's sign bit • For example, the high byte contains a copy of the sign bit from the low byte:
  • 9. 9 CBW, CWD, CDQ instructions • The CBW, CWD, and CDQ instructions provide important sign-extension operations: – CBW (convert byte to word) extends AL into AH – CWD (convert word to doubleword) extends AX into DX – CDQ (convert doubleword to quadword) extends EAX into EDX • For example: mov eax,0FFFFFF9Bh ; -101 (32 bits) cdq ; EDX:EAX = FFFFFFFFFFFFFF9Bh ; -101 (64 bits)
  • 10. 10 IDIV instruction • IDIV (signed divide) performs signed integer division • Uses same operands as DIV Example: 8-bit division of –48 by 5 mov al,-48 cbw ; extend AL into AH mov bl,5 idiv bl ; AL = -9, AH = -3
  • 11. 11 IDIV examples Example: 32-bit division of –48 by 5 mov eax,-48 cdq ; extend EAX into EDX mov ebx,5 idiv ebx ; EAX = -9, EDX = -3 Example: 16-bit division of –48 by 5 mov ax,-48 cwd ; extend AX into DX mov bx,5 idiv bx ; AX = -9, DX = -3
  • 12. 12 Divide overflow • Divide overflow happens when the quotient is too large to fit into the destination. mov ax, 1000h mov bl, 10h div bl It causes a CPU interrupt and halts the program. (divided by zero cause similar results)
  • 13. INDEC & OUTDEC OUTDEC used for, output an unsigned decimal number to the screen. 13 INDEC used for, input an unsigned decimal number from the keyboard. Example: .MODEL SMALL .STACK 100H .DATA PROMPT_1 DB 'Enter a Decimal number (-32767 to 32767) : $' PROMPT_2 DB 0DH,0AH,'The given Decimal number is : $' .CODE MAIN PROC MOV AX, @DATA ; initialize DS MOV DS, AX
  • 14. LEA DX, PROMPT_1 ; load and display the string PROMPT_1 MOV AH, 9 INT 21H CALL INDEC ; call the procedure INDEC PUSH AX ; push AX onto the STACK LEA DX, PROMPT_2 ; load and display the string PROMPT_2 MOV AH, 9 INT 21H POP AX ; pop a value from STACK into AX CALL OUTDEC ; call the procedure OUTDEC MOV AH, 4CH ; return control to DOS INT 21H MAIN ENDP INCLUDE INDEC.ASM INCLUDE OUTDEC.ASM END MAIN 14