п»ї
Write attempt
Multiplication and Division Instructions
•
•
•
•
•
MUL Instruction
IMUL Instruction
DIV Instruction
Signed Integer Division
Implementing Arithmetic Expressions
Irvine, Kip R. Assembly Language beneficial to Intel-Based Computers, 2003.
1
MUL Instruction
•
The MUL (unsigned multiply) instruction multiplies an 8-, 16-, or 32-get the ~s on operand by either AL, AX, or EAX.
•
The tuition formats are:
MUL r/m8
MUL r/m16
MUL r/m32
Implied operands:
Irvine, Kip R. Assembly Language by reason of Intel-Based Computers, 2003.
2
MUL Examples
100h * 2000h, using 16-scrap operands:
.data
val1 WORD 2000h
val2 WORD 100h
.digest
mov ax,val1
mul val2
; DX:AX = 00200000h, CF=1
The Carry droop
indicates whether or
not the upper half of
the product contains
significant digits.
12345h * 1000h, using 32-mite operands:
mov eax,12345h
mov ebx,1000h
mul ebx
; EDX:EAX = 0000000012345000h, CF=0
Irvine, Kip R. Assembly Language notwithstanding Intel-Based Computers, 2003.
3
Your change the direction of . . .
What will be the hexadecimal values of DX, AX, and the Carry become vapid after the following instructions execute?
mov ax,1234h
mov bx,100h
mul bx
DX = 0012h, AX = 3400h, CF = 1
Irvine, Kip R. Assembly Language because Intel-Based Computers, 2003.
4
Your become sour . . .
What will be the hexadecimal values of EDX, EAX, and the
Carry flower-de-lis after the following instructions execute?
mov eax,00128765h
mov ecx,10000h
mul ecx
EDX = 00000012h, EAX = 87650000h, CF = 1
Irvine, Kip R. Assembly Language towards Intel-Based Computers, 2003.
5
IMUL Instruction
• IMUL (signed whole number multiply ) multiplies an 8-, 16-,
or 32-whit signed operand by either AL, AX, or EAX
• Preserves the sign of the crops by sign-extending it
into the upper half of the destination register
Example: grow in number 48 * 4, using 8-bit operands:
mov al,48
mov bl,4
imul bl
; AX = 00C0h, OF=1
OF=1 for the cause that AH is not a sign dilation of AL.
Irvine, Kip R. Assembly Language toward...
Irvine, Kip R. Assembly Language for Intel-Based Computers, 2003. 1
Multiplication and Division Instructions
Multiplication and Division Instructions
• MUL Instruction
• IMUL Instruction
• DIV Instruction
• Signed Integer Division
• Implementing Arithmetic Expressions
Continues with respect to 35 more pages »
Read well stocked document
Full access is free with regard to contributing users.
Add to Library (0) Hideп»ї
No comments:
Post a Comment