The input parameters should be a pointer to the source string and a pointer 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 "SABC9" and returns with EAX pointing to the "5" in the target string: NCLUDE Irvine32.inc Str_find PROTO, pTarget:PTR BYTE, pSource:PTR BYTE data arget BYTE "01ABAAAAAABABCC45ABC9012",0 Source BYTE "SABC9",0 str1 BYTE "Source string found at position ",0 str2 BYTE" in Target string (counting from zero).",0Ah,0Ah,0Dh,0 str3 BYTE "Unable to find Source string in Target string.",0Ah,0Ah,0Dh,0 stop DWORD? enTarget DWORD? enSource DWORD? Dosition DWORD? code main PROC INVOKE Str_find ADDR target, ADDR source mov position.cax jz wasfound; ZF-1 indicates string found mov edx,OFFSET str3; string not found call WriteString jmp quit was found:; display message mov edx,OFFSET str1 call WriteString moveax position; write position value call WriteDec mov edx,OFFSET str2 call WriteString quit: exit nan ENDP Str_find PROC. [....] your code] Str_find ENDP

C++ Programming: From Problem Analysis to Program Design
8th Edition
ISBN:9781337102087
Author:D. S. Malik
Publisher:D. S. Malik
Chapter7: User-defined Simple Data Types, Namespaces, And The String Type
Section: Chapter Questions
Problem 8PE: Write a program that reads in a line consisting of a students name, Social Security number, user ID,...
icon
Related questions
icon
Concept explainers
Question

can you please show me with the screen shot of the output, Thank you.

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 parameters should be a pointer to the source string and a pointer 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
"5ABC9" and returns with EAX pointing to the "5" in the target string:
INCLUDE Irvine32.inc
Str_find PROTO, pTarget:PTR BYTE, pSource:PTR BYTE
.data
target BYTE "01ABAAAAAABABCC45ABC9012",0
source BYTE "5ABC9",0
str1 BYTE "Source string found at position ",0
str2 BYTE" in Target string (counting from zero).",0Ah,0Ah,0Dh,0
str3 BYTE "Unable to find Source string in Target string.",0Ah,0Ah,0Dh,0
stop DWORD?
lenTarget DWORD?
lenSource DWORD?
position DWORD?
.code
main PROC
INVOKE Str find,ADDR target, ADDR source
mov position, eax
jz wasfound ; ZF=1 indicates string found
mov edx,OFFSET str3; string not found
call WriteString
jmp quit
wasfound:; display message
mov edx,OFFSET str1
call WriteString
mov eax,position; write position value
call WriteDec
mov edx,OFFSET str2
call WriteString
quit:
exit
main ENDP
Str find PROC. [....]
[your code]
Į
!
Į
Str_find ENDP
END main
Transcribed Image Text: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 parameters should be a pointer to the source string and a pointer 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 "5ABC9" and returns with EAX pointing to the "5" in the target string: INCLUDE Irvine32.inc Str_find PROTO, pTarget:PTR BYTE, pSource:PTR BYTE .data target BYTE "01ABAAAAAABABCC45ABC9012",0 source BYTE "5ABC9",0 str1 BYTE "Source string found at position ",0 str2 BYTE" in Target string (counting from zero).",0Ah,0Ah,0Dh,0 str3 BYTE "Unable to find Source string in Target string.",0Ah,0Ah,0Dh,0 stop DWORD? lenTarget DWORD? lenSource DWORD? position DWORD? .code main PROC INVOKE Str find,ADDR target, ADDR source mov position, eax jz wasfound ; ZF=1 indicates string found mov edx,OFFSET str3; string not found call WriteString jmp quit wasfound:; display message mov edx,OFFSET str1 call WriteString mov eax,position; write position value call WriteDec mov edx,OFFSET str2 call WriteString quit: exit main ENDP Str find PROC. [....] [your code] Į ! Į Str_find ENDP END main
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 5 steps with 3 images

Blurred answer
Knowledge Booster
Control Structure
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT