943,837 Members | Top Members by Rank

Ad:
  • Assembly Discussion Thread
  • Unsolved
  • Views: 534
  • Assembly RSS
Jun 30th, 2009
0

Help Please

Expand Post »
Please I will be greatful if someone help me put the program below In assembly language. I have been trying for ages but couldnt get. I found the question in some science website and I have been trying to figure it out but i cant. So please join me in doing this.


The questions...
The goal of this lab is to read a series of numbers from a block of contineous memory, three numbers at a time. Upon obtaining the three numbers, the program will add the three numbers together and store the result back into a second contineous block of memory.

The program flow will look like this:

START (Label)

Call a "function"(1) named "ReadThree" to Read the next three numbers into registers %r1, %r2, and %r3.
The ReadThree function should use a memory label "INPUT", plus an offset that you store in %r10 to load the values. %r10 should be incremented appropriately.
When you have loaded the values into the registers, return using the JMPL command with %r15 as the destination address.

Check to see if all three values (%r1, %r2, and %r3) are ZERO. If they are, go to the label named END.

Call a "function" named "AddThree". This function will add the values in %r1, %r2 and %r3 and store the result in %r4, then return using JMPL.

Call a "function" called "StoreResult". This function will take the value in %r4 and store it in a memory location with the label "OUTPUT", plus an offset that is stored in %r11. %r11 should be incremented appropriately so that the results are stored in sequence in memory. When the output has been stored, the function should return using JMPL and %r15, as appropriate.

END (Label)

Once we come to the end, we should HALT the program.

At the end of the program code (before .end) we will have two sections of memory. One with the label INPUT, the other with the label OUTPUT. The code for this will appear as follows:


INPUT: 10 (2)
10
10
20
20
20
30
30
30
40
40
40
0
0
0
OUTPUT: 0
0
0
0
0

.end


When the program has finsihed running, memory should look like this:

INPUT: 10
10
10
20
20
20
30
30
30
40
40
40
0
0
0
OUTPUT: 30
60
90
120
0


Notes:

(1) They're not TRUE functions, but instead they are memory labels to which we jump and return. That's why I've written them as "function" (in quotes)
(2) This data is sample data only. I will use something sneaky like 0, 1, 2 in the data to see if you are looking for ONE zero in order to quit, or three like instructed.
Reputation Points: 10
Solved Threads: 0
Newbie Poster
indianjk is offline Offline
2 posts
since Jun 2009
Jun 30th, 2009
0

Re: Help Please

Your explanations at the bottom look like a teacher wrote them. Nice attempt at a disguise. Either way, we don't do projects for people - post your attempt at a solution, then we'll guide you.
Reputation Points: 874
Solved Threads: 352
Posting Maven
BestJewSinceJC is offline Offline
2,758 posts
since Sep 2008
Jun 30th, 2009
0

Re: Help Please

I wasnt asking for the code. I wanted to get explantory steps on doing the programming. I myself wants to learn assembly too.
Reputation Points: 10
Solved Threads: 0
Newbie Poster
indianjk is offline Offline
2 posts
since Jun 2009
Jun 30th, 2009
0

Re: Help Please

Write your algorithm in C first. Once working then in assembly. C is close to assembly without the time consumption necessary to get your program working. Once you have your flow down, then do the assembly.
Post your C and your latest attempt at assembly (since you said you've been working on this for ages).

Then we can help!
Reputation Points: 546
Solved Threads: 99
Practically a Posting Shark
wildgoose is offline Offline
891 posts
since Jun 2009

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in Assembly Forum Timeline: Factorial
Next Thread in Assembly Forum Timeline: Arithmetic Overflow - MIPS





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC