[solved]-Write Procedure Named Strfind Searches First Matching Occurrence Source String Inside Targ Q39024293
Write a procedure named Str_find that searches for the firstmatching occurrence of a source string inside a target string andreturns the matching position. The input prameters should be apointer to the source string and a point to the target string. If amatch is found, the procedure sets the Zero flag and EAX points tothe matching position in the target string. Otherwise, the Zeroflag is clear and EAX is undefined. The following code, forexample, searches for “ABC” and returns with EAX pointing to the“A” in the target string.
.data
Target BYTE “123ABC342342”, 0
Source BYTE “ABC”, 0
Pos DWORD ?
.code
INVOKE Str_find, ADDR source, ADDR target
Jnz notFound
Mov pos,eax ;store the position value

Extra Credit:
You may notice that in my solution, I only take lower case y/nbecause I used “call ReadChar” and “call WriteChar” to get theuser’s choice and display the user’s choice. If user try to typecapital Y, the program will exit since it will read the “shift” keyas user’s input. Any input different from lower case y will beconsider a NO choice
Modify your solution so that it all handle the following twocases:
1. If can take upper case letter as user’s choice
2. If user’s choice is NOT Y, y, N, or n, prompt error message andask user to reenter choice.
х C:IrvineExamples Project32_VS2015Project32 VS2015Debug Project.exe – Enter source string (the string to search for: AABA Enter target string (the string to search from): 0123ABAAABAAAABA789 Source string found at position 7 in Target string (counting from zero). (ahl Florida ARABSABAAABAAABAT Zero). Do you want to do another search? y/n (all lower case): y Enter source string (the string to search for: AAABA Enter target string (the string to search from): 0123ABAAABAAAABA789 Source string found at position 6 in Target string (counting from zero). Do you want to do another search? y/n (all lower case): n Press any key to exit … Show transcribed image text х C:IrvineExamples Project32_VS2015Project32 VS2015Debug Project.exe – Enter source string (the string to search for: AABA Enter target string (the string to search from): 0123ABAAABAAAABA789 Source string found at position 7 in Target string (counting from zero). (ahl Florida ARABSABAAABAAABAT Zero). Do you want to do another search? y/n (all lower case): y Enter source string (the string to search for: AAABA Enter target string (the string to search from): 0123ABAAABAAAABA789 Source string found at position 6 in Target string (counting from zero). Do you want to do another search? y/n (all lower case): n Press any key to exit …
Expert Answer
Answer to Write a procedure named Str_find that searches for the first matching occurrence of a source string inside a target stri… . . .
OR

