Question: Write a program in MIPS assembly language to convert an ASCII number string containing positive and negative integer decimal strings, to an integer. Your program
Write a program in MIPS assembly language to convert an ASCII number string containing positive and negative integer decimal strings, to an integer. Your program should expect register $a0 to hold the address of a null terminated string containing some combination of the digits 0 through 9. Your program should compute the integer value equivalent to this string of digits, then place the number in register $v0. If a non-digit character appears anywhere in the string, your program should stop with the value −1 in register $v0. For example, if register $a0 points to a sequence of three bytes 50ten, 52ten, 0ten (the nullterminated string “24”), then when the program stops, register $v0 should contain the value 24ten.
Step by Step Solution
3.49 Rating (162 Votes )
There are 3 Steps involved in it
MAIN addi sp sp 4 SW ra sp add t6 0 0x30 add t7 0 0x39 ... View full answer
Get step-by-step solutions from verified subject matter experts
