Subversion Repositories Kolibri OS

Rev

Rev 205 | Rev 308 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
205 heavyiron 1
window_y=88
2
;window_x=320
3
window_x=450
4
include 'macros.inc'
5
	meos_header par
6
	use_edit_box
7
	use_txt_button
8
	app_start
9
	cmp	[par],byte 0
10
	jne	read_par
11
	set_events_mask evm_mouse+evm_button+evm_key+evm_redraw
12
red:
13
	get_sys_colors sc
14
	set_sys_colors_txt_button run_but,sc
15
	push	dword [sc.work_graph]
16
	pop	[input_fn.focus_border_color]
17
	call	draw_window
18
still:
19
	wait_event red,key,button,mouse,,still
20
key:
21
	get_key
22
	cmp	ah,13
23
	je	run
24
	key_edit_box input_fn
25
	jmp	still
26
button:
27
	get_pressed_button
28
	dec	ah
29
	jz	close
30
	dec	ah
31
	jz	run
32
	jmp	still
33
mouse:
34
	mouse_edit_box input_fn
35
	jmp	still
31 halyavin 36
 
205 heavyiron 37
read_par:
38
	mov	esi,par
39
	mov	edi,fn
40
	mov	ecx,256
41
	rep	movsb
42
run:
43
	xor	eax,eax
44
	mov	edi,file_info.name
45
	mov	ecx,512
46
	rep	stosb
47
	mov	edi,run_par
48
	mov	ecx,256
49
	rep	stosb
31 halyavin 50
 
205 heavyiron 51
	mov	esi,fn
52
	mov	edi,file_info.name
53
	cmp	[esi],byte '"'
54
	je	copy_fn_with_spaces
55
copy_fn:
56
	cmp	[esi],byte ' '
57
	je	.stop
58
	cmp	[esi],byte 0
59
	je	.stop
60
	mov	al,[esi]
61
	mov	[edi],al
62
	inc	esi
63
	inc	edi
64
	jmp	copy_fn
65
.stop:
31 halyavin 66
 
205 heavyiron 67
	jmp	copy_par
31 halyavin 68
 
205 heavyiron 69
copy_fn_with_spaces:
70
	inc	esi
71
@@:
72
	cmp	[esi],byte '"'
73
	je	.stop
74
	cmp	[esi],byte 0
75
	je	.stop
76
	mov	al,[esi]
77
	mov	[edi],al
78
	inc	esi
79
	inc	edi
80
	jmp	@b
81
.stop:
31 halyavin 82
 
205 heavyiron 83
copy_par:
84
@@:
85
	inc	esi
86
	cmp	[esi],byte ' '
87
	je	@b
88
	mov	edi,run_par
89
@@:
90
	cmp	[esi],byte 0
91
	je	.stop
92
	mov	al,[esi]
93
	mov	[edi],al
94
	inc	esi
95
	inc	edi
96
	jmp	@b
97
.stop:
31 halyavin 98
 
205 heavyiron 99
	mov	eax,70
100
	mov	ebx,file_info
101
	int	0x40
31 halyavin 102
 
205 heavyiron 103
	;cmp     eax,0
104
	;jg      error
105
	bt	eax,31
106
	je	error
107
	jmp     still
108
close:
109
	app_close
31 halyavin 110
 
205 heavyiron 111
error:
31 halyavin 112
 
205 heavyiron 113
macro cmp_err code,text_ptr
114
{
115
	cmp	al,code
116
	jne	@f
117
	mov	[status],text_ptr
118
	;jmp     .draw_status
119
@@:
120
}
121
	neg	eax
31 halyavin 122
 
205 heavyiron 123
	;test    al,al
124
	;jz      close
31 halyavin 125
 
205 heavyiron 126
	cmp_err 3,bad_file_sys
31 halyavin 127
 
205 heavyiron 128
	cmp_err 5,file_not_find
31 halyavin 129
 
205 heavyiron 130
	cmp_err 9,bad_fat_table
31 halyavin 131
 
205 heavyiron 132
	cmp_err 10,acces_denyied
31 halyavin 133
 
205 heavyiron 134
	cmp_err 11,device_error
31 halyavin 135
 
205 heavyiron 136
	cmp_err 30,out_of_memory
31 halyavin 137
 
205 heavyiron 138
	cmp_err 31,file_not_executable
31 halyavin 139
 
205 heavyiron 140
	cmp_err 32,many_processes
31 halyavin 141
 
205 heavyiron 142
.draw_status:
143
	call	draw_status
144
	jmp	still
31 halyavin 145
 
146
draw_window:
205 heavyiron 147
	start_draw_window
148
	get_screen_size
149
	mov	cx,ax
150
	sub	cx,window_y+20
151
	shl	ecx,16
