0% found this document useful (0 votes)
355 views5 pages

Multiplication in Assembly Language

The MUL instruction multiplies two unsigned binary numbers and stores the product in registers, while IMUL handles signed numbers. For multiplying two bytes, the multiplicand is in the AL register and multiplier is a byte in memory or another register, with the 16-bit product stored in AX. The code demonstrates multiplying two user-input numbers, storing the multiplicand in CL and product in CL, then outputting the result.

Uploaded by

Md Iqbal Hossain
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
355 views5 pages

Multiplication in Assembly Language

The MUL instruction multiplies two unsigned binary numbers and stores the product in registers, while IMUL handles signed numbers. For multiplying two bytes, the multiplicand is in the AL register and multiplier is a byte in memory or another register, with the 16-bit product stored in AX. The code demonstrates multiplying two user-input numbers, storing the multiplicand in CL and product in CL, then outputting the result.

Uploaded by

Md Iqbal Hossain
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 5

Experiment name : Explain MUL instruction with example and implement code

Theory :

There are two instructions for multiplying binary data. The MUL (Multiply) instruction handles unsigned
data and the IMUL (Integer Multiply) handles signed data. Both instructions affect the Carry and
Overflow flag.

Syntax
The syntax for the MUL/IMUL instructions is as follows −

MUL/IMUL multiplier

Multiplicand in both cases will be in an accumulator, depending upon the size of the multiplicand and
the multiplier and the generated product is also stored in two registers depending upon the size of the
operands.

When two bytes are multiplied −

The multiplicand is in the AL register, and the multiplier is a byte in the memory or in another register.
The product is in AX. High-order 8 bits of the product is stored in AH and the low-order 8 bits are stored
in AL.

Code :

.model small

.stack 100h

.data

msg1 db ‘Enter first number $’

msg2 db ‘Enter second number $’

msg3 db ‘the result is $’

.code

Main proc

Mov ax,@data

Mov ds,ax
Mov ah,9

Lea dx,msg1

int 21h

Mov ah,1

Int 21h

Sub al,48

Mov cl,al

Mov ah,2

Mov dl,0dh

Int 21h

Mov dl,0ah

Int 21h

Mov ah,9

Lea dx,msg2

Int 21h

Mov ah,1

Int 21h

Sub al,48

Mul cl

Mov cl,al

Add cl,48

Mov ah,2

Mov dl,0dh
Int 21h

Mov dl,0ah

Int 21h

Mov ah,9

Lea dx,msg3

Int 21h

Mov ah,2

Mov dl,cl

Int 21h

Main endp

End main
Output:

Discussion :

We successfully multiply two number by using this code.

You might also like