Subversion Repositories Kolibri OS

Rev

Rev 5837 | Rev 6162 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 5837 Rev 5925
Line 1... Line 1...
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
include 'lang.inc'
-
 
7
WRITE_LOG    equ 1
-
 
8
P_LEN        equ 11
-
 
9
;------------------------------------------------------------------------------
-
 
10
        use32
6
use32
11
        org     0x0
7
org 0
12
        db      'MENUET01'
8
        db      'MENUET01'
13
        dd      0x01
9
        dd      1
14
        dd      START
10
        dd      START
15
        dd      I_END
11
        dd      I_END
16
        dd      mem
12
        dd      mem
17
        dd      mem
13
        dd      mem
18
        dd     filename, 0x0
14
        dd      filename
-
 
15
        dd      0
19
;------------------------------------------------------------------------------
16
;------------------------------------------------------------------------------
-
 
17
include 'lang.inc'
20
include '../../../macros.inc'
18
include '../../../macros.inc'
21
include '../../../debug.inc'
19
include '../../../debug.inc'
22
purge       newline
20
purge   newline
23
MAXSTRINGS  = 45
21
MAXSTRINGS = 45
24
TMP = 80*(MAXSTRINGS+1)
-
 
25
;------------------------------------------------------------------------------
22
;------------------------------------------------------------------------------
26
    START:
23
START:
27
        call    CheckUnique
24
        call    CheckUnique
28
        mov     edi, filename
25
        mov     edi, filename
29
        cmp     [edi], byte 0
26
        cmp     [edi], byte 0
Line 33... Line 30...
33
        lodsb
30
        lodsb
34
        stosb
31
        stosb
35
        test    al,al
32
        test    al,al
36
        jnz     @b
33
        jnz     @b
37
    param:
34
param:
-
 
35
        mov     ecx, (MAXSTRINGS+1)*20
38
        mov     ecx, TMP
36
        mov     edi, text1
39
        xor     eax, eax
37
        mov     eax, '    '
-
 
38
        rep     stosd
-
 
39
 
-
 
40
        mov     ecx, (MAXSTRINGS+1)*20
40
        mov     edi, [targ]
41
        mov     edi, text2
41
        rep     stosb
42
        rep     stosd
Line 42... Line 43...
42
 
43
 
43
        mov     [tmp1], 'x'
44
        mov     byte [tmp1], 'x'
Line 44... Line 45...
44
        mov     [tmp2], 'x'
45
        mov     byte [tmp2], 'x'
45
 
46
 
46
        mcall   14
47
        mcall   14
47
        and     eax, 0xffff0000
48
        and     eax, 0xffff0000
Line 82... Line 83...
82
    @@:
83
@@:
83
        movzx   ebx, byte[buffer_length]
84
        movzx   ebx, byte[buffer_length]
84
        mov     [ebx+tmp], al
85
        mov     [ebx+tmp], al
85
        inc     [buffer_length]
86
        inc     [buffer_length]
86
        mov     ebp, [targ]
87
        mov     ebp, [targ]
-
 
88
        cmp     al, 10
87
    .no4:
89
        jz      new_line
88
        cmp     al, 13
90
        cmp     al, 13
89
        jne     no13
91
        jz      new_check
90
        and     [ebp-8], dword 0
-
 
91
        jmp     new_check
92
        jmp     char
92
;------------------------------------------
93
;------------------------------------------
93
write_buffer:
94
write_buffer:
94
        pusha
95
        pusha
95
        mov     edx, tmp
96
        mov     edx, tmp
96
        movzx   ecx, byte[buffer_length]	;1
97
        movzx   ecx, byte[buffer_length]
97
        mov     esi, filename
98
        mov     esi, filename
98
    .write_to_logfile:
99
.write_to_logfile:
99
        call    WriteToFile
100
        call    WriteToFile
100
        cmp     eax, 5
101
        cmp     eax, 5
101
        jne     @f
102
        jne     @f
Line 109... Line 110...
109
        xor     eax,eax
110
        xor     eax,eax
110
        mov     [buffer_length],al
111
        mov     [buffer_length],al
111
        popa
112
        popa
112
        ret
113
        ret
113
;------------------------------------------
114
;------------------------------------------
114
no13:
115
new_line:
115
        cmp     al, 10
-
 
116
        jne     no10
-
 
117
        and     [ebp-8], dword 0
116
        and     [ebp-8], dword 0
118
        inc     dword [ebp-4]
117
        inc     dword [ebp-4]
119
        cmp     [ebp-4], dword MAXSTRINGS
118
        cmp     [ebp-4], dword MAXSTRINGS
120
        jbe     .noypos
119
        jbe     .noypos
121
        mov     [ebp-4], dword MAXSTRINGS
120
        mov     [ebp-4], dword MAXSTRINGS
122
        lea     esi, [ebp+80]
121
        lea     esi, [ebp+80]
123
        mov     edi, ebp
122
        mov     edi, ebp
124
        mov     ecx, 80*(MAXSTRINGS)
123
        mov     ecx, 20*(MAXSTRINGS)
125
        cld
124
        cld
126
        rep     movsb
125
        rep     movsd
Line 127... Line 126...
127
 
126
 
128
        mov     esi, [ebp-4]
127
        mov     esi, [ebp-4]
129
        imul    esi, 80
128
        imul    esi, 80
130
        add     esi, [ebp-8]
129
        add     esi, [ebp-8]
131
        add     esi, ebp
130
        add     esi, ebp
132
        mov     ecx, 80
