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