Question: Write an ASM program that prompts the user to enter a string of at most 128 characters and then displays the string in reverse order,


Write an ASM program that prompts the user to enter a string of at most 128 characters and then displays the string in reverse order, with: each lower-case letter converted to its corresponding upper-case letter, and each upper-case letter converted to the lower-case letter following it (eg 'A' will be converted to 'b', 'X' will be converted to 'y'). The program should also display the number of lower-case letters after displaying the output string, as well as the total number of characters in the string. For instance, a sample execution of "Ass2-Q2.exe" with the input string "An Input Line!" is shown below C: Programming lasm>Ass 1-22 Enter a string of at most 128 characters: An Input Line! Here it is, with all lowercases and uppercases flipped, and in reverse order: !ENIM TUPN Nb There are 3 upper-case letters after conversion. There are 14 characters in the string. C:\Programming lasm> HINT: Solving this question in the following sequential order will be much easier; though you can solve the way you want. It is always much easier to solve a problem when you break it down into smaller problems; don't care if your code is long. 1) First, read the string from the keyboard into a memory variable; make sure your string does not contain the upper-case character 'Z' for obvious reason (though, you can try to see what happens if there is a 'Z'). Count the number of characters while reading the string. 2) Second, convert initial upper-cases to lower-cases next to them and initial lower- cases to upper-cases; be careful here. You can also do this while reading the string. 3) Third, count the final number of lower-cases; after converting all upper-cases to lower-cases next to them. You can also do this while reading the string. 4) Fourth, print the resulting string in reverse order, by using indirect addressing (or indexed addressing, if you wish). Also, be careful here since there are two possible ways: you can either first reverse the initial string first then display the resulting reversed string, or you can directly display the initial string in reverse order. 5) Display the two counts. If the user enters more than 128 characters, only the first 128 characters must be processed (the rest are ignored but make sure that you cannot write outside the memory you have allocated for storing the string). Also, try to make use of data-related operators as much as possible, such as OFFSET, SIZEOF, TYPE, LENGTHOF, DUP or PTR, in order to make your program as flexible as possible and as short/efficient as possible); see Chapt_04-c. Write an ASM program that prompts the user to enter a string of at most 128 characters and then displays the string in reverse order, with: each lower-case letter converted to its corresponding upper-case letter, and each upper-case letter converted to the lower-case letter following it (eg 'A' will be converted to 'b', 'X' will be converted to 'y'). The program should also display the number of lower-case letters after displaying the output string, as well as the total number of characters in the string. For instance, a sample execution of "Ass2-Q2.exe" with the input string "An Input Line!" is shown below C: Programming lasm>Ass 1-22 Enter a string of at most 128 characters: An Input Line! Here it is, with all lowercases and uppercases flipped, and in reverse order: !ENIM TUPN Nb There are 3 upper-case letters after conversion. There are 14 characters in the string. C:\Programming lasm> HINT: Solving this question in the following sequential order will be much easier; though you can solve the way you want. It is always much easier to solve a problem when you break it down into smaller problems; don't care if your code is long. 1) First, read the string from the keyboard into a memory variable; make sure your string does not contain the upper-case character 'Z' for obvious reason (though, you can try to see what happens if there is a 'Z'). Count the number of characters while reading the string. 2) Second, convert initial upper-cases to lower-cases next to them and initial lower- cases to upper-cases; be careful here. You can also do this while reading the string. 3) Third, count the final number of lower-cases; after converting all upper-cases to lower-cases next to them. You can also do this while reading the string. 4) Fourth, print the resulting string in reverse order, by using indirect addressing (or indexed addressing, if you wish). Also, be careful here since there are two possible ways: you can either first reverse the initial string first then display the resulting reversed string, or you can directly display the initial string in reverse order. 5) Display the two counts. If the user enters more than 128 characters, only the first 128 characters must be processed (the rest are ignored but make sure that you cannot write outside the memory you have allocated for storing the string). Also, try to make use of data-related operators as much as possible, such as OFFSET, SIZEOF, TYPE, LENGTHOF, DUP or PTR, in order to make your program as flexible as possible and as short/efficient as possible); see Chapt_04-c
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
