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...

;"begin " (lowercase)

.if byte ptr  == 98 && byte ptr  == 101 &&
    byte ptr  == 103 && byte ptr  == 105 &&
    byte ptr  == 110 && byte ptr  == 32

...

.endif
Xtreme This message was edited by xtreme, on 3/18/2001 11:01:54 AM
Posted on 2001-03-18 10:00:00 by xtreme
You can compare dwords, too.

;"begin " (lowercase)
.IF dword ptr ="igeb"  && word ptr =" n"
    ....
.ENDIF
It compares the first 4 chars with a DWORD, the last 2 with a WORD. Thomas
Posted on 2001-03-18 10:12:00 by Thomas
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, hutch@pbq.com.au
Posted on 2001-03-18 13:28:00 by hutch--