Subversion Repositories Kolibri OS

Rev

Rev 1620 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 1620 Rev 2059
Line 2... Line 2...
2
;;                                                 ;;
2
;;                                                 ;;
3
;;  flat assembler source                          ;;
3
;;  flat assembler source                          ;;
4
;;  Copyright (c) 1999-2006, Tomasz Grysztar       ;;
4
;;  Copyright (c) 1999-2006, Tomasz Grysztar       ;;
5
;;  All rights reserved.                           ;;
5
;;  All rights reserved.                           ;;
6
;;                                                 ;;
6
;;                                                 ;;
-
 
7
;;  KolibriOS port by KolibriOS Team               ;;
7
;;  Menuet port by VT                              ;;
8
;;  Menuet port by VT                              ;;
8
;;                                                 ;;
9
;;                                                 ;;
9
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
10
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
Line 10... Line 11...
10
 
11
 
Line 17... Line 18...
17
APP_MEMORY     = 0x00800000
18
APP_MEMORY     = 0x00800000
Line 18... Line 19...
18
 
19
 
Line 19... Line 20...
19
;; Menuet header
20
;; Menuet header
20
 
-
 
-
 
21
 
21
appname equ "flat assembler "
22
appname equ "flat assembler "
22
 
-
 
23
use32
23
;---------------------------------------------------------------------
24
 
24
	use32
25
  org 0x0
25
	org 0x0
26
  db 'MENUET01'  ; 8 byte id
26
	db 'MENUET01'  ; 8 byte id
27
  dd 0x01	 ; header version
27
	dd 0x01	 ; header version
28
  dd START	 ; program start
28
	dd START	 ; program start
29
  dd program_end ; program image size
29
	dd program_end ; program image size
30
  dd stacktop	 ; required amount of memory
30
	dd stacktop	 ; required amount of memory
31
  dd stacktop	 ; stack
-
 
-
 
31
	dd stacktop	 ; stack
32
  dd params,cur_dir_path  ; parameters,icon
32
	dd params,cur_dir_path  ; parameters,icon
33
 
33
;---------------------------------------------------------------------
34
include 'lang.inc'
34
include 'lang.inc'
35
include '../../../macros.inc'
35
include '../../../macros.inc'
Line 36... Line 36...
36
purge add,sub	 ; macros.inc does incorrect substitution
36
purge add,sub	 ; macros.inc does incorrect substitution
37
include 'fasm.inc'
37
include 'fasm.inc'
38
 
38
 
Line 39... Line -...
39
include '../../../develop/libraries/box_lib/trunk/box_lib.mac'
-
 
40
include '../../../develop/libraries/box_lib/load_lib.mac'
-
 
41
  @use_library
39
include '../../../develop/libraries/box_lib/trunk/box_lib.mac'
42
 
-
 
-
 
40
include '../../../develop/libraries/box_lib/load_lib.mac'
43
 
41
  @use_library
44
 
42
 
45
center fix true
43
center fix true
46
 
44
;---------------------------------------------------------------------
47
START:	    ; Start of execution
45
START:	    ; Start of execution
Line 53... Line 51...
53
	pop	eax
51
	pop	eax
54
	push	11
52
	push	11
55
	pop	ebx
53
	pop	ebx
56
	mcall
54
	mcall
Line 57... Line 55...
57
 
55
 
58
   cmp	  [params],0
56
	cmp	[params],0
59
   jz	    start_1
57
	jz	start_1
60
 
58
	
61
   mov	  ecx,10
59
	mov	ecx,10
62
   mov	  eax,'    '
60
	mov	eax,'    '
63
   mov	  edi,infile
61
	mov	edi,infile
64
   push   ecx
62
	push	ecx
65
   cld
63
	cld
66
   rep	  stosd
64
	rep	stosd
67
   mov	  ecx,[esp]
65
	mov	ecx,[esp]
68
   mov	  edi,outfile
66
	mov	edi,outfile
69
   rep	  stosd
67
	rep	stosd
70
   pop	  ecx
68
	pop	ecx
71
   mov	  edi,path
69
	mov	edi,path
72
   rep	  stosd
70
	rep	stosd
73
 
71
	
74
   mov	   esi,params
72
	mov	 esi,params
75
;  DEBUGF  "params: %s\n",esi
73
;	DEBUGF	"params: %s\n",esi
76
   mov	   edi,infile
74
	mov	edi,infile
77
   call    mov_param_str
75
	call	mov_param_str
78
;  mov     edi,infile
76
;	mov	edi,infile
79
;  DEBUGF  " input: %s\n",edi
77
;	DEBUGF	" input: %s\n",edi
80
   mov	   edi,outfile
78
	mov	edi,outfile
81
   call    mov_param_str
79
	call	mov_param_str
82
;  mov     edi,outfile
80
;	mov	edi,outfile
83
;  DEBUGF  "output: %s\n",edi
81
;	DEBUGF	"output: %s\n",edi
84
   mov	   edi,path
82
	mov	edi,path
85
   call    mov_param_str
83
	call	mov_param_str
86
;  mov     edi,path
84
;	mov	edi,path
87
;  DEBUGF  "  path: %s\n",edi
85
;	DEBUGF	"  path: %s\n",edi
88
   dec	   esi
86
	dec	esi
89
   cmp	   [esi], dword ',run'
87
	cmp	[esi], dword ',run'
90
   jne	   @f
88
	jne	@f
91
   mov	   [_run_outfile],1
89
	mov	[_run_outfile],1
92
  @@:
-
 
93
 
90
@@:
94
   mov	   [_mode],CONSOLE_MODE
91
	mov	[_mode],CONSOLE_MODE
95
   jmp	   start
-
 
-
 
92
	jmp	start
96
 
