Subversion Repositories Kolibri OS

Rev

Rev 8824 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
8919 IgorA 1
include "..\..\develop\info3ds\info_fun_float.inc"
8824 IgorA 2
 
3
align 4
4
proc @DoubleToStr$qduso uses esi edi
8140 IgorA 5
  cld
8824 IgorA 6
  lea  esi,[esp+12]
7
  mov  edi,Data_Double
8
  movsd
9
  movsd
10
  mov  ax,[esp+20]
11
  mov [NumberSymbolsAD],ax
12
  call DoubleFloat_to_String
13
  cmp dword[esp+24],0
14
  je @f
15
  call String_crop_0
16
  @@:
17
  mov eax,Data_String
18
  ret
19
endp
20
 
21
align 4
22
proc @StrToDouble$qpc uses esi edi
23
  cld
24
  mov edi,Data_String
25
  mov esi,[esp+12]
26
  mov ecx,32
27
  repnz movsb
28
  call String_to_DoubleFloat
29
  fld qword[Data_Double]
30
  ret
31
endp
32
 
33
;input:
34
; *str - указатель на строку, число должно быть в 10 или 16 ричном виде
35
;output:
36
; eax - число
37
align 4
38
proc @StrToInt$qpc uses ebx esi
39
	xor eax,eax
40
	xor ebx,ebx
41
	mov esi,[esp+12]
42
 
43
	;на случай если перед числом находятся пробелы
44
	@@:
45
	cmp byte[esi],' '
46
	jne @f
47
		inc esi
48
		jmp @b
49
	@@:
50
 
51
	;определение отрицательных чисел
52
	xor ecx,ecx
53
	inc ecx
54
	cmp byte[esi],'-'
55
	jne @f
56
		dec ecx
57
		inc esi
58
	@@:
59
 
60
	cmp word[esi],'0x'
61
	je .load_digit_16
62
 
63
	.load_digit_10: ;считывание 10-тичных цифр
64
		mov bl,byte[esi]
65
		cmp bl,'0'
66
		jl @f
67
		cmp bl,'9'
68
		jg @f
69
			sub bl,'0'
70
			imul eax,10
71
			add eax,ebx
72
			inc esi
73
			jmp .load_digit_10
74
	jmp @f
75
 
76
	.load_digit_16: ;считывание 16-ричных цифр
77
		add esi,2
78
	.cycle_16:
79
		mov bl,byte[esi]
80
		cmp bl,'0'
81
		jl @f
82
		cmp bl,'f'
83
		jg @f
84
		cmp bl,'9'
85
		jle .us1
86
			cmp bl,'A'
87
			jl @f ;отсеиваем символы >'9' и <'A'
88
		.us1: ;составное условие
89
		cmp bl,'F'
90
		jle .us2
91
			cmp bl,'a'
92
			jl @f ;отсеиваем символы >'F' и <'a'
93
			sub bl,32 ;переводим символы в верхний регистр, для упрощения их последущей обработки
94
		.us2: ;составное условие
95
			sub bl,'0'
96
			cmp bl,9
97
			jle .cor1
98
				sub bl,7 ;convert 'A' to '10'
99
			.cor1:
100
			shl eax,4
101
			add eax,ebx
102
			inc esi
103
			jmp .cycle_16
104
	@@:
105
	or ecx,ecx ;если число отрицательное
106
	jnz @f
107
		sub ecx,eax
108
		mov eax,ecx
109
	@@:
110
	ret
111
endp
112
 
113
align 4
114
proc @strlen$qpxc uses edi
115
  cld
8140 IgorA 116
  mov  edi,[esp+8]
117
  mov  ecx,-1
118
  xor  al,al
8824 IgorA 119
  repnz scasb
8140 IgorA 120
  not  ecx
121
  lea  eax,[ecx-1]
122
  ret
123
endp
124
 
8824 IgorA 125
align 4
126
proc @strcpy$qpcpxc uses esi edi
8140 IgorA 127
  cld
128
  mov  edi,[esp+16]
129
  mov  ecx,-1
130
  mov  esi,edi
131
  xor  al,al
8824 IgorA 132
  repnz scasb
8140 IgorA 133
  not  ecx
134
  mov  edi,[esp+12]
135
  mov  edx,ecx
136
  mov  eax,edi
137
  shr  ecx,2
8824 IgorA 138
  rep movsd
8140 IgorA 139
  mov  ecx,edx
140
  and  ecx,3
8824 IgorA 141
  rep movsb
8140 IgorA 142
  ret
143
endp
144
 
8824 IgorA 145
align 4
146
proc @memcpy$qpvpxvui uses esi edi
8140 IgorA 147
  cld
