home *** CD-ROM | disk | FTP | other *** search
- ;****************************************************************************
- ; Filename: STRLEN.ASM
- ; Author: Peter Andersson
- ; Version: 0.0
- ; Created: 1995.02.09
- ; Updated: -
- ;****************************************************************************
- ; Copyright Peter Andersson, 1994-1995.
- ; All rights reserved.
- ;****************************************************************************
- ; Function: ULONG @strlen(PSZ string);
- ; Input: Eax, string - pointer to string
- ; Output: length of the string in bytes excluding '\0'
- ; Comment: strlen checks how long a string is in bytes excluding the '\0'.
- ;****************************************************************************
-
- Include STDDEF.INC
-
- Codeseg
-
- Proc strlen ,1
- Mov Ecx,Eax
- Jmp @@Next01
- Align 4
- @@Loop01: Add Eax,4
- @@Next01: Mov Edx,[Eax]
- TestZ Dl
- Jz @@Exit01
- TestZ Dh
- Jz @@Exit02
- Test Edx,0FF0000h
- Jz @@Exit03
- Test Edx,0FF000000h
- Jnz @@Loop01
- Add Eax,3
- Sub Eax,Ecx
- Ret
- Align 4
- @@Exit03: Add Eax,2
- Sub Eax,Ecx
- Ret
- Align 4
- @@Exit02: Inc Eax
- @@Exit01: Sub Eax,Ecx
- Ret
- Endp
-
- End