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