Subversion Repositories Kolibri OS

Rev

Rev 2125 | Rev 7575 | Go to most recent revision | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 2125 Rev 2159
1
struct FileInfoBlock
1
struct FileInfoBlock
2
	Function dd ?
2
	Function dd ?
3
	Position dd ?
3
	Position dd ?
4
	Flags	 dd ?
4
	Flags	 dd ?
5
	Count	 dd ?
5
	Count	 dd ?
6
	Buffer	 dd ?
6
	Buffer	 dd ?
7
		db ?
7
		db ?
8
	FileName dd ?
8
	FileName dd ?
9
ends
9
ends
10
 
10
 
11
struct TexColViv
11
struct TexColViv
12
	Text  rb MAX_COLOR_WORD_LEN ; ñëîâî äëÿ ïîäñâåòêè
12
	Text  rb MAX_COLOR_WORD_LEN ; ñëîâî äëÿ ïîäñâåòêè
13
	f1    dd 0 ; ñïðàâêà ïî ñëîâó
13
	f1    dd 0 ; ñïðàâêà ïî ñëîâó
14
	flags db ? ; f1+4 ôëàãè èñïîëüçóåìûå ïðè âûäåëåíèè
14
	flags db ? ; f1+4 ôëàãè èñïîëüçóåìûå ïðè âûäåëåíèè
15
	endc  db ? ; f1+5 ñèìâîë êîíöà âûäåëåíèÿ (èñïîëüçóåòñÿ ïðè flags&4)
15
	endc  db ? ; f1+5 ñèìâîë êîíöà âûäåëåíèÿ (èñïîëüçóåòñÿ ïðè flags&4)
16
	escc  db ? ; f1+6 ýêðàíèðóþùèé ñèìâîë (èñïîëüçóåòñÿ ïðè flags&4)
16
	escc  db ? ; f1+6 ýêðàíèðóþùèé ñèìâîë (èñïîëüçóåòñÿ ïðè flags&4)
17
	color db ? ; f1+7 íîìåð öâåòà
17
	color db ? ; f1+7 íîìåð öâåòà
18
ends
18
ends
19
 
19
 
20
count_colors_text dd 1
20
count_colors_text dd 1
21
ColWords dd 0
21
ColWords dd 0
22
color_cursor dd ?
22
color_cursor dd ?
23
color_wnd_capt dd ?
23
color_wnd_capt dd ?
24
color_wnd_work dd ?
24
color_wnd_work dd ?
25
color_wnd_bord dd ?
25
color_wnd_bord dd ?
26
color_select dd ?
26
color_select dd ?
27
color_cur_text dd ?
27
color_cur_text dd ?
28
color_wnd_text dd ?
28
color_wnd_text dd ?
29
 
29
 
30
options_file dd 0
30
options_file dd 0
31
options_file_end dd 0
31
options_file_end dd 0
32
tex_colors dd 0
32
tex_colors dd 0
33
tex_help_f1 dd 0
33
tex_help_f1 dd 0
34
 
34
 
35
Col dd 0 ;óêàçàòåëü íà ñòðóêòóðû êëþ÷åâûõ ñëîâ TexColViv
35
Col dd 0 ;óêàçàòåëü íà ñòðóêòóðû êëþ÷åâûõ ñëîâ TexColViv
36
 
36
 
37
keyUpr dd 0
37
keyUpr dd 0
38
err_opn db 0 ;îøèáêà îòêðûòèÿ ôàéëà
38
err_opn db 0 ;îøèáêà îòêðûòèÿ ôàéëà
39
err_sav db 0 ;îøèáêà ñîõðàíåíèÿ ôàéëà
39
err_sav db 0 ;îøèáêà ñîõðàíåíèÿ ôàéëà
40
 
40
 
41
sc system_colors
41
sc system_colors
42
 
42
 
43
run_file_70 FileInfoBlock
43
run_file_70 FileInfoBlock
44
 
44
 
45
align 4
45
align 4
46
InitColText:
46
InitColText:
47
	pushad
