8086 Assembly Program to Multiply Two 32 bit Numbers

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

Output

C:\TASM>masm an_32mul.asm
Microsoft (R) Macro Assembler Version 5.00
Copyright (C) Microsoft Corp 1981-1985, 1987.  All rights reserved.

Object filename [an_32mul.OBJ]:
Source listing  [NUL.LST]:
Cross-reference [NUL.CRF]:

  50278 + 450378 Bytes symbol space free

      0 Warning Errors
      0 Severe  Errors

C:\TASM>link an_32mul.obj

Microsoft (R) Overlay Linker  Version 3.60
Copyright (C) Microsoft Corp 1983-1987.  All rights reserved.

Run File [AN_32MUL.EXE]:
List File [NUL.MAP]:
Libraries [.LIB]:
LINK : warning L4021: no stack segment

C:\TASM>debug an_32mul.exe
-g

AX=5A90  BX=0626  CX=66DC  DX=014B  SP=0000  BP=0000  SI=0000  DI=0000
DS=0B97  ES=0B87  SS=0B97  CS=0B98  IP=0052   NV UP EI PL NZ NA PO NC
0B98:0052 CC            INT     3
-d 0B97:0000
0B97:0000  78 56 34 12 78 56 34 12-40 D8 F4 1D DC 66 4B 01  [email protected].
0B97:0010  B8 97 0B 8E D8 A1 00 00-F7 26 04 00 A3 08 00 8B  .........&......
0B97:0020  CA A1 02 00 F7 26 04 00-03 C8 8B DA 73 03 83 C3  .....&......s...
0B97:0030  01 A1 00 00 F7 26 06 00-03 C8 89 0E 0A 00 8B CA  .....&..........
0B97:0040  73 03 83 C3 01 A1 02 00-F7 26 06 00 03 C8 73 03  s........&....s.
0B97:0050  83 C2 01 03 CB 89 0E 0C-00 73 03 83 C2 01 89 16  .........s......
0B97:0060  0E 00 CC 08 8B 56 0A 89-46 FC 89 56 FE C4 5E FC  .....V..F..V..^.
0B97:0070  26 8A 47 0C 2A E4 40 50-8B C3 05 0C 00 52 50 E8  &.G.*[email protected].
-q

4 thoughts on “8086 Assembly Program to Multiply Two 32 bit Numbers”

Leave a Reply to Touheed HayatCancel reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.