Rev 2672 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
31 | halyavin | 1 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
2 | ;; ;; |
||
3 | ;; flat assembler source ;; |
||
2664 | dunkaist | 4 | ;; Copyright (c) 1999-2012, Tomasz Grysztar ;; |
31 | halyavin | 5 | ;; All rights reserved. ;; |
6 | ;; ;; |
||
2059 | mario79 | 7 | ;; KolibriOS port by KolibriOS Team ;; |
31 | halyavin | 8 | ;; Menuet port by VT ;; |
9 | ;; ;; |
||
10 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
||
11 | |||
12 | NORMAL_MODE = 8 |
||
13 | CONSOLE_MODE = 32 |
||
14 | |||
1361 | IgorA | 15 | MAGIC1 = 6*(text.line_size-1)+14 |
174 | heavyiron | 16 | MAX_PATH = 100 |
31 | halyavin | 17 | |
174 | heavyiron | 18 | APP_MEMORY = 0x00800000 |
31 | halyavin | 19 | |
20 | ;; Menuet header |
||
21 | |||
205 | heavyiron | 22 | appname equ "flat assembler " |
2059 | mario79 | 23 | ;--------------------------------------------------------------------- |
24 | use32 |
||
25 | org 0x0 |
||
26 | db 'MENUET01' ; 8 byte id |
||
27 | dd 0x01 ; header version |
||
28 | dd START ; program start |
||
29 | dd program_end ; program image size |
||
30 | dd stacktop ; required amount of memory |
||
31 | dd stacktop ; stack |
||
32 | dd params,cur_dir_path ; parameters,icon |
||
33 | ;--------------------------------------------------------------------- |
||
31 | halyavin | 34 | include 'lang.inc' |
1443 | diamond | 35 | include '../../../macros.inc' |
1361 | IgorA | 36 | purge add,sub ; macros.inc does incorrect substitution |
31 | halyavin | 37 | include 'fasm.inc' |
38 | |||
1443 | diamond | 39 | include '../../../develop/libraries/box_lib/trunk/box_lib.mac' |
40 | include '../../../develop/libraries/box_lib/load_lib.mac' |
||
1361 | IgorA | 41 | @use_library |
42 | |||
31 | halyavin | 43 | center fix true |
2059 | mario79 | 44 | ;--------------------------------------------------------------------- |
109 | heavyiron | 45 | START: ; Start of execution |
1361 | IgorA | 46 | mov edi, fileinfos |
47 | mov ecx, (fileinfos_end-fileinfos)/4 |
||
48 | or eax, -1 |
||
49 | rep stosd |
||
50 | push 68 |
||
51 | pop eax |
||
52 | push 11 |
||
53 | pop ebx |
||
54 | mcall |
||
55 | |||
2059 | mario79 | 56 | cmp [params],0 |
57 | jz start_1 |
||
58 | |||
3662 | GerdtR | 59 | ;---------GerdtR |
60 | or ecx,-1 |
||
61 | mov esi,params |
||
62 | cmp byte[esi],' ' |
||
63 | jne @f |
||
64 | mov edi,esi |
||
65 | mov al,' ' |
||
66 | repe scasb |
||
67 | mov esi,edi |
||
68 | dec esi |
||
69 | @@: |
||
70 | |||
71 | mov edi,dbgWord |
||
72 | @@: lodsb |
||
73 | scasb |
||
74 | jne NoOutDebugInfo |
||
75 | cmp byte[edi],0 |
||
76 | jnz @b |
||
77 | |||
78 | cmp byte[esi],' ' |
||
79 | jne NoOutDebugInfo |
||
80 | |||
81 | mov edi,esi |
||
82 | mov al,' ' |
||
83 | repe scasb |
||
84 | mov esi,edi |
||
85 | dec esi |
||
86 | |||
87 | mov edi,params |
||
88 | @@: lodsb |
||
89 | stosb |
||
90 | test al,al |
||
91 | jnz @b |
||
92 | |||
93 | ; mov [bGenerateDebugInfo], 1 |
||
94 | or dword[ch1_dbg.flags],10b |
||
95 | |||
96 | |||
97 | NoOutDebugInfo: |
||
98 | ;---------/GerdtR |
||
99 | |||
100 | |||
101 | |||
102 | |||
2059 | mario79 | 103 | mov ecx,10 |
104 | mov eax,' ' |
||
105 | mov edi,infile |
||
106 | push ecx |
||
107 | cld |
||
108 | rep stosd |
||
109 | mov ecx,[esp] |
||
110 | mov edi,outfile |
||
111 | rep stosd |
||
112 | pop ecx |
||
113 | mov edi,path |
||
114 | rep stosd |
||
115 | |||
116 | mov esi,params |
||
117 | ; DEBUGF "params: %s\n",esi |
||
118 | mov edi,infile |
||
119 | call mov_param_str |
||
120 | ; mov edi,infile |
||
121 | ; DEBUGF " input: %s\n",edi |
||
122 | mov edi,outfile |
||
123 | call mov_param_str |
||
124 | ; mov edi,outfile |
||
125 | ; DEBUGF "output: %s\n",edi |
||
126 | mov edi,path |
||
127 | call mov_param_str |
||
128 | ; mov edi,path |
||
129 | ; DEBUGF " path: %s\n",edi |
||
130 | dec esi |
||
131 | cmp [esi], dword ',run' |
||
132 | jne @f |
||
133 | mov [_run_outfile],1 |
||
134 | @@: |
||
135 | mov [_mode],CONSOLE_MODE |
||
136 | jmp start |
||
137 | ;--------------------------------------------------------------------- |
||
1395 | mario79 | 138 | start_1: |
1617 | IgorA | 139 | ;sys_ |
140 | load_libraries l_libs_start,load_lib_end |
||
31 | halyavin | 141 | |
2059 | mario79 | 142 | cmp eax,-1 |
143 | jne @f |
||
144 | mcall -1 ;exit if not open box_lib.obj |
||
145 | @@: |
||
146 | mcall 40,0x27 ;маска системных событий |
||
147 | ;--------------------------------------------------------------------- |
||
2298 | IgorA | 148 | init_checkboxes2 ch1_dbg,ch1_dbg+ch_struc_size |
2059 | mario79 | 149 | ;--------------------------------------------------------------------- |
150 | ; OpenDialog initialisation |
||
151 | push dword OpenDialog_data |
||
152 | call dword [OpenDialog_Init] |
||
153 | ;--------------------------------------------------------------------- |
||
174 | heavyiron | 154 | red: ; Redraw |
2059 | mario79 | 155 | call draw_window |
31 | halyavin | 156 | |
1361 | IgorA | 157 | still: |
2105 | mario79 | 158 | mcall 10 ; Wait here for event |
2059 | mario79 | 159 | cmp al,6 |
160 | je call_mouse |
||
161 | dec eax |
||
162 | je red ; Redraw request |
||
163 | dec eax |
||
164 | jne button ; Button in buffer |
||
1361 | IgorA | 165 | key: ; Key |
2105 | mario79 | 166 | mcall 2 ; Read it and ignore |
2059 | mario79 | 167 | |
168 | push dword edit1 |
||
169 | call [edit_box_key] |
||
170 | push dword edit2 |
||
171 | call [edit_box_key] |
||
172 | push dword edit3 |
||
173 | call [edit_box_key] |
||
174 | jmp still |
||
175 | ;--------------------------------------------------------------------- |
||
1443 | diamond | 176 | call_mouse: |
2059 | mario79 | 177 | call mouse |
178 | jmp still |
||
179 | ;--------------------------------------------------------------------- |
||
174 | heavyiron | 180 | button: ; Button in Window |
2105 | mario79 | 181 | mcall 17 |
2059 | mario79 | 182 | cmp ah,1 |
183 | jne noclose |
||
184 | or eax,-1 |
||
185 | mcall |
||
186 | ;--------------------------------------------------------------------- |
||
174 | heavyiron | 187 | noclose: |
2059 | mario79 | 188 | cmp ah,5 ;press button for OpenDialog |
189 | jne @f |
||
190 | call fun_opn_dlg |
||
191 | @@: |
||
192 | cmp ah,2 ; Start compiling |
||
193 | je start |
||
194 | cmp ah,3 ; Start compiled file |
||
195 | jnz norunout |
||
196 | |||
197 | mov edx,outfile |
||
198 | call make_fullpaths |
||
199 | mcall 70,file_info_start |
||
200 | ; xor ecx,ecx |
||
201 | jmp still |
||
202 | ;--------------------------------------------------------------------- |
||
203 | norunout: |
||
204 | cmp ah,4 |
||
205 | jnz norundebug |
||
206 | |||
207 | mov edx,outfile |
||
208 | call make_fullpaths |
||
209 | mcall 70,file_info_debug |
||
210 | jmp still |
||
211 | ;--------------------------------------------------------------------- |
||
212 | norundebug: |
||
213 | jmp still |
||
214 | ;--------------------------------------------------------------------- |
||
1361 | IgorA | 215 | mouse: |
2059 | mario79 | 216 | push dword edit1 |
217 | call [edit_box_mouse] |
||
218 | push dword edit2 |
||
219 | call [edit_box_mouse] |
||
220 | push dword edit3 |
||
221 | call [edit_box_mouse] |
||
222 | push dword ch1_dbg |
||
223 | call [check_box_mouse] |
||
224 | ret |
||
225 | ;--------------------------------------------------------------------- |
||
31 | halyavin | 226 | draw_window: |
2059 | mario79 | 227 | pusha |
228 | mcall 12,1 ; Start of draw |
||
2672 | leency | 229 | |
230 | get_sys_colors 1,0 |
||
231 | edit_boxes_set_sys_color edit1,editboxes_end,sc |
||
232 | check_boxes_set_sys_color2 ch1_dbg,ch1_dbg+ch_struc_size,sc |
||
2105 | mario79 | 233 | |
2059 | mario79 | 234 | mov edx,[sc.work] |
235 | or edx,0x33000000 |
||
2105 | mario79 | 236 | xor eax,eax |
237 | xor esi,esi |
||
238 | mcall ,<100,280>,<90,260>,,,title ; Draw Window Label Text |
||
31 | halyavin | 239 | |
2059 | mario79 | 240 | mcall 9,PROCESSINFO,-1 |
31 | halyavin | 241 | |
2059 | mario79 | 242 | mov eax,[PROCESSINFO+70] ;status of window |
243 | test eax,100b |
||
244 | jne .end |
||
31 | halyavin | 245 | |
2059 | mario79 | 246 | cmp dword[pinfo.box.width],230 ; яЁютхЁ хь °шЁшэє юъэр |
247 | jge @f |
||
248 | mov dword[pinfo.box.width],230 ; хёыш юъэю юўхэ№ єчъюх, єтхышўштрхь °шЁшэє фы шчсхцрэш уы■ъют |
||
249 | @@: |
||
250 | mpack ecx,1,1 |
||
251 | mov ebx,[pinfo.box.width] |
||
252 | sub ebx,10 |
||
253 | mov eax,8 |
||
254 | mov edx,0x4000000B |
||
255 | mpack ebx,[pinfo.box.width],MAGIC1 |
||
256 | msub ebx,MAGIC1+10+1,0 |
||
257 | mpack ecx,0, (14*3+16)/3-1 |
||
258 | madd ecx,1,0 |
||
259 | mcall ,,,0x00000002,[sc.work_button] |
||
260 | madd ecx, (14*3+16)/3+1,0 |
||
261 | mcall ,,,0x00000003 |
||
262 | madd ecx, (14*3+16)/3+1,0 |
||
263 | mcall ,,,4 |
||
264 | ;button for OpenDialog [..] |
||
265 | mov ebx, 5*65536+47 |
||
266 | mov ecx, 33*65536+14 |
||
267 | mcall ,,,5 |
||
31 | halyavin | 268 | |
2059 | mario79 | 269 | mpack ebx,6,0 ; Draw Window Text |
270 | add ebx,1+ 14/2-3 |
||
2105 | mario79 | 271 | mcall 4,,[sc.work_text],text,text.line_size ;InFile |
31 | halyavin | 272 | |
2059 | mario79 | 273 | add ebx, 16 ;14 |
274 | add edx,text.line_size |
||
275 | mcall ;OutFile |
||
1371 | IgorA | 276 | |
2059 | mario79 | 277 | mov ecx,[sc.work_button_text] |
278 | add ebx, 16 ;14 |
||
279 | add edx,text.line_size |
||
280 | mcall ;Path |
||
31 | halyavin | 281 | |
2059 | mario79 | 282 | mov ebx,[pinfo.box.width] |
283 | sub ebx,MAGIC1+10+1-9 |
||
284 | shl ebx,16 |
||
285 | add ebx,1+( (14*3+16)/3-1)/2-3 |
||
286 | mcall ,,[sc.work_button_text],s_compile,7 |
||
287 | add ebx,(14*3+16)/3+1 |
||
288 | mcall ,,,s_run |
||
289 | add ebx,(14*3+16)/3+1 |
||
290 | mcall ,,,s_debug |
||
291 | |||
292 | mpack ebx,MAGIC1+6,0 |
||
293 | add ebx,1+ 14/2-3+ 14*0 |
||
294 | mov esi,[pinfo.box.width] |
||
295 | sub esi,MAGIC1*2+5*2+6+3 |
||
296 | mov eax,esi |
||
297 | mov cl,6 |
||
298 | div cl |
||
299 | cmp al,MAX_PATH |
||
300 | jbe @f |
||
301 | mov al,MAX_PATH |
||
302 | @@: |
||
303 | movzx esi,al |
||
31 | halyavin | 304 | |
2059 | mario79 | 305 | call draw_messages |
306 | |||
2093 | mario79 | 307 | mov eax,dword [pinfo.box.width] |
2059 | mario79 | 308 | sub eax,127 |
309 | mov dword[edit1.width],eax ; єёЄрэртыштрхь °шЁшэє ЄхъёЄют√ї яюыхщ |
||
310 | mov dword[edit2.width],eax |
||
311 | mov dword[edit3.width],eax |
||
312 | |||
313 | push dword edit1 |
||
314 | call [edit_box_draw] |
||
315 | push dword edit2 |
||
316 | call [edit_box_draw] |
||
317 | push dword edit3 |
||
318 | call [edit_box_draw] |
||
319 | push dword ch1_dbg |
||
320 | call [check_box_draw] |
||
321 | .end: |
||
322 | mcall 12,2 ; End of Draw |
||
323 | popa |
||
324 | ret |
||
325 | ;--------------------------------------------------------------------- |
||
31 | halyavin | 326 | bottom_right dd ? |
327 | |||
1617 | IgorA | 328 | align 4 |
329 | fun_opn_dlg: ;функция для вызова OpenFile диалога |
||
330 | pushad |
||
331 | copy_path open_dialog_name,communication_area_default_path,library_path,0 |
||
2059 | mario79 | 332 | mov [OpenDialog_data.type],0 |
1617 | IgorA | 333 | |
2059 | mario79 | 334 | xor al,al |
2093 | mario79 | 335 | mov edi,dword [edit3.text] |
336 | mov ecx,dword [edit3.max] |
||
1617 | IgorA | 337 | cld |
2059 | mario79 | 338 | repne scasb |
339 | cmp byte[edi-2],'/' |
||
340 | jne @f |
||
341 | mov byte[edi-2],0 ;если в конце пути есть слеш, то путь укорачиваем на 1 символ |
||
342 | @@: |
||
343 | push dword OpenDialog_data |
||
344 | call dword [OpenDialog_Start] |
||
345 | cmp [OpenDialog_data.status],2 |
||
346 | je @f |
||
1617 | IgorA | 347 | |
2059 | mario79 | 348 | xor al,al |
2093 | mario79 | 349 | mov edi,dword [edit3.text] |
2059 | mario79 | 350 | mov ebx,edi ;copy text pointer |
2093 | mario79 | 351 | mov ecx,dword [edit3.max] |
2059 | mario79 | 352 | cld |
353 | repne scasb |
||
354 | cmp byte[edi-2],'/' |
||
355 | jne .no_slash |
||
356 | |||
357 | dec edi ;если в конце пути есть слеш, то путь укорачиваем на 1 символ |
||
358 | .no_slash: |
||
359 | mov byte[edi-1],'/' ;ставим в конце пути слеш |
||
360 | mov byte[edi],0 ;отрезаем имя найденного файла |
||
361 | sub edi,ebx ;edi = strlen(edit3.text) |
||
362 | mov [edit3.size],edi |
||
363 | mov [edit3.pos],edi |
||
1617 | IgorA | 364 | |
2059 | mario79 | 365 | push dword [OpenDialog_data.filename_area] |
366 | push dword edit1 |
||
367 | call dword [edit_box_set_text] |
||
1617 | IgorA | 368 | |
2059 | mario79 | 369 | push dword [OpenDialog_data.filename_area] |
370 | push dword edit2 |
||
371 | call dword [edit_box_set_text] |
||
1620 | IgorA | 372 | |
2059 | mario79 | 373 | mov esi,[edit2.text] |
374 | xor eax,eax |
||
375 | cld |
||
376 | .cycle: |
||
377 | lodsb |
||
378 | test eax,eax |
||
379 | jnz .cycle |
||
1620 | IgorA | 380 | |
2093 | mario79 | 381 | sub esi,5 |
2059 | mario79 | 382 | cmp esi,[edit2.text] |
383 | jle .short_fn |
||
384 | |||
385 | mov byte[esi],0 |
||
386 | sub dword [edit2.size],4 |
||
387 | sub dword [edit2.pos],4 |
||
388 | |||
389 | .short_fn: |
||
390 | push dword edit1 |
||
391 | call dword [edit_box_draw] |
||
392 | push dword edit2 |
||
393 | call dword [edit_box_draw] |
||
394 | push dword edit3 |
||
395 | call dword [edit_box_draw] |
||
396 | @@: |
||
1617 | IgorA | 397 | popad |
398 | ret |
||
2059 | mario79 | 399 | ;--------------------------------------------------------------------- |
31 | halyavin | 400 | draw_messages: |
2059 | mario79 | 401 | mpack ebx,7-2,[pinfo.box.width] |
402 | sub ebx,5*2+7*2-1-2*2 |
||
403 | mpack ecx,0,[pinfo.box.height] |
||
404 | madd ecx, 14*3+16+1+7+1,-( 14*3+16+1+7*2+25) |
||
405 | mov word[bottom_right+2],bx |
||
406 | mov word[bottom_right],cx |
||
407 | msub [bottom_right],7,11 |
||
408 | add [bottom_right],7 shl 16 + 53 |
||
2105 | mario79 | 409 | mcall 13,,,[sc.work] ; clear work area |
31 | halyavin | 410 | _cy = 0 |
411 | _sy = 2 |
||
412 | _cx = 4 |
||
413 | _sx = 6 |
||
2059 | mario79 | 414 | push ebx ecx |
415 | mpack ebx,4,5 |
||
416 | add bx,[esp+_cx] |
||
417 | mov ecx,[esp+_sy-2] |
||
418 | mov cx,[esp+_sy] |
||
419 | msub ecx,1,1 |
||
420 | mcall 38,,,[sc.work_graph] |
||
421 | mov si,[esp+_cy] |
||
422 | add cx,si |
||
423 | shl esi,16 |
||
424 | add ecx,esi |
||
425 | madd ecx,1,1 |
||
426 | mcall |
||
427 | mpack ebx,4,4 |
||
428 | mov esi,[esp+_sy-2] |
||
429 | mov si,cx |
||
430 | mov ecx,esi |
||
431 | mcall |
||
432 | mov si,[esp+_cx] |
||
433 | add bx,si |
||
434 | shl esi,16 |
||
435 | add ebx,esi |
||
436 | madd ebx,1,1 |
||
437 | mcall |
||
438 | pop ecx ebx |
||
439 | ret |
||
440 | ;--------------------------------------------------------------------- |
||
1361 | IgorA | 441 | ; DATA |
2059 | mario79 | 442 | ;--------------------------------------------------------------------- |
1361 | IgorA | 443 | if lang eq ru |
444 | text: |
||
445 | db ' ВхФайл:' |
||
446 | .line_size = $-text |
||
447 | db 'ВыхФайл:' |
||
448 | db ' Путь:' |
||
1617 | IgorA | 449 | ;db 'x' |
31 | halyavin | 450 | |
1361 | IgorA | 451 | s_compile db 'Компил.' |
452 | s_run db ' Пуск ' |
||
453 | s_debug db 'Отладка' |
||
1371 | IgorA | 454 | s_dbgdescr db 'Создавать отладочную информацию',0 |
31 | halyavin | 455 | |
2298 | IgorA | 456 | |
1617 | IgorA | 457 | err_message_found_lib0 db 'Не найдена библиотека box_lib.obj',0 ;строка, которая будет в сформированном окне, если библиотека не будет найдена |
458 | err_message_import0 db 'Ошибка при импорте библиотеки box_lib.obj',0 |
||
459 | err_message_found_lib1 db 'Не найдена библиотека proc_lib.obj',0 |
||
460 | err_message_import1 db 'Ошибка при импорте библиотеки proc_lib.obj',0 |
||
461 | head_f_i: |
||
1361 | IgorA | 462 | head_f_l db 'Системная ошибка',0 ;заголовок окна, при возникновении ошибки |
463 | else |
||
464 | text: |
||
1617 | IgorA | 465 | db ' InFile:' |
1361 | IgorA | 466 | .line_size = $-text |
1617 | IgorA | 467 | db 'OutFile:' |
468 | db ' Path:' |
||
469 | ;db 'x' |
||
31 | halyavin | 470 | |
1361 | IgorA | 471 | s_compile db 'COMPILE' |
472 | s_run db ' RUN ' |
||
473 | s_debug db ' DEBUG ' |
||
1371 | IgorA | 474 | s_dbgdescr db 'Generate debug information',0 |
31 | halyavin | 475 | |
2298 | IgorA | 476 | |
1617 | IgorA | 477 | err_message_found_lib0 db 'Sorry I cannot found library box_lib.obj',0 |
478 | err_message_import0 db 'Error on load import library box_lib.obj',0 |
||
479 | err_message_found_lib1 db 'Sorry I cannot found library proc_lib.obj',0 |
||
480 | err_message_import1 db 'Error on load import library proc_lib.obj',0 |
||
481 | |||
482 | head_f_i: |
||
1361 | IgorA | 483 | head_f_l db 'System error',0 ;заголовок окна, при возникновении ошибки |
484 | end if |
||
31 | halyavin | 485 | |
1617 | IgorA | 486 | system_dir0 db '/sys/lib/' |
487 | lib0_name db 'box_lib.obj',0 |
||
488 | |||
489 | system_dir1 db '/sys/lib/' |
||
490 | lib1_name db 'proc_lib.obj',0 |
||
2059 | mario79 | 491 | ;--------------------------------------------------------------------- |
1617 | IgorA | 492 | align 4 |
493 | import_box_lib: |
||
2059 | mario79 | 494 | edit_box_draw dd aEdit_box_draw |
495 | edit_box_key dd aEdit_box_key |
||
496 | edit_box_mouse dd aEdit_box_mouse |
||
497 | edit_box_set_text dd aEdit_box_set_text |
||
498 | ;version_ed dd aVersion_ed |
||
31 | halyavin | 499 | |
2298 | IgorA | 500 | init_checkbox dd aInit_checkbox |
2059 | mario79 | 501 | check_box_draw dd aCheck_box_draw |
502 | check_box_mouse dd aCheck_box_mouse |
||
503 | ;version_ch dd aVersion_ch |
||
31 | halyavin | 504 | |
2059 | mario79 | 505 | dd 0,0 |
31 | halyavin | 506 | |
2059 | mario79 | 507 | aEdit_box_draw db 'edit_box',0 |
508 | aEdit_box_key db 'edit_box_key',0 |
||
509 | aEdit_box_mouse db 'edit_box_mouse',0 |
||
510 | aEdit_box_set_text db 'edit_box_set_text',0 |
||
511 | ;aVersion_ed db 'version_ed',0 |
||
31 | halyavin | 512 | |
2298 | IgorA | 513 | aInit_checkbox db 'init_checkbox2',0 |
514 | aCheck_box_draw db 'check_box_draw2',0 |
||
515 | aCheck_box_mouse db 'check_box_mouse2',0 |
||
516 | ;aVersion_ch db 'version_ch2',0 |
||
2059 | mario79 | 517 | ;--------------------------------------------------------------------- |
1617 | IgorA | 518 | align 4 |
519 | import_proc_lib: |
||
2059 | mario79 | 520 | OpenDialog_Init dd aOpenDialog_Init |
521 | OpenDialog_Start dd aOpenDialog_Start |
||
522 | dd 0,0 |
||
523 | aOpenDialog_Init db 'OpenDialog_init',0 |
||
524 | aOpenDialog_Start db 'OpenDialog_start',0 |
||
525 | ;--------------------------------------------------------------------- |
||
1617 | IgorA | 526 | ;library structures |
527 | l_libs_start: |
||
528 | lib0 l_libs lib0_name, cur_dir_path, library_path, system_dir0, err_message_found_lib0, head_f_l, import_box_lib, err_message_import0, head_f_i |
||
529 | lib1 l_libs lib1_name, cur_dir_path, library_path, system_dir1, err_message_found_lib1, head_f_l, import_proc_lib,err_message_import1, head_f_i |
||
530 | load_lib_end: |
||
531 | |||
1371 | IgorA | 532 | edit1 edit_box 153, 56, 1, 0xffffff, 0xff, 0x80ff, 0, 0x8000, (outfile-infile-1), infile, mouse_dd, 0, 11,11 |
533 | edit2 edit_box 153, 56, 17, 0xffffff, 0xff, 0x80ff, 0, 0x8000,(path-outfile-1), outfile, mouse_dd, 0, 7,7 |
||
534 | edit3 edit_box 153, 56, 33, 0xffffff, 0xff, 0x80ff, 0, 0x8000,(path_end-path-1), path, mouse_dd, 0, 6,6 |
||
1372 | IgorA | 535 | editboxes_end: |
2298 | IgorA | 536 | ch1_dbg check_box2 (5 shl 16)+12, (49 shl 16)+12, 6, 0xffffff, 0x80ff, 0, s_dbgdescr,ch_flag_bottom |
1617 | IgorA | 537 | ;--------------------------------------------------------------------- |
538 | align 4 |
||
539 | OpenDialog_data: |
||
540 | .type dd 0 |
||
541 | .procinfo dd pinfo ;+4 |
||
542 | .com_area_name dd communication_area_name ;+8 |
||
543 | .com_area dd 0 ;+12 |
||
544 | .opendir_path dd path ;+16 |
||
545 | .dir_default_path dd default_dir ;+20 |
||
546 | .start_path dd library_path ;+24 путь к диалогу открытия файлов |
||
547 | .draw_window dd draw_window ;+28 |
||
548 | .status dd 0 ;+32 |
||
549 | .openfile_path dd path ;+36 путь к открываемому файлу |
||
550 | .filename_area dd filename_area ;+40 |
||
551 | .filter_area dd Filter |
||
552 | .x: |
||
553 | .x_size dw 420 ;+48 ; Window X size |
||
554 | .x_start dw 10 ;+50 ; Window X position |
||
555 | .y: |
||
556 | .y_size dw 320 ;+52 ; Window y size |
||
557 | .y_start dw 10 ;+54 ; Window Y position |
||
558 | |||
559 | default_dir db '/rd/1',0 ;директория по умолчанию |
||
560 | |||
561 | communication_area_name: |
||
562 | db 'FFFFFFFF_open_dialog',0 |
||
563 | open_dialog_name: |
||
564 | db 'opendial',0 |
||
565 | communication_area_default_path: |
||
566 | db '/rd/1/File managers/',0 |
||
567 | |||
568 | Filter: |
||
569 | dd Filter.end - Filter |
||
570 | .1: |
||
571 | db 'ASM',0 |
||
572 | .end: |
||
573 | db 0 |
||
2059 | mario79 | 574 | ;--------------------------------------------------------------------- |
1361 | IgorA | 575 | mouse_dd dd 0 ;эєцэю фы Shift-р т editbox |
2059 | mario79 | 576 | ;--------------------------------------------------------------------- |
205 | heavyiron | 577 | infile db 'example.asm' |
1371 | IgorA | 578 | times MAX_PATH-$+infile db 0 |
205 | heavyiron | 579 | outfile db 'example' |
1371 | IgorA | 580 | times MAX_PATH-$+outfile db 0 |
1617 | IgorA | 581 | path db '/rd/1//' ;OpenDialog при запуске убирает последний слеш, но диалог может использоваться не всегда, потому слеша 2 |
1371 | IgorA | 582 | times MAX_PATH-$+path db 0 |
1367 | Lrz | 583 | path_end: |
31 | halyavin | 584 | lf db 13,10,0 |
2059 | mario79 | 585 | ;--------------------------------------------------------------------- |
31 | halyavin | 586 | mov_param_str: |
2059 | mario79 | 587 | cld |
1395 | mario79 | 588 | @@: |
2059 | mario79 | 589 | lodsb |
590 | cmp al,',' |
||
591 | je @f |
||
592 | stosb |
||
593 | test al,al |
||
594 | jnz @b |
||
1395 | mario79 | 595 | @@: |
2059 | mario79 | 596 | xor al,al |
597 | stosb |
||
598 | ret |
||
599 | ;--------------------------------------------------------------------- |
||
31 | halyavin | 600 | start: |
2059 | mario79 | 601 | cmp [_mode],NORMAL_MODE |
602 | jne @f |
||
603 | call draw_messages |
||
604 | mov [textxy],7 shl 16 + 70 |
||
31 | halyavin | 605 | @@: |
2059 | mario79 | 606 | mov esi,_logo |
607 | call display_string |
||
31 | halyavin | 608 | |
2059 | mario79 | 609 | ;--------------------------------------------------------------------- |
610 | ; Fasm native code |
||
611 | ;--------------------------------------------------------------------- |
||
612 | mov [input_file],infile |
||
613 | mov [output_file],outfile |
||
614 | |||
615 | call init_memory |
||
616 | |||
617 | call make_timestamp |
||
618 | mov [start_time],eax |
||
619 | |||
620 | call preprocessor |
||
621 | call parser |
||
622 | call assembler |
||
623 | bt dword[ch1_dbg.flags],1 ;cmp [bGenerateDebugInfo], 0 |
||
624 | jae @f ;jz @f |
||
625 | call symbol_dump |
||
542 | diamond | 626 | @@: |
2059 | mario79 | 627 | call formatter |
628 | |||
629 | call display_user_messages |
||
630 | movzx eax,[current_pass] |
||
631 | inc eax |
||
632 | call display_number |
||
633 | mov esi,_passes_suffix |
||
634 | call display_string |
||
635 | call make_timestamp |
||
636 | sub eax,[start_time] |
||
637 | xor edx,edx |
||
638 | mov ebx,100 |
||
639 | div ebx |
||
640 | or eax,eax |
||
641 | jz display_bytes_count |
||
642 | xor edx,edx |
||
643 | mov ebx,10 |
||
644 | div ebx |
||
645 | push edx |
||
646 | call display_number |
||
647 | mov dl,'.' |
||
648 | call display_character |
||
649 | pop eax |
||
650 | call display_number |
||
651 | mov esi,_seconds_suffix |
||
652 | call display_string |
||
653 | display_bytes_count: |
||
654 | mov eax,[written_size] |
||
655 | call display_number |
||
656 | mov esi,_bytes_suffix |
||
657 | call display_string |
||
658 | xor al,al |
||
659 | |||
660 | cmp [_run_outfile],0 |
||
661 | je @f |
||
662 | mov edx,outfile |
||
663 | call make_fullpaths |
||
664 | xor ecx,ecx |
||
2093 | mario79 | 665 | mcall 70,file_info_start |
31 | halyavin | 666 | @@: |
2059 | mario79 | 667 | jmp exit_program |
668 | ;--------------------------------------------------------------------- |
||
31 | halyavin | 669 | include 'system.inc' |
670 | include 'version.inc' |
||
671 | include 'errors.inc' |
||
2287 | heavyiron | 672 | include 'symbdump.inc' |
31 | halyavin | 673 | include 'preproce.inc' |
674 | include 'parser.inc' |
||
2287 | heavyiron | 675 | include 'exprpars.inc' |
31 | halyavin | 676 | include 'assemble.inc' |
2287 | heavyiron | 677 | include 'exprcalc.inc' |
31 | halyavin | 678 | include 'formats.inc' |
679 | include 'x86_64.inc' |
||
2287 | heavyiron | 680 | include 'avx.inc' |
109 | heavyiron | 681 | include 'tables.inc' |
692 | heavyiron | 682 | include 'messages.inc' |
2059 | mario79 | 683 | ;--------------------------------------------------------------------- |
485 | heavyiron | 684 | title db appname,VERSION_STRING,0 |
196 | heavyiron | 685 | |
31 | halyavin | 686 | _logo db 'flat assembler version ',VERSION_STRING,13,10,0 |
687 | |||
688 | _passes_suffix db ' passes, ',0 |
||
689 | _seconds_suffix db ' seconds, ',0 |
||
690 | _bytes_suffix db ' bytes.',13,10,0 |
||
691 | |||
692 | _include db 'INCLUDE',0 |
||
693 | |||
694 | _counter db 4,'0000' |
||
695 | |||
109 | heavyiron | 696 | _mode dd NORMAL_MODE |
31 | halyavin | 697 | _run_outfile dd 0 |
1371 | IgorA | 698 | ;bGenerateDebugInfo db 0 |
31 | halyavin | 699 | |
3662 | GerdtR | 700 | dbgWord db '-d',0 |
701 | |||
31 | halyavin | 702 | sub_table: |
703 | times $41 db $00 |
||
704 | times $1A db $20 |
||
705 | times $25 db $00 |
||
706 | times $10 db $20 |
||
707 | times $30 db $00 |
||
708 | times $10 db $50 |
||
709 | times $04 db $00,$01 |
||
710 | times $08 db $00 |
||
711 | |||
712 | ;include_debug_strings |
||
713 | program_end: |
||
1395 | mario79 | 714 | ; params db 0 ; 'TINYPAD.ASM,TINYPAD,/HD/1/TPAD4/', |
715 | params rb 4096 |
||
716 | cur_dir_path rb 4096 |
||
717 | library_path rb 4096 |
||
1617 | IgorA | 718 | filename_area rb 256 |
1361 | IgorA | 719 | |
31 | halyavin | 720 | align 4 |
721 | |||
722 | include 'variable.inc' |
||
723 | |||
724 | program_base dd ? |
||
725 | buffer_address dd ? |
||
726 | memory_setting dd ? |
||
727 | start_time dd ? |
||
755 | diamond | 728 | memblock dd ? |
31 | halyavin | 729 | |
692 | heavyiron | 730 | predefinitions rb 1000h |
731 | |||
1361 | IgorA | 732 | dbgfilename rb MAX_PATH+4 |
542 | diamond | 733 | |
31 | halyavin | 734 | sc system_colors |
332 | diamond | 735 | max_handles = 8 |
736 | fileinfos rb (4+20+MAX_PATH)*max_handles |
||
737 | fileinfos_end: |
||
31 | halyavin | 738 | pinfo process_information |
635 | diamond | 739 | |
740 | align 1000h |
||
741 | rb 1000h |
||
742 | stacktop:90,260>100,280> |