Hi everyone....

see this definition..

.data
array1 dd 11112222h, 33334444h, 55556666h
array2 dd 22221111h, 44443333h, 55551111h

.data?

array3 dd 6 dup(?)

.code
; multiplication routine
ret
.end

my problem is
how to multiply this large number and get the result stored in array3.
can anyone help me out with any link or tutorials ??

cya
Posted on 2002-12-01 22:44:16 by processingspeed
``````    ABC
x  DEF
------
CF
BF
AF
CE
BE
AE
CD
BD
-------
CF
BF
CE
AF
BE
CD
AE
BD
-------
abcdef = 192 bits result``````
Each letter is 32-bits - don't forget to add the carries.
(AB) equals (A) times (B).
Posted on 2002-12-01 22:50:38 by bitRAKE
BitRake that's my question was......

I know how to multiply large number... The solution you have given is just an normal or traditional multiplication....but if you show me how to implement it for very larger array, say the double word array of 10 entries, then i will be more helpful.
Can anyone know any tutorial or links regarding that so that I can go through it on my own ??

cya
Posted on 2002-12-02 01:30:53 by processingspeed
1st 1 hope that my code is correct it seems to.

.data
arraylen dd 3
.code

Multi Proc,val1:dword,val2:dword
.data
tempval dd 0
.code
pusha
xor ecx,ecx
xor edx,edx
mov eax,val1
mov ebx,val2
mul ebx
mov tempval,eax
popa
mov eax,tempval
ret
Multi endp

ArrayMulti proc,Data1:dword,Data2:dword,DataLen:dword,DestData:dword
.Data
CountArray dd 0
ArrayMultiVal1 dd 0
ArrayMultiVal2 dd 0
.code
pusha
mov Countarray,0
mov ecx,datalen
BouArrayMulti:
mov esi,data1
lodsd
mov ArrayMultiVal1,eax
mov esi,data2
lodsd
mov ArrayMultiVal2,eax
call Multi,ArrayMultiVal1,ArrayMultiVal2
stosd
loop BouArrayMulti
popa
ret
ArrayMulti endp

and so for you here's a sample to use these funcs
call ArrayMulti,offset array1,offset array2,arraylen,offset array3

ok hope it help
Posted on 2002-12-02 08:26:32 by Thor0Asgard
processingspeed, I did not understand you were having a problem converting the process to code. Let me outline a possible algorithm in psuedo-code:
``````CLEAR Destination

ebx = 0
DO WHILE ebx < Number1.dwords
ecx = 0
DO WHILE ecx < Number2.dwords
mov eax, [Number1 + ebx*4]
mul [Number2 + ecx*4]
lea ebp, [ecx + ebx]
add [Destination + ebp*4], eax
@@:
adc [Destination + ebp*4 + 4], edx
inc ebp
jc @B
inc ecx
LOOP
inc ebx
LOOP``````
Posted on 2002-12-02 08:51:53 by bitRAKE
Thanks alot all you guys.....
this clear my confusion..... tomorrow whole day I was struggling with this problem and confusion too..

this explain and clear my confusion
once again thanks alot

cya
Posted on 2002-12-02 22:30:23 by processingspeed