Is there a clearer way to do the following? It tests the beginning of a buffer for the word "begin ". I can't use Instring here for various reasons...
Xtreme This message was edited by xtreme, on 3/18/2001 11:01:54 AM
;"begin " (lowercase) .if byte ptr == 98 && byte ptr == 101 && byte ptr == 103 && byte ptr == 105 && byte ptr == 110 && byte ptr == 32 ... .endif
You can compare dwords, too.
It compares the first 4 chars with a DWORD, the last 2 with a WORD. Thomas
;"begin " (lowercase) .IF dword ptr ="igeb" && word ptr =" n" .... .ENDIF
xtreme, If its just the start of the buffer that you need to test, you could use CMPSB to do the comparison. Means setting up a loop but its simple enough code to write. All you do is have your source string "begin " in a buffer and the string you wish to test in a buffer, load them into ESI/EDI and do the comparison. You use CMPSB with one of the REP prefixes and just set up the test you require. If it matches CMPSB will read the length you set in ECX, if not, it will exit on mismatch and you can test ECX to check if it was a match or not. Regards, firstname.lastname@example.org