Question: Using Assembly Language for x86 Processors 7th Edition Your Task You are to create the strRemove procedure and create a second procedure called strNextWord that

Using Assembly Language for x86 Processors 7th Edition

Your Task

You are to create the strRemove procedure and create a second procedure called strNextWord that will replace the first occurrence of a specified character (delimiter) with the null character. This will essentially terminate the string.

If the delimiter was found the procedure should set the zero flag and the offset of the next character after the delimiter should be loaded into the eax. This means that from main you should be able to load into the edi the value in the eax register and print out the string after the word that was null terminated.

If the delimiter is not found the zero flag should be cleared to indicate that the delimiter was not contained in the string.

You should use the INVOKE directive to pass parameters.

Inputs:

A pointer to the string to search through

The delimiter character.

ExitProcess proto,dwExitCode:dword

strRemove PROTO, pStart:PTR BYTE, nChars:DWORD

.data ;// write your data in this section

target BYTE "This is a test", 0

.code ;// write your program here

main proc

INVOKE strRemove, ADDR [target + 4], 3

mov edx, OFFSET target

call WriteString

call Crlf

invoke ExitProcess,0

main endp

strRemove PROC, pStart:PTR BYTE, nChars: DWORD

INVOKE Str_Length, pStart

mov ecx, eax ;ecx length of string

.IF nChars <= ecx

sub ecx, nChars ;set counter for repetition

.ENDIF

mov esi, pStart ;points to the screen

add esi, nChars ;points to 1st char to remove

mov edi, pStart ;point to destination position

cld ;clear direction flag

rep movsb

mov BYTE PTR[edi], 0

ret

strRemove ENDP

end main

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!