Westonci.ca connects you with experts who provide insightful answers to your questions. Join us today and start learning! Discover comprehensive answers to your questions from knowledgeable professionals on our user-friendly platform. Connect with a community of professionals ready to provide precise solutions to your questions quickly and accurately.
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 platform. We aim to provide accurate and up-to-date answers to all your queries. Come back soon. We appreciate your time. Please revisit us for more reliable answers to any questions you may have. Thank you for using Westonci.ca. Come back for more in-depth answers to all your queries.