Rev 5925 | Rev 6592 | Go to most recent revision | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 5925 | Rev 6162 | ||
---|---|---|---|
1 | ;------------------------------------------------------------------------------ |
1 | ;------------------------------------------------------------------------------ |
2 | ; DEBUG BOARD for APPLICATIONS and KERNEL DEVELOPMENT |
2 | ; DEBUG BOARD for APPLICATIONS and KERNEL DEVELOPMENT |
3 | ; See f63 |
3 | ; See f63 |
4 | ; Compile with FASM for KolibriOS |
4 | ; Compile with FASM for KolibriOS |
5 | ;------------------------------------------------------------------------------ |
5 | ;------------------------------------------------------------------------------ |
6 | use32 |
6 | use32 |
7 | org 0 |
7 | org 0 |
8 | db 'MENUET01' |
8 | db 'MENUET01' |
9 | dd 1 |
9 | dd 1 |
10 | dd START |
10 | dd START |
11 | dd I_END |
11 | dd I_END |
12 | dd mem |
12 | dd mem |
13 | dd mem |
13 | dd mem |
14 | dd filename |
14 | dd filename |
15 | dd 0 |
15 | dd 0 |
16 | ;------------------------------------------------------------------------------ |
16 | ;------------------------------------------------------------------------------ |
17 | include 'lang.inc' |
17 | include 'lang.inc' |
18 | include '../../../macros.inc' |
18 | include '../../../macros.inc' |
19 | include '../../../debug.inc' |
19 | include '../../../debug.inc' |
20 | purge newline |
20 | purge newline |
21 | MAXSTRINGS = 45 |
21 | MAXSTRINGS = 45 |
22 | ;------------------------------------------------------------------------------ |
22 | ;------------------------------------------------------------------------------ |
23 | START: |
23 | START: |
24 | call CheckUnique |
24 | call CheckUnique |
25 | mov edi, filename |
25 | mov edi, filename |
26 | cmp [edi], byte 0 |
26 | cmp [edi], byte 0 |
27 | jnz param |
27 | jnz param |
28 | mov esi, default_filename |
28 | mov esi, default_filename |
29 | @@: |
29 | @@: |
30 | lodsb |
30 | lodsb |
31 | stosb |
31 | stosb |
32 | test al,al |
32 | test al,al |
33 | jnz @b |
33 | jnz @b |
34 | param: |
34 | param: |
35 | mov ecx, (MAXSTRINGS+1)*20 |
35 | mov ecx, (MAXSTRINGS+1)*20 |
36 | mov edi, text1 |
36 | mov edi, text1 |
37 | mov eax, ' ' |
37 | mov eax, ' ' |
38 | rep stosd |
38 | rep stosd |
39 | 39 | ||
40 | mov ecx, (MAXSTRINGS+1)*20 |
40 | mov ecx, (MAXSTRINGS+1)*20 |
41 | mov edi, text2 |
41 | mov edi, text2 |
42 | rep stosd |
42 | rep stosd |
43 | 43 | ||
44 | mov byte [tmp1], 'x' |
44 | mov byte [tmp1], 'x' |
45 | mov byte [tmp2], 'x' |
45 | mov byte [tmp2], 'x' |
46 | 46 | ||
47 | mcall 14 |
47 | mcall 14 |
48 | and eax, 0xffff0000 |
48 | and eax, 0xffff0000 |
49 | sub eax, 399 shl 16 |
49 | sub eax, 399 shl 16 |
50 | add eax, 399 |
50 | add eax, 399 |
51 | mov [xstart], eax |
51 | mov [xstart], eax |
52 | mcall 48, 3, sc, sizeof.sys_colors_new |
52 | mcall 48, 3, sc, sizeof.system_colors |
53 | 53 | ||
54 | mov esi, filename |
54 | mov esi, filename |
55 | call CreateFile |
55 | call CreateFile |
56 | ;------------------------------------------------------------------------------ |
56 | ;------------------------------------------------------------------------------ |
57 | red: |
57 | red: |
58 | call draw_window |
58 | call draw_window |
59 | ;------------------------------------------------------------------------------ |
59 | ;------------------------------------------------------------------------------ |
60 | still: |
60 | still: |
61 | cmp [buffer_length], 0 |
61 | cmp [buffer_length], 0 |
62 | je @f |
62 | je @f |
63 | call write_buffer |
63 | call write_buffer |
64 | @@: |
64 | @@: |
65 | mcall 23, 50 ; wait here for event |
65 | mcall 23, 50 ; wait here for event |
66 | cmp eax, 1 ; redraw request ? |
66 | cmp eax, 1 ; redraw request ? |
67 | je red |
67 | je red |
68 | 68 | ||
69 | cmp eax, 2 ; key in buffer ? |
69 | cmp eax, 2 ; key in buffer ? |
70 | je key |
70 | je key |
71 | 71 | ||
72 | cmp eax, 3 ; button in buffer ? |
72 | cmp eax, 3 ; button in buffer ? |
73 | je button |
73 | je button |
74 | 74 | ||
75 | mcall 63, 2 |
75 | mcall 63, 2 |
76 | cmp ebx, 1 |
76 | cmp ebx, 1 |
77 | jne still |
77 | jne still |
78 | 78 | ||
79 | new_data: |
79 | new_data: |
80 | cmp [buffer_length], 255 |
80 | cmp [buffer_length], 255 |
81 | jne @f |
81 | jne @f |
82 | call write_buffer |
82 | call write_buffer |
83 | @@: |
83 | @@: |
84 | movzx ebx, byte[buffer_length] |
84 | movzx ebx, byte[buffer_length] |
85 | mov [ebx+tmp], al |
85 | mov [ebx+tmp], al |
86 | inc [buffer_length] |
86 | inc [buffer_length] |
87 | mov ebp, [targ] |
87 | mov ebp, [targ] |
88 | cmp al, 10 |
88 | cmp al, 10 |
89 | jz new_line |
89 | jz new_line |
90 | cmp al, 13 |
90 | cmp al, 13 |
91 | jz new_check |
91 | jz new_check |
92 | jmp char |
92 | jmp char |
93 | ;------------------------------------------ |
93 | ;------------------------------------------ |
94 | write_buffer: |
94 | write_buffer: |
95 | pusha |
95 | pusha |
96 | mov edx, tmp |
96 | mov edx, tmp |
97 | movzx ecx, byte[buffer_length] |
97 | movzx ecx, byte[buffer_length] |
98 | mov esi, filename |
98 | mov esi, filename |
99 | .write_to_logfile: |
99 | .write_to_logfile: |
100 | call WriteToFile |
100 | call WriteToFile |
101 | cmp eax, 5 |
101 | cmp eax, 5 |
102 | jne @f |
102 | jne @f |
103 | mov esi, filename |
103 | mov esi, filename |
104 | mov [filepos], 0 |
104 | mov [filepos], 0 |
105 | call CreateFile |
105 | call CreateFile |
106 | jnc .write_to_logfile |
106 | jnc .write_to_logfile |
107 | @@: |
107 | @@: |
108 | movzx eax,byte[buffer_length] |
108 | movzx eax,byte[buffer_length] |
109 | add [filepos],eax |
109 | add [filepos],eax |
110 | xor eax,eax |
110 | xor eax,eax |
111 | mov [buffer_length],al |
111 | mov [buffer_length],al |
112 | popa |
112 | popa |
113 | ret |
113 | ret |
114 | ;------------------------------------------ |
114 | ;------------------------------------------ |
115 | new_line: |
115 | new_line: |
116 | and [ebp-8], dword 0 |
116 | and [ebp-8], dword 0 |
117 | inc dword [ebp-4] |
117 | inc dword [ebp-4] |
118 | cmp [ebp-4], dword MAXSTRINGS |
118 | cmp [ebp-4], dword MAXSTRINGS |
119 | jbe .noypos |
119 | jbe .noypos |
120 | mov [ebp-4], dword MAXSTRINGS |
120 | mov [ebp-4], dword MAXSTRINGS |
121 | lea esi, [ebp+80] |
121 | lea esi, [ebp+80] |
122 | mov edi, ebp |
122 | mov edi, ebp |
123 | mov ecx, 20*(MAXSTRINGS) |
123 | mov ecx, 20*(MAXSTRINGS) |
124 | cld |
124 | cld |
125 | rep movsd |
125 | rep movsd |
126 | 126 | ||
127 | mov esi, [ebp-4] |
127 | mov esi, [ebp-4] |
128 | imul esi, 80 |
128 | imul esi, 80 |
129 | add esi, [ebp-8] |
129 | add esi, [ebp-8] |
130 | add esi, ebp |
130 | add esi, ebp |
131 | mov ecx, 20 |
131 | mov ecx, 20 |
132 | mov eax, ' ' |
132 | mov eax, ' ' |
133 | rep stosd |
133 | rep stosd |
134 | .noypos: |
134 | .noypos: |
135 | mov [targ],text2 |
135 | mov [targ],text2 |
136 | and [krnl_cnt],0 |
136 | and [krnl_cnt],0 |
137 | jmp new_check |
137 | jmp new_check |
138 | ;------------------------------------------ |
138 | ;------------------------------------------ |
139 | char: |
139 | char: |
140 | cmp ebp, text1 |
140 | cmp ebp, text1 |
141 | je add2 |
141 | je add2 |
142 | mov ecx, [krnl_cnt] |
142 | mov ecx, [krnl_cnt] |
143 | cmp al, [krnl_msg+ecx] |
143 | cmp al, [krnl_msg+ecx] |
144 | jne .noknl |
144 | jne .noknl |
145 | inc [krnl_cnt] |
145 | inc [krnl_cnt] |
146 | cmp [krnl_cnt], 4 |
146 | cmp [krnl_cnt], 4 |
147 | jne new_check |
147 | jne new_check |
148 | mov [targ], text1 |
148 | mov [targ], text1 |
149 | .noknl: |
149 | .noknl: |
150 | mov ebp, [targ] |
150 | mov ebp, [targ] |
151 | jecxz .add |
151 | jecxz .add |
152 | push eax |
152 | push eax |
153 | mov esi, krnl_msg |
153 | mov esi, krnl_msg |
154 | .l1: |
154 | .l1: |
155 | lodsb |
155 | lodsb |
156 | call add_char |
156 | call add_char |
157 | loop .l1 |
157 | loop .l1 |
158 | pop eax |
158 | pop eax |
159 | .add: |
159 | .add: |
160 | and [krnl_cnt], 0 |
160 | and [krnl_cnt], 0 |
161 | add2: |
161 | add2: |
162 | call add_char |
162 | call add_char |
163 | 163 | ||
164 | new_check: |
164 | new_check: |
165 | mcall 63, 2 |
165 | mcall 63, 2 |
166 | cmp ebx, 1 |
166 | cmp ebx, 1 |
167 | je new_data |
167 | je new_data |
168 | call draw_text |
168 | call draw_text |
169 | jmp still |
169 | jmp still |
170 | ;------------------------------------------------------------------------------ |
170 | ;------------------------------------------------------------------------------ |
171 | key: |
171 | key: |
172 | mcall 2 |
172 | mcall 2 |
173 | cmp ah, ' ' |
173 | cmp ah, ' ' |
174 | je button.noclose |
174 | je button.noclose |
175 | jmp still |
175 | jmp still |
176 | ;------------------------------------------------------------------------------ |
176 | ;------------------------------------------------------------------------------ |
177 | button: |
177 | button: |
178 | mcall 17 ; get id |
178 | mcall 17 ; get id |
179 | cmp ah, 1 ; button id=1 ? |
179 | cmp ah, 1 ; button id=1 ? |
180 | jne .noclose |
180 | jne .noclose |
181 | or eax, -1 ; close this program |
181 | or eax, -1 ; close this program |
182 | mcall |
182 | mcall |
183 | .noclose: |
183 | .noclose: |
184 | xor [vmode], 1 |
184 | xor [vmode], 1 |
185 | jmp red |
185 | jmp red |
186 | ;------------------------------------------------------------------------------ |
186 | ;------------------------------------------------------------------------------ |
187 | add_char: |
187 | add_char: |
188 | push esi |
188 | push esi |
189 | mov esi, [ebp-4] |
189 | mov esi, [ebp-4] |
190 | imul esi, 80 |
190 | imul esi, 80 |
191 | add esi, [ebp-8] |
191 | add esi, [ebp-8] |
192 | mov [ebp+esi], al |
192 | mov [ebp+esi], al |
193 | inc dword[ebp-8] |
193 | inc dword[ebp-8] |
194 | cmp dword[ebp-8], 80 |
194 | cmp dword[ebp-8], 80 |
195 | jb .ok |
195 | jb .ok |
196 | mov dword[ebp-8], 79 |
196 | mov dword[ebp-8], 79 |
197 | .ok: |
197 | .ok: |
198 | pop esi |
198 | pop esi |
199 | ret |
199 | ret |
200 | 200 | ||
201 | ;------------------------------------------------------------------------------ |
201 | ;------------------------------------------------------------------------------ |
202 | ;************************ WINDOW DEFINITIONS AND DRAW ************************ |
202 | ;************************ WINDOW DEFINITIONS AND DRAW ************************ |
203 | ;------------------------------------------------------------------------------ |
203 | ;------------------------------------------------------------------------------ |
204 | draw_window: |
204 | draw_window: |
205 | mcall 12, 1 ; 1, start of draw |
205 | mcall 12, 1 ; 1, start of draw |
206 | mcall 48, 5 ; GetClientTop |
206 | mcall 48, 5 ; GetClientTop |
207 | shr ebx, 16 |
207 | shr ebx, 16 |
208 | mov ecx, ebx |
208 | mov ecx, ebx |
209 | shl ecx, 16 |
209 | shl ecx, 16 |
210 | add ecx, MAXSTRINGS*10+45 ; [y start] *65536 + [y size] |
210 | add ecx, MAXSTRINGS*10+45 ; [y start] *65536 + [y size] |
211 | xor eax, eax ; function 0 : define and draw window |
211 | xor eax, eax ; function 0 : define and draw window |
212 | mov edx, 0xffffff |
212 | mov edx, 0xffffff |
213 | or edx, 0x14000000 |
213 | or edx, 0x14000000 |
214 | xor esi, esi |
214 | xor esi, esi |
215 | mcall ,[xstart],,,,title |
215 | mcall ,[xstart],,,,title |
216 | mov ebx, 296 shl 16+31 |
216 | mov ebx, 296 shl 16+31 |
217 | mcall 8,,<4,13>,3,[sc.btn_face] |
217 | mcall 8,,<4,13>,3,[sc.work_button] |
218 | mov edx, [vmode] |
218 | mov edx, [vmode] |
219 | lea edx, [edx*4+duk] |
219 | lea edx, [edx*4+duk] |
220 | mov ecx, 0x80 |
220 | mov ecx, 0x80 |
221 | shr ecx, 24 |
221 | shr ecx, 24 |
222 | add ecx, [sc.btn_text] |
222 | add ecx, [sc.work_button_text] |
223 | mcall 4,<300,7>,,,4 |
223 | mcall 4,<300,7>,,,4 |
224 | call draw_text |
224 | call draw_text |
225 | mcall 12, 2 ; 2, end of draw |
225 | mcall 12, 2 ; 2, end of draw |
226 | ret |
226 | ret |
227 | ;------------------------------------------------------------------------------ |
227 | ;------------------------------------------------------------------------------ |
228 | draw_text: |
228 | draw_text: |
229 | mov ebx, 15*65536+30 ; draw info text with function 4 |
229 | mov ebx, 15*65536+30 ; draw info text with function 4 |
230 | xor ecx, ecx |
230 | xor ecx, ecx |
231 | or ecx, 0x40000000 |
231 | or ecx, 0x40000000 |
232 | mov edi, 0xffffff |
232 | mov edi, 0xffffff |
233 | mov edx, text1 |
233 | mov edx, text1 |
234 | cmp [vmode], 0 |
234 | cmp [vmode], 0 |
235 | je .kern |
235 | je .kern |
236 | mov edx, text2 |
236 | mov edx, text2 |
237 | .kern: |
237 | .kern: |
238 | push ebx ecx edx |
238 | push ebx ecx edx |
239 | mcall 9, procinfo,-1 |
239 | mcall 9, procinfo,-1 |
240 | mov eax, [ebx+42] |
240 | mov eax, [ebx+42] |
241 | xor edx, edx |
241 | xor edx, edx |
242 | mov ebx, 6 |
242 | mov ebx, 6 |
243 | div ebx |
243 | div ebx |
244 | pop edx ecx ebx |
244 | pop edx ecx ebx |
245 | mov esi, 80 |
245 | mov esi, 80 |
246 | cmp eax, esi |
246 | cmp eax, esi |
247 | ja @f |
247 | ja @f |
248 | mov esi, eax |
248 | mov esi, eax |
249 | @@: |
249 | @@: |
250 | cmp esi, 5 |
250 | cmp esi, 5 |
251 | ja @f |
251 | ja @f |
252 | mov esi, 5 |
252 | mov esi, 5 |
253 | @@: |
253 | @@: |
254 | sub esi, 4 |
254 | sub esi, 4 |
255 | mov eax, 4 |
255 | mov eax, 4 |
256 | newline: |
256 | newline: |
257 | mcall |
257 | mcall |
258 | add ebx, 10 |
258 | add ebx, 10 |
259 | add edx, 80 |
259 | add edx, 80 |
260 | cmp [edx], byte 'x' |
260 | cmp [edx], byte 'x' |
261 | jne newline |
261 | jne newline |
262 | ret |
262 | ret |
263 | 263 | ||
264 | ;------------------------------------------------------------------------------ |
264 | ;------------------------------------------------------------------------------ |
265 | ;* input: esi = pointer to the file name * |
265 | ;* input: esi = pointer to the file name * |
266 | ;------------------------------------------------------------------------------ |
266 | ;------------------------------------------------------------------------------ |
267 | CreateFile: |
267 | CreateFile: |
268 | pusha |
268 | pusha |
269 | mov dword [InfoStructure+00], 2 ; create file |
269 | mov dword [InfoStructure+00], 2 ; create file |
270 | mov dword [InfoStructure+04], 0 ; reserved |
270 | mov dword [InfoStructure+04], 0 ; reserved |
271 | mov dword [InfoStructure+08], 0 ; reserved |
271 | mov dword [InfoStructure+08], 0 ; reserved |
272 | mov dword [InfoStructure+12], 0 ; 0 bytes to write (just create) |
272 | mov dword [InfoStructure+12], 0 ; 0 bytes to write (just create) |
273 | mov dword [InfoStructure+16], 0 ; NULL data pointer (no data) |
273 | mov dword [InfoStructure+16], 0 ; NULL data pointer (no data) |
274 | mov dword [InfoStructure+20], 0 ; reserved |
274 | mov dword [InfoStructure+20], 0 ; reserved |
275 | mov dword [InfoStructure+21], esi ; pointer to the file name |
275 | mov dword [InfoStructure+21], esi ; pointer to the file name |
276 | mcall 70, InfoStructure |
276 | mcall 70, InfoStructure |
277 | test eax, eax |
277 | test eax, eax |
278 | jz .out |
278 | jz .out |
279 | stc |
279 | stc |
280 | .out: |
280 | .out: |
281 | popa |
281 | popa |
282 | ret |
282 | ret |
283 | ;------------------------------------------------------------------------------ |
283 | ;------------------------------------------------------------------------------ |
284 | ;* input: esi = pointer to the file name * |
284 | ;* input: esi = pointer to the file name * |
285 | ;* edx = pointer to data buffer * |
285 | ;* edx = pointer to data buffer * |
286 | ;* ecx = data length * |
286 | ;* ecx = data length * |
287 | ;------------------------------------------------------------------------------ |
287 | ;------------------------------------------------------------------------------ |
288 | WriteToFile: |
288 | WriteToFile: |
289 | push ebx |
289 | push ebx |
290 | mov dword [InfoStructure+00], 3 ; write to file |
290 | mov dword [InfoStructure+00], 3 ; write to file |
291 | mov eax, [filepos] |
291 | mov eax, [filepos] |
292 | mov dword [InfoStructure+04], eax ; lower position addr |
292 | mov dword [InfoStructure+04], eax ; lower position addr |
293 | mov dword [InfoStructure+08], 0 ; upper position addr (0 for FAT) |
293 | mov dword [InfoStructure+08], 0 ; upper position addr (0 for FAT) |
294 | mov dword [InfoStructure+12], ecx ; number of bytes to write |
294 | mov dword [InfoStructure+12], ecx ; number of bytes to write |
295 | mov dword [InfoStructure+16], edx ; pointer to data buffer |
295 | mov dword [InfoStructure+16], edx ; pointer to data buffer |
296 | mov dword [InfoStructure+20], 0 ; reserved |
296 | mov dword [InfoStructure+20], 0 ; reserved |
297 | mov dword [InfoStructure+21], esi ; pointer to the file name |
297 | mov dword [InfoStructure+21], esi ; pointer to the file name |
298 | mcall 70, InfoStructure |
298 | mcall 70, InfoStructure |
299 | clc |
299 | clc |
300 | test eax, eax |
300 | test eax, eax |
301 | jz .out |
301 | jz .out |
302 | stc |
302 | stc |
303 | .out: |
303 | .out: |
304 | pop ebx |
304 | pop ebx |
305 | ret |
305 | ret |
306 | 306 | ||
307 | ;------------------------------------------------------------------------------ |
307 | ;------------------------------------------------------------------------------ |
308 | ;* input: esi = pointer to string * |
308 | ;* input: esi = pointer to string * |
309 | ;* edi = pointer to string * |
309 | ;* edi = pointer to string * |
310 | ;* ecx = data length * |
310 | ;* ecx = data length * |
311 | ;------------------------------------------------------------------------------ |
311 | ;------------------------------------------------------------------------------ |
312 | StrCmp: |
312 | StrCmp: |
313 | repe cmpsb |
313 | repe cmpsb |
314 | ja .a_greater_b |
314 | ja .a_greater_b |
315 | jb .a_less_b |
315 | jb .a_less_b |
316 | .equal: |
316 | .equal: |
317 | mov eax, 0 |
317 | mov eax, 0 |
318 | jmp .end |
318 | jmp .end |
319 | .a_less_b: |
319 | .a_less_b: |
320 | mov eax, 1 |
320 | mov eax, 1 |
321 | jmp .end |
321 | jmp .end |
322 | .a_greater_b: |
322 | .a_greater_b: |
323 | mov eax, -1 |
323 | mov eax, -1 |
324 | .end: |
324 | .end: |
325 | ret |
325 | ret |
326 | 326 | ||
327 | ;------------------------------------------------------------------------------ |
327 | ;------------------------------------------------------------------------------ |
328 | ;* input: edi = pointer to string * |
328 | ;* input: edi = pointer to string * |
329 | ;* ecx = data length * |
329 | ;* ecx = data length * |
330 | ;------------------------------------------------------------------------------ |
330 | ;------------------------------------------------------------------------------ |
331 | ; 'a' - 'A' = 32 -> 'A'|32 = 'a' |
331 | ; 'a' - 'A' = 32 -> 'A'|32 = 'a' |
332 | ToLower: |
332 | ToLower: |
333 | xor eax, eax |
333 | xor eax, eax |
334 | .cycle: |
334 | .cycle: |
335 | or byte[edi+eax], 32 |
335 | or byte[edi+eax], 32 |
336 | inc eax |
336 | inc eax |
337 | loop .cycle |
337 | loop .cycle |
338 | .end: |
338 | .end: |
339 | ret |
339 | ret |
340 | 340 | ||
341 | ;------------------------------------------------------------------------------ |
341 | ;------------------------------------------------------------------------------ |
342 | ;* get info on current thread, save pid/tid |
342 | ;* get info on current thread, save pid/tid |
343 | ;* look for another process with same name and different pid/tid |
343 | ;* look for another process with same name and different pid/tid |
344 | ;* if found, close self |
344 | ;* if found, close self |
345 | ;* else continue normally |
345 | ;* else continue normally |
346 | ;------------------------------------------------------------------------------ |
346 | ;------------------------------------------------------------------------------ |
347 | CheckUnique: |
347 | CheckUnique: |
348 | .get_thread_info: |
348 | .get_thread_info: |
349 | mov ebx, procinfo |
349 | mov ebx, procinfo |
350 | mov ecx, -1 |
350 | mov ecx, -1 |
351 | mcall 9 |
351 | mcall 9 |
352 | 352 | ||
353 | .get_pid: ; check_buffer |
353 | .get_pid: ; check_buffer |
354 | mov [process_count], eax |
354 | mov [process_count], eax |
355 | mov eax, [ebx+process_information.PID] |
355 | mov eax, [ebx+process_information.PID] |
356 | mov [pid_tid], eax |
356 | mov [pid_tid], eax |
357 | mov ecx, 2 |
357 | mov ecx, 2 |
358 | 358 | ||
359 | .check_threads: |
359 | .check_threads: |
360 | cmp ecx, [process_count] |
360 | cmp ecx, [process_count] |
361 | ja .leave_check |
361 | ja .leave_check |
362 | mov eax, 9 |
362 | mov eax, 9 |
363 | mcall |
363 | mcall |
364 | 364 | ||
365 | .check_slot_free: |
365 | .check_slot_free: |
366 | cmp dword [ebx+process_information.slot_state], 9 |
366 | cmp dword [ebx+process_information.slot_state], 9 |
367 | je .next_thread |
367 | je .next_thread |
368 | 368 | ||
369 | .check_pid: |
369 | .check_pid: |
370 | mov eax, [pid_tid] |
370 | mov eax, [pid_tid] |
371 | cmp [ebx+process_information.PID], eax |
371 | cmp [ebx+process_information.PID], eax |
372 | je .next_thread |
372 | je .next_thread |
373 | 373 | ||
374 | .get_proc_name: |
374 | .get_proc_name: |
375 | lea edi, [ebx+process_information.process_name] |
375 | lea edi, [ebx+process_information.process_name] |
376 | push ecx |
376 | push ecx |
377 | mov ecx, my_name_size-1 |
377 | mov ecx, my_name_size-1 |
378 | 378 | ||
379 | .lower_case: |
379 | .lower_case: |
380 | call ToLower |
380 | call ToLower |
381 | lea esi, [my_name] |
381 | lea esi, [my_name] |
382 | mov ecx, my_name_size |
382 | mov ecx, my_name_size |
383 | call StrCmp |
383 | call StrCmp |
384 | pop ecx |
384 | pop ecx |
385 | cmp eax, 0 |
385 | cmp eax, 0 |
386 | je .close_program |
386 | je .close_program |
387 | 387 | ||
388 | .next_thread: |
388 | .next_thread: |
389 | inc ecx |
389 | inc ecx |
390 | jmp .check_threads |
390 | jmp .check_threads |
391 | 391 | ||
392 | .close_program: |
392 | .close_program: |
393 | ; restore and active window of previous thread |
393 | ; restore and active window of previous thread |
394 | mcall 18, 3 |
394 | mcall 18, 3 |
395 | mov eax, -1 |
395 | mov eax, -1 |
396 | mcall |
396 | mcall |
397 | 397 | ||
398 | .leave_check: |
398 | .leave_check: |
399 | ret |
399 | ret |
400 | 400 | ||
401 | ;------------------------------------------------------------------------------ |
401 | ;------------------------------------------------------------------------------ |
402 | ; DATA |
402 | ; DATA |
403 | 403 | ||
404 | if lang eq ru |
404 | if lang eq ru |
405 | title db '®áª ®â« ¤ª¨ ¨ á®®¡é¥¨©',0 |
405 | title db '®áª ®â« ¤ª¨ ¨ á®®¡é¥¨©',0 |
406 | else if lang eq it |
406 | else if lang eq it |
407 | title db 'Notifiche e informazioni generiche per il debug',0 |
407 | title db 'Notifiche e informazioni generiche per il debug',0 |
408 | else if lang eq ge |
408 | else if lang eq ge |
409 | title db 'Allgemeines debug- & nachrichtenboard',0 |
409 | title db 'Allgemeines debug- & nachrichtenboard',0 |
410 | else |
410 | else |
411 | title db 'General debug & message board',0 |
411 | title db 'General debug & message board',0 |
412 | end if |
412 | end if |
413 | 413 | ||
414 | default_filename db '/sys/boardlog.txt',0 |
414 | default_filename db '/sys/boardlog.txt',0 |
415 | krnl_msg db 'K : ' |
415 | krnl_msg db 'K : ' |
416 | duk db 'KernUser' |
416 | duk db 'KernUser' |
417 | my_name db 'board',0 |
417 | my_name db 'board',0 |
418 | my_name_size = $-my_name |
418 | my_name_size = $-my_name |
419 | 419 | ||
420 | align 4 |
420 | align 4 |
421 | vmode dd 1 |
421 | vmode dd 1 |
422 | targ dd text2 |
422 | targ dd text2 |
423 | 423 | ||
424 | I_END: |
424 | I_END: |
425 | 425 | ||
426 | InfoStructure: |
426 | InfoStructure: |
427 | dd ? ; subfunction number |
427 | dd ? ; subfunction number |
428 | dd ? ; position in the file in bytes |
428 | dd ? ; position in the file in bytes |
429 | dd ? ; upper part of the position address |
429 | dd ? ; upper part of the position address |
430 | dd ? ; number of bytes to read |
430 | dd ? ; number of bytes to read |
431 | dd ? ; pointer to the buffer to write data |
431 | dd ? ; pointer to the buffer to write data |
432 | db ? |
432 | db ? |
433 | dd ? ; pointer to the filename |
433 | dd ? ; pointer to the filename |
434 | 434 | ||
435 | buffer_length rb 3 |
435 | buffer_length rb 3 |
436 | process_count dd ? |
436 | process_count dd ? |
437 | krnl_cnt dd ? |
437 | krnl_cnt dd ? |
438 | pid_tid dd ? |
438 | pid_tid dd ? |
439 | filepos dd ? |
439 | filepos dd ? |
440 | xstart dd ? |
440 | xstart dd ? |
441 | sc sys_colors_new |
441 | sc system_colors |
442 | 442 | ||
443 | rd 2 |
443 | rd 2 |
444 | text1 rb 80*(MAXSTRINGS+1) |
444 | text1 rb 80*(MAXSTRINGS+1) |
445 | tmp1 dd ? |
445 | tmp1 dd ? |
446 | 446 | ||
447 | rd 2 |
447 | rd 2 |
448 | text2 rb 80*(MAXSTRINGS+1) |
448 | text2 rb 80*(MAXSTRINGS+1) |
449 | tmp2 dd ? |
449 | tmp2 dd ? |
450 | 450 | ||
451 | tmp rb 256 |
451 | tmp rb 256 |
452 | filename rb 256 |
452 | filename rb 256 |
453 | procinfo rb 1024 |
453 | procinfo rb 1024 |
454 | stackbuf rb 2000h |
454 | stackbuf rb 2000h |
455 | mem:300,7>4,13> |
455 | mem:300,7>4,13> |