Question

Intel 8085 program to multiply two integers of size 20 digits each

Asked by: mstrachan

URGENT

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.

Subscribe now for full access to Experts Exchange and get

Instant Access to this Solution

  • Plus...
  • 30 Day FREE access, no risk, no obligation
  • Collaborate with the world's top tech experts
  • Unlimited access to our exclusive solution database
  • Never be left without tech help again

Subscribe Now

Asked On
2006-02-03 at 16:45:51ID21723524
Tags

8085

Topic

Assembly Programming Language

Participating Experts
7
Points
500
Comments
21

Trusted by hundreds of thousands everyday for fast, accurate and reliable tech support.

  • "The time we save is the biggest benefit of Experts Exchange to Warner Bros. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange." Mike Kapnisakis, Warner Bros.
  • "Our team likes having a resource that is more secure than just using Google and most experts using this service really know their stuff. It's nice to look here first versus using Google." Dayna Sellner, Lockheed Martin
  • "Anytime that I've been stumped with a problem, 9 out of 10 times Experts Exchange has either the accepted solution or an open discussion of the potential solution to the problem." Kenny Red, eBay Inc.

See what Experts Exchange can do for you.

Got a question?

We've got the answer.

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.

Screenshot of Experts Exchange Knowledgebase

Need individual assistance?

Our experts are ready to help.

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.

Screenshot of Experts Exchange Knowledgebase

Want to learn from the best?

Read articles from industry experts.

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.

Screenshot of an Article

Working on a long term project?

Store your work and research.

Save solutions to your questions, answers you’ve discovered through searching plus helpful articles in your personal knowledgebase for easy future access.

Screenshot of Experts Exchange Knowledgebase

Access the answers to your technology questions today.

Subscribe Now

30-day free trial. Register in 60 seconds.

What Makes Experts Exchange Unique?

Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Trusted by the world's most respected brands.

image of each brand's logo

Faithfully serving IT professionals since 1996.

Experts Exchange Logo

Try it out and discover for yourself.

Subscribe Now

30-day free trial. Register in 60 seconds.

Related Solutions

  1. Multiplying in a Column
    Sounds easy but what i want to do is take the numbers in this column and multiply them by 1.025 and leave the result in the same column ... Tahks in advance for your help.
  2. CALCULATION MULTIPLY
    Hi, I would need your help for doing a script which multiply the values of a column accortin to the changing in values of another column. Example: fn freq acum freq (multiplying...) answer 12 ...

Free Tech Articles

  1. WARNING: 5 Reasons why you should NEVER fix a computer for free.
    It is in our nature to love the puzzle. We are obsessed. The lot of us. We love puzzles. We love the challenge. We thrive on finding the answer. We hate disarray. It bothers us deep in our soul. W...
  2. SCCM OSD Basic troubleshooting
    SCCM 2007 OSD is a fantastic way to deploy operating systems, however, like most things SCCM issues can sometimes be difficult to resolve due to the sheer volume of logs to sift through and the dispe...
  3. Migrate Small Business Server 2003 to Exchange 2010 and Windows 2008 R2
    This guide is intended to provide step by step instructions on how to migrate from Small Business Server 2003 to Windows 2008 R2 with Exchange 2010. For this migration to work you will need the fo...
  4. Create a Win7 Gadget
    This article shows you how to create a simple "Gadget" -- a sort of mini-application supported by Windows 7 and Vista. Gadgets can be dropped anywhere on the desktop to provide instant information, ...
  5. Outlook continually prompting for username and password
    There have been a lot of questions recently regarding Outlook prompting for a username and password whilst using Exchange 2007. There are a few reasons why this would happen and I will try to cover t...
  6. Backup Exchange 2010 Information Store using Windows Backup
    There seems to be quite a lot of confusion around the ability to backup Exchange 2010 using the built in Windows Backup feature. This stems from the omission of this feature prior to Exchange 2007 s...

Cloud Class Webinars

  1. Avoiding Bugs in Microsoft Access
    Alison Balter takes and in-depth look at avoiding bugs in Access. In this webinar you will learn about using the immediate window to debug your applications, invoking the debugger, using breakpoints to troubleshoot, stepping through code, setting the next statement to execute, ...
  2. Top 10 Best New Features in Visio 2010
    Scott Helmers gives live demonstrations of the top 10 new features in Visio 2010. This webinar will teach you how to create compelling diagrams by adding shapes to the page with a single click, linking the shapes in a diagram to data in Excel (or SQL Server, or SharePoint), ...
  3. IT Consultant Business Secrets Revealed
    Michael Munger, Experts Exchange tech pro and IT consultant, pulls back the curtain on his very successful businesses and answers question on every IT consultant and business owner should know about. He shares secrets on what he did to solve the 5 most common problems in IT, ...
  4. Disaster Recovery and Business Continuity
    Quest CTO, Mike Billon, gives an overview of the steps involved in building a dunamic disaster recovery plan. Through case studies and an examination of software/hardware tooles for monitoring and testing, you'll gain a better understandin of where you are, where you want ...
  5. Organize Your Visio Diagrams with Containers and Lists
    Scott Helmers uses cross functional flowcharts, wireframe diagrams, data graphic legends and seating charts to teach you: how to ustilize all three new structured diagram components in Visio 2010, the best practices for organizeing shapes in previous version of Visio, how to organize ...
  6. How to Us Objects, Properties, Events and Methods in Microsoft Access
    Alison Dalter gives an in-depbth look at objects, properties, events and methods in Microsoft Access. In this webinar you will learn about using the object browser, referring to objects, working with properties and methods, working with object variables, understanding the ...