131
        mov     ecx, 20
133
        mov     al ,' '
132
        mov     eax, '    '
134
        rep     stosb
133
        rep     stosd
135
    .noypos:
134
.noypos:
136
        mov     [targ],text2
135
        mov     [targ],text2
137
        and     [krnl_cnt],0
136
        and     [krnl_cnt],0
138
        jmp     new_check
137
        jmp     new_check
139
;------------------------------------------
138
;------------------------------------------
140
no10:
139
char:
141
        cmp     ebp, text1
140
        cmp     ebp, text1
142
        je      add2
141
        je      add2
143
        mov     ecx, [krnl_cnt]
142
        mov     ecx, [krnl_cnt]
144
        cmp     al, [krnl_msg+ecx]
143
        cmp     al, [krnl_msg+ecx]
Line 397... Line 396...
397
        mcall
396
        mcall
Line 398... Line 397...
398
 
397
 
399
    .leave_check:
398
.leave_check:
Line 400... Line -...
400
        ret
-
 
401
 
-
 
402
 
-
 
403
;------------------------------------------------------------------------------
-
 
404
;***********************************  DATA ************************************
-
 
405
;------------------------------------------------------------------------------
-
 
406
align 4
-
 
407
InfoStructure:
-
 
408
        dd      0x0                       ; subfunction number
-
 
409
        dd      0x0                       ; position in the file in bytes
-
 
410
        dd      0x0                       ; upper part of the position address
-
 
411
        dd      0x0                       ; number of bytes to read
-
 
412
        dd      0x0                       ; pointer to the buffer to write data
-
 
413
        db      0x0
-
 
414
        dd      0x0                       ; pointer to the filename
-
 
415
filepos dd      0x0
399
        ret
-
 
400
 
-
 
401
;------------------------------------------------------------------------------
416
default_filename db '/sys/boardlog.txt',0
402
; DATA
417
;------------------------------------------------------------------------------
403
 
418
if lang eq ru
404
if lang eq ru
419
 title	db '„®áª  ®â« ¤ª¨ ¨ á®®¡é¥­¨©',0
405
 title	db '„®áª  ®â« ¤ª¨ ¨ á®®¡é¥­¨©',0
420
else if lang eq it
406
else if lang eq it
421
 title	db 'Notifiche e informazioni generiche per il debug',0
407
 title	db 'Notifiche e informazioni generiche per il debug',0
422
else if lang eq ge
408
else if lang eq ge
423
 title	db 'Allgemeines debug- & nachrichtenboard',0
409
 title	db 'Allgemeines debug- & nachrichtenboard',0
424
else
410
else
-
 
411
 title	db 'General debug & message board',0
425
 title	db 'General debug & message board',0
412
end if
426
end if
413
 
427
;------------------------------------------------------------------------------
414
default_filename db '/sys/boardlog.txt',0
428
krnl_msg        db  'K : '
-
 
429
duk             db  'KernUser'
-
 
430
krnl_cnt        dd  0
-
 
431
vmode           dd  1
415
krnl_msg        db  'K : '
432
targ            dd  text2
416
duk             db  'KernUser'
-
 
417
my_name         db  'board',0
-
 
418
my_name_size = $-my_name
433
my_name         db  'board',0
419
 
434
my_name_size    = $-my_name
420
align 4
435
process_count   dd  0x0
-
 
-
 
421
vmode   dd  1
436
pid_tid         dd  0x0
422
targ    dd  text2
-
 
423
 
-
 
424
I_END:
-
 
425
 
-
 
426
InfoStructure:
-
 
427
        dd      ?       ; subfunction number
-
 
428
        dd      ?       ; position in the file in bytes
437
;------------------------------------------------------------------------------
429
        dd      ?       ; upper part of the position address
-
 
430
        dd      ?       ; number of bytes to read
-
 
431
        dd      ?       ; pointer to the buffer to write data
-
 
432
        db      ?
-
 
433
        dd      ?       ; pointer to the filename
-
 
434
 
-
 
435
buffer_length   rb  3
-
 
436
process_count   dd  ?
438
I_END:
437
krnl_cnt        dd  ?
439
;------------------------------------------------------------------------------
438
pid_tid         dd  ?
-
 
439
filepos         dd  ?
-
 
440
xstart          dd  ?
440
offs            dd  ?
441
sc      sys_colors_new
441
flag            rb  1
442
 
442
                rd  2
443
        rd  2
-
 
444
text1   rb  80*(MAXSTRINGS+1)
443
text1           rb  80*(MAXSTRINGS+1)
445
tmp1    dd  ?
444
tmp1            db  ?
446
 
445
                rd  2
447
        rd  2
446
text2           rb  80*(MAXSTRINGS+1)
-
 
447
tmp2            db  ?
-
 
448
xstart          dd  ?
448
text2   rb  80*(MAXSTRINGS+1)
449
sc              sys_colors_new
-
 
450
i_end:
-
 
451
buffer_length   rb  1
449
tmp2    dd  ?
452
;------------------------------------------------------------------------------
450
 
453
tmp             rb  256
-
 
454
filename        rb  256
-
 
455
;------------------------------------------------------------------------------
-
 
456
align 4
451
tmp             rb  256
457
procinfo:
-
 
458
        rb 1024
-
 
459
;------------------------------------------------------------------------------
452
filename        rb  256
460
align 4
-
 
461
stackbuf        rb  2000h
453
procinfo        rb  1024
462
;------------------------------------------------------------------------------
454
stackbuf        rb  2000h