Skip to content

Instantly share code, notes, and snippets.

@Mischa-Alff
Created May 22, 2014 14:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Mischa-Alff/f68dbc034854bbae4b45 to your computer and use it in GitHub Desktop.
Save Mischa-Alff/f68dbc034854bbae4b45 to your computer and use it in GitHub Desktop.
strlen:
mov esi, eax
xor ecx, ecx
.loop:
mov edx, [esi+ecx]
cmp edx, 0
je .end
inc ecx
jmp .loop
.end:
mov eax, ecx
ret
strcmp:
pop eax
pop ebx
push eax
call strlen
push eax
mov eax, ebx
call strlen
mov ecx, eax
pop edx
pop eax
cmp edx, ecx
jne .false
mov edi, eax
mov esi, ebx
.loop:
cmp [edi+ecx], [esi+ecx]
jne .false
loop .loop
mov eax, 1
ret
.false:
mov eax, 0
ret
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment