Question: Help in MIPS please. In this assignment we are going to explore strings and arrays a bit more in addition to functions. Our goal for
Help in MIPS please. In this assignment we are going to explore strings and arrays a bit more in addition to functions. Our goal for the assignment will be to have the user input a string and then be able to make changes to the characters that are in the string until they are ready to stop. This means that we will need to read in several pieces of data from the user, including a string and multiple characters. You can set a maximum size for the user string, however, the specific size of the string can change and you can't ask them how long the string is see the sample runs In order to work with characters, we need to remember that each ASCII character is stored using a single byte. Finally, the actual exchanging of characters in the String should be done in its own function. Assume that you do not have access to the data segment of your program inside of the function and send in arguments and return values accordingly.
Requirements:
Name your file PLastNameFirstName.asm.
Use proper prompts and formatting so that someone who knows nothing about the program can understand what it is doing based on the information you are giving them.
While you can set how long the string can be at maximum, you can't tell the user a specific length that the string must be eg Enter a string of length and you can't ask them how long the string is
After you have their string, you will prompt them to see if they want to make any changes. If they do then read in the character that they want to change in the string and then the character that they want to change it to
All characters of the same type in the string can be affected, not just a single one of them. So if they choose to change the spaces to dashes, all spaces are affected. See sample run
Use a function to do the character swaps ensuring you maintain registers according to our conventions.
Assume that you do not have access to the data segment in the function, so you may not use the load address instruction inside of the function to load something from the data segment.
After each change print the current string out to them and ask if they want to make another change.
When they are finished making changes, print the final string and then exit the program properly.
Hints:
Our lab using strings and the previous assignment with the integer array can be helpful resources in addition to our in class examples.
Reading in a character is a little different from reading in an integer. Experiment with it to see what happens after you type in your character. They are very similar in usage though, as seen on the syscall table.
Remember we can use the ASCII chart to help or use characters themselves as immediate values.
Sample Runs:
Note user input is bolded and underlined for ease of reading and clarity, it is not done in the program
Run #:
This program reads in a String from the user and then allows the user to make changes to it until they want to stop.
Please enter your string now maximum of characters:
We can input a fairly long string.
Your current string is:
We can input a fairly long string.
Do you want to make any changes to the string? YN:Y
Enter the character in the string would you like replaced: i
Enter what you would like to change the character to:
Your current string is:
We can nput a farly long strng
Do you want to make any changes to the string? YN:Y
Enter the character in the string would you like replaced: a
Enter what you would like to change the character to: @
Your current string is:
We c@n nput @ f @rly long strng
Do you want to make any changes to the string? YN:N
Your final string is:
We c@n nput @ f@rly long strng
program is finished running
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
