Subversion Repositories Kolibri OS

Rev

Rev 9460 | Details | Compare with Previous | Last modification | View Log | RSS feed

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