Subversion Repositories Kolibri OS

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
3749 GerdtR 1
;****************************************
2
;*  input:  esi = pointer to string     *
3
;*  output: ecx = length of the string  *
4
;****************************************
5
strlen:
6
      push	eax esi
7
      xor	ecx, ecx
8
      @@:
9
	lodsb
10
	or	al, al
11
	jz	@f
12
	inc	ecx
13
	jmp	@b
14
      @@:
15
      pop      esi eax
16
  ret
17
 
18
;*************************************************
19
;*  input:  esi = pointer to the src string      *
20
;*          edi = pointer to the dest string     *
21
;*          ecx = number of bytes to copy        *
22
;*************************************************
23
strncpy:
24
      push	eax ecx esi edi
25
      @@:
26
	lodsb
27
	stosb
28
	or	al, al
29
	jz	@f
30
	dec	ecx
31
	jz	@f
32
	jmp	@b
33
      @@:
34
      pop	edi esi ecx eax
35
  ret
36
 
37
;*************************************************
38
;*  input:  esi = pointer to the src string      *
39
;*          edi = pointer to the dest string     *
40
;*************************************************
41
strcpy:
42
     push  esi edi
43
     rep   movsb
44
     pop   edi esi
45
  ret
46
 
47
;*************************************************
48
;*  input:  esi = pointer to the src string      *
49
;*          edi = pointer to the dest string     *
50
;*************************************************
51
strcat:
52
     push  esi
53
     call  strlen
54
     add   esi, ecx
55
     call  strcpy
56
     pop   esi
57
  ret
58
 
59
;*************************************************
60
;*  input:  esi = pointer to the src string      *
61
;*          edi = pointer to the dest string     *
62
;*          ecx = number of bytes to copy        *
63
;*************************************************
64
strncat:
65
     push  edi
66
     push  ecx esi
67
     mov   esi, edi
68
     call  strlen
69
     add   edi, ecx
70
     pop   esi ecx
71
     call  strncpy
72
     pop   edi
73
  ret
74
 
75
;*************************************************
76
;*  input:  edi = pointer to the dest string     *
77
;*           al = byte to set the string to      *
78
;*************************************************
79
;strset:
80
;     push  edi
81
;     rep   stosb
82
;     pop   edi
83
;  ret
84
 
85
;*************************************************
86
;*  input:  edi = pointer to the dest string     *
87
;*           al = byte to set the string to      *
88
;*          ecx = number of bytes to set         *
89
;*************************************************
90
strnset:
91
     push    edi ecx
92
     repe    stosb
93
     pop     ecx edi
94
  ret