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