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 Microprocssor

Part III: Assembly Language
Part III: Assembly LanguagePart III: Assembly Language
Part III: Assembly Language
Ahmed M. Abed
 
Keyboard interrupt
Keyboard interruptKeyboard interrupt
Keyboard interrupt
Tech_MX
 
EMBEDDED SYSTEMS 4&5
EMBEDDED SYSTEMS 4&5EMBEDDED SYSTEMS 4&5
EMBEDDED SYSTEMS 4&5
PRADEEP
 
Stack and subroutine
Stack and subroutineStack and subroutine
Stack and subroutine
Ashim Saha
 

Similar to Microprocssor (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

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
kauryashika82
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptx
heathfieldcps1
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
QucHHunhnh
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
QucHHunhnh
 
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
 

Recently uploaded (20)

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
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptx
 
Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphZ Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot Graph
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdf
 
Disha NEET Physics Guide for classes 11 and 12.pdf
Disha NEET Physics Guide for classes 11 and 12.pdfDisha NEET Physics Guide for classes 11 and 12.pdf
Disha NEET Physics Guide for classes 11 and 12.pdf
 
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
 
General AI for Medical Educators April 2024
General AI for Medical Educators April 2024General AI for Medical Educators April 2024
General AI for Medical Educators April 2024
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
 
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
 
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
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)
 
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impact
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The Basics
 
IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...
IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...
IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...
 
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...
 
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...
 
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13
 

Microprocssor

  • 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