Question: Create a procedure named StringConcat which takes two strings and concatenates them. This procedure should receive a stack frame with 6 variables: the offsets of

Create a procedure named StringConcat which takes two strings and concatenates them.
This procedure should receive a stack frame with 6 variables: the offsets of two strings being concatenated, their lengths, the offset of the destination string, and its length.If the two strings being concatenated are too long (their lengths combined are longer than the length of the destination), return 0.Otherwise, concatenate the second string to the end of the first string with a space character in between them.Then return 1.
Hint: you may want to use movsb but point one of the two registers somewhere other than the start of a string.
Create a procedure named ToLowerCase which takes a string's offset and its size as parameters in a stack frame. This procedure should update the incoming string so that each character is lowercase.
Hint: Refer to lecture 13 for help on how to convert a character to lowercase.
Create a procedure named DisplayLetterCount which takes a string's offset and its size as parameters in a stack frame. This procedure should display how many times each letter appears in the incoming string. To write this procedure, do the following:
Convert the incoming string to lowercase by calling ToLowerCase.In a nested loop, loop over the characters in the lowercase string 26 times, once for each letter of the alphabet. In the inner loop, count how many times the current letter appears in the name. After the inner loop (but before the next iteration of the outer loop) display the letter if it appears at least once and how many times it appears.
Hint 1: The lowercase letters have ascii codes from 97-122. In first iteration of the outer loop, see if any character in the string equals 97(without quotes). That will tell you how many 'a' characters there are.Hint 2: When printing how many times a letter appears, print the letter first followed by the count. Recall that to print a letter with the Irvine32 library, we move its ascii code to AL and then call WriteChar.
When the user begins the program, ask for their first name and place it in one string variable. Then, ask for their last name and place it in another string variable. Pass both to the StringConcat procedure.
If the procedure returns 0, print an error message and end the program.Otherwise, print a welcome message including the user's concatenated full name.
Next, pass the user's name to the DisplayLetterCount procedure, which should display how many times each letter appears in their name.
Make sure that each procedure you write properly preserves any registers other than eax and properly cleans up the stack!

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!