Question: Problem Description: Write a procedure named Str _ find that searches for the first matching occurrence of a source string inside a target string and

Problem Description:
Write a procedure named Str_find that searches for the first matching occurrence of a source string inside a target string and returns the matching position. The input prameters should be a pointer to the source string and a point to the target string. If a match is found, the procedure sets the Zero flag and EAX points to the matching position in the target string. Otherwise, the Zero flag is clear and EAX is undefined. The following code, for example, searches for "\( A B C \)" 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
(Refer to Programming Project 4 on page 386)
Sample Run:
```
* ClirvinelsxamplesWroject32 V52015\Project32 V52015\ DebigWMojectexe
Enter source string (the ttring to search for): AMBA
Entor target string (the atring to search from): 0123ABARABRARABAT89
Source atring found at position T in Target atring (counting from zero).
Do you uant to do another Gearch? y/n (all lower cace): y
Enter cource string (the atring to search for): Mphak
```
```
Source string found at position 6 in Target string (counting fron zero).
Do you Hant to do another search? y/n (all lower case); n
Preos any key to oxit ...........
```
Extra Credit:
You may notice that in my solution, I only take lower case \(\mathrm{y}/\mathrm{n}\) because I used "call ReadChar" and "call WriteChar" to get the user's choice and display the user's choice. If user try to type capital \( Y \), the program will exit since it will read the "shift" key as user's input. Any input different from lower case y will be consider a NO choice Modify your solution so that it all handle the following two cases:
1. If can take upper case letter as user's choice
2. If user's choice is NOT \(\mathrm{Y},\mathrm{y},\mathrm{N}\), or n , prompt error message and ask user to reenter choice.
This worth \(2\%\) overall extra credit. No curve for this class. If you want one, do this extra credit so you get 2\% curve!
Due Date:
Turn in YourNameProj9.asm via Blackboard. Due date will be announced on Blackboard.
Problem Description: Write a procedure named Str

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!