Reference no: EM132200442
Question :
Write 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.
Having trouble writing this program on visual studio 2015 keep getting compile errors when i go by the example above. Need help on one that will compile and work correctly.