Discover the best answers at Westonci.ca, where experts share their insights and knowledge with you. Connect with a community of experts ready to provide precise solutions to your questions on our user-friendly Q&A platform. Get quick and reliable solutions to your questions from a community of experienced experts on our platform.
Sagot :
Answer:
Str_nextword PROC, pString:PTR BYTE, ; pointer to string delimiter:BYTE ; delimiter to find push esi mov al,delimiter mov esi,pString cld ; clear Direction flag (forward) L1: lodsb ; AL = [esi], inc(esi) cmp al,0 ; end of string? je L3 ; yes: exit with ZF = 0 cmp al,delimiter ; delimiter found? jne L1 ; no: repeat loop L2: mov BYTE PTR [esi-1],0 ; yes: insert null byte mov eax,esi ; point EAX to next character jmp Exit_proc ; exit with ZF = 1 L3: or al,1 ; clear Zero flag Exit_proc: pop esi ret Str_nextword ENDP
Explanation:
push esimov al,delimitermov esi,pStringcld ; clear Direction flag (forward)L1: lodsb ; AL = [esi], inc(esi)cmp al,0 ; end of string?je L3 ; yes: exit with ZF = 0cmp al,delimiter ; delimiter found?jne L1 ; no: repeat loopL2: mov BYTE PTR [esi-1],0 ; yes: insert null bytemov eax,esi ; point EAX to next characterjmp Exit_proc ; exit with ZF = 1L3: or al,1 ; clear Zero flagExit_proc:pop esiretStr_nextword ENDPStr_nextword ENDP
Thanks for using our service. We aim to provide the most accurate answers for all your queries. Visit us again for more insights. We hope you found what you were looking for. Feel free to revisit us for more answers and updated information. We're glad you visited Westonci.ca. Return anytime for updated answers from our knowledgeable team.