Rev 1720 | Rev 1732 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
1698 | IgorA | 1 | ; |
1727 | IgorA | 2 | ; в этом файле собраны функции создающие програмный код |
1698 | IgorA | 3 | ; |
1727 | IgorA | 4 | u_object object ;временный объект для задания смещений |
1698 | IgorA | 5 | |
6 | macro insert_coma |
||
7 | { |
||
8 | stdcall [ted_text_add], tedit0,txt_coma,1,ted_opt_ed_move_cursor |
||
9 | } |
||
10 | macro insert_nl |
||
11 | { |
||
12 | stdcall [ted_text_add], tedit0,txt_nl,1,ted_opt_ed_move_cursor |
||
13 | } |
||
14 | macro insert_com |
||
15 | { |
||
16 | stdcall [ted_text_add], tedit0,txt_com,1,ted_opt_ed_move_cursor |
||
17 | } |
||
18 | macro insert_sp |
||
19 | { |
||
20 | stdcall [ted_text_add], tedit0,txt_sp,1,ted_opt_ed_move_cursor |
||
21 | } |
||
22 | |||
1727 | IgorA | 23 | ;функция вставляет текстовую строку в текстовый редактор |
1698 | IgorA | 24 | align 4 |
25 | proc insert_text, txt:dword |
||
26 | push eax |
||
27 | stdcall str_len,dword[txt] |
||
28 | cmp eax,1 |
||
29 | jl @f |
||
30 | stdcall [ted_text_add], tedit0,dword[txt],eax,ted_opt_ed_move_cursor |
||
31 | @@: |
||
32 | pop eax |
||
33 | ret |
||
34 | endp |
||
35 | |||
1727 | IgorA | 36 | ;вставляет указанное текстовое свойство из объекта в текстовый редактор |
1698 | IgorA | 37 | align 4 |
38 | proc insert_text_prop, p_obj:dword,index:dword |
||
39 | push eax edx |
||
40 | mov eax,[p_obj] |
||
41 | mov edx,[index] |
||
42 | stdcall get_obj_text_col,eax,edx |
||
43 | stdcall str_len,edx |
||
44 | stdcall [ted_text_add], tedit0,edx,eax,ted_opt_ed_move_cursor |
||
45 | pop edx eax |
||
46 | ret |
||
47 | endp |
||
48 | |||
1727 | IgorA | 49 | ;вставляет указанное битовое свойство из объекта в текстовый редактор |
50 | align 4 |
||
51 | proc insert_bit_prop, p_obj:dword,index:dword |
||
52 | push ebx ecx edi |
||
53 | mov ebx,[p_obj] |
||
54 | mov ecx,[index] |
||
55 | test_bool_prop ebx,ecx |
||
56 | jnc @f ;если пользователь не выбрал в объекте данное свойство |
||
57 | mov ebx,dword[ebx] |
||
58 | call find_obj_in_opt |
||
59 | mov ecx,dword[edi+obj_opt.bit_val-obj_opt] ;ecx - смещение значений свойств (констант) |
||
60 | cmp byte[ecx],0 |
||
61 | je @f ;если у объекта нет заданных битовых свойств |
||
62 | add ecx,obj_opt ;добавляем начало файла с опциями |
||
63 | stdcall get_string_by_ind, ecx,[index] |
||
64 | cmp byte[edi],0 |
||
65 | je @f ;если у объекта битовое свойство пустое |
||
66 | stdcall insert_text, txt_plus |
||
67 | stdcall insert_text, edi |
||
68 | @@: |
||
69 | pop edi ecx ebx |
||
70 | ret |
||
71 | endp |
||
72 | |||
73 | ;функция вставляет 2 параметра по 16 бит в виде: |
||
1720 | IgorA | 74 | ; (_p1_ shl 16 + _p2_) |
75 | align 4 |
||
76 | proc insert_2_prop_16_bit, obj:dword, p_hi:dword, p_lo:dword |
||
77 | stdcall insert_text, txt_skob_o |
||
78 | stdcall insert_text_prop, [obj],[p_hi] |
||
79 | stdcall insert_text, txt_shl_16 |
||
80 | stdcall insert_text, txt_skob_c |
||
81 | stdcall insert_text, txt_plus |
||
82 | stdcall insert_text_prop, [obj],[p_lo] |
||
83 | ret |
||
84 | endp |
||
85 | |||
1727 | IgorA | 86 | ;вставляем строку вида: |
1720 | IgorA | 87 | ; txt_(n) db (s) |
88 | align 4 |
||
89 | proc insert_text_label_data, obj:dword, col:dword |
||
90 | push eax edx |
||
91 | mov eax,[obj] |
||
92 | stdcall insert_text, txt_txt |
||
93 | mov edx,fp_icon |
||
94 | stdcall get_obj_id_str, eax,edx ;edx = 'n' |
||
95 | stdcall str_cat, edx,txt_db ;edx = 'n db ' |
||
96 | stdcall insert_text, edx |
||
97 | stdcall insert_text_prop, eax,[col] |
||
98 | insert_nl |
||
99 | pop edx eax |
||
100 | ret |
||
101 | endp |
||
102 | |||
1698 | IgorA | 103 | macro insert_tab |
104 | { |
||
105 | stdcall [ted_text_add], tedit0,txt_tab,1,ted_opt_ed_move_cursor |
||
106 | } |
||
107 | macro insert_br |
||
108 | { |
||
109 | stdcall [ted_text_add], tedit0,txt_br,3,ted_opt_ed_move_cursor |
||
110 | } |
||
111 | macro insert_a_met |
||
112 | { |
||
113 | stdcall [ted_text_add], tedit0,txt_a_met,3,ted_opt_ed_move_cursor |
||
114 | } |
||
115 | macro insert_0 |
||
116 | { |
||
117 | stdcall [ted_text_add], tedit0,txt_0,1,ted_opt_ed_move_cursor |
||
118 | } |
||
119 | macro insert_plus |
||
120 | { |
||
121 | stdcall [ted_text_add], tedit0,txt_plus,1,ted_opt_ed_move_cursor |
||
122 | } |
||
123 | macro insert_xor |
||
124 | { |
||
125 | stdcall [ted_text_add], tedit0,txt_xor,4,ted_opt_ed_move_cursor |
||
126 | } |
||
127 | macro insert_cmp |
||
128 | { |
||
129 | stdcall [ted_text_add], tedit0,txt_cmp,4,ted_opt_ed_move_cursor |
||
130 | } |
||
131 | macro insert_reg reg_name |
||
132 | { |
||
133 | stdcall [ted_text_add], tedit0,reg_name,3,ted_opt_ed_move_cursor |
||
134 | } |
||
135 | macro insert_reg8 reg_name |
||
136 | { |
||
137 | stdcall [ted_text_add], tedit0,reg_name,2,ted_opt_ed_move_cursor |
||
138 | } |
||
139 | |||
140 | ; |
||
141 | macro insert_but_beg |
||
142 | { |
||
143 | stdcall [ted_text_add], tedit0,txt_but_1,txt_but_2-txt_but_1,ted_opt_ed_move_cursor |
||
144 | } |
||
145 | macro insert_but_end |
||
146 | { |
||
147 | stdcall [ted_text_add], tedit0,txt_but_2,txt_but_3-txt_but_2,ted_opt_ed_move_cursor |
||
148 | } |
||
149 | ; |
||
150 | macro insert_key_beg |
||
151 | { |
||
152 | stdcall [ted_text_add], tedit0,txt_key_1,txt_key_2-txt_key_1,ted_opt_ed_move_cursor |
||
153 | } |
||
154 | macro insert_key_end |
||
155 | { |
||
156 | stdcall [ted_text_add], tedit0,txt_key_2,txt_key_3-txt_key_2,ted_opt_ed_move_cursor |
||
157 | } |
||
158 | |||
159 | macro insert_d_poi |
||
160 | { |
||
161 | stdcall [ted_text_add], tedit0,txt_d_poi,1,ted_opt_ed_move_cursor |
||
162 | } |
||
163 | macro insert_ret |
||
164 | { |
||
165 | stdcall [ted_text_add], tedit0,txt_ret,4,ted_opt_ed_move_cursor |
||
166 | } |
||
167 | |||
168 | |||
169 | align 4 |
||
1711 | IgorA | 170 | but_update: |
171 | call draw_constructor |
||
1727 | IgorA | 172 | cmp byte[show_mode],0 ;условие видимости окна конструктора |
1711 | IgorA | 173 | jne @f |
174 | stdcall [buf2d_draw], buf_fon |
||
175 | @@: |
||
1698 | IgorA | 176 | call code_gen |
1727 | IgorA | 177 | cmp byte[show_mode],1 ;условие видимости текстового окна |
1698 | IgorA | 178 | jne @f |
179 | stdcall [ted_draw], tedit0 |
||
180 | @@: |
||
181 | ret |
||
182 | |||
1727 | IgorA | 183 | ;функция создающая код всего файла |
1698 | IgorA | 184 | align 4 |
185 | code_gen: |
||
186 | stdcall [ted_clear], tedit0,1 |
||
187 | pushad |
||
188 | stdcall dword[tl_node_poi_get_info], 0,tree2 |
||
189 | pop esi |
||
190 | xor bl,bl |
||
191 | call code_gen_obj |
||
192 | stdcall [ted_text_add], tedit0,\ |
||
1727 | IgorA | 193 | txt_nl,1,ted_opt_ed_move_cursor+ted_opt_ed_change_time ;добавляем символ новой строки с опцией ted_opt_ed_change_time для возможности сохранения файла |
194 | stdcall [ted_init_scroll_bars], tedit0, 4 ;меняем размеры скроллингов |
||
1698 | IgorA | 195 | popad |
196 | ret |
||
197 | |||
198 | ;input: |
||
1727 | IgorA | 199 | ; bl - уровень объекта |
200 | ; esi - указатель на узел |
||
1698 | IgorA | 201 | align 4 |
202 | code_gen_obj: |
||
1720 | IgorA | 203 | push ebx edx |
1698 | IgorA | 204 | .beg_iterat: |
205 | cmp esi,0 |
||
206 | je .find_no |
||
207 | |||
208 | cmp byte[esi+2],bl ;lev |
||
209 | jl .find_no |
||
210 | |||
211 | stdcall dword[tl_node_poi_get_data], esi,tree2 |
||
1727 | IgorA | 212 | pop eax ;получаем данные узла |
1698 | IgorA | 213 | cmp eax,0 |
214 | je .find_no |
||
215 | |||
1717 | IgorA | 216 | cmp dword[eax],C_STR |
1720 | IgorA | 217 | jne .no_struct |
1727 | IgorA | 218 | stdcall get_obj_text_col, eax,1 ;edx - указатель на 1-е свойство структуры |
1720 | IgorA | 219 | stdcall insert_text,txt_struc |
220 | cmp byte[edx],0 |
||
221 | jne @f |
||
222 | stdcall insert_text,txt_t |
||
223 | @@: |
||
224 | insert_sp |
||
1717 | IgorA | 225 | stdcall insert_text_prop, eax,0 |
1720 | IgorA | 226 | |
227 | cmp byte[edx],0 |
||
228 | je @f |
||
1727 | IgorA | 229 | ;если структура задана макросом |
1720 | IgorA | 230 | insert_sp |
231 | stdcall insert_text_prop, eax,1 |
||
232 | insert_nl |
||
233 | stdcall insert_text, txt_skob_fo |
||
234 | @@: |
||
1717 | IgorA | 235 | insert_nl |
236 | |||
1698 | IgorA | 237 | stdcall dword[tl_node_poi_get_next_info], esi,tree2 |
1727 | IgorA | 238 | pop esi ;переходим к следущему узлу |
1711 | IgorA | 239 | cmp esi,0 |
240 | je .end_st |
||
241 | cmp byte[esi+2],bl ;lev |
||
1698 | IgorA | 242 | jle .end_st |
243 | push bx |
||
244 | mov bl,byte[esi+2] |
||
1727 | IgorA | 245 | call code_gen_obj ;рекурсивный вызов дочерних объектов |
1698 | IgorA | 246 | pop bx |
247 | .end_st: |
||
1720 | IgorA | 248 | cmp byte[edx],0 |
249 | je @f |
||
1727 | IgorA | 250 | ;если структура задана макросом |
1720 | IgorA | 251 | stdcall insert_text, txt_skob_fc |
252 | insert_nl |
||
253 | jmp .beg_iterat |
||
254 | @@: |
||
1717 | IgorA | 255 | stdcall insert_text,txt_ends |
1698 | IgorA | 256 | jmp .beg_iterat |
1720 | IgorA | 257 | .no_struct: |
1717 | IgorA | 258 | cmp dword[eax],C_TXT |
1698 | IgorA | 259 | jne @f |
1727 | IgorA | 260 | stdcall get_code_text,eax ;обработка объекта |
1698 | IgorA | 261 | @@: |
1717 | IgorA | 262 | cmp dword[eax],C_INC |
1698 | IgorA | 263 | jne @f |
1727 | IgorA | 264 | stdcall get_code_incl,eax ;обработка объекта |
1698 | IgorA | 265 | @@: |
1717 | IgorA | 266 | cmp dword[eax],C_VAR |
1698 | IgorA | 267 | jne @f |
1727 | IgorA | 268 | stdcall get_code_variable,eax,ebx ;обработка объекта |
1698 | IgorA | 269 | @@: |
1717 | IgorA | 270 | cmp dword[eax],C_WND |
1698 | IgorA | 271 | jne @f |
1727 | IgorA | 272 | stdcall get_code_window,eax ;обработка объекта |
1698 | IgorA | 273 | @@: |
1717 | IgorA | 274 | cmp dword[eax],C_ACO |
1698 | IgorA | 275 | jne @f |
1727 | IgorA | 276 | stdcall get_code_auto,eax ;обработка объекта |
1698 | IgorA | 277 | @@: |
1727 | IgorA | 278 | cmp dword[eax],C_KEY ;клавиатура |
1698 | IgorA | 279 | jne @f |
1727 | IgorA | 280 | stdcall get_code_key,eax ;обработка объекта |
1698 | IgorA | 281 | @@: |
282 | |||
283 | stdcall dword[tl_node_poi_get_next_info], esi,tree2 |
||
1727 | IgorA | 284 | pop esi ;переходим к следущему узлу |
1698 | IgorA | 285 | |
286 | jmp .beg_iterat |
||
287 | .find_no: |
||
1720 | IgorA | 288 | pop edx ebx |
1698 | IgorA | 289 | ret |
290 | |||
1727 | IgorA | 291 | ;добавление объекта с програмным кодом (текстом) |
1698 | IgorA | 292 | align 4 |
293 | proc get_code_text, p_obj:dword |
||
1717 | IgorA | 294 | ;pushad |
1698 | IgorA | 295 | insert_nl |
1717 | IgorA | 296 | stdcall insert_text_prop, dword[p_obj],0 |
1698 | IgorA | 297 | insert_nl |
1717 | IgorA | 298 | ;popad |
1698 | IgorA | 299 | ret |
300 | endp |
||
301 | |||
1727 | IgorA | 302 | ;обработка объекта создающего автоматичексие коды |
1698 | IgorA | 303 | align 4 |
304 | proc get_code_auto, p_obj:dword |
||
305 | pushad |
||
306 | insert_nl |
||
307 | mov ebx,dword[p_obj] |
||
1720 | IgorA | 308 | test_bool_prop ebx,BIT_MOD_ACI |
309 | jae @f |
||
310 | mov edx,C_CHB |
||
311 | stdcall find_obj_in_file,edx ;eax - указатель на структуру check_box |
||
312 | cmp eax,0 |
||
313 | je @f |
||
314 | stdcall insert_text, txt_std_init_cb |
||
315 | @@: |
||
1717 | IgorA | 316 | test_bool_prop ebx,BIT_MOD_ACM |
1698 | IgorA | 317 | jae @f |
1727 | IgorA | 318 | ;автоматические события от мыши |
1698 | IgorA | 319 | call get_code_auto_m |
320 | @@: |
||
1717 | IgorA | 321 | test_bool_prop ebx,BIT_MOD_ABU |
1698 | IgorA | 322 | jae @f |
1727 | IgorA | 323 | ;создание функции button |
1698 | IgorA | 324 | insert_but_beg |
1727 | IgorA | 325 | call get_code_auto_but ;коды вызова кнопок |
1698 | IgorA | 326 | insert_but_end |
1727 | IgorA | 327 | call get_code_a_but_fun ;коды функций, вызываемых при нажатии кнопок |
1698 | IgorA | 328 | @@: |
1717 | IgorA | 329 | test_bool_prop ebx,BIT_MOD_ACD |
1698 | IgorA | 330 | jae @f |
331 | call get_code_auto_data_el |
||
1720 | IgorA | 332 | |
333 | mov edx,C_CHB |
||
334 | stdcall find_obj_in_file,edx ;eax - указатель на структуру check_box |
||
335 | cmp eax,0 |
||
336 | je .no_check |
||
337 | stdcall insert_text, txt_cb_b |
||
338 | call get_code_auto_data_el_cbox |
||
339 | stdcall insert_text, txt_cb_e |
||
340 | .no_check: |
||
341 | |||
1698 | IgorA | 342 | call get_code_auto_data_dop |
1706 | IgorA | 343 | |
1717 | IgorA | 344 | mov edx,C_LIB |
1727 | IgorA | 345 | stdcall find_obj_in_file,edx ;eax - указатель на структуру библиотеки |
1706 | IgorA | 346 | cmp eax,0 |
347 | je @f |
||
1720 | IgorA | 348 | insert_nl |
1706 | IgorA | 349 | stdcall insert_text, txt_head_i |
350 | stdcall insert_text, txt_d_poi |
||
351 | insert_nl |
||
352 | stdcall insert_text, txt_head_l |
||
353 | stdcall insert_text, txt_db |
||
354 | stdcall insert_text, txt_str_beg |
||
355 | stdcall insert_text, txt_sys_err |
||
356 | stdcall insert_text, txt_str_end |
||
357 | insert_nl |
||
358 | |||
359 | call get_code_auto_data_libs_param |
||
360 | stdcall insert_text, txt_ll_start |
||
361 | call get_code_auto_data_libs_struc |
||
362 | stdcall insert_text, txt_ll_end |
||
1727 | IgorA | 363 | call get_code_auto_data_libs ;таблицы импорта библиотек |
1698 | IgorA | 364 | @@: |
365 | insert_nl |
||
366 | popad |
||
367 | ret |
||
368 | endp |
||
369 | |||
370 | align 4 |
||
371 | proc get_code_auto_m |
||
372 | pushad |
||
373 | stdcall dword[tl_node_poi_get_info], 0,tree2 |
||
374 | pop esi |
||
375 | .beg_iterat: |
||
376 | cmp esi,0 |
||
377 | je .find_no |
||
378 | |||
379 | stdcall dword[tl_node_poi_get_data], esi,tree2 |
||
1727 | IgorA | 380 | pop ebx ;получаем данные узла |
1698 | IgorA | 381 | cmp ebx,0 |
382 | je .find_no |
||
383 | |||
1717 | IgorA | 384 | cmp dword[ebx],C_EDB |
1698 | IgorA | 385 | jne @f |
386 | stdcall insert_text, txt_std_mouse_ed |
||
1720 | IgorA | 387 | stdcall insert_text_prop, ebx,0 |
1698 | IgorA | 388 | insert_nl |
389 | @@: |
||
1717 | IgorA | 390 | cmp dword[ebx],C_CHB |
1698 | IgorA | 391 | jne @f |
392 | stdcall insert_text, txt_std_mouse_cb |
||
1720 | IgorA | 393 | stdcall insert_text_prop, ebx,0 |
1698 | IgorA | 394 | insert_nl |
395 | @@: |
||
396 | |||
397 | stdcall dword[tl_node_poi_get_next_info], esi,tree2 |
||
1727 | IgorA | 398 | pop esi ;переходим к следущему узлу |
1698 | IgorA | 399 | |
400 | jmp .beg_iterat |
||
401 | .find_no: |
||
402 | popad |
||
403 | ret |
||
404 | endp |
||
405 | |||
1727 | IgorA | 406 | ;создание данных (структур объектов) |
1698 | IgorA | 407 | align 4 |
408 | proc get_code_auto_data_el |
||
409 | pushad |
||
1727 | IgorA | 410 | insert_nl ;отступ для форматирования |
1698 | IgorA | 411 | |
412 | stdcall dword[tl_node_poi_get_info], 0,tree2 |
||
413 | pop esi |
||
414 | .beg_iterat: |
||
415 | cmp esi,0 |
||
416 | je .find_no |
||
417 | |||
418 | stdcall dword[tl_node_poi_get_data], esi,tree2 |
||
1727 | IgorA | 419 | pop ebx ;получаем данные узла |
1698 | IgorA | 420 | cmp ebx,0 |
421 | je .find_no |
||
422 | |||
1717 | IgorA | 423 | cmp dword[ebx],C_EDB |
1698 | IgorA | 424 | jne @f |
425 | ;1,2,3,4,...,6,...8,...,10 - w,x,y,col_fon,...,col_frame,...,col_txt,...,txt |
||
1705 | IgorA | 426 | stdcall insert_text_prop, ebx,0 |
1698 | IgorA | 427 | stdcall insert_text, txt_ebox |
428 | |||
429 | mov ecx,1 |
||
430 | .prop: |
||
431 | insert_sp |
||
1705 | IgorA | 432 | stdcall insert_text_prop, ebx,ecx |
1698 | IgorA | 433 | insert_coma |
434 | inc ecx |
||
435 | cmp ecx,10 |
||
436 | jl .prop |
||
437 | |||
438 | insert_br |
||
439 | stdcall insert_text, txt_txt |
||
440 | |||
441 | mov edx,fp_icon |
||
1714 | IgorA | 442 | stdcall get_obj_id_str, ebx,edx |
1720 | IgorA | 443 | stdcall insert_text, edx |
1698 | IgorA | 444 | |
445 | stdcall insert_text, txt_mouse_dd |
||
1711 | IgorA | 446 | |
1727 | IgorA | 447 | stdcall insert_text, txt_0 ;свойства editbox |
448 | stdcall insert_bit_prop, ebx,BIT_MOD_EDIT_FOC |
||
449 | stdcall insert_bit_prop, ebx,BIT_MOD_EDIT_FIO |
||
450 | |||
451 | xchg eax,edx ;сохраняем значение edx |
||
1711 | IgorA | 452 | stdcall get_obj_text_col,ebx,10 |
1727 | IgorA | 453 | cmp byte[edx],0 ;проверяем пустая ли строка при запуске editbox |
1711 | IgorA | 454 | je .null_string |
1727 | IgorA | 455 | xchg eax,edx ;востанавливаем значение edx |
1711 | IgorA | 456 | stdcall insert_text, txt_coma |
457 | |||
458 | stdcall insert_text, txt_txt |
||
1727 | IgorA | 459 | stdcall insert_text, edx |
460 | stdcall insert_text, txt_met_end |
||
461 | stdcall insert_text, txt_minus |
||
1711 | IgorA | 462 | stdcall insert_text, txt_txt |
1727 | IgorA | 463 | stdcall insert_text, edx |
464 | stdcall insert_text, txt_minus |
||
1711 | IgorA | 465 | stdcall insert_text, txt_1 |
466 | stdcall insert_text, txt_coma |
||
467 | |||
468 | stdcall insert_text, txt_txt |
||
1727 | IgorA | 469 | stdcall insert_text, edx |
470 | stdcall insert_text, txt_met_end |
||
471 | stdcall insert_text, txt_minus |
||
1711 | IgorA | 472 | stdcall insert_text, txt_txt |
1727 | IgorA | 473 | stdcall insert_text, edx |
474 | stdcall insert_text, txt_minus |
||
1711 | IgorA | 475 | stdcall insert_text, txt_1 |
476 | .null_string: |
||
1698 | IgorA | 477 | insert_nl |
478 | @@: |
||
1717 | IgorA | 479 | cmp dword[ebx],C_DTT |
1711 | IgorA | 480 | jne @f |
1720 | IgorA | 481 | stdcall insert_text_label_data, ebx,0 |
482 | @@: |
||
483 | |||
484 | stdcall dword[tl_node_poi_get_next_info], esi,tree2 |
||
1727 | IgorA | 485 | pop esi ;переходим к следущему узлу |
1720 | IgorA | 486 | |
487 | jmp .beg_iterat |
||
488 | .find_no: |
||
489 | popad |
||
490 | ret |
||
491 | endp |
||
492 | |||
493 | align 4 |
||
494 | proc get_code_auto_data_el_cbox |
||
495 | pushad |
||
1727 | IgorA | 496 | insert_nl ;отступ для форматирования |
1720 | IgorA | 497 | |
498 | stdcall dword[tl_node_poi_get_info], 0,tree2 |
||
499 | pop esi |
||
500 | .beg_iterat: |
||
501 | cmp esi,0 |
||
502 | je .find_no |
||
503 | |||
504 | stdcall dword[tl_node_poi_get_data], esi,tree2 |
||
1727 | IgorA | 505 | pop ebx ;получаем данные узла |
1720 | IgorA | 506 | cmp ebx,0 |
507 | je .find_no |
||
508 | |||
509 | cmp dword[ebx],C_CHB |
||
510 | jne .no_check |
||
511 | ;1,2,3,4,5, 6,7,8, 9 - ot_x,ot_y,w,h,ot_w_txt, col_fon,col_frame,col_txt, txt |
||
512 | |||
513 | stdcall insert_text_prop, ebx,0 |
||
514 | stdcall insert_text, txt_cbox |
||
515 | insert_sp |
||
516 | |||
517 | stdcall insert_2_prop_16_bit, ebx,1,3 |
||
518 | stdcall insert_text, txt_coma |
||
519 | stdcall insert_2_prop_16_bit, ebx,2,4 |
||
520 | stdcall insert_text, txt_coma |
||
521 | |||
522 | stdcall insert_text_prop, ebx,5 |
||
523 | stdcall insert_text, txt_coma |
||
524 | insert_sp |
||
525 | |||
526 | stdcall insert_text_prop, ebx,6 |
||
527 | stdcall insert_text, txt_coma |
||
528 | stdcall insert_text_prop, ebx,7 |
||
529 | stdcall insert_text, txt_coma |
||
530 | stdcall insert_text_prop, ebx,8 |
||
531 | stdcall insert_text, txt_coma |
||
532 | stdcall insert_text, txt_br |
||
533 | |||
1711 | IgorA | 534 | stdcall insert_text, txt_txt |
535 | mov edx,fp_icon |
||
1714 | IgorA | 536 | stdcall get_obj_id_str, ebx,edx |
1720 | IgorA | 537 | stdcall insert_text, edx |
538 | stdcall insert_text, txt_coma |
||
539 | |||
1727 | IgorA | 540 | ;флаги |
1720 | IgorA | 541 | stdcall insert_text,txt_0 |
1727 | IgorA | 542 | stdcall insert_bit_prop, ebx,BIT_MOD_CHE |
543 | stdcall insert_bit_prop, ebx,BIT_MOD_CHE_T |
||
544 | stdcall insert_bit_prop, ebx,BIT_MOD_CHE_M |
||
545 | stdcall insert_bit_prop, ebx,BIT_MOD_CHE_B |
||
1720 | IgorA | 546 | |
1711 | IgorA | 547 | insert_nl |
1720 | IgorA | 548 | .no_check: |
549 | cmp dword[ebx],C_DTT |
||
550 | jne @f |
||
551 | stdcall insert_text_label_data, ebx,0 |
||
1711 | IgorA | 552 | @@: |
1698 | IgorA | 553 | |
554 | stdcall dword[tl_node_poi_get_next_info], esi,tree2 |
||
1727 | IgorA | 555 | pop esi ;переходим к следущему узлу |
1698 | IgorA | 556 | |
557 | jmp .beg_iterat |
||
558 | .find_no: |
||
559 | popad |
||
560 | ret |
||
561 | endp |
||
562 | |||
1727 | IgorA | 563 | ;данные для библиотек |
1705 | IgorA | 564 | align 4 |
1706 | IgorA | 565 | proc get_code_auto_data_libs_param |
566 | pushad |
||
1727 | IgorA | 567 | insert_nl ;отступ для форматирования |
1706 | IgorA | 568 | |
569 | stdcall dword[tl_node_poi_get_info], 0,tree2 |
||
570 | pop esi |
||
571 | .beg_iterat: |
||
572 | cmp esi,0 |
||
573 | je .find_no |
||
574 | |||
575 | stdcall dword[tl_node_poi_get_data], esi,tree2 |
||
1727 | IgorA | 576 | pop ebx ;получаем данные узла |
1706 | IgorA | 577 | cmp ebx,0 |
578 | je .find_no |
||
579 | |||
1717 | IgorA | 580 | cmp dword[ebx],C_LIB |
1706 | IgorA | 581 | jne @f |
582 | ;0,1,2,3,4,5 - l_nam,s_dir,i_met,... |
||
583 | |||
584 | stdcall insert_text, txt_sys_dir |
||
585 | ;object code |
||
586 | mov edx,fp_icon |
||
1714 | IgorA | 587 | stdcall get_obj_id_str, ebx,edx |
1706 | IgorA | 588 | stdcall insert_text,edx |
589 | stdcall insert_text,txt_db |
||
590 | ;stdcall insert_text, txt_str_beg |
||
591 | stdcall insert_text_prop, ebx,1 |
||
592 | ;stdcall insert_text, txt_str_end |
||
593 | insert_nl |
||
594 | |||
595 | stdcall insert_text, txt_lib_name |
||
596 | stdcall insert_text,edx |
||
597 | stdcall insert_text,txt_db |
||
598 | stdcall insert_text, txt_str_beg |
||
599 | stdcall insert_text_prop, ebx,0 |
||
600 | stdcall insert_text, txt_str_end |
||
601 | insert_nl |
||
602 | |||
603 | stdcall insert_text,txt_err_m_f_lib |
||
604 | stdcall insert_text,edx |
||
605 | stdcall insert_text,txt_db |
||
606 | stdcall insert_text, txt_str_beg |
||
607 | stdcall insert_text_prop, ebx,4 |
||
608 | stdcall insert_text, txt_str_end |
||
609 | insert_nl |
||
610 | |||
611 | stdcall insert_text,txt_err_m_i_lib |
||
612 | stdcall insert_text,edx |
||
613 | stdcall insert_text,txt_db |
||
614 | stdcall insert_text, txt_str_beg |
||
615 | stdcall insert_text_prop, ebx,5 |
||
616 | stdcall insert_text, txt_str_end |
||
617 | insert_nl |
||
618 | |||
619 | insert_nl |
||
620 | @@: |
||
621 | |||
622 | stdcall dword[tl_node_poi_get_next_info], esi,tree2 |
||
1727 | IgorA | 623 | pop esi ;переходим к следущему узлу |
1706 | IgorA | 624 | |
625 | jmp .beg_iterat |
||
626 | .find_no: |
||
627 | popad |
||
628 | ret |
||
629 | endp |
||
630 | |||
1727 | IgorA | 631 | ;данные для библиотек |
1706 | IgorA | 632 | align 4 |
633 | proc get_code_auto_data_libs_struc |
||
634 | pushad |
||
1727 | IgorA | 635 | ;insert_nl ;отступ для форматирования |
1706 | IgorA | 636 | |
637 | stdcall dword[tl_node_poi_get_info], 0,tree2 |
||
638 | pop esi |
||
639 | .beg_iterat: |
||
640 | cmp esi,0 |
||
641 | je .find_no |
||
642 | |||
643 | stdcall dword[tl_node_poi_get_data], esi,tree2 |
||
1727 | IgorA | 644 | pop ebx ;получаем данные узла |
1706 | IgorA | 645 | cmp ebx,0 |
646 | je .find_no |
||
647 | |||
1717 | IgorA | 648 | cmp dword[ebx],C_LIB |
1706 | IgorA | 649 | jne @f |
650 | ;0,1,2,3,4,5 - l_nam,s_dir,i_met,... |
||
651 | |||
652 | stdcall insert_text, txt_lib |
||
653 | ;object code |
||
654 | mov edx,fp_icon |
||
1714 | IgorA | 655 | stdcall get_obj_id_str, ebx,edx |
1706 | IgorA | 656 | stdcall insert_text,edx |
657 | insert_sp |
||
658 | stdcall insert_text, txt_ll |
||
659 | stdcall insert_text, txt_lib_name |
||
660 | stdcall insert_text,edx |
||
661 | stdcall insert_text,txt_coma |
||
662 | |||
663 | stdcall insert_text, txt_lib_path |
||
664 | |||
665 | stdcall insert_text, txt_sys_dir |
||
666 | stdcall insert_text,edx |
||
667 | stdcall insert_text,txt_coma |
||
668 | stdcall insert_text,txt_br |
||
669 | stdcall insert_text,txt_tab |
||
670 | |||
671 | stdcall insert_text,txt_err_m_f_lib |
||
672 | stdcall insert_text,edx |
||
673 | stdcall insert_text,txt_coma |
||
674 | stdcall insert_text,txt_head_l |
||
675 | stdcall insert_text,txt_coma |
||
676 | |||
677 | stdcall insert_text_prop, ebx,2 |
||
678 | stdcall insert_text,txt_coma |
||
679 | |||
680 | stdcall insert_text,txt_err_m_i_lib |
||
681 | stdcall insert_text,edx |
||
682 | stdcall insert_text,txt_coma |
||
683 | stdcall insert_text,txt_head_i |
||
684 | |||
685 | insert_nl |
||
686 | @@: |
||
687 | |||
688 | stdcall dword[tl_node_poi_get_next_info], esi,tree2 |
||
1727 | IgorA | 689 | pop esi ;переходим к следущему узлу |
1706 | IgorA | 690 | |
691 | jmp .beg_iterat |
||
692 | .find_no: |
||
693 | popad |
||
694 | ret |
||
695 | endp |
||
696 | |||
1727 | IgorA | 697 | ;данные для библиотек |
1706 | IgorA | 698 | align 4 |
1705 | IgorA | 699 | proc get_code_auto_data_libs |
700 | pushad |
||
1727 | IgorA | 701 | insert_nl ;отступ для форматирования |
1705 | IgorA | 702 | |
703 | stdcall dword[tl_node_poi_get_info], 0,tree2 |
||
704 | pop esi |
||
705 | .beg_iterat: |
||
706 | cmp esi,0 |
||
707 | je .find_no |
||
708 | |||
709 | stdcall dword[tl_node_poi_get_data], esi,tree2 |
||
1727 | IgorA | 710 | pop ebx ;получаем данные узла |
1705 | IgorA | 711 | cmp ebx,0 |
712 | je .find_no |
||
713 | |||
1717 | IgorA | 714 | cmp dword[ebx],C_LIB |
1705 | IgorA | 715 | jne @f |
716 | ;0,1,2,3,4,5 - l_nam,s_dir,i_met,... |
||
717 | stdcall insert_text, txt_align_4 |
||
718 | stdcall insert_text_prop, ebx,2 |
||
719 | stdcall insert_text, txt_d_poi |
||
720 | insert_nl |
||
721 | |||
722 | call get_code_lib_table |
||
723 | @@: |
||
724 | |||
725 | stdcall dword[tl_node_poi_get_next_info], esi,tree2 |
||
1727 | IgorA | 726 | pop esi ;переходим к следущему узлу |
1705 | IgorA | 727 | |
728 | jmp .beg_iterat |
||
729 | .find_no: |
||
730 | popad |
||
731 | ret |
||
732 | endp |
||
733 | |||
734 | ;input: |
||
735 | ; esi |
||
736 | align 4 |
||
737 | get_code_lib_table: |
||
738 | pushad |
||
739 | mov bl,byte[esi+2] |
||
740 | mov edi,esi |
||
741 | stdcall dword[tl_node_poi_get_data], esi,tree2 |
||
1727 | IgorA | 742 | pop edx ;получение данных родительского объекта |
1705 | IgorA | 743 | cmp edx,0 |
744 | je @f |
||
745 | @@: |
||
746 | stdcall dword[tl_node_poi_get_next_info], esi,tree2 |
||
1727 | IgorA | 747 | pop esi ;переходим к следущему узлу |
1705 | IgorA | 748 | cmp esi,0 |
749 | je @f |
||
750 | cmp byte[esi+2],bl ;lev |
||
751 | jle @f |
||
752 | stdcall dword[tl_node_poi_get_data], esi,tree2 |
||
1727 | IgorA | 753 | pop ecx ;получаем данные узла |
1705 | IgorA | 754 | cmp ecx,0 |
755 | je @f |
||
1717 | IgorA | 756 | cmp dword[ecx],C_IFN |
1705 | IgorA | 757 | jne @b |
1727 | IgorA | 758 | ;вставка указателя на функцию |
1720 | IgorA | 759 | test_bool_prop ecx,BIT_MOD_IMPORT_FUNCT_COMMENT |
760 | jae .no_com_0 |
||
761 | stdcall insert_text, txt_com |
||
762 | .no_com_0: |
||
1705 | IgorA | 763 | insert_tab |
764 | stdcall insert_text_prop, ecx,0 |
||
765 | stdcall insert_text, txt_dd |
||
1727 | IgorA | 766 | stdcall insert_text_prop, edx,3 ;приставка к функции |
1705 | IgorA | 767 | stdcall insert_text_prop, ecx,0 |
768 | insert_nl |
||
769 | jmp @b |
||
770 | @@: |
||
771 | stdcall insert_text, txt_dd_0_0 |
||
772 | mov esi,edi |
||
773 | @@: |
||
774 | stdcall dword[tl_node_poi_get_next_info], esi,tree2 |
||
1727 | IgorA | 775 | pop esi ;переходим к следущему узлу |
1705 | IgorA | 776 | cmp esi,0 |
777 | je @f |
||
778 | cmp byte[esi+2],bl ;lev |
||
779 | jle @f |
||
780 | stdcall dword[tl_node_poi_get_data], esi,tree2 |
||
1727 | IgorA | 781 | pop ecx ;получаем данные узла |
1705 | IgorA | 782 | cmp ecx,0 |
783 | je @f |
||
1717 | IgorA | 784 | cmp dword[ecx],C_IFN |
1705 | IgorA | 785 | jne @b |
1727 | IgorA | 786 | ;вставка имени импортированной функции |
1720 | IgorA | 787 | test_bool_prop ecx,BIT_MOD_IMPORT_FUNCT_COMMENT |
788 | jae .no_com_1 |
||
789 | stdcall insert_text, txt_com |
||
790 | .no_com_1: |
||
1705 | IgorA | 791 | insert_tab |
1727 | IgorA | 792 | stdcall insert_text_prop, edx,3 ;приставка к функции |
1705 | IgorA | 793 | stdcall insert_text_prop, ecx,0 |
794 | stdcall insert_text, txt_db |
||
795 | stdcall insert_text, txt_str_beg |
||
796 | stdcall insert_text_prop, ecx,1 |
||
797 | stdcall insert_text, txt_str_end |
||
798 | insert_nl |
||
799 | jmp @b |
||
800 | @@: |
||
801 | popad |
||
802 | ret |
||
803 | |||
1698 | IgorA | 804 | ; |
805 | align 4 |
||
806 | proc get_code_auto_data_dop |
||
807 | pushad |
||
1727 | IgorA | 808 | insert_nl ;отступ для форматирования |
1698 | IgorA | 809 | |
810 | stdcall dword[tl_node_poi_get_info], 0,tree2 |
||
811 | pop esi |
||
812 | .beg_iterat: |
||
813 | cmp esi,0 |
||
814 | je .find_no |
||
815 | |||
816 | stdcall dword[tl_node_poi_get_data], esi,tree2 |
||
1727 | IgorA | 817 | pop ebx ;получаем данные узла |
1698 | IgorA | 818 | cmp ebx,0 |
819 | je .find_no |
||
820 | |||
1717 | IgorA | 821 | cmp dword[ebx],C_EDB |
1698 | IgorA | 822 | jne @f |
823 | ;1,2,3,4,...,6,...8,...,10 - w,x,y,col_fon,...,col_frame,...,col_txt,...,txt |
||
1727 | IgorA | 824 | |
825 | ;формируем текстовые данные для editbox-ов |
||
1698 | IgorA | 826 | stdcall insert_text, txt_txt |
827 | mov edx,fp_icon |
||
1714 | IgorA | 828 | stdcall get_obj_id_str, ebx,edx |
1711 | IgorA | 829 | stdcall insert_text,edx |
1698 | IgorA | 830 | |
1711 | IgorA | 831 | stdcall get_obj_text_col,ebx,10 |
832 | cmp byte[edx],0 |
||
833 | je .no_text |
||
834 | stdcall insert_text, txt_d_poi |
||
835 | stdcall insert_text, txt_db |
||
836 | stdcall insert_text, txt_str_beg |
||
837 | stdcall str_len,edx |
||
838 | stdcall [ted_text_add], tedit0,edx,eax,ted_opt_ed_move_cursor |
||
839 | stdcall insert_text, txt_str_end |
||
840 | insert_nl |
||
1698 | IgorA | 841 | |
1711 | IgorA | 842 | insert_tab |
843 | stdcall insert_text, txt_met_end |
||
844 | stdcall insert_text, txt_rb |
||
845 | stdcall insert_text, txt_txt |
||
846 | mov edx,fp_icon |
||
1714 | IgorA | 847 | stdcall get_obj_id_str, ebx,edx |
1711 | IgorA | 848 | stdcall insert_text,edx |
849 | |||
850 | stdcall insert_text, txt_minus |
||
851 | stdcall insert_text, txt_txt |
||
852 | stdcall insert_text,edx |
||
853 | stdcall insert_text, txt_met_end |
||
854 | |||
855 | insert_plus |
||
856 | stdcall insert_text_prop,ebx,9 |
||
857 | insert_plus |
||
858 | stdcall insert_text, txt_3 |
||
859 | |||
860 | insert_nl |
||
861 | |||
862 | jmp @f |
||
863 | |||
1727 | IgorA | 864 | .no_text: ;первоначально текст не задан |
1711 | IgorA | 865 | stdcall insert_text, txt_times |
866 | |||
867 | stdcall insert_text_prop,ebx,9 |
||
868 | insert_plus |
||
869 | stdcall insert_text, txt_2 |
||
870 | stdcall insert_text, txt_db |
||
871 | insert_0 |
||
872 | insert_nl |
||
1698 | IgorA | 873 | @@: |
1720 | IgorA | 874 | cmp dword[ebx],C_CHB |
875 | jne @f |
||
876 | stdcall insert_text_label_data, ebx,9 |
||
877 | @@: |
||
1698 | IgorA | 878 | |
879 | stdcall dword[tl_node_poi_get_next_info], esi,tree2 |
||
1727 | IgorA | 880 | pop esi ;переходим к следущему узлу |
1698 | IgorA | 881 | |
882 | jmp .beg_iterat |
||
883 | .find_no: |
||
884 | popad |
||
885 | ret |
||
886 | endp |
||
887 | |||
1727 | IgorA | 888 | ;связываем кнопки с функциями |
1698 | IgorA | 889 | align 4 |
890 | proc get_code_auto_but |
||
891 | pushad |
||
892 | stdcall dword[tl_node_poi_get_info], 0,tree2 |
||
893 | pop esi |
||
894 | .beg_iterat: |
||
895 | cmp esi,0 |
||
896 | je .find_no |
||
897 | |||
898 | stdcall dword[tl_node_poi_get_data], esi,tree2 |
||
1727 | IgorA | 899 | pop ebx ;получаем данные узла |
1698 | IgorA | 900 | cmp ebx,0 |
901 | je .find_no |
||
902 | |||
1717 | IgorA | 903 | cmp dword[ebx],C_BUT |
1698 | IgorA | 904 | jne @f |
905 | insert_tab |
||
906 | insert_cmp |
||
907 | insert_reg8 txt_ah |
||
908 | insert_coma |
||
909 | stdcall get_obj_text_col,ebx,0 |
||
910 | stdcall str_len,edx |
||
911 | stdcall [ted_text_add], tedit0,edx,eax,ted_opt_ed_move_cursor |
||
912 | insert_nl |
||
913 | insert_tab |
||
914 | stdcall insert_text, txt_jne_f |
||
915 | insert_nl |
||
916 | insert_tab |
||
917 | insert_tab |
||
918 | stdcall insert_text, txt_call |
||
919 | stdcall get_obj_text_col,ebx,6 |
||
920 | stdcall str_len,edx |
||
921 | cmp eax,1 |
||
922 | jl .c_fun |
||
923 | stdcall [ted_text_add], tedit0,edx,eax,ted_opt_ed_move_cursor |
||
924 | .c_fun: |
||
925 | insert_nl |
||
926 | insert_tab |
||
927 | insert_a_met ;@@: |
||
928 | insert_nl |
||
929 | @@: |
||
930 | |||
931 | stdcall dword[tl_node_poi_get_next_info], esi,tree2 |
||
1727 | IgorA | 932 | pop esi ;переходим к следущему узлу |
1698 | IgorA | 933 | |
934 | jmp .beg_iterat |
||
935 | .find_no: |
||
936 | popad |
||
937 | ret |
||
938 | endp |
||
939 | |||
1727 | IgorA | 940 | ;берем коды для функций нажатий на кнопки |
1698 | IgorA | 941 | align 4 |
942 | proc get_code_a_but_fun |
||
943 | pushad |
||
944 | stdcall dword[tl_node_poi_get_info], 0,tree2 |
||
945 | pop esi |
||
946 | .beg_iterat: |
||
947 | cmp esi,0 |
||
948 | je .find_no |
||
949 | |||
950 | stdcall dword[tl_node_poi_get_data], esi,tree2 |
||
1727 | IgorA | 951 | pop ebx ;получаем данные узла |
1698 | IgorA | 952 | cmp ebx,0 |
953 | je .find_no |
||
954 | |||
1717 | IgorA | 955 | cmp dword[ebx],C_BUT |
1698 | IgorA | 956 | jne @f |
957 | stdcall get_obj_text_col,ebx,6 |
||
958 | stdcall str_len,edx |
||
959 | cmp eax,1 |
||
960 | jl .c_fun |
||
961 | insert_nl |
||
962 | stdcall insert_text, txt_align_4 |
||
963 | stdcall [ted_text_add], tedit0,edx,eax,ted_opt_ed_move_cursor |
||
964 | insert_d_poi |
||
965 | insert_nl |
||
966 | insert_tab |
||
967 | insert_ret |
||
968 | .c_fun: |
||
969 | @@: |
||
970 | |||
971 | stdcall dword[tl_node_poi_get_next_info], esi,tree2 |
||
1727 | IgorA | 972 | pop esi ;переходим к следущему узлу |
1698 | IgorA | 973 | |
974 | jmp .beg_iterat |
||
975 | .find_no: |
||
976 | popad |
||
977 | ret |
||
978 | endp |
||
979 | |||
980 | align 4 |
||
981 | proc get_code_key, p_obj:dword |
||
982 | pushad |
||
983 | insert_nl |
||
984 | mov ebx,dword[p_obj] |
||
985 | |||
986 | insert_key_beg |
||
1727 | IgorA | 987 | call get_code_funct_key ;коды вызова кнопок |
1698 | IgorA | 988 | insert_key_end |
989 | |||
990 | insert_nl |
||
991 | popad |
||
992 | ret |
||
993 | endp |
||
994 | |||
995 | align 4 |
||
996 | proc get_code_funct_key |
||
997 | pushad |
||
998 | stdcall dword[tl_node_poi_get_info], 0,tree2 |
||
999 | pop esi |
||
1000 | .beg_iterat: |
||
1001 | cmp esi,0 |
||
1002 | je .find_no |
||
1003 | |||
1004 | stdcall dword[tl_node_poi_get_data], esi,tree2 |
||
1727 | IgorA | 1005 | pop ebx ;получаем данные узла |
1698 | IgorA | 1006 | cmp ebx,0 |
1007 | je .find_no |
||
1008 | |||
1717 | IgorA | 1009 | cmp dword[ebx],C_EDB |
1698 | IgorA | 1010 | jne @f |
1011 | stdcall insert_text, txt_std_key_ed |
||
1012 | stdcall insert_text_prop,ebx,0 |
||
1013 | insert_nl |
||
1014 | @@: |
||
1015 | |||
1016 | stdcall dword[tl_node_poi_get_next_info], esi,tree2 |
||
1727 | IgorA | 1017 | pop esi ;переходим к следущему узлу |
1698 | IgorA | 1018 | |
1019 | jmp .beg_iterat |
||
1020 | .find_no: |
||
1021 | popad |
||
1022 | ret |
||
1023 | endp |
||
1024 | |||
1727 | IgorA | 1025 | ;объекты подключения файлов 'include ...' |
1698 | IgorA | 1026 | align 4 |
1027 | proc get_code_incl, p_obj:dword |
||
1028 | pushad |
||
1029 | stdcall insert_text, txt_incl |
||
1030 | mov ebx,dword[p_obj] |
||
1031 | stdcall insert_text_prop,ebx,0 |
||
1032 | |||
1033 | stdcall get_obj_text_col,ebx,1 |
||
1034 | stdcall str_len,edx |
||
1035 | cmp eax,1 |
||
1036 | jl @f |
||
1037 | insert_sp |
||
1038 | insert_com |
||
1039 | stdcall [ted_text_add], tedit0,edx,eax,ted_opt_ed_move_cursor |
||
1040 | @@: |
||
1041 | |||
1042 | insert_nl |
||
1043 | popad |
||
1044 | ret |
||
1045 | endp |
||
1046 | |||
1727 | IgorA | 1047 | ;создаем код задания окна |
1698 | IgorA | 1048 | align 4 |
1049 | proc get_code_window, p_obj:dword |
||
1050 | pushad |
||
1051 | mov ebx,dword[p_obj] |
||
1052 | ;2,3,4,5,6 - x,y,w,h,col_bkg |
||
1053 | |||
1054 | stdcall insert_text, txt_draw_wb |
||
1055 | |||
1056 | insert_tab |
||
1057 | insert_xor |
||
1058 | insert_reg txt_eax |
||
1059 | insert_coma |
||
1060 | insert_reg txt_eax |
||
1061 | insert_nl |
||
1062 | |||
1063 | ;mov ebx,... |
||
1064 | insert_tab |
||
1065 | stdcall insert_text, txt_mov |
||
1066 | insert_reg txt_ebx |
||
1067 | insert_coma |
||
1720 | IgorA | 1068 | stdcall insert_2_prop_16_bit, ebx,2,4 |
1698 | IgorA | 1069 | insert_nl |
1070 | |||
1071 | ;mov ecx,... |
||
1072 | insert_tab |
||
1073 | stdcall insert_text, txt_mov |
||
1074 | insert_reg txt_ecx |
||
1075 | insert_coma |
||
1720 | IgorA | 1076 | stdcall insert_2_prop_16_bit, ebx,3,5 |
1698 | IgorA | 1077 | insert_nl |
1078 | |||
1079 | ;mov edx,... |
||
1080 | insert_tab |
||
1081 | stdcall insert_text, txt_mov |
||
1082 | insert_reg txt_edx |
||
1083 | insert_coma |
||
1084 | stdcall insert_text_prop, ebx,6 |
||
1085 | insert_nl |
||
1086 | |||
1087 | ;or edx,0x33000000 |
||
1705 | IgorA | 1088 | insert_tab |
1698 | IgorA | 1089 | stdcall insert_text, txt_or |
1090 | insert_reg txt_edx |
||
1091 | insert_coma |
||
1092 | stdcall insert_text, txt_0x33000000 |
||
1093 | insert_nl |
||
1094 | |||
1095 | ;mov edi,... |
||
1096 | insert_tab |
||
1097 | stdcall insert_text, txt_mov |
||
1098 | insert_reg txt_edi |
||
1099 | insert_coma |
||
1100 | stdcall insert_text_prop, ebx,0 |
||
1101 | insert_nl |
||
1102 | |||
1103 | insert_tab |
||
1104 | stdcall insert_text, txt_i_40 |
||
1705 | IgorA | 1105 | insert_nl |
1698 | IgorA | 1106 | |
1107 | call get_code_draw_obj |
||
1108 | |||
1727 | IgorA | 1109 | stdcall insert_text, txt_draw_we ;код завершающий функцию рисования |
1698 | IgorA | 1110 | popad |
1111 | ret |
||
1112 | endp |
||
1113 | |||
1114 | |||
1727 | IgorA | 1115 | ;формируем вызов функций для рисования объектов |
1698 | IgorA | 1116 | align 4 |
1117 | proc get_code_draw_obj |
||
1118 | pushad |
||
1119 | stdcall dword[tl_node_poi_get_info], 0,tree2 |
||
1120 | pop esi |
||
1121 | .beg_iterat: |
||
1122 | cmp esi,0 |
||
1123 | je .find_no |
||
1124 | |||
1125 | stdcall dword[tl_node_poi_get_data], esi,tree2 |
||
1727 | IgorA | 1126 | pop ebx ;получаем данные узла |
1698 | IgorA | 1127 | cmp ebx,0 |
1128 | je .find_no |
||
1129 | |||
1717 | IgorA | 1130 | cmp dword[ebx],C_EDB |
1698 | IgorA | 1131 | jne @f |
1132 | stdcall insert_text, txt_editb_draw |
||
1133 | stdcall insert_text_prop, ebx,0 |
||
1134 | insert_nl |
||
1135 | @@: |
||
1717 | IgorA | 1136 | cmp dword[ebx],C_CHB |
1698 | IgorA | 1137 | jne @f |
1138 | stdcall insert_text, txt_cbox_draw |
||
1139 | stdcall insert_text_prop, ebx,0 |
||
1140 | insert_nl |
||
1141 | @@: |
||
1717 | IgorA | 1142 | cmp dword[ebx],C_BUT |
1143 | jne .ob_draw_but |
||
1698 | IgorA | 1144 | insert_tab |
1145 | stdcall insert_text, txt_mov |
||
1146 | insert_reg txt_eax |
||
1147 | insert_coma |
||
1148 | stdcall insert_text, txt_8 |
||
1149 | insert_nl |
||
1150 | |||
1151 | insert_tab |
||
1152 | stdcall insert_text, txt_mov |
||
1153 | insert_reg txt_ebx |
||
1154 | insert_coma |
||
1720 | IgorA | 1155 | stdcall insert_2_prop_16_bit, ebx,1,3 |
1698 | IgorA | 1156 | insert_nl |
1157 | |||
1158 | insert_tab |
||
1159 | stdcall insert_text, txt_mov |
||
1160 | insert_reg txt_ecx |
||
1161 | insert_coma |
||
1720 | IgorA | 1162 | stdcall insert_2_prop_16_bit, ebx,2,4 |
1698 | IgorA | 1163 | insert_nl |
1164 | |||
1165 | insert_tab |
||
1166 | stdcall insert_text, txt_mov |
||
1167 | insert_reg txt_edx |
||
1168 | insert_coma |
||
1169 | stdcall insert_text_prop, ebx,0 |
||
1717 | IgorA | 1170 | test_bool_prop ebx,BIT_MOD_BUT_NFON |
1171 | jnc @f |
||
1172 | stdcall insert_text, txt_plus |
||
1173 | stdcall insert_text, txt_bit_30 |
||
1174 | @@: |
||
1175 | test_bool_prop ebx,BIT_MOD_BUT_NBORD |
||
1176 | jnc @f |
||
1177 | stdcall insert_text, txt_plus |
||
1178 | stdcall insert_text, txt_bit_29 |
||
1179 | @@: |
||
1698 | IgorA | 1180 | insert_nl |
1181 | |||
1182 | insert_tab |
||
1183 | stdcall insert_text, txt_mov |
||
1184 | insert_reg txt_esi |
||
1185 | insert_coma |
||
1186 | stdcall insert_text_prop, ebx,5 ;button color |
||
1187 | insert_nl |
||
1188 | |||
1189 | insert_tab |
||
1190 | stdcall insert_text, txt_i_40 |
||
1191 | insert_nl |
||
1717 | IgorA | 1192 | .ob_draw_but: |
1193 | cmp dword[ebx],C_REC |
||
1698 | IgorA | 1194 | jne @f |
1195 | insert_tab |
||
1196 | stdcall insert_text, txt_mov |
||
1197 | insert_reg txt_eax |
||
1198 | insert_coma |
||
1199 | stdcall insert_text, txt_1 |
||
1200 | stdcall insert_text, txt_3 |
||
1201 | insert_nl |
||
1202 | |||
1203 | insert_tab |
||
1204 | stdcall insert_text, txt_mov |
||
1205 | insert_reg txt_ebx |
||
1206 | insert_coma |
||
1720 | IgorA | 1207 | stdcall insert_2_prop_16_bit, ebx,1,3 |
1698 | IgorA | 1208 | insert_nl |
1209 | |||
1210 | insert_tab |
||
1211 | stdcall insert_text, txt_mov |
||
1212 | insert_reg txt_ecx |
||
1213 | insert_coma |
||
1720 | IgorA | 1214 | stdcall insert_2_prop_16_bit, ebx,2,4 |
1698 | IgorA | 1215 | insert_nl |
1216 | |||
1217 | insert_tab |
||
1218 | stdcall insert_text, txt_mov |
||
1219 | insert_reg txt_edx |
||
1220 | insert_coma |
||
1221 | stdcall insert_text_prop, ebx,0 ;rect color |
||
1222 | insert_nl |
||
1223 | |||
1224 | insert_tab |
||
1225 | stdcall insert_text, txt_i_40 |
||
1226 | insert_nl |
||
1227 | @@: |
||
1727 | IgorA | 1228 | cmp dword[ebx],C_DTT ;рисование текста через сист. ф. 4 |
1717 | IgorA | 1229 | jne .ob_draw_text |
1711 | IgorA | 1230 | insert_tab |
1231 | stdcall insert_text, txt_mov |
||
1232 | insert_reg txt_eax |
||
1233 | insert_coma |
||
1234 | stdcall insert_text, txt_4 |
||
1235 | insert_nl |
||
1698 | IgorA | 1236 | |
1711 | IgorA | 1237 | insert_tab |
1238 | stdcall insert_text, txt_mov |
||
1239 | insert_reg txt_ebx |
||
1240 | insert_coma |
||
1720 | IgorA | 1241 | stdcall insert_2_prop_16_bit, ebx,1,2 |
1711 | IgorA | 1242 | insert_nl |
1243 | |||
1244 | insert_tab |
||
1245 | stdcall insert_text, txt_mov |
||
1246 | insert_reg txt_ecx |
||
1247 | insert_coma |
||
1248 | stdcall insert_text_prop, ebx,3 |
||
1727 | IgorA | 1249 | stdcall insert_bit_prop, ebx,BIT_MOD_TXT_ASCII_0 ;31 - бит для строки ASCIIZ |
1250 | stdcall insert_bit_prop, ebx,BIT_MOD_TXT_NO_TRAN ;30 - бит для не прозрачного текста |
||
1251 | stdcall insert_bit_prop, ebx,BIT_MOD_TXT_CHAR2 ;28 - бит для 2-го сист. шрифта |
||
1711 | IgorA | 1252 | insert_nl |
1253 | |||
1254 | insert_tab |
||
1255 | stdcall insert_text, txt_mov |
||
1256 | insert_reg txt_edx |
||
1257 | insert_coma |
||
1258 | stdcall insert_text, txt_txt |
||
1259 | mov edx,fp_icon |
||
1714 | IgorA | 1260 | stdcall get_obj_id_str, ebx,edx |
1711 | IgorA | 1261 | stdcall insert_text,edx |
1262 | insert_nl |
||
1263 | |||
1264 | ;mov esi,... |
||
1717 | IgorA | 1265 | test_bool_prop ebx,BIT_MOD_TXT_NO_TRAN |
1266 | jnc @f |
||
1267 | insert_tab |
||
1268 | stdcall insert_text, txt_mov |
||
1269 | insert_reg txt_edi |
||
1270 | insert_coma |
||
1727 | IgorA | 1271 | stdcall insert_text_prop, ebx,4 ;цвет фона |
1717 | IgorA | 1272 | insert_nl |
1273 | @@: |
||
1711 | IgorA | 1274 | |
1275 | insert_tab |
||
1276 | stdcall insert_text, txt_i_40 |
||
1277 | insert_nl |
||
1717 | IgorA | 1278 | .ob_draw_text: |
1711 | IgorA | 1279 | |
1698 | IgorA | 1280 | stdcall dword[tl_node_poi_get_next_info], esi,tree2 |
1727 | IgorA | 1281 | pop esi ;переходим к следущему узлу |
1698 | IgorA | 1282 | |
1283 | jmp .beg_iterat |
||
1284 | .find_no: |
||
1285 | popad |
||
1286 | ret |
||
1287 | endp |
||
1288 | |||
1727 | IgorA | 1289 | ;создать код объявления переменной |
1698 | IgorA | 1290 | align 4 |
1291 | proc get_code_variable, p_obj:dword,o_lev:dword |
||
1292 | pushad |
||
1293 | mov ebx,dword[p_obj] |
||
1294 | ;0,1,2 - name,value,comment |
||
1295 | |||
1296 | mov ecx,dword[o_lev] |
||
1297 | cmp cl,0 |
||
1727 | IgorA | 1298 | je .no_tab ;избегаем зацикливания (0-1 = 2^32-1) |
1717 | IgorA | 1299 | and ecx,0xff |
1698 | IgorA | 1300 | cld |
1301 | @@: |
||
1727 | IgorA | 1302 | insert_tab ;формирование отступа перед переменной |
1698 | IgorA | 1303 | loop @b |
1304 | .no_tab: |
||
1305 | |||
1727 | IgorA | 1306 | stdcall insert_text_prop, ebx,0 ;имя переменной |
1698 | IgorA | 1307 | insert_sp |
1308 | |||
1727 | IgorA | 1309 | mov ecx,dword[ebx+u_object.typid-u_object] ;ecx - относительный индекс родительского объекта (в памяти) |
1698 | IgorA | 1310 | xor eax,eax |
1311 | mov ax,[tree2.info_size] |
||
1727 | IgorA | 1312 | imul ecx,eax ;умножаем индекс на размер структуры |
1313 | add ecx,[tree2.data_info] ;ecx - указатель данные родительского узла |
||
1698 | IgorA | 1314 | |
1727 | IgorA | 1315 | ;проверку на правильность ecx ??? |
1698 | IgorA | 1316 | |
1727 | IgorA | 1317 | stdcall insert_text_prop, ecx,0 ;тип переменной |
1698 | IgorA | 1318 | insert_sp |
1727 | IgorA | 1319 | stdcall insert_text_prop, ebx,1 ;значение |
1698 | IgorA | 1320 | |
1727 | IgorA | 1321 | stdcall get_obj_text_col,ebx,2 ;комментарий |
1698 | IgorA | 1322 | stdcall str_len,edx |
1323 | cmp eax,1 |
||
1324 | jl @f |
||
1325 | insert_sp |
||
1326 | insert_com |
||
1327 | stdcall [ted_text_add], tedit0,edx,eax,ted_opt_ed_move_cursor |
||
1328 | @@: |
||
1329 | insert_nl |
||
1330 | |||
1331 | popad |
||
1332 | ret |
||
1333 | endp |
||
1334 | |||
1335 | |||
1336 | |||
1727 | IgorA | 1337 | ;--- текстовые константы --- |
1705 | IgorA | 1338 | txt_str_beg db 39,0 |
1339 | txt_str_end db 39,',0',0 |
||
1698 | IgorA | 1340 | txt_coma db ',',0 |
1720 | IgorA | 1341 | txt_skob_o db '(',0 |
1342 | txt_skob_c db ')',0 |
||
1727 | IgorA | 1343 | txt_skob_fo db '{',0 ;скобка фигурная открывающая |
1344 | txt_skob_fc db '}',0 ;скобка фигурная закрывающая |
||
1698 | IgorA | 1345 | txt_i_40 db 'int 0x40',13,0 |
1346 | txt_0 db '0',0 |
||
1347 | txt_1 db '1',0 |
||
1348 | txt_2 db '2',0 |
||
1349 | txt_3 db '3',0 |
||
1350 | txt_4 db '4',0 |
||
1351 | txt_8 db '8',0 |
||
1352 | txt_plus db '+',0 |
||
1711 | IgorA | 1353 | txt_minus db '-',0 |
1354 | ;txt_dol db '$',0 |
||
1698 | IgorA | 1355 | txt_nl db 13,0 |
1356 | txt_com db ';',0 |
||
1357 | txt_sp db ' ',0 |
||
1358 | txt_tab db 9,0 |
||
1359 | txt_br db '\',13,9,0 |
||
1705 | IgorA | 1360 | txt_txt db 'txt_',0 |
1361 | txt_db db ' db ',0 |
||
1362 | txt_dd db ' dd ',0 |
||
1711 | IgorA | 1363 | txt_rb db ' rb ',0 |
1705 | IgorA | 1364 | txt_dd_0_0 db 9,'dd 0,0',13,0 |
1365 | txt_mouse_dd db ', mouse_dd, ',0 |
||
1366 | txt_times db ':',13,9,'times ',0 |
||
1698 | IgorA | 1367 | txt_draw_wb: |
1368 | db 13,'align 4',13,'draw_window:',13,'pushad',13,9,'mcall 12,1',13,0 |
||
1369 | txt_draw_we: |
||
1370 | db 9,'mcall 12,2',13,'popad',13,9,'ret',13,0 |
||
1706 | IgorA | 1371 | txt_sys_dir db 'system_dir_',0 |
1372 | txt_lib_name db 'lib_name_',0 |
||
1373 | txt_lib_path db ' sys_path, library_path, ',0 |
||
1374 | txt_sys_err db 'Системная ошибка',0 |
||
1375 | txt_ll_start db 'l_libs_start:',13,0 |
||
1376 | txt_lib db 9,'lib_',0 |
||
1377 | txt_ll db 'l_libs ',0 |
||
1378 | txt_err_m_f_lib db 'err_msg_found_lib_',0 |
||
1379 | txt_head_l db 'head_f_l',0 |
||
1380 | txt_err_m_i_lib db 'err_msg_import_',0 |
||
1381 | txt_head_i db 'head_f_i',0 |
||
1382 | txt_ll_end db 'l_libs_end:',13,0 |
||
1727 | IgorA | 1383 | ;txt_bit_28 db '0x10000000',0 |
1717 | IgorA | 1384 | txt_bit_29 db '0x20000000',0 |
1385 | txt_bit_30 db '0x40000000',0 |
||
1727 | IgorA | 1386 | ;txt_bit_31 db '0x80000000',0 |
1698 | IgorA | 1387 | txt_0x33000000 db '0x33000000',0 ;tmp |
1720 | IgorA | 1388 | txt_struc db 'struc',0 |
1389 | txt_t db 't',0 |
||
1711 | IgorA | 1390 | txt_met_end db '.end',0 |
1698 | IgorA | 1391 | txt_ends db 'ends',13,13,0 |
1392 | txt_mov db 'mov ',0 |
||
1393 | txt_xor db 'xor ',0 |
||
1394 | txt_or db 'or ',0 |
||
1395 | txt_cmp db 'cmp ',0 |
||
1396 | txt_call db 'call ',0 |
||
1397 | txt_jne_f db 'jne @f',0 |
||
1398 | txt_a_met db '@@:',0 |
||
1399 | txt_ah db 'ah',0 |
||
1400 | txt_eax db 'eax',0 |
||
1401 | txt_ebx db 'ebx',0 |
||
1402 | txt_ecx db 'ecx',0 |
||
1403 | txt_edx db 'edx',0 |
||
1404 | txt_edi db 'edi',0 |
||
1405 | txt_esi db 'esi',0 |
||
1406 | txt_align_4 db 'align 4',13,0 |
||
1407 | txt_d_poi db ':',0 |
||
1408 | txt_ret db 'ret',13,0 |
||
1720 | IgorA | 1409 | txt_shl_16 db ' shl 16',0 |
1698 | IgorA | 1410 | txt_std_mouse_ed: |
1411 | db 9,'stdcall [edit_box_mouse], ',0 |
||
1720 | IgorA | 1412 | txt_std_init_cb: |
1413 | db 9,'init_checkboxes2 check_boxes,check_boxes_end',13,0 |
||
1698 | IgorA | 1414 | txt_std_mouse_cb: |
1415 | db 9,'stdcall [check_box_mouse], ',0 |
||
1416 | txt_std_key_ed: |
||
1417 | db 9,'stdcall [edit_box_key], ',0 |
||
1418 | txt_incl: |
||
1419 | db 'include ',0 |
||
1720 | IgorA | 1420 | |
1421 | txt_cbox db ' check_box2',0 |
||
1422 | txt_cb_b db 13,'check_boxes:',0 |
||
1423 | txt_cb_e db 'check_boxes_end:',13,0 |
||
1424 | |||
1706 | IgorA | 1425 | txt_ebox db ' edit_box',0 |
1698 | IgorA | 1426 | txt_editb_draw: |
1427 | db 9,'stdcall [edit_box_draw], ',0 |
||
1428 | txt_cbox_draw: |
||
1429 | db 9,'stdcall [check_box_draw], ',0 |
||
1430 | |||
1431 | txt_but_1: |
||
1432 | db 'align 4',13,'button:',13,9,'mcall 17',13 |
||
1433 | txt_but_2: |
||
1434 | db 9,'cmp ah,1',13,9,'jne still',13,'.exit:',13,9,'mcall -1',13 |
||
1435 | txt_but_3: |
||
1436 | |||
1437 | txt_key_1: |
||
1438 | db 'align 4',13,'key:',13,9,'mcall 2',13 |
||
1439 | txt_key_2: |
||
1440 | db 9,'jmp still',13 |
||
1441 | txt_key_3: |
||
1442 | |||
1727 | IgorA | 1443 | ;получаем порядковый номер объекта относительно памяти элемента tree2 |
1714 | IgorA | 1444 | ;output: |
1727 | IgorA | 1445 | ; txt_buf - строка с номером объекта |
1698 | IgorA | 1446 | align 4 |
1714 | IgorA | 1447 | proc get_obj_id_str, p_obj:dword, txt_buf:dword |
1698 | IgorA | 1448 | push eax ecx edx |
1449 | mov eax,dword[p_obj] |
||
1450 | sub eax,[tree2.data_info] |
||
1451 | xor edx,edx |
||
1452 | xor ecx,ecx |
||
1453 | mov cx,word[tree2.info_size] |
||
1454 | div ecx |
||
1455 | |||
1456 | mov edx,dword[txt_buf] |
||
1457 | mov byte[edx],0 |
||
1458 | stdcall str_cat_value,edx,eax |
||
1459 | pop edx ecx eax |
||
1460 | ret |
||
1461 | endp |
||
1462 | |||
1727 | IgorA | 1463 | ;получаем порядковый номер объекта относительно памяти элемента tree2 |
1714 | IgorA | 1464 | ;output: |
1727 | IgorA | 1465 | ; eax - номер объекта |
1714 | IgorA | 1466 | align 4 |
1467 | proc get_obj_id, p_obj:dword |
||
1468 | push ecx edx |
||
1469 | mov eax,dword[p_obj] |
||
1470 | sub eax,[tree2.data_info] |
||
1471 | xor edx,edx |
||
1472 | xor ecx,ecx |
||
1473 | mov cx,word[tree2.info_size] |
||
1474 | div ecx |
||
1475 | pop edx ecx |
||
1476 | ret |
||
1477 | endp |
||
1478 | |||
1727 | IgorA | 1479 | ;--- текстовые функции --- |
1698 | IgorA | 1480 | |
1727 | IgorA | 1481 | ;выбираем строку из масива, по указанному индексу |
1482 | ;input: |
||
1483 | ; str - указатель на масив строк |
||
1484 | ; ind - индекс искомой строки |
||
1485 | ;output: |
||
1486 | ; edi - указатель на найденую строку |
||
1698 | IgorA | 1487 | align 4 |
1727 | IgorA | 1488 | proc get_string_by_ind, str:dword, ind:dword |
1489 | push eax ebx ecx |
||
1490 | mov edi,[str] |
||
1491 | mov ebx,[ind] |
||
1492 | xor al,al ;0 - символ конца строки |
||
1493 | @@: |
||
1494 | cmp ebx,0 |
||
1495 | jle @f ;если найдена строка с указанным индексом |
||
1496 | xor ecx,ecx |
||
1497 | dec ecx ;ecx - число просматриваемых байт |
||
1498 | cld |
||
1499 | repne scasb ;ищем конец строки (al=0) |
||
1500 | cmp byte[edi],0 |
||
1501 | je @f ;если следующей строки нет выход из цикла |
||
1502 | dec ebx |
||
1503 | jmp @b |
||
1504 | @@: |
||
1505 | pop ecx ebx eax |
||
1506 | ret |
||
1507 | endp |
||
1508 | |||
1509 | align 4 |
||
1698 | IgorA | 1510 | proc mem_clear, mem:dword, len:dword |
1511 | push eax ecx edi |
||
1512 | cld |
||
1513 | xor al,al |
||
1514 | mov edi, dword[mem] |
||
1515 | mov ecx, dword[len] |
||
1516 | repne stosb |
||
1517 | pop edi ecx eax |
||
1518 | ret |
||
1519 | endp |
||
1520 | |||
1521 | align 4 |
||
1522 | proc str_cat, str1:dword, str2:dword |
||
1523 | push eax ecx edi esi |
||
1524 | mov esi,dword[str2] |
||
1525 | stdcall str_len,esi |
||
1526 | mov ecx,eax |
||
1527 | inc ecx |
||
1528 | mov edi,dword[str1] |
||
1529 | stdcall str_len,edi |
||
1530 | add edi,eax |
||
1531 | cld |
||
1532 | repne movsb |
||
1533 | pop esi edi ecx eax |
||
1534 | ret |
||
1535 | endp |
||
1536 | |||
1537 | align 4 |
||
1538 | proc str_cat_value, str1:dword, value:dword |
||
1539 | pushad |
||
1540 | mov edi,[str1] |
||
1541 | stdcall str_len,edi |
||
1542 | add edi,eax |
||
1543 | mov eax,[value] |
||
1544 | call tl_convert_to_str |
||
1545 | popad |
||
1546 | ret |
||
1547 | endp |
||
1548 | |||
1549 | ;output: |
||
1550 | ; eax = strlen |
||
1551 | align 4 |
||
1552 | proc str_len, str1:dword |
||
1553 | mov eax,[str1] |
||
1554 | @@: |
||
1555 | cmp byte[eax],0 |
||
1556 | je @f |
||
1557 | inc eax |
||
1558 | jmp @b |
||
1559 | @@: |
||
1560 | sub eax,[str1] |
||
1561 | ret |
||
1562 | endp |
||
1563 | |||
1564 | ;input: |
||
1565 | ; eax = value |
||
1566 | ; edi = string buffer |
||
1567 | align 4 |
||
1568 | tl_convert_to_str: |
||
1569 | pushad |
||
1570 | stdcall mem_clear,edi,12 |
||
1571 | call .str |
||
1572 | popad |
||
1573 | ret |
||
1574 | |||
1575 | align 4 |
||
1576 | .str: |
||
1727 | IgorA | 1577 | mov ecx,0x0a ;задается система счисления изменяются регистры ebx,eax,ecx,edx входные параметры eax - число |
1578 | ;преревод числа в ASCII строку входные данные ecx=система счисленя edi адрес куда записывать, будем строку, причем конец переменной |
||
1579 | cmp eax,ecx ;сравнить если в eax меньше чем в ecx то перейти на @@-1 т.е. на pop eax |
||
1698 | IgorA | 1580 | jb @f |
1727 | IgorA | 1581 | xor edx,edx ;очистить edx |
1582 | div ecx ;разделить - остаток в edx |
||
1583 | push edx ;положить в стек |
||
1584 | ;dec edi ;смещение необходимое для записи с конца строки |
||
1585 | call .str ;перейти на саму себя т.е. вызвать саму себя и так до того момента пока в eax не станет меньше чем в ecx |
||
1698 | IgorA | 1586 | pop eax |
1727 | IgorA | 1587 | @@: ;cmp al,10 ;проверить не меньше ли значение в al чем 10 (для системы счисленя 10 данная команда - лишная)) |
1588 | or al,0x30 ;данная команда короче чем две выше |
||
1589 | stosb ;записать элемент из регистра al в ячеку памяти es:edi |
||
1698 | IgorA | 1590 | ret |