Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Systems On GPUs In Databases

Authors: Johns Paul ,Shengliang Lu ,Bingsheng He

1st Edition

1680838482, 978-1680838480

Students also viewed these Databases questions