SVKM’s NMIMS
Mukesh Patel School of Technology Management & Engineering
Department of Computer Engineering
SUB: Computer Organization and Architecture
EXPERIMENT NO. 7
Multiplication and Division of Numbers in 8086
AIM : Write a program to multiplication and division of two 16-bit numbers
Theory:
The 8086 Processor provides both signed and unsigned multiply in their
instruction set to overcome the loss of efficiency in performing the repeated addition.
The MUL instruction can have both 16 and 8 bit operands and the multiplicand is AX or
AL, accordingly the result for a byte multiply is a 16 bit number in AX while that for a
word multiply is a 32 bit number, the lower word of which is in AX and the higher
word in DX.
Multiplication Multiplicant Operand Result
(MUL or IMUL) (Multiplier)
Byte*Byte AL Register or AX
memory
Word*Word AX Register or DX :AX
memory
Dword*Dword EAX Register or EAX :EDX
memory
The 8086 Processor provides both signed and unsigned divide in their Instruction set to
overcome the loss of efficiency in performing the repeated subtraction.
Division Dividend Operand Quotient:
(DIV or IDIV) (Divisor) Remainder
Word/Byte AX Register or AL : AH
Memory
Dword/Word DX:AX Register or AX : DX
Memory
Qword/Dword EDX: EAX Register or EAX : EDX
Memory
Algorithm (Multiplication)
Step1: Initialize the data segment.
Step2: Get the first number in AX register.
Step3: Get the second number .
Step4: Multiply the two numbers and result is in DX:AX.
Step5: Stop.
Program:
data segment
num1 dw 56abh
num2 dw 1232h
prodl dw ?
prodh dw ?
data ends
code segment
start: assume ds:data, cs:code
mov ax,data
mov ds,ax
mov ax,num1
mul num2
mov prodl,ax
mov prodh,dx
mov ax,4c00h
int 21h
code ends
end start
Algorithm (Division)
Step1: Initialise the data segment.
Step2: Get the first number in AX register i.e. dividend.
Step3: Get the second number in BL i.e. divisor.
Step4: Divide the two numbers. Result is in register AX.
Step5: Stop.
Program:
data segment
num1 dw 0056h
num2 db 12h
quo db ?
rem db ?
data ends
code segment
start: assume ds:data, cs:code
mov ax,data
mov ds,ax
mov ax,num1
div num2
mov quo,al
mov rem,ah
mov ax,4c00h
int 21h
code ends
end start
Results
8 bit Multiplication of two numbers
16 bit Multiplication of two numbers
Division of 16 bit number by 8 bit number
Division of 32 bit number by 16 bit number
Conclusion:
We have learnt how to multiply and divide unsigned numbers in TASM. We have done 8-bit
into 8-bit and 16-bit into 16-bit. We divided a 16-bit by 8-bit number and 32-bit by 16-bit
number.