93
;---------------------------------------------------------------------
97
start_1:
94
start_1:
98
;sys_
95
;sys_
Line 99... Line 96...
99
load_libraries l_libs_start,load_lib_end
96
load_libraries l_libs_start,load_lib_end
100
 
97
 
101
  cmp eax,-1
98
	cmp	eax,-1
102
  jne @f
99
	jne	@f
103
    mcall -1 ;exit if not open box_lib.obj
100
	mcall	-1 ;exit if not open box_lib.obj
104
  @@:
-
 
-
 
101
@@:
105
  mcall 40,0x27 ;¬ áª  á¨á⥬­ëå ᮡë⨩
102
	mcall	40,0x27 ;¬ áª  á¨á⥬­ëå ᮡë⨩
106
 
103
;---------------------------------------------------------------------
107
  get_sys_colors 1,0
104
get_sys_colors 1,0
108
  edit_boxes_set_sys_color edit1,editboxes_end,sc
-
 
-
 
105
edit_boxes_set_sys_color edit1,editboxes_end,sc
109
  check_boxes_set_sys_color ch1_dbg,ch1_dbg+ch_struc_size,sc
106
check_boxes_set_sys_color ch1_dbg,ch1_dbg+ch_struc_size,sc
110
 
107
;---------------------------------------------------------------------
111
  ; OpenDialog initialisation
108
; OpenDialog initialisation
112
  push dword OpenDialog_data
-
 
-
 
109
	push dword OpenDialog_data
113
  call dword [OpenDialog_Init]
110
	call dword [OpenDialog_Init]
114
 
111
;---------------------------------------------------------------------
Line 115... Line 112...
115
red:	; Redraw
112
red:	; Redraw
116
    call draw_window
113
	call	draw_window
117
 
114
 
118
still:	
115
still:	
119
    push 10	     ; Wait here for event
116
	push	10	     ; Wait here for event
120
    pop eax 
117
	pop	eax 
121
    mcall
118
	mcall
122
    cmp al,6
119
	cmp	al,6
123
    je	call_mouse
120
	je	call_mouse
124
    dec eax 
121
	dec	eax 
125
    je	red	     ; Redraw request
-
 
126
    dec eax 
122
	je	red	     ; Redraw request
127
    jne button	     ; Button in buffer
123
	dec	eax 
128
 
124
	jne	button	     ; Button in buffer
129
key:		     ; Key
125
key:		     ; Key
130
    mov  al,2	     ; Read it and ignore
126
	mov	al,2	     ; Read it and ignore
131
    mcall
127
	mcall
132
 
128
	
133
    push dword edit1
129
	push	dword edit1
134
    call [edit_box_key]
130
	call	[edit_box_key]
135
    push dword edit2
131
	push	dword edit2
136
    call [edit_box_key]
-
 
137
    push dword edit3
132
	call	[edit_box_key]
138
    call [edit_box_key]
-
 
-
 
133
	push	dword edit3
139
 
134
	call	[edit_box_key]
140
    jmp  still
135
	jmp	still
141
 
136
;---------------------------------------------------------------------
142
call_mouse:
-
 
-
 
137
call_mouse:
143
    call mouse
138
	call	mouse
144
    jmp  still
-
 
145
 
139
	jmp	still
146
button:    ; Button in Window
140
;---------------------------------------------------------------------
147
 
141
button:    ; Button in Window
148
    mov  al,17
142
	mov	al,17
149
    mcall
143
	mcall
150
 
144
	
151
    cmp     ah,1
145
	cmp	ah,1
152
    jne     noclose
-
 
-
 
146
	jne	noclose
153
    or	    eax,-1
147
	or	eax,-1
154
    mcall
148
	mcall
155
 
149
;---------------------------------------------------------------------
156
noclose:    
150
noclose:    
157
	cmp ah,5 ;press button for OpenDialog
151
	cmp	ah,5 ;press button for OpenDialog
158
	jne @f
152
	jne	@f
159
		call fun_opn_dlg
153
	call	fun_opn_dlg
160
	@@:
154
@@:
161
    cmp  ah,2	      ; Start compiling
155
	cmp	ah,2	      ; Start compiling
162
    je	 start
156
	je	start
163
    cmp  ah,3	      ; Start compiled file
157
	cmp	ah,3	      ; Start compiled file
164
    jnz  norunout
158
	jnz	norunout
165
 
159
	
166
    mov  edx,outfile
160
	mov	edx,outfile
167
    call make_fullpaths
161
	call	make_fullpaths
-
 
162
	mcall	70,file_info_start
168
    mcall  70,file_info_start
163
;	xor	ecx,ecx
169
;   xor   ecx,ecx
164
	jmp	still
170
    jmp  still
165
;---------------------------------------------------------------------
171
   norunout:
166
norunout:
172
    cmp  ah,4
167
	cmp	ah,4
173
    jnz  norundebug
168
	jnz	norundebug
174
 
169
	
175
    mov  edx,outfile
170
	mov	edx,outfile
176
    call make_fullpaths
-
 
-
 
171
	call	make_fullpaths
177
    mcall 70,file_info_debug
172
	mcall	70,file_info_debug
178
    jmp  still
-
 
179
 
173
	jmp	still
180
   norundebug:
-
 
181
 
-
 
-
 
174
;---------------------------------------------------------------------
182
    jmp  still
175
norundebug:
183
 
176
	jmp	still
184
 
177
;---------------------------------------------------------------------
185
mouse:
178
mouse:
186
  push dword edit1
179
	push	dword edit1
187
  call [edit_box_mouse]
180
	call	[edit_box_mouse]
188
  push dword edit2
181
	push	dword edit2
189
  call [edit_box_mouse]
182
	call	[edit_box_mouse]