47
	pushad
48
 
48
 
49
	mov  ebx,dword[fn_col_option]
49
	mov  ebx,dword[fn_col_option]
50
	copy_path ebx,fn_syntax_dir,file_name_rez,0
50
	copy_path ebx,fn_syntax_dir,file_name_rez,0
51
	copy_path file_name_rez,sys_path,file_name,0
51
	copy_path file_name_rez,sys_path,file_name,0
52
 
52
 
53
  mov eax,70
53
  mov eax,70
54
  mov [run_file_70.Function], 0
54
  mov [run_file_70.Function], 0
55
  mov [run_file_70.Position], 0
55
  mov [run_file_70.Position], 0
56
  mov [run_file_70.Flags], 0
56
  mov [run_file_70.Flags], 0
57
  mov ebx,[options_file_end]
57
  mov ebx,[options_file_end]
58
  sub ebx,[options_file]
58
  sub ebx,[options_file]
59
  mov [run_file_70.Count], ebx
59
  mov [run_file_70.Count], ebx
60
  m2m [run_file_70.Buffer], [options_file]
60
  m2m [run_file_70.Buffer], [options_file]
61
  mov byte[run_file_70+20], 0
61
  mov byte[run_file_70+20], 0
62
  mov [run_file_70.FileName], file_name
62
  mov [run_file_70.FileName], file_name
63
  mov ebx,run_file_70
63
  mov ebx,run_file_70
64
  int 0x40
64
  int 0x40
65
 
65
 
66
 
66
 
67
	;init: count_colors_text, ColWords, ...
67
	;init: count_colors_text, ColWords, ...
68
	mov dword[count_colors_text],1
68
	mov dword[count_colors_text],1
69
	mov dword[ColWords],0
69
	mov dword[ColWords],0
70
	mov dword[tex_help_f1],0
70
	mov dword[tex_help_f1],0
71
 
71
 
72
  cmp eax,6
72
	cmp eax,6
73
  je @f
73
	je @f
74
  cmp eax,0
74
	cmp eax,0
75
  je @f
75
	je @f
76
    cmp ax,10
76
		cmp ax,10
77
    jl .zifra_0_9
77
		jl .zifra_0_9
78
      mov al,'?'
78
			mov al,'?'
79
      sub ax,48
79
			sub ax,48
80
    .zifra_0_9:
80
		.zifra_0_9:
81
    add ax,48
81
		add ax,48
82
 
-
 
83
    jmp .no_colors
82
		jmp .no_colors
84
  @@:
83
	@@:
85
 
84
 
86
	mov esi,[options_file]
85
	mov esi,[options_file]
87
	mov edi,count_colors_text
86
	mov edi,count_colors_text
88
	mov ecx,9*4
87
	mov ecx,9*4
89
	rep movsb
88
	rep movsb
90
 
89
 
91
	mov eax,[options_file]
90
	mov eax,[options_file]
92
	add eax,32
91
	add eax,32
93
	mov dword[tex_colors],eax
92
	mov dword[tex_colors],eax
94
 
93
 
95
	mov eax,dword[count_colors_text] ;init: Col (offset to key words)
94
	mov eax,dword[count_colors_text] ;init: Col (offset to key words)
96
	add eax,8
95
	add eax,8
97
	shl eax,2
96
	shl eax,2
98
	add eax,[options_file]
97
	add eax,[options_file]
99
	mov dword[Col],eax
98
	mov dword[Col],eax
100
 
99
 
101
	;init: tex_help_f1
100
	;init: tex_help_f1
102
	mov ecx,dword[ColWords]
101
	mov ecx,dword[ColWords]
103
	imul ecx,sizeof.TexColViv
102
	imul ecx,sizeof.TexColViv
104
	add ecx,dword[Col]
103
	add ecx,dword[Col]
105
	mov dword[tex_help_f1],ecx
104
	mov dword[tex_help_f1],ecx
106
 
105
 
107
	;ôîðìèðîâàíèå òåêñòà â îêíå òåêñòîâîãî ðåäàêòîðà
