Subversion Repositories Kolibri OS

Rev

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