1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Vinvika [58]
3 years ago
8

Write a procedure named Str_find that searches for the first matching occurrence of a source string inside a target string and r

eturns 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.
Computers and Technology
1 answer:
kirill115 [55]3 years ago
6 0

Answer: Provided in the explanation section

Explanation:

Str_find PROTO, pTarget:PTR BYTE, pSource:PTR BYTE

.data

target BYTE "01ABAAAAAABABCC45ABC9012",0

source BYTE "AAABA",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, pTarget:PTR BYTE, ;PTR to Target string

pSource:PTR BYTE ;PTR to Source string

;

; Searches for the first matching occurrence of a source

; string inside a target string.

; Receives: pointer to the source string and a pointer

;    to the target string.

; Returns: If a match is found, ZF=1 and EAX points to

; the offset of the match in the target string.

; IF ZF=0, no match was found.

;--------------------------------------------------------

  INVOKE Str_length,pTarget   ; get length of target

  mov lenTarget,eax

  INVOKE Str_length,pSource   ; get length of source

  mov lenSource,eax

  mov edi,OFFSET target       ; point to target

  mov esi,OFFSET source       ; point to source

; Compute place in target to stop search

  mov eax,edi    ; stop = (offset target)

  add eax,lenTarget    ; + (length of target)

  sub eax,lenSource    ; - (length of source)

  inc eax    ; + 1

  mov stop,eax           ; save the stopping position

; Compare source string to current target

  cld

  mov ecx,lenSource    ; length of source string

L1:

  pushad

  repe cmpsb           ; compare all bytes

  popad

  je found           ; if found, exit now

  inc edi               ; move to next target position

  cmp edi,stop           ; has EDI reached stop position?

  jae notfound           ; yes: exit

  jmp L1               ; not: continue loop

notfound:                   ; string not found

  or eax,1           ; ZF=0 indicates failure

  jmp done

found:                   ; string found

  mov eax,edi           ; compute position in target of find

  sub eax,pTarget

  cmp eax,eax    ; ZF=1 indicates success

done:

  ret

Str_find ENDP

END main

cheers i hoped this helped !!

You might be interested in
I need more friends plz talk with me
Bad White [126]

Answer:

hello hru??

Explanation:

<h2><em><u>PLEASE</u></em><em><u> MARK</u></em><em><u> ME</u></em><em><u> BRAINLIEST</u></em><em><u> AND</u></em><em><u> FOLLOW</u></em><em><u> ME</u></em><em><u> LOTS</u></em><em><u> OF</u></em><em><u> LOVE</u></em><em><u> FROM</u></em><em><u> MY</u></em><em><u> HEART</u></em><em><u> AND</u></em><em><u> SOUL</u></em><em><u> DARLING</u></em><em><u> TEJASWINI</u></em><em><u> SINHA</u></em><em><u> HERE</u></em><em><u> ❤️</u></em></h2>
6 0
3 years ago
Read 2 more answers
A company is experiencing overwhelming visits to a main web server. The IT department is developing a plan to add a couple more
Varvara68 [4.7K]
The answer is C) Availability.

Although the company is addressing scalability by adding more servers, the question is asking for security requirement. Therefore we need to choose one of the principles from CIA triad which includes confidentiality, integrity, and availability.

Integrity involves keeping the data accurate and confidentiality involves keeping the data between the sender and intended recipient(s). That being said, scalability and availability are the possible answers.

C) Availability is the best answer because it is part of the CIA triad.

Note: Another resource to look at for cyber security principles would be the Parkerian Hexad.
5 0
3 years ago
Read 2 more answers
If it is impractical to place guest users in a secure network, isolated from the production network by firewall barriers, then:
IgorLugansk [536]

Answer:

specific areas of access should be determined and they should be as restrictive as possible.

Explanation:

According to my research on security features of networks , I can say that based on the information provided within the question then specific areas of access should be determined and they should be as restrictive as possible. This would provide the highest level of security while still allowing production to be smooth.

I hope this answered your question. If you have any more questions feel free to ask away at Brainly.

7 0
3 years ago
Michael Holliday is a business systems analyst who is working on a feasibility study for a new​ e-911 system for the city of Mem
postnew [5]

Answer:

E

Explanation:

The requirement analysis phase is a very key vital phase of the system life cycle in which a system designer sees the future result of his input in the system he intends to design, the requirement analysis clearly state the result of any system in progress design and proccess stage

7 0
3 years ago
What is the most common way to perform searches in a search engine?
valina [46]
Using key words is the best way to search things in the search engine. make sure everything is spelled correctly.
5 0
2 years ago
Other questions:
  • If parties in a contract are not ____, the contract can be canceled.
    12·1 answer
  • Which file extension indicates that a file is an Adobe Acrobat document?
    13·1 answer
  • File Sales.java contains a Java program that prompts for and reads in the sales for each of 5 salespeople in a company. It then
    8·1 answer
  • Which of the following is true about scalability?
    9·1 answer
  • why is the disk method a special case of the general slicing​ method? choose the correct answer below. a. the cross sections of
    7·1 answer
  • Multiple Choice
    9·1 answer
  • You can minimize the Ribbon with a command contained on the _____.
    7·1 answer
  • Which of the following is the correct binary representation of the number 2?
    14·1 answer
  • A(n) ________ cloud does not free an organization from the issues associated with managing the cloud infrastructure, but it does
    7·1 answer
  • I have the requirements for Ace rank on Brainly but hasn't given me it yet. Does it just take longer than normal ranks or someth
    15·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!