Category Archives: 8086 TASM

8086 Assembly Program to Multiply Two 32 bit Numbers

In this blog post, we will discuss how to multiply two 32-bit numbers using 8086 assembly language. Since the 8086 microprocessor is 16-bit, handling 32-bit multiplication requires breaking it into multiple steps and managing carries properly. Let’s dive into the implementation.

data segment
abc dd 12345678H
def dd 12345678H
ghi dq ?
data ends

code segment
assume cs:code, ds:data
start:
mov ax, data
mov ds, ax
mov ax, word ptr abc
mul word ptr def
mov word ptr ghi, ax
mov cx, dx
mov ax, word ptr abc+2
mul word ptr def
add cx, ax
mov bx, dx
jnc move
add bx,0001H

move: mov ax,word ptr abc
mul word ptr def+2
add cx, ax
mov word ptr ghi+2, cx
mov cx,dx

jnc ma
add bx, 0001H
ma: mov ax, word ptr abc+2
mul word ptr def+2
add cx, ax

jnc mb
add dx, 0001H
mb: add cx, bx
mov word ptr ghi+4, cx

jnc mc
add dx, 0001H
mc: mov word ptr ghi+6, dx
int 3
code ends
end start
Continue reading 8086 Assembly Program to Multiply Two 32 bit Numbers

8086 Assembly Program for Subtraction of Two 32 bit Numbers

​In this blog post, we’ll explore how to perform the subtraction of two 32-bit numbers using an 8086 assembly language program. Handling 32-bit arithmetic operations on the 16-bit 8086 microprocessor requires managing carries between the lower and upper words of the numbers. Let’s delve into the implementation.​

data segment
abc dd 9ABCDEF0h
def dd 12345678h
ghi dw ?
data ends

code segment
assume cs:code, ds:data
start:
mov ax,data
mov ds,ax
mov dl,00h
mov ax, word ptr abc
mov bx, word ptr def
sub ax,bx
mov word ptr ghi,ax
mov ax, word ptr abc+2
mov bx, word ptr def+2
sbb ax,bx
mov word ptr ghi+2,ax
jnc move
inc dl
move: mov byte ptr ghi+4,dl
int 3
code ends
end start
Continue reading 8086 Assembly Program for Subtraction of Two 32 bit Numbers

8086 Assembly Program to Multiply Two 16 bit Numbers

In this blog post, we will explore an 8086 assembly program designed to multiply two 16-bit numbers. The 8086 microprocessor, with its rich set of instructions and registers, makes it possible to perform arithmetic operations efficiently. This program demonstrates how to use the AX, BX, and DX registers to handle the multiplication process, ensuring accurate results for 16-bit operands. Let’s dive into the code and its detailed explanation!

Continue reading 8086 Assembly Program to Multiply Two 16 bit Numbers

8086 Assembly Program to Divide Two 16 bit Numbers

When working with assembly language, one of the fundamental operations is division. In this blog post, we will explore an 8086 assembly program that divides two 16-bit numbers using the DIV instruction.

The following program takes two 16-bit numbers stored in memory, performs division, and stores the result.

data segment
a dw 4444h
b dw 0002h
c dw ?
data ends

code segment
assume ds:data, cs:code
start:
mov ax,data
mov ds,ax
mov ax,a
mov bx,b
div bx
mov c,ax
int 3
code ends
end start
Continue reading 8086 Assembly Program to Divide Two 16 bit Numbers