|
-
Apr 23rd, 2001, 04:14 PM
#1
Does anyone have a string compare procedure in asm?
-
May 2nd, 2001, 10:24 PM
#2
Lively Member
All you need to do is go through each byte of the arrays and compare them with each other. If they are not equal, go to a different label. If you have reached the end of the arrays and all of them were equal then go to another label. I don't have a procedure, but I can write one if you want.
-
May 3rd, 2001, 01:28 AM
#3
Ya that would be cool. I tried to write one, but i just have trouble working with two strings.
-
Sep 13th, 2001, 08:37 PM
#4
New Member
_strcmp proc STDCALL wrd1:dword, wrd2:dword
mov ecx, wrd1
mov edx, wrd2
xor eax, eax
@@lop:
mov bl, byte ptr [ecx]
mov bh, byte ptr [edx]
cmp bl, bh
jne @@err
cmp bl, 0
je @@done
cmp bh, 0
je @@done
inc ecx
inc edx
jmp @@lop
@@err:
ret
@@done:
mov eax, 1
ret
_strcmp endp
A few months late but never mind!! LOL
-
Sep 13th, 2001, 09:35 PM
#5
A little late, but thanks for the reply. If you look into the newest APJ, the strmp routine i eventualy got to work is in there.
-
Oct 8th, 2001, 01:53 PM
#6
Hyperactive Member
TRY THIS
This is for using GCC... I hope this map come in useful...
Code:
inline char * strcpy(char * dest,const char *src)
{
__asm__("cld\n"
"1:\tlodsb\n\t"
"stosb\n\t"
"testb %%al,%%al\n\t"
"jne 1b"
: /* no output */
:"S" (src),"D" (dest):"si","di","ax","memory");
return dest;
}
Designer/Programmer of the Comtech Operating System(CTOS)
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|