152
	mov	cx,window_y
153
	shr	eax,16
154
	mov	bx,ax
155
	sub	bx,window_x
156
	shl	ebx,15
157
	mov	bx,window_x
158
	mov	edx,[sc.work]
305 Lrz 159
	or	edx,0xb3000000
205 heavyiron 160
	xor	eax,eax
305 Lrz 161
	mov	esi,[sc.grab_text]
162
	mov	edi,hed
205 heavyiron 163
	int	0x40
31 halyavin 164
 
205 heavyiron 165
	get_procinfo app
31 halyavin 166
 
205 heavyiron 167
	mov	ax,[app.width]
168
	sub	ax,20
305 Lrz 169
	mov	[input_fn.width],eax
205 heavyiron 170
	mov	[run_but.width],ax
31 halyavin 171
 
305 Lrz 172
	mov	ebx,10000
205 heavyiron 173
	mov	bx,ax
305 Lrz 174
	add	bx,10
175
	mov	cx,47
205 heavyiron 176
	push	cx
177
	shl	ecx,16
178
	pop	cx
179
	mov	edx,[sc.work_graph]
180
	mov	eax,38
181
	int	0x40
31 halyavin 182
 
205 heavyiron 183
	draw_edit_box input_fn
184
	draw_txt_button run_but
31 halyavin 185
 
205 heavyiron 186
	call	draw_status_text
31 halyavin 187
 
205 heavyiron 188
	stop_draw_window
31 halyavin 189
ret
190
 
205 heavyiron 191
draw_status:
305 Lrz 192
	mov	ebx,5*65536+(window_x-5-10)
193
	mov	ecx,(window_y-39)*65536+12
205 heavyiron 194
	mov	edx,[sc.work]
195
	mov	eax,13
196
	int	0x40
197
draw_status_text:
198
	mov	edx,[status]
199
	xor	esi,esi
200
@@:
201
	cmp	[edx+esi],byte 0
202
	je	@f
203
	inc	esi
204
	jmp	@b
205
@@:
206
	mov	eax,4
305 Lrz 207
	mov	ebx,6*65536+(window_y-37)
205 heavyiron 208
	mov	ecx,[sc.work_text]
209
	int	0x40
31 halyavin 210
ret
211
 
305 Lrz 212
run_but txt_button 0,5,15,30,2,0,0,run_but_text,
205 heavyiron 213
if lang eq ru
214
run_but_text db 'ЗАПУСТИТЬ',0
215
else
216
run_but_text db 'RUN',0
217
end if
305 Lrz 218
input_fn edit_box 0,5,10,0xffffff,0,0xaaaaaa,0,511,fn,ed_focus+\
205 heavyiron 219
ed_always_focus
31 halyavin 220
 
205 heavyiron 221
if lang eq ru
222
hello db 'Введите полный путь к файлу и нажмите Enter',0
223
bad_file_sys db 'Неизвестная файловая система',0 ; 3
224
file_not_find db 'Файл не найден',0		 ; 5
225
bad_fat_table db 'Таблица FAT разрушена',0	 ; 9
226
acces_denyied db 'Доступ запрещен',0		 ; 10
227
device_error db 'Ошибка устройства',0		 ; 11
228
out_of_memory db 'Недостаточно памяти',0	 ; 30
229
file_not_executable db 'Файл не является исполняемым',0 ; 31
230
many_processes db 'Слишком много процессов',0	 ; 32
231
else
232
hello db 'Enter full path to file and press ',0
233
bad_file_sys db 'Unknown file system',0                ; 3
234
file_not_find db 'File not found',0                    ; 5
235
bad_fat_table db 'FAT table corrupted',0               ; 9
236
acces_denyied db 'Access denied',0                     ; 10
237
device_error db 'Device error',0                       ; 11
238
out_of_memory db 'Out of memory',0                     ; 30
239
file_not_executable db 'File is not executable',0      ; 31
240
many_processes db 'Too many processes',0               ; 32
241
end if
31 halyavin 242
 
305 Lrz 243
if lang eq ru
244
hed db 'RUN от первого Февраля 2007 года',0
245
else
246
hed db 'RUN of the first of FEBRUARY 2007 year',0
247
end if
205 heavyiron 248
status dd hello
31 halyavin 249
 
205 heavyiron 250
file_info:
251
.mode dd 7
252
.flags dd 0
253
.par dd run_par
254
dd 0,0
255
.name rb 512
31 halyavin 256
 
205 heavyiron 257
flags dw ?
31 halyavin 258
 
205 heavyiron 259
fn rb 512
31 halyavin 260
 
205 heavyiron 261
sc sys_color_table
262
app procinfo
263
run_par rb 256
264
par rb 256
265
	app_end