Rev 4602 | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 4602 | Rev 4613 | ||
---|---|---|---|
Line 3... | Line 3... | ||
3 | ; LAUNCHER - startup of programs |
3 | ; LAUNCHER - startup of programs |
4 | ; |
4 | ; |
5 | ; Compile with FASM 1.52 or newer |
5 | ; Compile with FASM 1.52 or newer |
6 | ; |
6 | ; |
7 | ;----------------------------------------------------------------------------- |
7 | ;----------------------------------------------------------------------------- |
- | 8 | ; last update: 06/03/2014 |
|
- | 9 | ; changed by: Marat Zakiyanov aka Mario79, aka Mario |
|
- | 10 | ; changes: Dynamic memory allocation for AUTORUN.DAT. |
|
- | 11 | ; Added additional diagnostic messages for BOARD. |
|
- | 12 | ;----------------------------------------------------------------------------- |
|
8 | ; last update: 02/03/2014 |
13 | ; last update: 02/03/2014 |
9 | ; changed by: Marat Zakiyanov aka Mario79, aka Mario |
14 | ; changed by: Marat Zakiyanov aka Mario79, aka Mario |
10 | ; changes: Reducing the consumption of RAM, 4 KB instead of 32 KB. |
15 | ; changes: Reducing the consumption of RAM, 4 KB instead of 32 KB. |
11 | ; Output to BOARD information about running applications. |
16 | ; Output to BOARD information about running applications. |
12 | ; Cleaning of the source code. |
17 | ; Cleaning of the source code. |
Line 28... | Line 33... | ||
28 | define __DEBUG__ 1 |
33 | define __DEBUG__ 1 |
29 | define __DEBUG_LEVEL__ 1 |
34 | define __DEBUG_LEVEL__ 1 |
30 | include "../../../debug-fdo.inc" |
35 | include "../../../debug-fdo.inc" |
31 | ;----------------------------------------------------------------------------- |
36 | ;----------------------------------------------------------------------------- |
32 | START: ; start of execution |
37 | START: ; start of execution |
- | 38 | mcall 68,11 |
|
- | 39 | mcall 70,autorun_dat_info ;get information AUTORUN.DAT |
|
- | 40 | test eax,eax |
|
- | 41 | jnz .read_error |
|
- | 42 | ||
- | 43 | mov ecx,[processinfo+32] |
|
- | 44 | test ecx,ecx |
|
- | 45 | jnz @f |
|
- | 46 | ||
- | 47 | inc ecx ; if file size zero |
|
- | 48 | ;-------------------------------------- |
|
- | 49 | @@: |
|
- | 50 | mov [autorun_dat_info.size],ecx |
|
- | 51 | mcall 68,12 |
|
- | 52 | mov [autorun_dat_info.address],eax |
|
- | 53 | mov ebp,eax |
|
- | 54 | mov [autorun_dat_info.mode],dword 0 |
|
33 | mcall 70,autorun_dat_info ; load AUTORUN.DAT |
55 | mcall 70,autorun_dat_info ;load AUTORUN.DAT |
- | 56 | test eax,eax |
|
- | 57 | jz @f |
|
- | 58 | .read_error: |
|
- | 59 | DEBUGF 1, "L: AUTORUN.DAT read error\n" |
|
- | 60 | jmp exit |
|
- | 61 | ;-------------------------------------- |
|
- | 62 | @@: |
|
34 | add ebx,file_data |
63 | add ebx,ebp |
35 | mov [fileend],ebx |
64 | mov [fileend],ebx |
36 | ;----------------------------------------------------------------------------- |
65 | ;----------------------------------------------------------------------------- |
37 | ; this cycle does not contain an obvious exit condition, |
66 | ; this cycle does not contain an obvious exit condition, |
38 | ; but auxiliary procedures (like "get_string") will exit |
67 | ; but auxiliary procedures (like "get_string") will exit |
39 | ; at EOF |
68 | ; at EOF |
Line 51... | Line 80... | ||
51 | ;-------------------------------------- |
80 | ;-------------------------------------- |
52 | skip_this_string: |
81 | skip_this_string: |
53 | call next_line |
82 | call next_line |
54 | jmp start_program |
83 | jmp start_program |
55 | ;----------------------------------------------------------------------------- |
84 | ;----------------------------------------------------------------------------- |
- | 85 | exit_1: |
|
- | 86 | DEBUGF 1, "L: AUTORUN.DAT processed\n" |
|
56 | exit: |
87 | exit: |
57 | or eax,-1 |
88 | or eax,-1 |
58 | mcall |
89 | mcall |
59 | ;----------------------------------------------------------------------------- |
90 | ;----------------------------------------------------------------------------- |
60 | run_program: ; time to delay in eax |
91 | run_program: ; time to delay in eax |
61 | DEBUGF 1, "Launch: %s Parameter: %s\n",program,parameters |
92 | DEBUGF 1, "L: %s Param: %s\n",program,parameters |
62 | push eax |
93 | push eax |
63 | mcall 70,start_info |
94 | mcall 70,start_info |
64 | pop ebx |
95 | pop ebx |
65 | ; if delay is negative, wait for termination |
96 | ; if delay is negative, wait for termination |
66 | ; of the spawned process |
97 | ; of the spawned process |
Line 108... | Line 139... | ||
108 | ;----------------------------------------------------------------------------- |
139 | ;----------------------------------------------------------------------------- |
109 | get_string: ; pointer to destination buffer in edi |
140 | get_string: ; pointer to destination buffer in edi |
110 | pushad |
141 | pushad |
111 | call skip_spaces |
142 | call skip_spaces |
112 | mov esi,[position] |
143 | mov esi,[position] |
113 | add esi,file_data |
144 | add esi,ebp |
114 | cmp [esi],byte '"' |
145 | cmp [esi],byte '"' |
115 | jz .quoted |
146 | jz .quoted |
116 | ;-------------------------------------- |
147 | ;-------------------------------------- |
117 | .start: |
148 | .start: |
118 | cmp esi,[fileend] |
149 | cmp esi,[fileend] |
Line 148... | Line 179... | ||
148 | ;----------------------------------------------------------------------------- |
179 | ;----------------------------------------------------------------------------- |
149 | get_number: |
180 | get_number: |
150 | push ebx esi |
181 | push ebx esi |
151 | call skip_spaces |
182 | call skip_spaces |
152 | mov esi,[position] |
183 | mov esi,[position] |
153 | add esi,file_data |
184 | add esi,ebp |
154 | xor eax,eax |
185 | xor eax,eax |
155 | cmp [esi],byte '-' |
186 | cmp [esi],byte '-' |
156 | jnz @f |
187 | jnz @f |
Line 157... | Line 188... | ||
157 | 188 | ||
Line 192... | Line 223... | ||
192 | ;----------------------------------------------------------------------------- |
223 | ;----------------------------------------------------------------------------- |
193 | skip_spaces: |
224 | skip_spaces: |
194 | push esi |
225 | push esi |
195 | xor eax,eax |
226 | xor eax,eax |
196 | mov esi,[position] |
227 | mov esi,[position] |
197 | add esi,file_data |
228 | add esi,ebp |
198 | ;-------------------------------------- |
229 | ;-------------------------------------- |
199 | .start: |
230 | .start: |
200 | cmp esi,[fileend] |
231 | cmp esi,[fileend] |
201 | jae .finish |
232 | jae .finish |
Line 211... | Line 242... | ||
211 | pop esi |
242 | pop esi |
212 | ret |
243 | ret |
213 | ;----------------------------------------------------------------------------- |
244 | ;----------------------------------------------------------------------------- |
214 | next_line: |
245 | next_line: |
215 | mov esi,[position] |
246 | mov esi,[position] |
216 | add esi,file_data |
247 | add esi,ebp |
217 | ;-------------------------------------- |
248 | ;-------------------------------------- |
218 | .start: |
249 | .start: |
219 | cmp esi,[fileend] |
250 | cmp esi,[fileend] |
220 | jae exit |
251 | jae exit_1 |
Line 221... | Line 252... | ||
221 | 252 | ||
222 | lodsb |
253 | lodsb |
223 | cmp al,13 |
254 | cmp al,13 |
Line 230... | Line 261... | ||
230 | jmp .start |
261 | jmp .start |
231 | ;-------------------------------------- |
262 | ;-------------------------------------- |
232 | .finish: |
263 | .finish: |
233 | inc dword [position] |
264 | inc dword [position] |
234 | cmp esi,[fileend] |
265 | cmp esi,[fileend] |
235 | jae exit |
266 | jae exit_1 |
Line 236... | Line 267... | ||
236 | 267 | ||
237 | lodsb |
268 | lodsb |
238 | cmp al,13 |
269 | cmp al,13 |
Line 246... | Line 277... | ||
246 | ; DATA: |
277 | ; DATA: |
247 | ;----------------------------------------------------------------------------- |
278 | ;----------------------------------------------------------------------------- |
248 | include_debug_strings |
279 | include_debug_strings |
249 | ;----------------------------------------------------------------------------- |
280 | ;----------------------------------------------------------------------------- |
250 | autorun_dat_info: ; AUTORUN.DAT |
281 | autorun_dat_info: ; AUTORUN.DAT |
251 | .mode dd 0 ; read file |
282 | .mode dd 5 ; get information or read file |
252 | .start_block dd 0 ; block to read |
283 | .start dd 0 |
253 | dd 0 |
284 | .params dd 0 |
254 | .blocks dd 4*512 ; 2 Kb max for AUTORUN.DAT |
285 | .size dd 0 |
255 | .address dd file_data |
286 | .address dd processinfo |
256 | db "/SYS/SETTINGS/AUTORUN.DAT",0 |
287 | db "/SYS/SETTINGS/AUTORUN.DAT",0 |
257 | ;----------------------------------------------------------------------------- |
288 | ;----------------------------------------------------------------------------- |
258 | start_info: |
289 | start_info: |
259 | .mode dd 7 |
290 | .mode dd 7 |
260 | dd 0 |
291 | .flags dd 0 |
261 | .params dd parameters |
292 | .params dd parameters |
262 | dd 0 |
293 | dd 0 |
263 | dd 0 |
294 | dd 0 |
264 | .path: |
295 | db 0 |
- | 296 | .path dd program |
|
265 | ;----------------------------------------------------------------------------- |
297 | ;----------------------------------------------------------------------------- |
266 | IM_END: |
298 | IM_END: |
267 | ;----------------------------------------------------------------------------- |
299 | ;----------------------------------------------------------------------------- |
268 | align 4 |
300 | align 4 |
269 | processinfo: |
301 | processinfo: |
Line 281... | Line 313... | ||
281 | ;----------------------------------------------------------------------------- |
313 | ;----------------------------------------------------------------------------- |
282 | fileend: |
314 | fileend: |
283 | rd 1 |
315 | rd 1 |
284 | ;----------------------------------------------------------------------------- |
316 | ;----------------------------------------------------------------------------- |
285 | align 4 |
317 | align 4 |
286 | file_data: |
- | |
287 | rb 4*512 ; 2 Kb for AUTORUN.DAT |
- | |
288 | ;----------------------------------------------------------------------------- |
- | |
289 | align 4 |
- | |
290 | rb 256 |
318 | rb 256 |
291 | stack_top: |
319 | stack_top: |
292 | ;----------------------------------------------------------------------------- |
320 | ;----------------------------------------------------------------------------- |
293 | I_END: |
321 | I_END: |
294 | ;----------------------------------------------------------------------------- |
322 | ;----------------------------------------------------------------------------- |