106
	;ôîðìèðîâàíèå òåêñòà â îêíå òåêñòîâîãî ðåäàêòîðà
108
	stdcall [ted_clear], tedit0,1
107
	stdcall [ted_clear], tedit0,1
109
 
108
 
110
	stdcall print_capt,capt_header
109
	stdcall print_capt,capt_header
111
 
110
 
112
	stdcall print_capt,col_1
111
	stdcall print_capt,col_1
113
	stdcall print_color,[color_cursor]
112
	stdcall print_color,[color_cursor]
114
	stdcall print_capt,col_2
113
	stdcall print_capt,col_2
115
	stdcall print_color,[color_wnd_capt]
114
	stdcall print_color,[color_wnd_capt]
116
	stdcall print_capt,col_3
115
	stdcall print_capt,col_3
117
	stdcall print_color,[color_wnd_work]
116
	stdcall print_color,[color_wnd_work]
118
	stdcall print_capt,col_4
117
	stdcall print_capt,col_4
119
	stdcall print_color,[color_wnd_bord]
118
	stdcall print_color,[color_wnd_bord]
120
	stdcall print_capt,col_5
119
	stdcall print_capt,col_5
121
	stdcall print_color,[color_select]
120
	stdcall print_color,[color_select]
122
	stdcall print_capt,col_6
121
	stdcall print_capt,col_6
123
	stdcall print_color,[color_cur_text]
122
	stdcall print_color,[color_cur_text]
124
 
123
 
125
	stdcall print_capt,col_7
124
	stdcall print_capt,col_7
126
	mov ecx,[count_colors_text] ;êîëè÷åñòâî öâåòîâ òåêñòà
125
	mov ecx,[count_colors_text] ;êîëè÷åñòâî öâåòîâ òåêñòà
127
	mov eax,[tex_colors]
126
	mov eax,[tex_colors]
128
	@@:
127
	@@:
129
		stdcall print_capt,capt_type_dd
128
		stdcall print_capt,capt_type_dd
130
		stdcall print_color,[eax]
129
		stdcall print_color,[eax]
131
		add eax,4
130
		add eax,4
132
	loop @b
131
	loop @b
133
 
132
 
134
	stdcall print_capt,capt_lbl_wo
133
	stdcall print_capt,capt_lbl_wo
135
	mov ecx,dword[ColWords]
134
	mov ecx,dword[ColWords]
136
	mov eax,[Col]
135
	mov eax,[Col]
137
	xor ebx,ebx
136
	xor ebx,ebx
138
	@@:
137
	@@:
139
		inc ebx
138
		inc ebx
140
		stdcall print_word,eax,ebx
139
		stdcall print_word,eax,ebx
141
		add eax,sizeof.TexColViv
140
		add eax,sizeof.TexColViv
142
	loop @b
141
	loop @b
143
 
142
 
144
	stdcall print_capt,capt_lbl_f1
143
	stdcall print_capt,capt_lbl_f1
145
	mov ecx,dword[ColWords]
144
	mov ecx,dword[ColWords]
146
	mov eax,[Col]
145
	mov eax,[Col]
147
	xor ebx,ebx
146
	xor ebx,ebx
148
	@@:
147
	@@:
149
		inc ebx
148
		inc ebx
150
		stdcall print_word_f1,eax,ebx
149
		stdcall print_word_f1,eax,ebx
151
		add eax,sizeof.TexColViv
150
		add eax,sizeof.TexColViv
152
	loop @b
151
	loop @b
153
	
152
	
154
	; ïîäãîòîâêà äëÿ  PathShow
153
	; ïîäãîòîâêà äëÿ  PathShow
155
	push dword PathShow_data_1
154
	push dword PathShow_data_1
156
	call [PathShow_prepare]
155
	call [PathShow_prepare]
157
	call draw_window
156
	call draw_window
158
 
157
 
159
	.no_colors:
158
	.no_colors:
160
	popad
159
	popad
161
	ret
160
	ret
