Question: 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

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 P04LastNameFirstName.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 (e.g. Enter a string of length 10) 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 2)
- Use a function to do the character swap(s), 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.
In this assignment we are going to explore

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