190
  push dword edit3
183
	push	dword edit3
191
  call [edit_box_mouse]
184
	call	[edit_box_mouse]
192
  push dword ch1_dbg
-
 
-
 
185
	push	dword ch1_dbg
193
  call [check_box_mouse]
186
	call	[check_box_mouse]
194
  ret
187
	ret
195
 
-
 
196
draw_window:
188
;---------------------------------------------------------------------
197
    pusha
-
 
198
 
189
draw_window:
199
    mcall  12,1 ; Start of draw
-
 
200
 
190
	pusha
201
    ;get_sys_colors 1,0
191
	mcall	12,1 ; Start of draw
202
 
192
;get_sys_colors 1,0
203
    xor  eax,eax		     
193
	xor	eax,eax		     
204
    mov  ebx,100*65536+280
194
	mov	ebx,100*65536+280
205
    mov  ecx,90*65536+260
195
	mov	ecx,90*65536+260
206
    mov  edx,[sc.work]
196
	mov	edx,[sc.work]
207
    or	 edx,0x33000000
-
 
208
    mov  edi,title	       ; Draw Window Label Text
-
 
209
    mcall
-
 
210
 
-
 
211
    mcall 9,PROCESSINFO,-1	    
-
 
212
 
-
 
213
    cmp dword[pinfo.box.width],230 ; ïðîâåðÿåì øèðèíó îêíà
-
 
214
    jge @f
-
 
215
      mov dword[pinfo.box.width],230 ; åñëè îêíî î÷åíü óçêîå, óâåëè÷èâàåì øèðèíó äëÿ èçáåæàíèÿ ãëþêîâ
-
 
216
    @@:
-
 
217
 
-
 
218
    mpack ecx,1,1
-
 
219
    mov   ebx,[pinfo.box.width]
-
 
220
    sub   ebx,10
-
 
221
 
-
 
222
    mov eax,8
-
 
223
    mov edx,0x4000000B
-
 
224
    mpack ebx,[pinfo.box.width],MAGIC1
-
 
225
    msub  ebx,MAGIC1+10+1,0
-
 
226
    mpack ecx,0, (14*3+16)/3-1
-
 
227
    madd  ecx,1,0
-
 
228
    mcall  ,,,0x00000002,[sc.work_button]
-
 
229
    madd  ecx, (14*3+16)/3+1,0
-
 
230
    mcall  ,,,0x00000003
-
 
231
    madd  ecx, (14*3+16)/3+1,0
-
 
232
    mcall ,,,4
-
 
233
 
-
 
234
	;button for OpenDialog [..]
-
 
235
	mov ebx, 5*65536+47
-
 
236
	mov ecx, 33*65536+14
-
 
237
	mcall ,,,5
-
 
238
 
-
 
239
    mpack ebx,6,0    ; Draw Window Text
-
 
240
    add  ebx,1+ 14/2-3
-
 
241
    mov  ecx,[sc.work_text]
-
 
242
    mov  edx,text
-
 
243
    mov  esi,text.line_size
-
 
244
    mov  eax,4
-
 
245
 
-
 
246
    mcall ;InFile
-
 
247
    add  ebx, 16 ;14
-
 
248
    add  edx,text.line_size
-
 
249
    mcall ;OutFile
-
 
250
	mov ecx,[sc.work_button_text]
-
 
251
    add  ebx, 16 ;14
-
 
252
    add  edx,text.line_size
-
 
253
	mcall ;Path
-
 
254
 
-
 
255
    mov   ebx,[pinfo.box.width]
-
 
256
    sub   ebx,MAGIC1+10+1-9
-
 
257
    shl   ebx,16
-
 
258
    add   ebx,1+( (14*3+16)/3-1)/2-3
-
 
259
    mcall  ,,[sc.work_button_text],s_compile,7
-
 
260
    add   ebx,(14*3+16)/3+1
-
 
261
    mcall ,,,s_run
-
 
262
    add   ebx,(14*3+16)/3+1
-
 
263
    mcall ,,,s_debug
-
 
264
 
-
 
265
    mpack ebx,MAGIC1+6,0
-
 
266
    add   ebx,1+ 14/2-3+ 14*0
-
 
267
    mov   esi,[pinfo.box.width]
-
 
268
    sub   esi,MAGIC1*2+5*2+6+3
-
 
269
    mov   eax,esi
-
 
270
    mov   cl,6
-
 
271
    div   cl
-
 
272
    cmp   al,MAX_PATH
-
 
273
    jbe   @f
-
 
274
    mov   al,MAX_PATH
-
 
275
@@: movzx esi,al
-
 
276
 
-
 
277
    call draw_messages
-
 
278
 
-
 
279
    mov eax,dword[pinfo.box.width]
-
 
280
    sub eax,127
-
 
281
    mov dword[edit1.width],eax ; óñòàíàâëèâàåì øèðèíó òåêñòîâûõ ïîëåé
-
 
282
    mov dword[edit2.width],eax
-
 
283
    mov dword[edit3.width],eax
-
 
284
 
-
 
285
    push dword edit1
-
 
286
    call [edit_box_draw]
-
 
287
    push dword edit2
-
 
288
    call [edit_box_draw]
-
 
289
    push dword edit3
-
 
Line 290... Line 197...
290
    call [edit_box_draw]
197
	or	edx,0x33000000
Line -... Line 198...
-
 
198
	mov	edi,title	       ; Draw Window Label Text
-
 
199
	mcall
-
 
200
 
-
 
201
	mcall	9,PROCESSINFO,-1
-
 
202
 
-
 
203
	mov	eax,[PROCESSINFO+70] ;status of window
-
 
204
	test	eax,100b
-
 
205
	jne	.end
-
 
206
 
