Question: MIPS: write a function CheckName to compare the name with the input string. CheckName takes the addresses of two strings and returns 1 if those

MIPS: write a function CheckName to compare the name with the input string. CheckName takes the addresses of two strings and returns 1 if those two strings match or returns 0 otherwise

using:

.data

names: .asciiz julia, steven, daniel, kate, adrian

cities: .asciiz boston, new york, chicago, pittsburgh, denver

As you are checking for a name match, keep track of the current index of array names. For example, julia is at index 0, daniel is at index 2 and so on. If you get a name match, you can use the index to find out the corresponding city from that index of the cities array using another function called LookUp. The function LookUp takes the address of a string array and an index, and returns the address of the string at that index.

You also need to keep track of the address of the current string in the names array. To increment this address by the correct amount after each loop iteration, you can use another function called StrSize. The function StrSize takes the address of a string and returns the number of characters before the next null (0x00) character (the size of the string).

If you reach the end of the names array, then there is no match of available names with the input name. In that case your program will print Not found! and exit.

here are the outputs:

 MIPS: write a function CheckName to compare the name with the

input string. CheckName takes the addresses of two strings and returns 1

I also want to know if the names are considered as words or halfs because I am not sure what to do.

Please enter a name kate this is the input City is: pittsbucgh

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 Databases Questions!