News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

Beginner needing help

Started by riak, March 30, 2006, 02:18:36 PM

Previous topic - Next topic

riak

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

hutch--

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.
Download site for MASM32      New MASM Forum
https://masm32.com          https://masm32.com/board/index.php

riak

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

MichaelW

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

eschew obfuscation