-
 
207
	cmp	dword[pinfo.box.width],230 ; ïðîâåðÿåì øèðèíó îêíà
-
 
208
	jge	@f
-
 
209
	mov	dword[pinfo.box.width],230 ; åñëè îêíî î÷åíü óçêîå, óâåëè÷èâàåì øèðèíó äëÿ èçáåæàíèÿ ãëþêîâ
-
 
210
@@:
-
 
211
	mpack	ecx,1,1
-
 
212
	mov	ebx,[pinfo.box.width]
-
 
213
	sub	ebx,10
-
 
214
	mov	eax,8
-
 
215
	mov	edx,0x4000000B
-
 
216
	mpack	ebx,[pinfo.box.width],MAGIC1
-
 
217
	msub	ebx,MAGIC1+10+1,0
-
 
218
	mpack	ecx,0, (14*3+16)/3-1
-
 
219
	madd	ecx,1,0
-
 
220
	mcall	,,,0x00000002,[sc.work_button]
-
 
221
	madd	ecx, (14*3+16)/3+1,0
-
 
222
	mcall	,,,0x00000003
-
 
223
	madd	ecx, (14*3+16)/3+1,0
-
 
224
	mcall	,,,4
-
 
225
;button for OpenDialog [..]
-
 
226
	mov	ebx, 5*65536+47
-
 
227
	mov	ecx, 33*65536+14
-
 
228
	mcall	,,,5
-
 
229
 
-
 
230
	mpack	ebx,6,0    ; Draw Window Text
-
 
231
	add	ebx,1+ 14/2-3
-
 
232
	mov	ecx,[sc.work_text]
-
 
233
	mov	edx,text
-
 
234
	mov	esi,text.line_size
-
 
235
	mov	eax,4
-
 
236
	mcall	;InFile
-
 
237
 
-
 
238
	add	ebx, 16 ;14
-
 
239
	add	edx,text.line_size
-
 
240
	mcall	;OutFile
-
 
241
 
-
 
242
	mov	ecx,[sc.work_button_text]
-
 
243
	add	ebx, 16 ;14
-
 
244
	add	edx,text.line_size
-
 
245
	mcall	;Path
-
 
246
 
-
 
247
	mov	ebx,[pinfo.box.width]
-
 
248
	sub	ebx,MAGIC1+10+1-9
-
 
249
	shl	ebx,16
-
 
250
	add	ebx,1+( (14*3+16)/3-1)/2-3
-
 
251
	mcall	,,[sc.work_button_text],s_compile,7
-
 
252
	add	ebx,(14*3+16)/3+1
-
 
253
	mcall	,,,s_run
-
 
254
	add	ebx,(14*3+16)/3+1
-
 
255
	mcall	,,,s_debug
-
 
256
	
-
 
257
	mpack	ebx,MAGIC1+6,0
291
    push dword ch1_dbg
258
	add	ebx,1+ 14/2-3+ 14*0
-
 
259
	mov	esi,[pinfo.box.width]
292
    call [check_box_draw]
260
	sub	esi,MAGIC1*2+5*2+6+3
-
 
261
	mov	eax,esi
-
 
262
	mov	cl,6
-
 
263
	div	cl
Line -... Line 264...
-
 
264
	cmp	al,MAX_PATH
-
 
265
	jbe	@f
-
 
266
	mov	al,MAX_PATH
-
 
267
@@:
-
 
268
	movzx	esi,al
-
 
269
 
-
 
270
	call	draw_messages
-
 
271
	
-
 
272
	mov	eax,dword[pinfo.box.width]
-
 
273
	sub	eax,127
-
 
274
	mov	dword[edit1.width],eax ; óñòàíàâëèâàåì øèðèíó òåêñòîâûõ ïîëåé
-
 
275
	mov	dword[edit2.width],eax
-
 
276
	mov	dword[edit3.width],eax
-
 
277
	
-
 
278
	push	dword edit1
-
 
279
	call	[edit_box_draw]
-
 
280
	push	dword edit2
-
 
281
	call	[edit_box_draw]
-
 
282
	push	dword edit3
-
 
283
	call	[edit_box_draw]
-
 
284
	push	dword ch1_dbg
293
 
285
	call	[check_box_draw]
Line 294... Line 286...
294
    mcall  12,2 ; End of Draw
286
.end:	
295
 
287
	mcall	12,2 ; End of Draw
296
    popa
288
	popa
297
    ret
289
	ret
298
 
290
;---------------------------------------------------------------------
Line 299... Line 291...
299
bottom_right dd ?
291
bottom_right dd ?
300
 
292
 
301
align 4
293
align 4
302
fun_opn_dlg: ;äã­ªæ¨ï ¤«ï ¢ë§®¢  OpenFile ¤¨ «®£ 
294
fun_opn_dlg: ;äã­ªæ¨ï ¤«ï ¢ë§®¢  OpenFile ¤¨ «®£ 
303
	pushad
295
	pushad
304
	copy_path open_dialog_name,communication_area_default_path,library_path,0
296
	copy_path open_dialog_name,communication_area_default_path,library_path,0
305
	mov [OpenDialog_data.type],0
297
	mov	[OpenDialog_data.type],0
306
 
298
 
307
	xor al,al
299
	xor	al,al
-
 
300
	mov	edi,dword[edit3.text]
-
 
301
	mov	ecx,dword[edit3.max]
-
 
302
	cld
-
 
303
	repne	scasb
-
 
304
	cmp	byte[edi-2],'/'
-
 
305
	jne	@f
-
 
306
	mov	byte[edi-2],0 ;¥á«¨ ¢ ª®­æ¥ ¯ã⨠¥áâì á«¥è, â® ¯ãâì 㪮à ç¨¢ ¥¬ ­  1 ᨬ¢®«
