; int _MulUnsArrByUnsArr(src1,src2,dst,m,n,tmp1) ; ; ARGUMENT ; unsigned *src1[m],*src2[n]; where (m,n)<=5 ; unsigned *dst[10]; destination is unsigned [10] ; int m,n; m=#ints in src1, n=#ints in src2 ; int tmp1; where tmp1 is used as a temp multiplier for each loop ; ; DESCRIPTION ; ; Multiplies multiplier by multiplicand giving dst. Src1 and scr2 are ; 80-bitx80-bit is computed to 160-bit. The number of ints in src1 ; and src2 are examined to determine which is the multiplier, ie. ; which has the fewest number of ints. If they have the same number ; number of ints, then src1 will be the multiplier. As each int ; is multiplied to obtain the partial product, it is added to the dst ; and any carries are added to succeeding column locations in the ; dst array. ; ; SIDE EFFECTS ; Src1 and src2 remain unchanged. Dst IS ZEROED PRIOR TO ADD. NOTE THAT ; NEITHER pSrc1 or pSrc2 CAN HAVE THE MSB OF THE HIGH-ORDER INT SET, ie. ; neither number can be negative. If it is, the results are indeterminate. ; ; RETURNS ; None. ; ; AUTHOR ; Andy Anderson 04-Jun-88 1030 ; Copyright (C) 1987-90 Greenleaf Software Inc. All Rights Reserved. ; ; MODIFICATIONS ; ; .SFCOND include model.h include prologue.h include gm.equ ; partial products for intermediate results ReferVar wGMTemp1, dseg _gm endds pseg gmath ; ; ; if large memory model then: ; ; parm1_ = ptr to multiplier ; parm3_ = ptr to multiplicand ; parm5_ = destination segment ptr } pointer to unsigned[10] ; destination offset ptr } destination ; parm7_ = # of 16-bit int's in multiplier ; parm8_ = # of 16-bit int's in multiplicand ; parm9_ = temp for current multiplier ; ; for if small model then ; parm1_ = ptr to multiplier ; parm2_ = ptr to multiplicand ; parm3_ = ptr to unsigned[10] dst ; parm4_ = # of 16-bit int's in MULTIPLIER (a1,...,an) ; parm5_ = # of 16-bit int's in MULTIPLICAND(b1,...,bn) ; parm6_ = temp for current multiplier ; ; ; Then set up and do the first set of mults. Note that the # of ; 'bigloop' iterations correspond to the number of 16-bit digits ; in the multiplier and the 'mlp' loop iterations correspond to the ; # ints in the multiplicand. [these line up if you set tab=5]. ; Algorithm(32-bitx32-bit): ; b2 b1 ; a2 a1 ; __________ ; ;| first p1h p1l ;|iteration p2h p2l ;|2nd p3h p3l ;|iter p4h p4l ; ____________________________________ ; c4 c3 c2 c1 ; ;or---> Algorithm(64-bitx32-bit): ; b4 b3 b2 b1 ; a2 a1 ; __________________ ;| first p1h p1l ;|iteration p2h p2l ;| p3h p3l ;| p4h p4l ;---- ;| p5h p5l ;| 2nd p6h p6l ;|iter p7h p7l ;| p8h p8l ;----- ;______________________________________ ; 0 0 c6 c5 c4 c3 c2 c1 ; ;or---> Algorithm(64-bitx64-bit): ; b4 b3 b2 b1 ; a4 a3 a2 a1 ; __________________ ;| first p1h p1l ;|iteration p2h p2l ;| p3h p3l ;| p4h p4l ;---- ;| p5h p5l ;| 2nd p6h p6l ;|iter p7h p7l ;| p8h p8l ;----- ;| third p1h p1l ;|iteration p2h p2l ;| p3h p3l ;| p4h p4l ;---- ;| p5h p5l ;| 4th p6h p6l ;|iter p7h p7l ;| p8h p8l ;----- ;| fifth p9h p9l ;|iteration p10h p10l ;| p11h p11l ;| p12h p12l ;---- ;| 6th p13h p13l ;| p14h p14l ;| p15h p15l ;|p16h p16l ;----- ;_________________________________________________________________ ; c8 c7 c6 c5 c4 c3 c2 c1 ; ; As each multiply is done, the partial product is added to ; the destination 'dst' ; ; ; cproc _MulUnsArrByUnsArr,,_mgmn if _LDATA push ds push es mov ax,parm7_ cmp ax,parm8_ ; see which is larger jle nochg ; m