148
  mov  edi,[esp+12]
149
  mov  eax,edi
150
  mov  ecx,[esp+20]
151
  mov  esi,[esp+16]
152
  mov  edx,ecx
153
  shr  ecx,2
8824 IgorA 154
  rep movsd
8140 IgorA 155
  mov  ecx,edx
156
  and  ecx,3
8824 IgorA 157
  rep movsb
8140 IgorA 158
  ret
159
endp
160
 
8824 IgorA 161
align 4
162
proc @memset$qpvcui uses edi
8140 IgorA 163
  cld
164
  mov  edi,[esp+8]
165
  mov  al,[esp+12]
166
  mov  ah,al
167
  mov  dx,ax
168
  shl  eax,16
169
  mov  ax,dx
170
  mov  ecx,[esp+16]
171
  mov  edx,ecx
172
  shr  ecx,2
8824 IgorA 173
  rep stosd
8140 IgorA 174
  mov  ecx,edx
175
  and  ecx,3
8824 IgorA 176
  rep stosb
8140 IgorA 177
  mov  eax,[esp+4]
178
  ret
179
endp
180
 
8824 IgorA 181
align 4
182
proc @strcmp$qpxct1 uses esi edi
183
	cld
184
	xor	eax,eax
185
	mov	edi,[esp+16]
186
	mov	esi,edi
187
	mov	ecx,-1
188
	repne scasb
189
	not	ecx
190
	mov	edi,esi
191
	mov	esi,[esp+12]
192
	repe  cmpsb
193
	mov	al,[esi-1]
194
	movzx edx,byte[edi-1]
195
	sub	eax,edx
196
	ret
197
endp
198
 
199
align 4
200
proc @strchr$qpxci uses edi
201
	mov	edi,[esp+8]
202
	mov	edx,edi
203
	mov	ecx,-1
204
	xor	eax,eax
205
	cld
206
	repne scasb
207
	not	ecx
208
	mov	edi,edx
209
	mov	al,[esp+12]
210
	repne scasb
211
	jnz	@f
212
	lea	eax,[edi-1]
213
	ret
214
@@:
215
	xor	eax,eax
216
	ret
217
endp
218
 
219
align 4
220
proc @strstr$qpxct1 uses ebx esi edi
221
	xor  eax,eax
222
	mov  esi,[esp+16]
223
	test esi,esi
224
	je   .not_f
225
	mov  edi,[esp+20]
226
	test edi,edi
227
	je   .not_f
228
	mov  edx,edi
229
	mov	 ecx,-1
230
	cld
231
	repne scasb
232
	not	 ecx
233
	mov  ebx,ecx ;ebx = strlen(str2)
234
align 4
235
.cycle:
236
	cmp  byte[esi],0
237
	je   .not_f
238
	mov  edi,edx
239
	push esi
240
	mov  ecx,ebx
241
	repe cmpsb
242
	pop  esi
243
	inc  esi
244
	cmp  byte[edi-1],0
245
	jne  .cycle
246
 
247
	lea  eax,[esi-1]
248
.not_f:
249
	ret
250
endp
251
 
252
align 4
8140 IgorA 253
proc __ftol
254
  sub  esp,12
255
  wait
256
  fstcw word [esp+8]
257
  wait
258
  mov  al,[esp+9]
8824 IgorA 259
  or  byte [esp+9],0x0c
8140 IgorA 260
  fldcw word [esp+8]
261
  fistp qword [esp]
262
  mov  [esp+9],al
263
  fldcw word [esp+8]
264
  mov  eax,[esp]
265
  mov  edx,[esp+4]
266
  add  esp,12
267
  ret
268
endp
269
 
8824 IgorA 270
align 4
271
proc @floor$qd
8140 IgorA 272
  fld  qword [esp+4]
273
  mov  ax,[esp+10]
274
  shl  ax,1
275
  cmp  ax,0x8680
8824 IgorA 276
  ja  .floor_end
8140 IgorA 277
  mov  ch,4
278
  sub  esp,2
279
  wait
280
  fstcw word [esp]
281
  mov  ax,0xf3ff
282
  wait
283
  mov  dx,[esp]
284
  and  ax,dx
8824 IgorA 285
  or  ah,ch
8140 IgorA 286
  mov  [esp],ax
287
  fldcw word [esp]
288
  frndint
289
  mov  [esp],dx
290
  fldcw word [esp]
291
  add  esp,2
292
.floor_end:
293
  ret
294
endp
8919 IgorA 295
 
296
align 4
297
proc @MessageBox$qpc
298
	mov eax,[esp+4]
299
	notify_window_run eax
300
	ret
301
endp