Rev 109 | Rev 305 | 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] |
||
159 | or edx,0x03000000 |
||
160 | xor eax,eax |
||
161 | xor esi,esi |
||
162 | xor edi,edi |
||
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 |
||
169 | mov [input_fn.width],ax |
||
170 | mov [run_but.width],ax |
||
31 | halyavin | 171 | |
205 | heavyiron | 172 | mov bx,5 |
173 | shl ebx,16 |
||
174 | mov bx,ax |
||
175 | add bx,15 |
||
176 | mov cx,70 |
||
177 | push cx |
||
178 | shl ecx,16 |
||
179 | pop cx |
||
180 | mov edx,[sc.work_graph] |
||
181 | mov eax,38 |
||
182 | int 0x40 |
||
31 | halyavin | 183 | |
205 | heavyiron | 184 | draw_edit_box input_fn |
185 | draw_txt_button run_but |
||
31 | halyavin | 186 | |
205 | heavyiron | 187 | call draw_status_text |
31 | halyavin | 188 | |
205 | heavyiron | 189 | stop_draw_window |
31 | halyavin | 190 | ret |
191 | |||
205 | heavyiron | 192 | draw_status: |
193 | mov ebx,5*65536+(window_x-5-5) |
||
194 | mov ecx,(window_y-16)*65536+12 |
||
195 | mov edx,[sc.work] |
||
196 | mov eax,13 |
||
197 | int 0x40 |
||
198 | draw_status_text: |
||
199 | mov edx,[status] |
||
200 | xor esi,esi |
||
201 | @@: |
||
202 | cmp [edx+esi],byte 0 |
||
203 | je @f |
||
204 | inc esi |
||
205 | jmp @b |
||
206 | @@: |
||
207 | mov eax,4 |
||
208 | mov ebx,10*65536+(window_y-14) |
||
209 | mov ecx,[sc.work_text] |
||
210 | int 0x40 |
||
31 | halyavin | 211 | ret |
212 | |||
205 | heavyiron | 213 | run_but txt_button 0,10,15,50,2,0,0,run_but_text, |
214 | if lang eq ru |
||
215 | run_but_text db 'ЗАПУСТИТЬ',0 |
||
216 | else |
||
217 | run_but_text db 'RUN',0 |
||
218 | end if |
||
219 | input_fn edit_box 0,10,30,0xffffff,0,0xaaaaaa,0,511,fn,ed_focus+\ |
||
220 | ed_always_focus |
||
31 | halyavin | 221 | |
205 | heavyiron | 222 | if lang eq ru |
223 | hello db 'Введите полный путь к файлу и нажмите Enter',0 |
||
224 | bad_file_sys db 'Неизвестная файловая система',0 ; 3 |
||
225 | file_not_find db 'Файл не найден',0 ; 5 |
||
226 | bad_fat_table db 'Таблица FAT разрушена',0 ; 9 |
||
227 | acces_denyied db 'Доступ запрещен',0 ; 10 |
||
228 | device_error db 'Ошибка устройства',0 ; 11 |
||
229 | out_of_memory db 'Недостаточно памяти',0 ; 30 |
||
230 | file_not_executable db 'Файл не является исполняемым',0 ; 31 |
||
231 | many_processes db 'Слишком много процессов',0 ; 32 |
||
232 | else |
||
233 | hello db 'Enter full path to file and press |
||
234 | bad_file_sys db 'Unknown file system',0 ; 3 |
||
235 | file_not_find db 'File not found',0 ; 5 |
||
236 | bad_fat_table db 'FAT table corrupted',0 ; 9 |
||
237 | acces_denyied db 'Access denied',0 ; 10 |
||
238 | device_error db 'Device error',0 ; 11 |
||
239 | out_of_memory db 'Out of memory',0 ; 30 |
||
240 | file_not_executable db 'File is not executable',0 ; 31 |
||
241 | many_processes db 'Too many processes',0 ; 32 |
||
242 | end if |
||
31 | halyavin | 243 | |
205 | heavyiron | 244 | status dd hello |
31 | halyavin | 245 | |
205 | heavyiron | 246 | file_info: |
247 | .mode dd 7 |
||
248 | .flags dd 0 |
||
249 | .par dd run_par |
||
250 | dd 0,0 |
||
251 | .name rb 512 |
||
31 | halyavin | 252 | |
205 | heavyiron | 253 | flags dw ? |
31 | halyavin | 254 | |
205 | heavyiron | 255 | fn rb 512 |
31 | halyavin | 256 | |
205 | heavyiron | 257 | sc sys_color_table |
258 | app procinfo |
||
259 | run_par rb 256 |
||
260 | par rb 256 |
||
261 | app_end |