Subversion Repositories Kolibri OS

Rev

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