162
 
161
 
163
align 4
162
align 4
164
proc print_color, color:dword
163
proc print_color, color:dword
165
	pushad
164
	pushad
166
	mov eax,dword[color]
165
	mov eax,dword[color]
167
 
166
 
168
	mov ebx,eax ;ìåíÿåì ìåñòàìè red è blue
167
	mov ebx,eax ;ìåíÿåì ìåñòàìè red è blue
169
	shr ebx,16
168
	shr ebx,16
170
	xchg al,bl
169
	xchg al,bl
171
	and eax,0xffff
170
	and eax,0xffff
172
	and ebx,0xff
171
	and ebx,0xff
173
	shl ebx,16
172
	shl ebx,16
174
	or eax,ebx
173
	or eax,ebx
175
 
174
 
176
	ror al,4
175
	ror al,4
177
	ror eax,8
176
	ror eax,8
178
	ror al,4
177
	ror al,4
179
	ror eax,8
178
	ror eax,8
180
	ror al,4
179
	ror al,4
181
	rol eax,16
180
	rol eax,16
182
	mov edi,text_buffer
181
	mov edi,text_buffer
183
	mov word[edi],'0x'
182
	mov word[edi],'0x'
184
	add edi,2
183
	add edi,2
185
	mov ecx,6
184
	mov ecx,6
186
	@@:
185
	@@:
187
		mov ebx,eax
186
		mov ebx,eax
188
		and ebx,0xf
187
		and ebx,0xf
189
		cmp bx,9
188
		cmp bx,9
190
		jle .cifra
189
		jle .cifra
191
			add bx,39
190
			add bx,39
192
		.cifra:
191
		.cifra:
193
		add bx,48
192
		add bx,48
194
		mov byte[edi],bl
193
		mov byte[edi],bl
195
		inc edi
194
		inc edi
196
		shr eax,4
195
		shr eax,4
197
	loop @b
196
	loop @b
198
	mov byte[edi],13
197
	mov byte[edi],13
199
	mov ebx,ted_opt_ed_change_time+ted_opt_ed_move_cursor
198
	mov ebx,ted_opt_ed_change_time+ted_opt_ed_move_cursor
200
	stdcall [ted_text_add], tedit0,text_buffer,9,ebx
199
	stdcall [ted_text_add], tedit0,text_buffer,9,ebx
201
	popad
200
	popad
202
	ret
201
	ret
203
endp
202
endp
204
 
203
 
205
align 4
204
align 4
206
proc print_capt, capt:dword
205
proc print_capt, capt:dword
207
	pushad
206
	pushad
208
	mov esi,dword[capt]
207
	mov esi,dword[capt]
209
	stdcall str_len,esi
208
	stdcall str_len,esi
210
	stdcall [ted_text_add], tedit0,esi,eax,ted_opt_ed_change_time+ted_opt_ed_move_cursor
209
	stdcall [ted_text_add], tedit0,esi,eax,ted_opt_ed_change_time+ted_opt_ed_move_cursor
211
	popad
210
	popad
212
	ret
211
	ret
213
endp
212
endp
214
 
213
 
215
align 4
214
align 4
216
proc print_word, text:dword, index:dword
215
proc print_word, text:dword, index:dword
217
	pushad
216
	pushad
218
	mov esi,text_buffer
217
	mov esi,text_buffer
219
	mov byte[esi],0
218
	mov byte[esi],0
220
	stdcall str_cat,esi,capt_beg_word
219
	stdcall str_cat,esi,capt_beg_word
221
	stdcall str_len,esi
220
	stdcall str_len,esi
222
	add esi,eax
221
	add esi,eax
223
 
222
 
224
	mov edi,dword[text]	
223
	mov edi,dword[text]	
225
	stdcall code_string,edi,esi ;êîäèðóåì ñòðîêó ñ êëþ÷åâûì ñëîâîì
224
	stdcall code_string,edi,esi ;êîäèðóåì ñòðîêó ñ êëþ÷åâûì ñëîâîì
