Database System Concepts
Database System Concepts
7th Edition
ISBN: 9780078022159
Author: Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher: McGraw-Hill Education
Bartleby Related Questions Icon

Related questions

bartleby

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
expand button
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
Check Mark
Knowledge Booster
Background pattern image
Computer Science
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
Recommended textbooks for you
Text book image
Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education
Text book image
Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON
Text book image
Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON
Text book image
C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON
Text book image
Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning
Text book image
Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education