-
 
307
@@:
-
 
308
	push	dword OpenDialog_data
-
 
309
	call	dword [OpenDialog_Start]
-
 
310
	cmp	[OpenDialog_data.status],2
-
 
311
	je	@f
-
 
312
 
-
 
313
	xor	al,al
-
 
314
	mov	edi,dword[edit3.text]
-
 
315
	mov	ebx,edi ;copy text pointer
-
 
316
	mov	ecx,dword[edit3.max]
-
 
317
	cld
-
 
318
	repne	scasb
-
 
319
	cmp	byte[edi-2],'/'
-
 
320
	jne	.no_slash
-
 
321
	
-
 
322
	dec	edi ;¥á«¨ ¢ ª®­æ¥ ¯ã⨠¥áâì á«¥è, â® ¯ãâì 㪮à ç¨¢ ¥¬ ­  1 ᨬ¢®«
-
 
323
.no_slash:
-
 
324
	mov	byte[edi-1],'/' ;áâ ¢¨¬ ¢ ª®­æ¥ ¯ã⨠᫥è
-
 
325
	mov	byte[edi],0 ;®â१ ¥¬ ¨¬ï ­ ©¤¥­­®£® ä ©« 
-
 
326
	sub	edi,ebx ;edi = strlen(edit3.text)
-
 
327
	mov	[edit3.size],edi
-
 
328
	mov	[edit3.pos],edi
Line 308... Line -...
308
	mov edi,dword[edit3.text]
-
 
309
	mov ecx,dword[edit3.max]
-
 
310
	cld
-
 
311
	repne scasb
-
 
312
	cmp byte[edi-2],'/'
-
 
313
	jne @f
-
 
314
		mov byte[edi-2],0 ;¥á«¨ ¢ ª®­æ¥ ¯ã⨠¥áâì á«¥è, â® ¯ãâì 㪮à ç¨¢ ¥¬ ­  1 ᨬ¢®«
-
 
315
	@@:
-
 
316
 
-
 
317
	push dword OpenDialog_data
-
 
318
	call dword [OpenDialog_Start]
-
 
319
	cmp [OpenDialog_data.status],2
-
 
320
	je @f
-
 
321
		xor al,al
-
 
322
		mov edi,dword[edit3.text]
-
 
323
		mov ebx,edi ;copy text pointer
-
 
324
		mov ecx,dword[edit3.max]
-
 
325
		cld
-
 
326
		repne scasb
-
 
327
		cmp byte[edi-2],'/'
-
 
328
		jne .no_slash
-
 
329
			dec edi ;¥á«¨ ¢ ª®­æ¥ ¯ã⨠¥áâì á«¥è, â® ¯ãâì 㪮à ç¨¢ ¥¬ ­  1 ᨬ¢®«
-
 
330
		.no_slash:
-
 
331
		mov byte[edi-1],'/' ;áâ ¢¨¬ ¢ ª®­æ¥ ¯ã⨠᫥è
-
 
332
		mov byte[edi],0 ;®â१ ¥¬ ¨¬ï ­ ©¤¥­­®£® ä ©« 
-
 
333
		sub edi,ebx ;edi = strlen(edit3.text)
-
 
334
		mov [edit3.size],edi
-
 
335
		mov [edit3.pos],edi
-
 
336
 
329
 
337
		push dword [OpenDialog_data.filename_area]
330
	push	dword [OpenDialog_data.filename_area]
338
		push dword edit1
331
	push	dword edit1
339
		call dword [edit_box_set_text]
332
	call	dword [edit_box_set_text]
340
 
333
 
341
		push dword [OpenDialog_data.filename_area]
334
	push	dword [OpenDialog_data.filename_area]
342
		push dword edit2
335
	push	dword edit2
-
 
336
	call	dword [edit_box_set_text]
343
		call dword [edit_box_set_text]
337
 
344
 
338
	mov	esi,[edit2.text]
345
		mov esi,[edit2.text]
339
	xor	eax,eax
-
 
340
	cld
346
		xor eax,eax
341
.cycle:
347
		cld
342
	lodsb
348
		.cycle:
343
	test	eax,eax
349
			lodsb
-
 
350
			test eax,eax
344
	jnz	.cycle
-
 
345
 
351
			jnz .cycle
346
	sub	esi,4
352
		sub esi,4
347
	cmp	esi,[edit2.text]
353
		cmp esi,[edit2.text]
348
	jle	.short_fn
354
		jle .short_fn
349
	
355
			mov byte[esi],0
350
	mov	byte[esi],0
356
			sub dword [edit2.size],4
351
	sub	dword [edit2.size],4
357
			sub dword [edit2.pos],4
352
	sub	dword [edit2.pos],4
358
		.short_fn:
353
 
359
 
354
.short_fn:
360
		push dword edit1
-
 
-
 
355
	push	dword edit1
361
		call dword [edit_box_draw]
356
	call	dword [edit_box_draw]
362
		push dword edit2
357
	push	dword edit2
363
		call dword [edit_box_draw]
358
	call	dword [edit_box_draw]
364
		push dword edit3
359
	push	dword edit3
365
		call dword [edit_box_draw]
360
	call	dword [edit_box_draw]
366
	@@:
361
@@:
367
	popad
362
	popad
368
	ret
363
	ret
369
 
364
;---------------------------------------------------------------------
370
draw_messages:
365
draw_messages:
371
    mov    eax,13      ; clear work area
366
	mov	eax,13      ; clear work area
372
    mpack  ebx,7-2,[pinfo.box.width]
367
	mpack	ebx,7-2,[pinfo.box.width]
373
    sub    ebx,5*2+7*2-1-2*2
