Subversion Repositories Kolibri OS

Rev

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