Join the Community

Give a Little. Get a Lot.

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.

Join the Community

Answers

 

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

 

by: dimitryPosted on 2006-02-04 at 11:40:01ID: 15873351

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/ cs3760b_99_winter/lectures/lecture5.pdf

 

by: PaulCaswellPosted on 2006-02-04 at 16:41:35ID: 15874370

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

 

by: mgh_mgharishPosted on 2006-02-04 at 17:05:32ID: 15874417

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

 

by: mgh_mgharishPosted on 2006-02-04 at 17:09:56ID: 15874429

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/tutorials/tutorial1766.html

 

by: abithPosted on 2006-02-04 at 22:49:48ID: 15875298

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.

 

by: mstrachanPosted on 2006-02-05 at 00:09:59ID: 15875463

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.

 

by: grg99Posted on 2006-02-05 at 03:49:19ID: 15875897

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.

 

by: PaulCaswellPosted on 2006-02-05 at 05:42:57ID: 15876087

abith,

>>And if you use any shift mnemonic, we will not get any carry flag to set.
I am not familliar with 8085. Is there a ROL/ROR instruction? If so you can rotate and check the lowest bit after for carry state.

Paul

 

by: mgh_mgharishPosted on 2006-02-05 at 05:55:09ID: 15876123

There are rotate instructions which can set the carry flag.

RAR  --> Rotate Right Through Carry
RAL  --> Rotate Left Through Carry
RRC  --> Rotate Right Directly
RLC  --> Rotate Left Directly

 

by: mgh_mgharishPosted on 2006-02-05 at 06:00:21ID: 15876138

Through carry means (M/LSB = C; C = L/MSB)
Directly means (C = M/LSB = L/MSB)

 

by: abithPosted on 2006-02-05 at 20:54:31ID: 15880454


>> mgh_mgharish
i meant for addition you can not use shift instructions, that carry flag is one of bits of acc. this will not help for any addition, since we have to do repeated addition for multiplication.

 

by: mgh_mgharishPosted on 2006-02-06 at 10:17:28ID: 15885204

abith, I still don't understand what you mean. You can use SHIFT instructions for BOTH addition and multiplication.

 

by: abithPosted on 2006-02-06 at 21:56:26ID: 15889899

mgh_mgharish , i dont know whether it is possible to add two numbers using shift instructions. if it is possible can you brief it.

 

by: mgh_mgharishPosted on 2006-02-10 at 10:01:32ID: 15924928

You asked it for multibyte addition right ?

I was replying to this:

> 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.

Shift instructions do set the carry flag and they can be used for higher bytes

 

by: mstrachanPosted on 2006-02-11 at 08:49:53ID: 15931017

Hello Everyone,

Thanks for your help, regarding this matter. I have read
all your messages and have finsihed the assignment thanks
to your help.

Please do not post any more replies.

Thanks,

Manny

 

by: anthrax759Posted on 2006-02-11 at 09:49:24ID: 15931252

mstrachan, aren't you forgetting to give someone a grade? Whoever pointed you in the right direction should get the points, not only because it's courteous but also to mark this question as having a solution...

 

by: mstrachanPosted on 2006-02-11 at 10:50:51ID: 15931489

anthrax759,

I apologize I am new here. I'll get on that right away.

 

by: anthrax759Posted on 2006-02-11 at 11:16:16ID: 15931582

Ah, I feel guilty now because I'm not the one who pointed you in the right direction (?) I'll try to transfer the pts to both mgharish and abith as I think they're more deserving than I...
-aNthrax

 

by: abithPosted on 2006-02-13 at 03:22:04ID: 15940121

hi anthrax759 ...
we appriciate your honestness..
its ok let it be...

 

by: mykids3Posted on 2008-10-24 at 23:24:10ID: 22801904

Hi mstrachan,
If you completed assignment can I get solution?

Thanks

20120131-EE-VQP-002

3 Ways to Join

30-Day Free Trial

The Experts

98% positive feedback on 31,087 answers since March 2000. angeliii is a Microsoft Most Valuable Professional for his work with MS SQL Server & Develoment.

He has also proven his knowledge of Visual Basic Programming, PHP Scripting and Oracle Databases.

The Experts

97% positive feedback on 10,752 answers since July 2000. lrmoore has more than 18 years experience in the networking industry.

The six-time Mircosoft MVPs specialties include firewalls, virtual private networking, and network management.

Testimonials

"...and excellent source for support... Kind of like having your very own IT dept." Electriciansnet

Testimonials

"I was apprehensive at signing up at first. However... it has already made my life as an IT administrator much easier." JaCrews

Testimonials

"WOW! You guys have great, active, and knowledgeable people on here." moore50

Business Clients

Business Clients

In the Press

"If you’ve got a question... Experts Exchange can supply an answer.”

In the Press

"...an invaluable aid for both IT professionals and those who require tech support."

In the Press

"where IT professionals provide quick answers on just about any topic"

Business Account Plans

Loading Advertisement...