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 Strfind 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 ABC
Source BYTE "ABC",
Pos DWORD
code
INVOKE Strfind, ADDR source, ADDR target
Jnz notFound
Mov pos, eax ; store the position value
Refer to Programming Project on page
Sample Run:
ClirvinelsxamplesWroject VProject V DebigWMojectexe
Enter source string the ttring to search for: AMBA
Entor target string the atring to search from: ABARABRARABAT
Source atring found at position T in Target atring counting from zero
Do you uant to do another Gearch? yn all lower cace: y
Enter cource string the atring to search for: Mphak
Source string found at position in Target string counting fron zero
Do you Hant to do another search? yn all lower case; n
Preos any key to oxit
Extra Credit:
You may notice that in my solution, I only take lower case mathrmymathrmn 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:
If can take upper case letter as user's choice
If user's choice is NOT mathrmYmathrmymathrmN or n prompt error message and ask user to reenter choice.
This worth overall extra credit. No curve for this class. If you want one, do this extra credit so you get curve!
Due Date:
Turn in YourNameProjasm via Blackboard. Due date will be announced on Blackboard.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
