Question: We've defined a function that rolls dice called roll, which returns a number 1 - 6 . Your task is to write an ABI -

We've defined a function that rolls dice called roll, which returns a number 1-6.
Your task is to write an ABI-complaint function sum_dice in nios2 assembly that takes as a single argument the number N, and calls roll N times, and returns the sum of all the returned rolls. For example, if you are given that N=2, you should call roll twice. If the first roll returns 6, and the second returns 2, your function should return 8.
The C-function prototype should look like unsigned int sum_dice(unsigned int N); though you must write the function in assembly!
We've defined a function that rolls dice called

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!