Rev 1236 | Rev 1293 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 1236 | Rev 1262 | ||
---|---|---|---|
Line 1... | Line 1... | ||
1 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
1 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
2 | ;; Copyright (C) Vasiliy Kosenko (vkos), 2009 ;; |
2 | ;; Copyright (C) Vasiliy Kosenko (vkos), 2009 ;; |
3 | ;; Launch is free software: you can redistribute it and/or modify it under the terms of the GNU ;; |
3 | ;; Launch is free software: you can redistribute it and/or modify it under the terms of the GNU ;; |
4 | ;; General Public License as published by the Free Software Foundation, either version 2 ;; |
4 | ;; General Public License as published by the Free Software Foundation, either version 3 ;; |
5 | ;; of the License, or (at your option) any later version. ;; |
5 | ;; of the License, or (at your option) any later version. ;; |
6 | ;; ;; |
6 | ;; ;; |
7 | ;; Launch is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without ;; |
7 | ;; Launch is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without ;; |
8 | ;; even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ;; |
8 | ;; even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ;; |
9 | ;; General Public License for more details. ;; |
9 | ;; General Public License for more details. ;; |
Line 18... | Line 18... | ||
18 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
18 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
Line 19... | Line 19... | ||
19 | 19 | ||
Line 20... | Line 20... | ||
20 | format binary |
20 | format binary |
21 | 21 | ||
Line 22... | Line 22... | ||
22 | APP_NAME fix 'Launch' |
22 | APP_NAME fix 'Launch' |
23 | APP_VERSION fix '0.1.5' |
23 | APP_VERSION fix '0.1.60' |
Line 24... | Line 24... | ||
24 | 24 | ||
Line 41... | Line 41... | ||
41 | define PATH_MAX_LEN 1024 |
41 | define PATH_MAX_LEN 1024 |
42 | define DEBUG_MAX_LEN 8 |
42 | define DEBUG_MAX_LEN 8 |
43 | define DEBUG_DEFAULT 0 |
43 | define DEBUG_DEFAULT 0 |
44 | define BUFF_SIZE 1024 |
44 | define BUFF_SIZE 1024 |
Line 45... | Line 45... | ||
45 | 45 | ||
46 | include '../../../proc32.inc' |
46 | include 'proc32.inc' |
47 | include '../../../macros.inc' |
47 | include 'macros.inc' |
48 | include 'libio.inc' |
48 | include 'libio.inc' |
49 | include 'mem.inc' |
49 | include 'mem.inc' |
Line -... | Line 50... | ||
- | 50 | include 'dll.inc' |
|
- | 51 | ||
- | 52 | purge mov |
|
- | 53 | ||
- | 54 | include 'thread.inc' |
|
- | 55 | include 'ipc.inc' |
|
50 | include 'dll.inc' |
56 | include 'kobra.inc' |
51 | 57 | ||
52 | ;;-------------------------------------------------------------------------------------------------- |
58 | ;;-------------------------------------------------------------------------------------------------- |
53 | ;; Basic initialization |
59 | ;; Basic initialization |
54 | START: |
60 | START: |
Line 109... | Line 115... | ||
109 | je .ok |
115 | je .ok |
Line 110... | Line 116... | ||
110 | 116 | ||
Line 111... | Line 117... | ||
111 | jmp .con_init |
117 | jmp .con_init |
112 | 118 | ||
113 | .console_err: |
119 | .console_err: |
Line 114... | Line 120... | ||
114 | mov dword [debug_option], 0 |
120 | mov byte [debug_option], 0 |
115 | jmp .ok |
121 | jmp .ok |
116 | 122 | ||
Line 121... | Line 127... | ||
121 | invoke con.init, -1, -1, -1, -1, window_title |
127 | invoke con.init, -1, -1, -1, -1, window_title |
Line 122... | Line 128... | ||
122 | 128 | ||
123 | .read_level: |
129 | .read_level: |
124 | invoke ini.get_int, etc_cfg, cfg_debug, cfg_level, 0 |
130 | invoke ini.get_int, etc_cfg, cfg_debug, cfg_level, 0 |
125 | invoke ini.get_int, path, cfg_debug, cfg_level, eax |
131 | invoke ini.get_int, path, cfg_debug, cfg_level, eax |
126 | mov dword [debug_level], eax |
132 | mov byte [debug_level], al |
Line 127... | Line 133... | ||
127 | .ok: |
133 | .ok: |
128 | 134 | ||
129 | ; read_ini_kobra: |
135 | read_ini_kobra: |
130 | ; invoke ini.get_str, etc_cfg, cfg_kobra, cfg_use, kobra_use, KOBRA_USE_MAX_LEN, KOBRA_USE_DEFAULT |
- | |
131 | ; invoke ini.get_str, path, cfg_kobra, cfg_use, kobra_use, KOBRA_USE_MAX_LEN, kobra_use |
- | |
Line -... | Line 136... | ||
- | 136 | invoke ini.get_bool, etc_cfg, cfg_kobra, cfg_use, 0 |
|
Line 132... | Line 137... | ||
132 | ; |
137 | invoke ini.get_bool, path, cfg_kobra, cfg_use, eax |
133 | ; ;; Now convert string option to acceptable type |
138 | |
134 | 139 | mov byte [kobra_use], al |
|
135 | 140 | ||
Line 180... | Line 185... | ||
180 | push eax |
185 | push eax |
181 | mov al, byte [debug_option] |
186 | mov al, byte [debug_option] |
182 | ; dec al |
187 | ; dec al |
183 | test al, al |
188 | test al, al |
184 | je .prn_stp |
189 | je .prn_stp |
185 | mov eax, dword [debug_level] |
190 | mov al, byte [debug_level] |
186 | or eax, eax |
191 | or al, al |
187 | je .prn_stp |
192 | je .prn_stp |
188 | dec eax |
193 | dec al |
189 | or eax, eax |
194 | or al, al |
190 | je .prn_1 |
195 | je .prn_1 |
191 | .prn_1: |
196 | .prn_1: |
192 | cinvoke con.printf, message_dbg_not_found, buff |
197 | cinvoke con.printf, message_dbg_not_found, buff |
Line 193... | Line 198... | ||
193 | 198 | ||
Line 236... | Line 241... | ||
236 | jl .loop |
241 | jl .loop |
Line 237... | Line 242... | ||
237 | 242 | ||
238 | ;;-------------------------------------------------------------------------------------------------- |
243 | ;;-------------------------------------------------------------------------------------------------- |
239 | ;; Exit |
244 | ;; Exit |
240 | exit: |
245 | exit: |
241 | push eax |
246 | mov dword [tid], eax |
242 | ;; If console is present we should write some info |
247 | ;; If console is present we should write some info |
243 | mov al, byte [debug_option] |
248 | mov al, byte [debug_option] |
244 | cmp al, DEBUG_CONSOLE |
249 | cmp al, DEBUG_CONSOLE |
Line 245... | Line 250... | ||
245 | jne .close |
250 | jne .kobra |
246 | 251 | ||
247 | .write_console: |
252 | .write_console: |
248 | pop eax |
253 | mov eax, dword [tid] |
249 | test eax, eax |
254 | test eax, eax |
250 | jz .write_error |
255 | jz .write_error |
251 | .write_launched: |
256 | .write_launched: |
Line 255... | Line 260... | ||
255 | pop edi |
260 | pop edi |
256 | cinvoke con.printf, message_error, edi |
261 | cinvoke con.printf, message_error, edi |
257 | .wr_end: |
262 | .wr_end: |
258 | invoke con.exit, 0 |
263 | invoke con.exit, 0 |
Line -... | Line 264... | ||
- | 264 | ||
- | 265 | .kobra: |
|
- | 266 | mov al, byte [kobra_use] |
|
- | 267 | test al, al |
|
- | 268 | je .close |
|
- | 269 | ||
- | 270 | .register: |
|
- | 271 | mov dword [IPC_area], buff |
|
- | 272 | call IPC_init |
|
- | 273 | ; jnz .close |
|
- | 274 | ||
- | 275 | mov dword [thread_find_buff], another_buff |
|
- | 276 | ||
- | 277 | call kobra_register |
|
- | 278 | ||
- | 279 | test eax, eax |
|
- | 280 | jnz .close |
|
- | 281 | ||
- | 282 | ;; Prepare message |
|
- | 283 | mov dword [kobra_message], KOBRA_MESSAGE_LAUNCH_STATE |
|
- | 284 | ||
- | 285 | mov eax, dword [tid] |
|
- | 286 | mov dword [kobra_message+4], eax |
|
- | 287 | ||
- | 288 | .kobra_send: |
|
- | 289 | stdcall kobra_send_message, kobra_group_launch_reactive, kobra_message, 8 |
|
259 | 290 | ||
260 | .close: |
291 | .close: |
Line 261... | Line 292... | ||
261 | mcall -1 |
292 | mcall -1 |
262 | 293 | ||
Line -... | Line 294... | ||
- | 294 | ;; End of code |
|
- | 295 | ;;-------------------------------------------------------------------------------------------------- |
|
263 | ;; End of code |
296 | |
264 | ;;-------------------------------------------------------------------------------------------------- |
297 | ;;-------------------------------------------------------------------------------------------------- |
Line 265... | Line 298... | ||
265 | 298 | ;; Imports |
|
266 | align 16 |
299 | align 16 |
Line 274... | Line 307... | ||
274 | \; ini.set_str ,'ini_set_str', \ |
307 | \; ini.set_str ,'ini_set_str', \ |
275 | ini.get_int ,'ini_get_int', \ |
308 | ini.get_int ,'ini_get_int', \ |
276 | \; ini.set_int ,'ini_set_int', \ |
309 | \; ini.set_int ,'ini_set_int', \ |
277 | \; ini.get_color ,'ini_get_color', \ |
310 | \; ini.get_color ,'ini_get_color', \ |
278 | \; ini.set_color ,'ini_set_color', \ |
311 | \; ini.set_color ,'ini_set_color', \ |
279 | ini.get_option_str ,'ini_get_option_str';, \ |
312 | ini.get_option_str ,'ini_get_option_str', \ |
- | 313 | ini.get_bool ,'ini_get_bool';,\ |
|
Line 280... | Line 314... | ||
280 | 314 | ||
281 | ;import libio, \ |
315 | ;import libio, \ |
282 | ; file_find_first,'file_find_first', \ |
316 | ; file_find_first,'file_find_first', \ |
283 | ; file_find_next ,'file_find_next', \ |
317 | ; file_find_next ,'file_find_next', \ |
Line 300... | Line 334... | ||
300 | con.init, 'con_init',\ |
334 | con.init, 'con_init',\ |
301 | con.exit, 'con_exit',\ |
335 | con.exit, 'con_exit',\ |
302 | con.printf, 'con_printf' ;,\ |
336 | con.printf, 'con_printf' ;,\ |
303 | ; con.write_asciiz, 'con_write_asciiz' |
337 | ; con.write_asciiz, 'con_write_asciiz' |
Line -... | Line 338... | ||
- | 338 | ||
- | 339 | ;;-------------------------------------------------------------------------------------------------- |
|
304 | 340 | ;; Data |
|
305 | align 16 |
341 | align 16 |
Line 306... | Line 342... | ||
306 | APP_DATA: |
342 | APP_DATA: |
307 | 343 | ||
Line 315... | Line 351... | ||
315 | 351 | ||
316 | message_error: |
352 | message_error: |
Line 317... | Line 353... | ||
317 | db 'File (%s) not found!', 0 |
353 | db 'File (%s) not found!', 0 |
318 | 354 | ||
319 | message_ok: |
- | |
320 | db '%s loaded succesfully. PID: %d (0x%X)' |
- | |
321 | - | ||
322 | ;; Empty string |
- | |
Line 323... | Line 355... | ||
323 | empty_str: |
355 | message_ok: |
324 | db 0 |
356 | db '%s loaded succesfully. PID: %d (0x%X)', 0 |
325 | 357 | ||
326 | ;; Configuration path |
358 | ;; Configuration path |
327 | etc_cfg: |
359 | etc_cfg: |
328 | db '/sys/etc/' |
360 | db '/sys/etc/' |
329 | cfg_name: |
361 | cfg_name: |
Line 330... | Line 362... | ||
330 | db 'launch' |
362 | db 'launch' |
331 | cfg_ext: |
363 | cfg_ext: |
332 | db '.cfg', 0 |
364 | db '.cfg', 0 |
333 | 365 | ||
334 | ;; String in config file |
366 | ;; Strings in config file |
335 | cfg_main: |
367 | cfg_main: |
336 | db 'main', 0 |
368 | db 'main', 0 |
337 | cfg_path: |
369 | cfg_path: |
338 | db 'path', 0 |
370 | db 'path', 0 |
- | 371 | cfg_debug: |
|
- | 372 | db 'debug', 0 |
|
- | 373 | cfg_level: |
|
- | 374 | db 'level', 0 |
|
Line 339... | Line 375... | ||
339 | cfg_debug: |
375 | cfg_kobra: |
340 | db 'debug', 0 |
376 | db 'kobra', 0 |
341 | cfg_level: |
377 | cfg_use: |
342 | db 'level', 0 |
378 | db 'use', 0 |
Line 350... | Line 386... | ||
350 | debug_no: |
386 | debug_no: |
351 | db 'no', 0 |
387 | db 'no', 0 |
352 | debug_console: |
388 | debug_console: |
353 | db 'console', 0 |
389 | db 'console', 0 |
Line 354... | Line 390... | ||
354 | 390 | ||
355 | ; modes_nums: |
391 | ;; Empty string |
356 | ; debug_no_num: |
392 | empty_str: |
357 | ; db 1 |
393 | db 0 |
358 | ; |
394 | |
359 | ; debug_console_num: |
395 | kobra_group_launch_reactive: |
Line -... | Line 396... | ||
- | 396 | db 'launch_reactive', 0 |
|
- | 397 | ||
360 | ; db 2 |
398 | ;;-------------------------------------------------------------------------------------------------- |
361 | 399 | ;; Configuration options |
|
- | 400 | debug_level: |
|
- | 401 | db 0 |
|
- | 402 | ||
- | 403 | ; debug_kobra: |
|
- | 404 | ; db 0 |
|
- | 405 | ||
- | 406 | ;; debug option (bool) |
|
Line 362... | Line 407... | ||
362 | debug_level: |
407 | debug_option: |
363 | dd 0 |
408 | db 0 |
Line -... | Line 409... | ||
- | 409 | ||
- | 410 | kobra_use: |
|
- | 411 | db 0 |
|
- | 412 | ||
364 | 413 | ;;-------------------------------------------------------------------------------------------------- |
|
Line 365... | Line 414... | ||
365 | debug_kobra: |
414 | tid: |
366 | db 0 |
415 | dd 0 |
367 | 416 | ||
Line 378... | Line 427... | ||
378 | 427 | ||
379 | ;; Search path will be here |
428 | ;; Search path will be here |
380 | search_path: |
429 | search_path: |
Line 381... | Line -... | ||
381 | rb PATH_MAX_LEN |
- | |
382 | - | ||
383 | ;; debug option as number |
- | |
384 | debug_option: |
- | |
385 | dd 0 |
430 | rb PATH_MAX_LEN |
386 | 431 | ||
387 | ;; Buffer |
432 | ;; Buffer |
Line -... | Line 433... | ||
- | 433 | buff: |
|
- | 434 | rb BUFF_SIZE |
|
- | 435 | ||
- | 436 | another_buff: |
|
- | 437 | rb 0x1000 |
|
- | 438 | ||
388 | buff: |
439 | kobra_message: |
389 | rb BUFF_SIZE |
440 | rb 0x100 |
390 | 441 |