368
	sub	ebx,5*2+7*2-1-2*2
374
    mpack  ecx,0,[pinfo.box.height]
369
	mpack	ecx,0,[pinfo.box.height]
375
    madd   ecx, 14*3+16+1+7+1,-( 14*3+16+1+7*2+25)
370
	madd	ecx, 14*3+16+1+7+1,-( 14*3+16+1+7*2+25)
376
    mov    word[bottom_right+2],bx
371
	mov	word[bottom_right+2],bx
377
    mov    word[bottom_right],cx
372
	mov	word[bottom_right],cx
378
    msub   [bottom_right],7,11
373
	msub	[bottom_right],7,11
379
    add    [bottom_right],7 shl 16 + 53
374
	add	[bottom_right],7 shl 16 + 53
380
    mov    edx,[sc.work]
375
	mov	edx,[sc.work]
381
    mcall
376
	mcall
382
_cy = 0
377
_cy = 0
383
_sy = 2
378
_sy = 2
384
_cx = 4
379
_cx = 4
385
_sx = 6
380
_sx = 6
386
    push   ebx ecx
381
	push	ebx ecx
387
    mpack  ebx,4,5
382
	mpack	ebx,4,5
388
    add    bx,[esp+_cx]
383
	add	bx,[esp+_cx]
389
    mov    ecx,[esp+_sy-2]
384
	mov	ecx,[esp+_sy-2]
390
    mov    cx,[esp+_sy]
385
	mov	cx,[esp+_sy]
391
    msub   ecx,1,1
386
	msub	ecx,1,1
392
    mcall  38,,,[sc.work_graph]
387
	mcall	38,,,[sc.work_graph]
393
    mov    si,[esp+_cy]
388
	mov	si,[esp+_cy]
394
    add    cx,si
389
	add	cx,si
395
    shl    esi,16
390
	shl	esi,16
396
    add    ecx,esi
391
	add	ecx,esi
397
    madd   ecx,1,1
392
	madd	ecx,1,1
398
    mcall
393
	mcall
399
    mpack  ebx,4,4
394
	mpack	ebx,4,4
400
    mov    esi,[esp+_sy-2]
395
	mov	esi,[esp+_sy-2]
401
    mov    si,cx
396
	mov	si,cx
402
    mov    ecx,esi
397
	mov	ecx,esi
403
    mcall
-
 
404
    mov    si,[esp+_cx]
-
 
-
 
398
	mcall
405
    add    bx,si
399
	mov	si,[esp+_cx]
406
    shl    esi,16
-
 
-
 
400
	add	bx,si
407
    add    ebx,esi
401
	shl	esi,16
408
    madd   ebx,1,1
402
	add	ebx,esi
409
    mcall
403
	madd	ebx,1,1
410
    pop    ecx ebx
404
	mcall
411
    ret
405
	pop	ecx ebx
Line 459... Line 453...
459
  system_dir0 db '/sys/lib/'
453
  system_dir0 db '/sys/lib/'
460
  lib0_name db 'box_lib.obj',0
454
  lib0_name db 'box_lib.obj',0
Line 461... Line 455...
461
 
455
 
462
  system_dir1 db '/sys/lib/'
456
  system_dir1 db '/sys/lib/'
463
  lib1_name db 'proc_lib.obj',0
-
 
464
 
-
 
-
 
457
  lib1_name db 'proc_lib.obj',0
465
 
458
;---------------------------------------------------------------------
466
align 4
459
align 4
467
import_box_lib:
460
import_box_lib:
468
	edit_box_draw  dd aEdit_box_draw
461
edit_box_draw		dd aEdit_box_draw
469
	edit_box_key	 dd aEdit_box_key
462
edit_box_key		dd aEdit_box_key
470
	edit_box_mouse dd aEdit_box_mouse
463
edit_box_mouse		dd aEdit_box_mouse
471
	edit_box_set_text dd aEdit_box_set_text
464
edit_box_set_text	dd aEdit_box_set_text
472
	;version_ed     dd aVersion_ed
465
;version_ed		dd aVersion_ed
473
 
466
 
474
  check_box_draw  dd aCheck_box_draw
467
check_box_draw		dd aCheck_box_draw
475
  check_box_mouse dd aCheck_box_mouse
468
check_box_mouse		dd aCheck_box_mouse
476
  ;version_ch      dd aVersion_ch
469
;version_ch		dd aVersion_ch
477
 
470
 
478
  dd 0,0
471
			dd 0,0
479
 
472
 
480
  aEdit_box_draw  db 'edit_box',0
473
aEdit_box_draw		db 'edit_box',0
481
  aEdit_box_key   db 'edit_box_key',0
474
aEdit_box_key		db 'edit_box_key',0
482
  aEdit_box_mouse db 'edit_box_mouse',0
475
aEdit_box_mouse		db 'edit_box_mouse',0
483
  aEdit_box_set_text db 'edit_box_set_text',0
476
aEdit_box_set_text	db 'edit_box_set_text',0
484
  ;aVersion_ed     db 'version_ed',0
477
;aVersion_ed		db 'version_ed',0
485
 
478
 
486
  aCheck_box_draw  db 'check_box_draw',0
479
aCheck_box_draw		db 'check_box_draw',0
487
  aCheck_box_mouse db 'check_box_mouse',0
480
aCheck_box_mouse	db 'check_box_mouse',0
488
  ;aVersion_ch      db 'version_ch',0
-
 
-
 
481
;aVersion_ch		db 'version_ch',0
489
 
482
;---------------------------------------------------------------------
490
align 4
483
align 4
491
import_proc_lib:
484
import_proc_lib:
492
	OpenDialog_Init dd aOpenDialog_Init
485
OpenDialog_Init		dd aOpenDialog_Init
493
	OpenDialog_Start dd aOpenDialog_Start
