The MASM Forum Archive 2004 to 2012

Project Support Forums => MASM32 => Topic started by: riak on March 30, 2006, 02:18:36 PM

Title: Beginner needing help
Post by: riak on March 30, 2006, 02:18:36 PM
Hi all,

Last week I d/l masm32 and started to go through as many beginners tutorials I could find on the web. Most things seem quite straight forward, I'm really only interested at the moment in the Math side of it and can happily add , sub , mul numbers to my hearts content. The problem is I cannot find any (beginners) explanation on how to add large numbers (100 digits or so)
I sort  :red understand that I'm stuffing a large number into an area that cannot hold it, but haven't found anything on the net that I understand, that will allow me to add or whatever two large numbers. I would imagine that I need to somehow set up several registers and spread the number over them I.e in 8 /6/32 or 64 bit chunks ?? But I have no idea how I would do it :P

Has anyone created a function similar to Java's BigInteger ?

Anyway, if anyone could point me in the right direction or show me a simple example I'd appreciate it.

Thanks in advance

Robin
Title: Re: Beginner needing help
Post by: hutch-- on March 30, 2006, 02:25:56 PM
Robin,

What comes to mind is Ray Filiatreault's BCD functions as I think they can do very large numbers but its not really beginners stuff. Have a look at Rays page on the masmcode link at the top right of the forum, its good stuff and will probably do what you need.
Title: Re: Beginner needing help
Post by: riak on March 30, 2006, 02:42:11 PM
Thanks for the response.

Had actually looked at that site, but didn't see what I wanted. but having looked again have found what you were referring to. It seems well documented and layed out, so will try and see if I can get it to work.

Thanks again

Robin
Title: Re: Beginner needing help
Post by: MichaelW on March 30, 2006, 04:06:34 PM
Hi Robin,

A quick search of the forum for "big integer" found what I think are two likely possibilities:

Do it using BCD math. Raymond Filiatreault has a BCD tutorial that includes examples that show how to add, subtract, multiply, divide, and take the square root of large ASCII numbers:

http://www.ray.masmcode.com/BCDtut.html

Do it using integer instructions. Randall Hyde's AoA Windows 32 Bit Edition has a chapter that covers extended precision arithmetic:

http://webster.cs.ucr.edu/AoA/Windows/HTML/AdvancedArithmetic.html#998265