As part of this requirement, you must develop a library that contain functions to:
Please name your library MY_IO.asm
. This should use the definitions in IO_DEFS.asm. You may not use libraries (follow the examples and Jorgensen, not Carter).
You must observe the following:
You should then build a recursive function to calculate n!. n! is defined for any non-negative integer as : $$n! = \begin{cases} 1, & n= 0,1 \\n(n-1)!, & \text{otherwise} \\ \end{cases}$$ This function should use the calling convention to properly preserve and restore the base pointer and the stack pointer. In addition, for debugging purposes, the parameter n should be stored in the stack frame (or activation record). You must pass the parameter n as a parameter and return a value properly. No global variables in this function.
Your program should use the exact verbiage listed below:
This program will compute n! for a non-negative integer. Enter a value for n: 5 5! = 120
Please follow this format as I will grade your program with a script. There should be no spaces at the end of any line except the prompt line. There should be a newline at the end of every line except the newline. The user, in this example enters a 5, followed by newline.
factorial.asm
this should compile and link with MY_IO.asm
to build the factorial
program automatically.