Write a MIPS assembly language function with the following characteristics:
1)Obeys all applicable MIPS function calling conventions
2)Takes two arguments:
[url removed, login to view] argument: address of a null terminated string
[url removed, login to view] argument: An integer in the range of 2 to 16, inclusive
3)Returns an integer result
The first argument is the address of a sequence of digits, possibly starting with a “-“ (minus) sign. The function steps through the string of characters (in an appropriate direction) and converts the string to asigned integer value, assuming the integer base value given in the second argument. Negation is to be 2’s complement.
You can assume the following:
1)The first argument is a legitimate address, indicating the first character of a
string of characters.
2)The string of characters is terminated by a null character “\0”. This character is not considered part of the string.
3)It is possible the string is empty, that is, the character at the address in the first argument is the null [url removed, login to view] this case, a return value of zero is appropriate.
4)The result will fit into a 32-bit integer You may NOT assume all the characters in the string are legal with respect to the base argument. That is, you could encounter characters other than 0, 1, 2, 3, 4, 5, 6 and 7 when converting a base 8 number.
If any character is encountered which is not a legal digit for the base given, print an error message and return a zero result. Bases larger than 10 will use the upper case letters A, B, C, D, E and F as the digits larger that 9. Lower case letters will not be recognized as legal [url removed, login to view] string argument may begin with a “-“ sign indicating a negative number. In this case, convert the remaining digits and perform a 2’s complement operation before returning the result value. A minus sign is only permitted as the first character of the string. A plus “+” character is never legal in the string.
If the second argument is not in the range of 2 through 16 (inclusive), print an error
message and return a zero value.
I specialize in low-level assembly programming and embedded systems. Please contact me with more details of your job. Stay tuned, I'm still working on this proposal.