226
	stdcall str_cat,esi,capt_end_word
225
	stdcall str_cat,esi,capt_end_word
227
 
226
 
228
	cmp dword[edi+MAX_COLOR_WORD_LEN],0 ;f1
227
	cmp dword[edi+MAX_COLOR_WORD_LEN],0 ;f1
229
	je @f
228
	je @f
230
		stdcall str_cat,esi,capt_calc_f1
229
		stdcall str_cat,esi,capt_calc_f1
231
		stdcall str_cat_value,esi,[index]
230
		stdcall str_cat_value,esi,[index]
232
		stdcall str_cat,esi,capt_lbl_f1_use
231
		stdcall str_cat,esi,capt_lbl_f1_use
233
		jmp .end_f1_calc
-
 
234
	@@:
232
	@@:
235
		stdcall str_cat,esi,capt_null
-
 
236
	.end_f1_calc:
-
 
237
 
233
 
238
	mov esi,text_buffer
234
	mov esi,text_buffer
239
	stdcall str_len,esi ;óçíàåì äëèííó âñåé ñòðîêè
235
	stdcall str_len,esi ;óçíàåì äëèííó âñåé ñòðîêè
240
	stdcall [ted_text_add], tedit0,esi,eax,ted_opt_ed_change_time+ted_opt_ed_move_cursor
236
	stdcall [ted_text_add], tedit0,esi,eax,ted_opt_ed_change_time+ted_opt_ed_move_cursor
241
 
237
 
242
mov ecx,edi
238
mov ecx,edi
243
mov edi,text_buffer
239
mov edi,text_buffer
244
mov byte[edi],','
240
mov byte[edi],','
245
inc edi
241
inc edi
246
mov byte[edi],0
242
mov byte[edi],0
247
	xor eax,eax
243
	xor eax,eax
248
	mov al,byte[ecx+MAX_COLOR_WORD_LEN+4] ;wwo
244
	mov al,byte[ecx+MAX_COLOR_WORD_LEN+4] ;wwo
249
	stdcall str_cat_value,edi,eax
245
	stdcall str_cat_value,edi,eax
250
	stdcall str_len,edi
246
	stdcall str_len,edi
251
	add edi,eax
247
	add edi,eax
252
	mov byte[edi],','
248
	mov byte[edi],','
253
	inc edi
249
	inc edi
254
 
250
 
255
	xor eax,eax
251
	xor eax,eax
256
	mov ax,word[ecx+MAX_COLOR_WORD_LEN+4+1] ;(escc shl 8)+endc
252
	mov ax,word[ecx+MAX_COLOR_WORD_LEN+4+1] ;(escc shl 8)+endc
257
	cmp ax,0 ;ïðîâåðÿåì åñòü ëè çàâåðøàþùèé è ýêðàíèíóþùèé ñèìâîë
253
	cmp ax,0 ;ïðîâåðÿåì åñòü ëè çàâåðøàþùèé è ýêðàíèíóþùèé ñèìâîë
258
	je @f
254
	je @f
259
		stdcall str_cat_value,edi,eax
255
		stdcall str_cat_value,edi,eax
260
		stdcall str_len,edi
256
		stdcall str_len,edi
261
		add edi,eax
257
		add edi,eax
262
	@@:
258
	@@:
263
	mov byte[edi],','
259
	mov byte[edi],','
264
	inc edi
260
	inc edi
265
 
261
 
266
	xor eax,eax
262
	xor eax,eax
267
	mov al,byte[ecx+MAX_COLOR_WORD_LEN+4+2] ;color
263
	mov al,byte[ecx+MAX_COLOR_WORD_LEN+4+3] ;color
268
	stdcall str_cat_value,edi,eax
264
	stdcall str_cat_value,edi,eax
269
	stdcall str_len,edi
265
	stdcall str_len,edi
270
	add edi,eax
266
	add edi,eax
271
	mov byte[edi],13
267
	mov byte[edi],13
272
	inc edi
268
	inc edi
273
	mov byte[edi],0
