Also anthrax759's suggestion is correct, his method of accumulation is not the effective one. Please take a look here for multiplication algorithms:
www.cc.gatech.edu/classes/
Main Topics
Browse All TopicsURGENT
I need to write an Intel 8085 program to multiply two integers of size 20 digits each ( For example : 19837653929987654321 x 90870054781976543975 ). Since you will not find an 8085 multiply instruction to do this operation, you need to write your own sequence of instructions. Let the operands be supplied in two sequences of memory locations in any format. The result could be stored in a third sequence of memory locations.
Can someone please help me as I do not know where to even start. Thanks.
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
Also anthrax759's suggestion is correct, his method of accumulation is not the effective one. Please take a look here for multiplication algorithms:
www.cc.gatech.edu/classes/
mstrachan,
This is clearly an excercise in using the carry flag.
You can multiply two numbers together in assembler and get the carry flag set if the calculation overflowed beyond the limit of the values. All you need to do then is to use that carry while multiplying the next block up the line. You can extend multiplication as far as you like this way. This is like junior/primary school long multiplication but with much bigger numbers.
Paul
Hi,
> You can multiply two numbers together in assembler and get the carry
> flag set if the calculation overflowed beyond the limit of the values.
8085 doesn't have MUL or IMUL instructions. You have to do successive approximation only. But that method will not be suitable in any way to this large number.
Assuming 3 instructions per iteration using a 3 MHz processor, it will take about 3e13 seconds, which means about, 1000000 years
---
Harish
mstrachan, another method would be SHIFT LEFT and ADD method but it is difficult to implement for such astronomical numbers.
Many other methods are given here:
http://www.daniweb.com/tut
Hi mstrachan ,
mgharish is correct,
8085 is 8-bit processor.
For storing this 19837653929987654321 (20 digits) itself will take 8 mem locations. So it will need 1+7 inner iterations to manage count value itself. And 8 more locations for multiplier. and 8 conditions to check overflow in every addition since one register can hold only value upto 256, as per mathematical rule result may come in upto 40digits (sum of digits of both numbers) so for managing this number you need to have 16 more registers and 16 more conditions for overflow,
and nearly 16+8+8+ (8 to 16 for actual addition) addition statements you need.
So finally as mgharish told it will take long years to complete. Using 8086 itself will take longer time. So better you can choose any 32 bit processor.
>>mgh_mgharish
>> Another method would be SHIFT LEFT ....
What I feel is, we can not use and shift mnemonics. Because we can not take this as whole value. We can take only part of (mod of 256) only. For this purpose we can not use shift mnemonics. And if you use any shift mnemonic, we will not get any carry flag to set.
This problem looks like an application oriented( or some result oriented). 8085 is designed for controlling machines (control oriented). For application oriented you need to use more than 80(1)86.
So definitely this can not be achieved using 8085. If program is developed then we will not be living to see the results.
Well you know, this is a question that is given to a whole bunch of students,
all over the world. I spoke to someone who already did the exact assignment
and got it to work correctly. It doesn't have to run on an 8085 machine, it
is going to run on an emulator that will be emulating an intel 8085 machine
not on an actual intel 8085 processor.
Maybe I forgot to mention that.
You can do it in ASCII, by following the exact method you use to do it by hand. Exactly.
Not trivial, but not really very hard if you just stick to doing it exactly as described.
At the lowest level, to multiply two one-digit numbers, you can do it one of two ways:
(1) Just do repetitive addition, not too slow for single digits.
(2) Have a 10 x 10 multiplication table in memory that you just index into.
Business Accounts
Answer for Membership
by: anthrax759Posted on 2006-02-04 at 11:20:38ID: 15873287
Hello mstrachan,
I would suggest you create three variables for those numbers, and run through some type of loop (if possible) var1 # of times, and successively add var2 each time to var3 -- multiplication is the same thing as successive addition...
4*3=12
4+4+4=12
3+3+3+3=12
So this should give you a start... Although I don't know the capacity of Intel 8085...
Hope this helps you,
-aNthrax