486
OpenDialog_Start	dd aOpenDialog_Start
494
dd 0,0
487
			dd 0,0
495
	aOpenDialog_Init db 'OpenDialog_init',0
488
aOpenDialog_Init	db 'OpenDialog_init',0
496
	aOpenDialog_Start db 'OpenDialog_start',0
-
 
-
 
489
aOpenDialog_Start	db 'OpenDialog_start',0
497
 
490
;---------------------------------------------------------------------
498
;library structures
491
;library structures
499
l_libs_start:
492
l_libs_start:
500
  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
493
  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
501
  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
494
  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
Line 504... Line 497...
504
edit1 edit_box 153, 56, 1, 0xffffff, 0xff, 0x80ff, 0, 0x8000, (outfile-infile-1), infile, mouse_dd, 0, 11,11
497
edit1 edit_box 153, 56, 1, 0xffffff, 0xff, 0x80ff, 0, 0x8000, (outfile-infile-1), infile, mouse_dd, 0, 11,11
505
edit2 edit_box 153, 56, 17, 0xffffff, 0xff, 0x80ff, 0, 0x8000,(path-outfile-1), outfile, mouse_dd, 0, 7,7
498
edit2 edit_box 153, 56, 17, 0xffffff, 0xff, 0x80ff, 0, 0x8000,(path-outfile-1), outfile, mouse_dd, 0, 7,7
506
edit3 edit_box 153, 56, 33, 0xffffff, 0xff, 0x80ff, 0, 0x8000,(path_end-path-1), path, mouse_dd, 0, 6,6
499
edit3 edit_box 153, 56, 33, 0xffffff, 0xff, 0x80ff, 0, 0x8000,(path_end-path-1), path, mouse_dd, 0, 6,6
507
editboxes_end:
500
editboxes_end:
508
ch1_dbg check_box 5, 49, 6, 12, 0xffffff, 0x80ff, 0, s_dbgdescr,(s_dbgdescr_end-s_dbgdescr)
501
ch1_dbg check_box 5, 49, 6, 12, 0xffffff, 0x80ff, 0, s_dbgdescr,(s_dbgdescr_end-s_dbgdescr)
509
 
-
 
510
;---------------------------------------------------------------------
502
;---------------------------------------------------------------------
511
align 4
503
align 4
512
OpenDialog_data:
504
OpenDialog_data:
513
.type			dd 0
505
.type			dd 0
514
.procinfo		dd pinfo	;+4
506
.procinfo		dd pinfo	;+4
Line 542... Line 534...
542
dd Filter.end - Filter
534
dd Filter.end - Filter
543
.1:
535
.1:
544
db 'ASM',0
536
db 'ASM',0
545
.end:
537
.end:
546
db 0
538
db 0
547
 
-
 
-
 
539
;---------------------------------------------------------------------
548
mouse_dd dd 0 ;íóæíî äëÿ Shift-à â editbox
540
mouse_dd dd 0 ;íóæíî äëÿ Shift-à â editbox
549
 
-
 
-
 
541
;---------------------------------------------------------------------
550
infile	  db 'example.asm'
542
infile	  db 'example.asm'
551
  times MAX_PATH-$+infile  db 0
543
  times MAX_PATH-$+infile  db 0
552
outfile db 'example'
544
outfile db 'example'
553
  times MAX_PATH-$+outfile db 0
545
  times MAX_PATH-$+outfile db 0
554
path	db '/rd/1//' ;OpenDialog ¯à¨ § ¯ã᪥ 㡨ࠥ⠯®á«¥¤­¨© á«¥è, ­® ¤¨ «®£ ¬®¦¥â ¨á¯®«ì§®¢ âìáï ­¥ ¢á¥£¤ , ¯®â®¬ã á«¥è  2
546
path	db '/rd/1//' ;OpenDialog ¯à¨ § ¯ã᪥ 㡨ࠥ⠯®á«¥¤­¨© á«¥è, ­® ¤¨ «®£ ¬®¦¥â ¨á¯®«ì§®¢ âìáï ­¥ ¢á¥£¤ , ¯®â®¬ã á«¥è  2
555
  times MAX_PATH-$+path    db 0
547
  times MAX_PATH-$+path    db 0
556
path_end:
548
path_end:
557
lf db 13,10,0
549
lf db 13,10,0
558
 
-
 
559
 
-
 
-
 
550
;---------------------------------------------------------------------
560
mov_param_str:
551
mov_param_str:
561
    cld
552
	cld
562
@@:
553
@@:
563
    lodsb
554
	lodsb
564
    cmp    al,','
555
	cmp	al,','
565
    je	   @f
556
	je	@f
566
    stosb
557
	stosb
567
    test   al,al
558
	test	al,al
568
    jnz    @b
559
	jnz	@b
569
@@:
560
@@:
570
    xor    al,al
561
	xor	al,al
571
    stosb
562
	stosb
572
    ret
563
	ret
573
 
-
 
574
 
-
 
575
 
-
 
-
 
564
;---------------------------------------------------------------------
576
start:
565
start:
577
    cmp    [_mode],NORMAL_MODE
566
	cmp	[_mode],NORMAL_MODE
578
    jne    @f
567
	jne	@f
579
    call   draw_messages
568
	call	draw_messages
580
    mov    [textxy],7 shl 16 + 70
569
	mov	[textxy],7 shl 16 + 70
581
@@:
-
 
582
    mov    esi,_logo
-
 
583
    call   display_string
-
 
584
 
-
 
585
 ;
-
 
586
 ;   Fasm native code
-
 
587
 ;
-
 
588
 
-
 
589
    mov    [input_file],infile
-
 
590
    mov    [output_file],outfile