269
	mov byte[edi],0
274
 
270
 
275
	mov esi,text_buffer
271
	mov esi,text_buffer
276
	stdcall str_len,esi
272
	stdcall str_len,esi
277
	stdcall [ted_text_add], tedit0,esi,eax,ted_opt_ed_move_cursor
273
	stdcall [ted_text_add], tedit0,esi,eax,ted_opt_ed_move_cursor
278
 
274
 
279
	popad
275
	popad
280
	ret
276
	ret
281
endp
277
endp
282
 
278
 
283
align 4
279
align 4
284
proc print_word_f1, text:dword, index:dword
280
proc print_word_f1, text:dword, index:dword
285
	pushad
281
	pushad
286
	mov edi,dword[text]
282
	mov edi,dword[text]
287
	mov esi,dword[edi+MAX_COLOR_WORD_LEN] ;f1
283
	mov esi,dword[edi+MAX_COLOR_WORD_LEN] ;f1
288
	cmp esi,0
284
	cmp esi,0
289
	je @f
285
	je @f
290
		mov ebx,text_buffer
286
		mov ebx,text_buffer
291
		mov byte[ebx],0
287
		mov byte[ebx],0
292
		stdcall str_cat,ebx,capt_point
288
		stdcall str_cat,ebx,capt_point
293
		stdcall str_cat_value,ebx,[index]
289
		stdcall str_cat_value,ebx,[index]
294
		stdcall str_cat,ebx,capt_beg_db
290
		stdcall str_cat,ebx,capt_beg_db
295
		stdcall str_len,ebx
291
		stdcall str_len,ebx
296
		add ebx,eax
292
		add ebx,eax
297
		
293
		
298
		add esi,dword[tex_help_f1]
294
		add esi,dword[tex_help_f1]
299
		stdcall code_string,esi,ebx ;êîäèðóåì ñòðîêó
295
		stdcall code_string,esi,ebx ;êîäèðóåì ñòðîêó
300
		stdcall str_cat,ebx,capt_end_word_f1
296
		stdcall str_cat,ebx,capt_end_word_f1
301
 
297
 
302
		mov ebx,text_buffer
298
		mov ebx,text_buffer
303
		stdcall str_len,ebx
299
		stdcall str_len,ebx
304
		stdcall [ted_text_add], tedit0,ebx,eax,ted_opt_ed_move_cursor
300
		stdcall [ted_text_add], tedit0,ebx,eax,ted_opt_ed_move_cursor
305
	@@:
301
	@@:
306
	popad
302
	popad
307
	ret
303
	ret
308
endp
304
endp
309
 
305
 
310
align 4
306
align 4
311
proc code_string, text:dword, out_text:dword
307
proc code_string, text:dword, out_text:dword
312
	pushad
308
	pushad
313
	mov esi,dword[text]
309
	mov esi,dword[text]
314
	stdcall str_len,esi
310
	stdcall str_len,esi
315
	mov ecx,eax
311
	mov ecx,eax
316
	mov edi,dword[out_text]
312
	mov edi,dword[out_text]
317
 
313
 
318
	.copy:
314
	.copy:
319
		mov al,byte[esi]
315
		mov al,byte[esi]
320
		inc esi
316
		inc esi
321
		cmp al,9
317
		cmp al,9
322
		je @f
318
		je @f
323
		cmp al,13
319
		cmp al,13
324
		je @f
320
		je @f
325
		cmp al,39
321
		cmp al,39
326
		je @f
322
		je @f
327
			mov byte[edi],al
323
			mov byte[edi],al
328
			inc edi
324
			inc edi
329
			loop .copy
325
			loop .copy
330
			jmp .end_copy
326
			jmp .end_copy
331
		@@:
327
		@@:
332
			mov byte[edi],39
328
			mov byte[edi],39
333
			mov byte[edi+1],','
329
			mov byte[edi+1],','
334
			add edi,2
330
			add edi,2
335
			and eax,0xff
331
			and eax,0xff
336
			mov dword[edi],0
