Question: Exercise 2.23 In this exercise, you will be asked to write a MIPS assembly program that converts strings into the number format as specifi ed

Exercise 2.23 In this exercise, you will be asked to write a MIPS assembly program that converts strings into the number format as specifi ed in the table.

a. positive integer decimal strings

b. two’s complement hexadecimal integers 2.23.1 [10] <2.9> Write a program in MIPS assembly language to convert an ASCII number string with the conditions listed in the table above, 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 nondigit 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 null-terminated string

“24”), then when the program stops, register $v0 should contain the value 24ten.

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 Computer Organization And Design Questions!