-
 
591
 
-
 
592
    call   init_memory
-
 
593
 
-
 
594
    call   make_timestamp
-
 
595
    mov    [start_time],eax
-
 
596
 
-
 
597
    call   preprocessor
-
 
598
    call   parser
-
 
599
    call   assembler
-
 
600
    bt	   dword[ch1_dbg.flags],1 ;cmp [bGenerateDebugInfo], 0
-
 
601
    jae    @f			  ;jz @f
-
 
602
    call   symbol_dump
-
 
603
@@:
-
 
604
    call   formatter
-
 
605
 
-
 
606
    call   display_user_messages
-
 
607
    movzx  eax,[current_pass]
-
 
608
    inc    eax
-
 
609
    call   display_number
-
 
610
    mov    esi,_passes_suffix
-
 
611
    call   display_string
-
 
612
    call   make_timestamp
-
 
613
    sub    eax,[start_time]
-
 
614
    xor    edx,edx
-
 
615
    mov    ebx,100
-
 
616
    div    ebx
-
 
617
    or	     eax,eax
-
 
618
    jz	     display_bytes_count
-
 
619
    xor    edx,edx
-
 
620
    mov    ebx,10
-
 
621
    div    ebx
-
 
622
    push   edx
-
 
623
    call   display_number
-
 
624
    mov    dl,'.'
-
 
625
    call   display_character
-
 
626
    pop    eax
-
 
627
    call   display_number
-
 
628
    mov    esi,_seconds_suffix
-
 
629
    call   display_string
-
 
630
  display_bytes_count:
-
 
631
    mov    eax,[written_size]
-
 
632
    call   display_number
-
 
633
    mov    esi,_bytes_suffix
-
 
634
    call   display_string
-
 
635
    xor    al,al
-
 
636
 
-
 
637
    cmp    [_run_outfile],0
-
 
638
    je	   @f
-
 
639
    mov    edx,outfile
-
 
640
    call   make_fullpaths
-
 
641
    mov    eax,70
-
 
642
    mov    ebx,file_info_start
-
 
643
    xor    ecx,ecx
-
 
644
    mcall
-
 
645
@@:
570
@@:
646
    jmp    exit_program
571
	mov	esi,_logo
647
 
-
 
-
 
572
	call	display_string
Line -... Line 573...
-
 
573
 
-
 
574
;---------------------------------------------------------------------
-
 
575
;   Fasm native code
-
 
576
;---------------------------------------------------------------------
-
 
577
	mov	[input_file],infile
-
 
578
	mov	[output_file],outfile
-
 
579
	
-
 
580
	call	init_memory
-
 
581
	
-
 
582
	call	make_timestamp
-
 
583
	mov	[start_time],eax
-
 
584
	
-
 
585
	call	preprocessor
-
 
586
	call	parser
-
 
587
	call	assembler
-
 
588
	bt	dword[ch1_dbg.flags],1 ;cmp [bGenerateDebugInfo], 0
-
 
589
	jae	@f			  ;jz @f
-
 
590
	call	symbol_dump
-
 
591
@@:
-
 
592
	call	formatter
-
 
593
	
-
 
594
	call	display_user_messages
-
 
595
	movzx	eax,[current_pass]
-
 
596
	inc	eax
-
 
597
	call	display_number
-
 
598
	mov	esi,_passes_suffix
-
 
599
	call	display_string
-
 
600
	call	make_timestamp
-
 
601
	sub	eax,[start_time]
-
 
602
	xor	edx,edx
-
 
603
	mov	ebx,100
-
 
604
	div	ebx
-
 
605
	or	eax,eax
-
 
606
	jz	display_bytes_count
-
 
607
	xor	edx,edx
-
 
608
	mov	ebx,10
-
 
609
	div	ebx
-
 
610
	push	edx
-
 
611
	call	display_number
-
 
612
	mov	dl,'.'
-
 
613
	call	display_character
-
 
614
	pop	eax
-
 
615
	call	display_number
-
 
616
	mov	esi,_seconds_suffix
-
 
617
	call	display_string
-
 
618
display_bytes_count:
-
 
619
	mov	eax,[written_size]
-
 
620
	call	display_number
-
 
621
	mov	esi,_bytes_suffix
-
 
622
	call	display_string
-
 
623
	xor	al,al
-
 
624
	
-
 
625
	cmp	[_run_outfile],0
-
 
626
	je	@f
-
 
627
	mov	edx,outfile
-
 
628
	call	make_fullpaths
-
 
629
	mov	eax,70
-
 
630
	mov	ebx,file_info_start
-
 
631
	xor	ecx,ecx
-
 
632
	mcall
-
 
633
@@:
-
 
634
	jmp	exit_program
648
 
635
;---------------------------------------------------------------------
649
include 'system.inc'
636
include 'system.inc'
650
include 'version.inc'
637
include 'version.inc'
651
include 'errors.inc'
638
include 'errors.inc'
652
include 'expressi.inc'
639
include 'expressi.inc'
Line 656... Line 643...
656
include 'formats.inc'
643
include 'formats.inc'
657
include 'x86_64.inc'
644
include 'x86_64.inc'
658
include 'tables.inc'
645
include 'tables.inc'
659
include 'symbdump.inc'
646
include 'symbdump.inc'
660
include 'messages.inc'
647
include 'messages.inc'
661
 
-
 
-
 
648
;---------------------------------------------------------------------
662
title db appname,VERSION_STRING,0
649
title db appname,VERSION_STRING,0
Line 663... Line 650...
663
 
650
 
Line 664... Line 651...
664
_logo db 'flat assembler  version ',VERSION_STRING,13,10,0
651
_logo db 'flat assembler  version ',VERSION_STRING,13,10,0