332
			mov dword[edi],0
337
			call tl_convert_to_str
333
			call tl_convert_to_str
338
			stdcall str_len,edi
334
			stdcall str_len,edi
339
			add edi,eax
335
			add edi,eax
340
			mov byte[edi],','
336
			mov byte[edi],','
341
			mov byte[edi+1],39
337
			mov byte[edi+1],39
342
			add edi,2
338
			add edi,2
343
	loop .copy
339
	loop .copy
344
	.end_copy:
340
	.end_copy:
345
	mov byte[edi],0
341
	mov byte[edi],0
346
	popad
342
	popad
347
	ret
343
	ret
348
endp
344
endp
349
 
345
 
350
align 4
346
align 4
351
proc mem_clear, mem:dword, len:dword
347
proc mem_clear, mem:dword, len:dword
352
	push eax ecx edi
348
	push eax ecx edi
353
	cld
349
	cld
354
	xor al,al
350
	xor al,al
355
	mov edi, dword[mem]
351
	mov edi, dword[mem]
356
	mov ecx, dword[len]
352
	mov ecx, dword[len]
357
	repne stosb
353
	repne stosb
358
	pop edi ecx eax
354
	pop edi ecx eax
359
	ret
355
	ret
360
endp
356
endp
361
 
357
 
362
align 4
358
align 4
363
proc str_cat, str1:dword, str2:dword
359
proc str_cat, str1:dword, str2:dword
364
	push eax ecx edi esi
360
	push eax ecx edi esi
365
	mov esi,dword[str2]
361
	mov esi,dword[str2]
366
	stdcall str_len,esi
362
	stdcall str_len,esi
367
	mov ecx,eax
363
	mov ecx,eax
368
	inc ecx
364
	inc ecx
369
	mov edi,dword[str1]
365
	mov edi,dword[str1]
370
	stdcall str_len,edi
366
	stdcall str_len,edi
371
	add edi,eax
367
	add edi,eax
372
	cld
368
	cld
373
	repne movsb
369
	repne movsb
374
	pop esi edi ecx eax
370
	pop esi edi ecx eax
375
	ret
371
	ret
376
endp
372
endp
377
 
373
 
378
align 4
374
align 4
379
proc str_cat_value, str1:dword, value:dword
375
proc str_cat_value, str1:dword, value:dword
380
	pushad
376
	pushad
381
	mov edi,[str1]
377
	mov edi,[str1]
382
	stdcall str_len,edi
378
	stdcall str_len,edi
383
	add edi,eax
379
	add edi,eax
384
	mov eax,[value]
380
	mov eax,[value]
385
	call tl_convert_to_str
381
	call tl_convert_to_str
386
	popad
382
	popad
387
	ret
383
	ret
388
endp
384
endp
389
 
385
 
390
;output:
386
;output:
391
; eax = strlen
387
; eax = strlen
392
align 4
388
align 4
393
proc str_len, str1:dword
389
proc str_len, str1:dword
394
	mov eax,[str1]
390
	mov eax,[str1]
395
	@@:
391
	@@:
396
		cmp byte[eax],0
392
		cmp byte[eax],0
397
		je @f
393
		je @f
398
		inc eax
394
		inc eax
399
		jmp @b
395
		jmp @b
400
	@@:
396
	@@:
401
	sub eax,[str1]
397
	sub eax,[str1]
402
	ret
398
	ret
403
endp
399
endp
404
 
400
 
405
;input:
401
;input:
406
; eax = value
402
; eax = value
407
; edi = string buffer
403
; edi = string buffer
408
align 4
404
align 4
409
tl_convert_to_str:
405
tl_convert_to_str:
410
	pushad
406
	pushad
411
	stdcall mem_clear,edi,12
407
	stdcall mem_clear,edi,12
412
	call .str
408
	call .str
413
	popad
409
	popad
414
	ret
410
	ret
415
 
411
 
