kolibrios-fun/programs/system/MyKey/trunk/string.inc
Yogev Ezra 3d31c6abab 'kerpack' removed (it already exists on SVN in /programs/other folder). 'MyKey' updated till ver. 0.2
git-svn-id: svn://kolibrios.org@1816 a494cfbc-eb01-0410-851d-a64ba20cac60
2011-01-30 16:12:10 +00:00

95 lines
2.3 KiB
PHP

;****************************************
;* input: esi = pointer to string *
;* output: ecx = length of the string *
;****************************************
strlen:
push eax esi
xor ecx, ecx
@@:
lodsb
or al, al
jz @f
inc ecx
jmp @b
@@:
pop esi eax
ret
;*************************************************
;* input: esi = pointer to the src string *
;* edi = pointer to the dest string *
;* ecx = number of bytes to copy *
;*************************************************
strncpy:
push eax ecx esi edi
@@:
lodsb
stosb
or al, al
jz @f
dec ecx
jz @f
jmp @b
@@:
pop edi esi ecx eax
ret
;*************************************************
;* input: esi = pointer to the src string *
;* edi = pointer to the dest string *
;*************************************************
strcpy:
push esi edi
rep movsb
pop edi esi
ret
;*************************************************
;* input: esi = pointer to the src string *
;* edi = pointer to the dest string *
;*************************************************
strcat:
push esi
call strlen
add esi, ecx
call strcpy
pop esi
ret
;*************************************************
;* input: esi = pointer to the src string *
;* edi = pointer to the dest string *
;* ecx = number of bytes to copy *
;*************************************************
strncat:
push edi
push ecx esi
mov esi, edi
call strlen
add edi, ecx
pop esi ecx
call strncpy
pop edi
ret
;*************************************************
;* input: edi = pointer to the dest string *
;* al = byte to set the string to *
;*************************************************
;strset:
; push edi
; rep stosb
; pop edi
; ret
;*************************************************
;* input: edi = pointer to the dest string *
;* al = byte to set the string to *
;* ecx = number of bytes to set *
;*************************************************
strnset:
push edi ecx
rep stosb
pop ecx edi
ret