home *** CD-ROM | disk | FTP | other *** search
- / strcmp.s (emx+gcc) -- Copyright (c) 1990-1993 by Eberhard Mattes
-
- .globl _strcmp
-
- / int strcmp (const char *string1, const char *string2)
- / {
- / int d;
- /
- / for (;;)
- / {
- / d = (int)(unsigned char)*string1 - (int)(unsigned char)*string2;
- / if (d != 0 || *string1 == 0 || *string2 == 0)
- / return (d);
- / ++string1; ++string2;
- / }
- / }
-
- / assumes ds=es!
-
- .text
-
- .align 2, 0x90
-
- _strcmp:
- pushl %esi
- pushl %edi
- movl 3*4(%esp), %esi / string1
- movl 4*4(%esp), %edi / string2
- .align 2, 0x90
- 1: lodsb
- scasb
- jne 2f
- orb %al, %al
- jne 1b
- xorl %eax, %eax
- popl %edi
- popl %esi
- ret
-
- .align 2, 0x90
- 2: subb -1(%edi), %al
- movsbl %al, %eax
- popl %edi
- popl %esi
- ret
-