416
align 4
412
align 4
417
.str:
413
.str:
418
	mov ecx,0x0a ;çàäàåòñÿ ñèñòåìà ñ÷èñëåíèÿ èçìåíÿþòñÿ ðåãèñòðû ebx,eax,ecx,edx âõîäíûå ïàðàìåòðû eax - ÷èñëî
414
	mov ecx,0x0a ;çàäàåòñÿ ñèñòåìà ñ÷èñëåíèÿ èçìåíÿþòñÿ ðåãèñòðû ebx,eax,ecx,edx âõîäíûå ïàðàìåòðû eax - ÷èñëî
419
		;ïðåðåâîä ÷èñëà â ASCII ñòðîêó âõîäíûå äàííûå ecx=ñèñòåìà ñ÷èñëåíÿ edi àäðåñ êóäà çàïèñûâàòü, áóäåì ñòðîêó, ïðè÷åì êîíåö ïåðåìåííîé 
415
		;ïðåðåâîä ÷èñëà â ASCII ñòðîêó âõîäíûå äàííûå ecx=ñèñòåìà ñ÷èñëåíÿ edi àäðåñ êóäà çàïèñûâàòü, áóäåì ñòðîêó, ïðè÷åì êîíåö ïåðåìåííîé 
420
	cmp eax,ecx  ;ñðàâíèòü åñëè â eax ìåíüøå ÷åì â ecx òî ïåðåéòè íà @@-1 ò.å. íà pop eax
416
	cmp eax,ecx  ;ñðàâíèòü åñëè â eax ìåíüøå ÷åì â ecx òî ïåðåéòè íà @@-1 ò.å. íà pop eax
421
	jb @f
417
	jb @f
422
		xor edx,edx ;î÷èñòèòü edx
418
		xor edx,edx ;î÷èñòèòü edx
423
		div ecx     ;ðàçäåëèòü - îñòàòîê â edx
419
		div ecx     ;ðàçäåëèòü - îñòàòîê â edx
424
		push edx    ;ïîëîæèòü â ñòåê
420
		push edx    ;ïîëîæèòü â ñòåê
425
		;dec edi    ;ñìåùåíèå íåîáõîäèìîå äëÿ çàïèñè ñ êîíöà ñòðîêè
421
		;dec edi    ;ñìåùåíèå íåîáõîäèìîå äëÿ çàïèñè ñ êîíöà ñòðîêè
426
		call .str   ;ïåðåéòè íà ñàìó ñåáÿ ò.å. âûçâàòü ñàìó ñåáÿ è òàê äî òîãî ìîìåíòà ïîêà â eax íå ñòàíåò ìåíüøå ÷åì â ecx
422
		call .str   ;ïåðåéòè íà ñàìó ñåáÿ ò.å. âûçâàòü ñàìó ñåáÿ è òàê äî òîãî ìîìåíòà ïîêà â eax íå ñòàíåò ìåíüøå ÷åì â ecx
427
		pop eax
423
		pop eax
428
	@@: ;cmp al,10 ;ïðîâåðèòü íå ìåíüøå ëè çíà÷åíèå â al ÷åì 10 (äëÿ ñèñòåìû ñ÷èñëåíÿ 10 äàííàÿ êîìàíäà - ëèøíàÿ))
424
	@@: ;cmp al,10 ;ïðîâåðèòü íå ìåíüøå ëè çíà÷åíèå â al ÷åì 10 (äëÿ ñèñòåìû ñ÷èñëåíÿ 10 äàííàÿ êîìàíäà - ëèøíàÿ))
429
	or al,0x30  ;äàííàÿ êîìàíäà êîðî÷å  ÷åì äâå âûøå 
425
	or al,0x30  ;äàííàÿ êîìàíäà êîðî÷å  ÷åì äâå âûøå 
430
	stosb	    ;çàïèñàòü ýëåìåíò èç ðåãèñòðà al â ÿ÷åêó ïàìÿòè es:edi
426
	stosb	    ;çàïèñàòü ýëåìåíò èç ðåãèñòðà al â ÿ÷åêó ïàìÿòè es:edi
431
	ret
427
	ret