Question: Need help on writing a inline assembly language program subroutine that searches for a character in a string and returns the first occurrence of the
Need help on writing a inline assembly language program subroutine that searches for a character in a string and returns the first occurrence of the character in the string.
The subroutine must be called search and the string is passed in the ESI register. The character to search for should be placed in the AL register and the length of the string is in the ECX register.
The subroutine should return the location of the character in the EBX register, where the first character is 1 and if not found, returns 0.
For example, given a 10 character string in mystring = 'EXCELLENTE', locate the first 'X' character.
lea ESI,mystring mov al,'X' mov ecx,10 call search
------returns with EBX =2
lea ESI,mystring mov al,'Y' mov ecx,10 call search
------returns EBX = 0
The program must work for any sized string or character combination.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
