Question: Write an Assembly program called lab04b that does the following: Create a function which computes factorials: n! = n (n ? 1) ... 3 2

Write an Assembly program called lab04b that does the following:

Create a function which computes factorials: n! = n (n ? 1) ... 3 2 1 1, recursively; the assembly function needs to call itself somewhere.

Will be called from main with lab04b(n); (n will be passed in with the X0 register)

Do not use a loop in your program!

Use a function called my_mul for multiplicationsEach function must save on the stack all variables it modifies.

To multiply two numbers use X0 and X1 for arguments to the my_mul function; assume it will return X0 * X1

hint: will need to use the BL command; which register will the result be stored?

Make sure you comment the code.

Registers that are modified in the program and not used to return values should be stored on the Stack

The return value should go into X0

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 Databases Questions!