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