32 BIT MULTIPLICATION
Author:rahul
Comment: only a 2-32 bit no. multiplication has been achieved.this is coz 2-32 bit nos give a product 64 bit no. which if further mul by another 32 bit no. will result in a 96 bit and so on makin prog algorith and memory req difficult to handle.use of calculator present default in the OS of a sys to verify the result is inadequate for it req a 64 bit calc.
Status:PERFECT
.model small
.data
no1 dw 9987h,9dcbh
no2 dw 9876h,9cbah
intrmd dw 16d dup(0)
ans dw 10d dup(0)
.code
start: mov ax,@data
mov ds,ax
mov di,offset intrmd
mov bx,offset no1
mov si,offset no2
mov ax,[bx]
mul word ptr[si]
mov [di],ax
mov [di+2],dx
mov ax,[bx]
mul word ptr[si+2]
mov [di+10],ax
mov [di+12],dx
mov ax,[bx+2]
mul word ptr[si]
mov [di+18],ax
mov [di+20],dx
mov ax,[bx+2]
mul word ptr[si+2]
mov [di+28],ax
mov [di+30],dx
mov si,offset intrmd
mov cl,4
nxtno: clc
mov di,offset ans
mov dl,4d
nxtwrd: lodsw
mov bx,[di]
adc ax,bx
mov [di],ax
inc di
inc di
dec dl
jnz nxtwrd
dec cl
jnz nxtno
mov ax,4c00h
int 21h
end start
end

0 Comments:
Post a Comment
<< Home