Task: Finding a Substring in a String
Find all occurrences of the substring substring in the source_text string in the find_substring.asm file.
Display the results as follows:
Substring found at index: <N>
IMPORTANT: You cannot use the strstr library function (or similar) for this subtask.
TIP: For display, you can use both the PRINTF32 macro and the printf function, as in previous exercises. The steps for display using printf are as follows:
- push the value you want to display onto the stack (the position where the substring was found)
- push the address of the
print_formatstring onto the stack- call the
printffunction- clean up the parameters added earlier from the stack by adding the value 8 to the
espregister (each parameter is 4 bytes).
If you’re having difficulties solving this exercise, go through this reading material.