Subversion Repositories Kolibri OS

Rev

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