2014-06-17 16:12:56 +02:00
|
|
|
|
;------------------------------------------------------------------------------
|
|
|
|
|
; DEBUG BOARD for APPLICATIONS and KERNEL DEVELOPMENT
|
|
|
|
|
; See f63
|
|
|
|
|
; Compile with FASM for KolibriOS
|
|
|
|
|
;------------------------------------------------------------------------------
|
2015-11-22 02:06:00 +01:00
|
|
|
|
use32
|
|
|
|
|
org 0
|
2014-06-17 16:12:56 +02:00
|
|
|
|
db 'MENUET01'
|
2015-11-22 02:06:00 +01:00
|
|
|
|
dd 1
|
2014-06-17 16:12:56 +02:00
|
|
|
|
dd START
|
|
|
|
|
dd I_END
|
|
|
|
|
dd mem
|
|
|
|
|
dd mem
|
2015-11-22 02:06:00 +01:00
|
|
|
|
dd filename
|
|
|
|
|
dd 0
|
2014-06-17 16:12:56 +02:00
|
|
|
|
;------------------------------------------------------------------------------
|
2015-11-22 02:06:00 +01:00
|
|
|
|
include 'lang.inc'
|
2011-01-18 12:56:31 +01:00
|
|
|
|
include '../../../macros.inc'
|
2012-11-09 10:19:16 +01:00
|
|
|
|
include '../../../debug.inc'
|
2015-11-22 02:06:00 +01:00
|
|
|
|
purge newline
|
2016-10-14 16:17:06 +02:00
|
|
|
|
;SMALL FONT
|
2015-11-22 02:06:00 +01:00
|
|
|
|
MAXSTRINGS = 45
|
2016-10-14 16:17:06 +02:00
|
|
|
|
LINE_H = 10
|
|
|
|
|
WINDOW_W = 399
|
|
|
|
|
WINDOW_H = MAXSTRINGS*LINE_H+45
|
|
|
|
|
FONT_TYPE = 0x40000000
|
|
|
|
|
;BIG FONT
|
|
|
|
|
; MAXSTRINGS = 30
|
|
|
|
|
; LINE_H = 15
|
|
|
|
|
; WINDOW_W = 630
|
|
|
|
|
; WINDOW_H = MAXSTRINGS*LINE_H+50
|
|
|
|
|
; FONT_TYPE = 0x50000000
|
|
|
|
|
|
2011-09-23 06:14:41 +02:00
|
|
|
|
;------------------------------------------------------------------------------
|
2015-11-22 02:06:00 +01:00
|
|
|
|
START:
|
2014-06-17 16:12:56 +02:00
|
|
|
|
call CheckUnique
|
|
|
|
|
mov edi, filename
|
|
|
|
|
cmp [edi], byte 0
|
|
|
|
|
jnz param
|
|
|
|
|
mov esi, default_filename
|
2015-11-22 02:06:00 +01:00
|
|
|
|
@@:
|
2014-06-17 16:12:56 +02:00
|
|
|
|
lodsb
|
|
|
|
|
stosb
|
|
|
|
|
test al,al
|
|
|
|
|
jnz @b
|
2015-11-22 02:06:00 +01:00
|
|
|
|
param:
|
|
|
|
|
mov ecx, (MAXSTRINGS+1)*20
|
|
|
|
|
mov edi, text1
|
|
|
|
|
mov eax, ' '
|
|
|
|
|
rep stosd
|
|
|
|
|
|
|
|
|
|
mov ecx, (MAXSTRINGS+1)*20
|
|
|
|
|
mov edi, text2
|
|
|
|
|
rep stosd
|
2014-06-17 16:12:56 +02:00
|
|
|
|
|
2015-11-22 02:06:00 +01:00
|
|
|
|
mov byte [tmp1], 'x'
|
|
|
|
|
mov byte [tmp2], 'x'
|
2014-06-17 16:12:56 +02:00
|
|
|
|
|
|
|
|
|
mcall 14
|
|
|
|
|
and eax, 0xffff0000
|
2016-10-14 16:17:06 +02:00
|
|
|
|
sub eax, WINDOW_W shl 16
|
|
|
|
|
add eax, WINDOW_W
|
2014-06-17 16:12:56 +02:00
|
|
|
|
mov [xstart], eax
|
2016-02-07 17:59:31 +01:00
|
|
|
|
mcall 48, 3, sc, sizeof.system_colors
|
2014-06-17 16:12:56 +02:00
|
|
|
|
|
|
|
|
|
mov esi, filename
|
|
|
|
|
call CreateFile
|
2011-09-23 06:14:41 +02:00
|
|
|
|
;------------------------------------------------------------------------------
|
|
|
|
|
red:
|
2015-11-22 02:06:00 +01:00
|
|
|
|
call draw_window
|
2011-09-23 06:14:41 +02:00
|
|
|
|
;------------------------------------------------------------------------------
|
2006-01-03 10:43:31 +01:00
|
|
|
|
still:
|
2014-06-17 16:12:56 +02:00
|
|
|
|
cmp [buffer_length], 0
|
|
|
|
|
je @f
|
|
|
|
|
call write_buffer
|
2015-11-22 02:06:00 +01:00
|
|
|
|
@@:
|
2014-06-17 16:12:56 +02:00
|
|
|
|
mcall 23, 50 ; wait here for event
|
|
|
|
|
cmp eax, 1 ; redraw request ?
|
|
|
|
|
je red
|
2006-01-03 10:43:31 +01:00
|
|
|
|
|
2014-06-17 16:12:56 +02:00
|
|
|
|
cmp eax, 2 ; key in buffer ?
|
|
|
|
|
je key
|
2010-08-17 23:40:33 +02:00
|
|
|
|
|
2014-06-17 16:12:56 +02:00
|
|
|
|
cmp eax, 3 ; button in buffer ?
|
|
|
|
|
je button
|
2010-08-17 23:40:33 +02:00
|
|
|
|
|
2014-06-17 16:12:56 +02:00
|
|
|
|
mcall 63, 2
|
|
|
|
|
cmp ebx, 1
|
|
|
|
|
jne still
|
2006-08-18 15:32:18 +02:00
|
|
|
|
|
2011-09-23 06:14:41 +02:00
|
|
|
|
new_data:
|
2014-06-17 16:12:56 +02:00
|
|
|
|
cmp [buffer_length], 255
|
|
|
|
|
jne @f
|
|
|
|
|
call write_buffer
|
2015-11-22 02:06:00 +01:00
|
|
|
|
@@:
|
2014-06-17 16:12:56 +02:00
|
|
|
|
movzx ebx, byte[buffer_length]
|
|
|
|
|
mov [ebx+tmp], al
|
|
|
|
|
inc [buffer_length]
|
|
|
|
|
mov ebp, [targ]
|
2015-11-22 02:06:00 +01:00
|
|
|
|
cmp al, 10
|
|
|
|
|
jz new_line
|
2014-06-17 16:12:56 +02:00
|
|
|
|
cmp al, 13
|
2015-11-22 02:06:00 +01:00
|
|
|
|
jz new_check
|
|
|
|
|
jmp char
|
2014-01-18 21:41:33 +01:00
|
|
|
|
;------------------------------------------
|
|
|
|
|
write_buffer:
|
2014-06-17 16:12:56 +02:00
|
|
|
|
pusha
|
|
|
|
|
mov edx, tmp
|
2015-11-22 02:06:00 +01:00
|
|
|
|
movzx ecx, byte[buffer_length]
|
2014-06-17 16:12:56 +02:00
|
|
|
|
mov esi, filename
|
2015-11-22 02:06:00 +01:00
|
|
|
|
.write_to_logfile:
|
2014-06-17 16:12:56 +02:00
|
|
|
|
call WriteToFile
|
|
|
|
|
cmp eax, 5
|
|
|
|
|
jne @f
|
|
|
|
|
mov esi, filename
|
|
|
|
|
mov [filepos], 0
|
|
|
|
|
call CreateFile
|
|
|
|
|
jnc .write_to_logfile
|
2011-09-23 06:14:41 +02:00
|
|
|
|
@@:
|
2014-06-17 16:12:56 +02:00
|
|
|
|
movzx eax,byte[buffer_length]
|
|
|
|
|
add [filepos],eax
|
|
|
|
|
xor eax,eax
|
|
|
|
|
mov [buffer_length],al
|
|
|
|
|
popa
|
|
|
|
|
ret
|
2011-09-23 06:14:41 +02:00
|
|
|
|
;------------------------------------------
|
2015-11-22 02:06:00 +01:00
|
|
|
|
new_line:
|
2014-06-17 16:12:56 +02:00
|
|
|
|
and [ebp-8], dword 0
|
|
|
|
|
inc dword [ebp-4]
|
|
|
|
|
cmp [ebp-4], dword MAXSTRINGS
|
|
|
|
|
jbe .noypos
|
|
|
|
|
mov [ebp-4], dword MAXSTRINGS
|
|
|
|
|
lea esi, [ebp+80]
|
|
|
|
|
mov edi, ebp
|
2015-11-22 02:06:00 +01:00
|
|
|
|
mov ecx, 20*(MAXSTRINGS)
|
2014-06-17 16:12:56 +02:00
|
|
|
|
cld
|
2015-11-22 02:06:00 +01:00
|
|
|
|
rep movsd
|
2014-06-17 16:12:56 +02:00
|
|
|
|
|
|
|
|
|
mov esi, [ebp-4]
|
|
|
|
|
imul esi, 80
|
|
|
|
|
add esi, [ebp-8]
|
|
|
|
|
add esi, ebp
|
2015-11-22 02:06:00 +01:00
|
|
|
|
mov ecx, 20
|
|
|
|
|
mov eax, ' '
|
|
|
|
|
rep stosd
|
|
|
|
|
.noypos:
|
2014-06-17 16:12:56 +02:00
|
|
|
|
mov [targ],text2
|
|
|
|
|
and [krnl_cnt],0
|
|
|
|
|
jmp new_check
|
2011-09-23 06:14:41 +02:00
|
|
|
|
;------------------------------------------
|
2015-11-22 02:06:00 +01:00
|
|
|
|
char:
|
2014-06-17 16:12:56 +02:00
|
|
|
|
cmp ebp, text1
|
|
|
|
|
je add2
|
|
|
|
|
mov ecx, [krnl_cnt]
|
|
|
|
|
cmp al, [krnl_msg+ecx]
|
|
|
|
|
jne .noknl
|
|
|
|
|
inc [krnl_cnt]
|
|
|
|
|
cmp [krnl_cnt], 4
|
|
|
|
|
jne new_check
|
|
|
|
|
mov [targ], text1
|
2015-11-22 02:06:00 +01:00
|
|
|
|
.noknl:
|
2014-06-17 16:12:56 +02:00
|
|
|
|
mov ebp, [targ]
|
|
|
|
|
jecxz .add
|
|
|
|
|
push eax
|
|
|
|
|
mov esi, krnl_msg
|
2015-11-22 02:06:00 +01:00
|
|
|
|
.l1:
|
2014-06-17 16:12:56 +02:00
|
|
|
|
lodsb
|
|
|
|
|
call add_char
|
|
|
|
|
loop .l1
|
|
|
|
|
pop eax
|
2015-11-22 02:06:00 +01:00
|
|
|
|
.add:
|
2014-06-17 16:12:56 +02:00
|
|
|
|
and [krnl_cnt], 0
|
2011-09-23 06:14:41 +02:00
|
|
|
|
add2:
|
2014-06-17 16:12:56 +02:00
|
|
|
|
call add_char
|
2011-09-23 06:14:41 +02:00
|
|
|
|
|
|
|
|
|
new_check:
|
2014-06-17 16:12:56 +02:00
|
|
|
|
mcall 63, 2
|
|
|
|
|
cmp ebx, 1
|
|
|
|
|
je new_data
|
|
|
|
|
call draw_text
|
|
|
|
|
jmp still
|
2011-09-23 06:14:41 +02:00
|
|
|
|
;------------------------------------------------------------------------------
|
|
|
|
|
key:
|
2014-06-17 16:12:56 +02:00
|
|
|
|
mcall 2
|
|
|
|
|
cmp ah, ' '
|
|
|
|
|
je button.noclose
|
2018-10-02 16:01:29 +02:00
|
|
|
|
cmp ah, 51 ; F2
|
|
|
|
|
je open_boardlog
|
2014-06-17 16:12:56 +02:00
|
|
|
|
jmp still
|
2018-10-02 16:01:29 +02:00
|
|
|
|
open_boardlog:
|
|
|
|
|
mcall 70, open_log_in_tinypad
|
|
|
|
|
jmp red
|
|
|
|
|
|
2011-09-23 06:14:41 +02:00
|
|
|
|
;------------------------------------------------------------------------------
|
|
|
|
|
button:
|
2014-06-17 16:12:56 +02:00
|
|
|
|
mcall 17 ; get id
|
|
|
|
|
cmp ah, 1 ; button id=1 ?
|
|
|
|
|
jne .noclose
|
|
|
|
|
or eax, -1 ; close this program
|
|
|
|
|
mcall
|
2015-11-22 02:06:00 +01:00
|
|
|
|
.noclose:
|
2014-06-17 16:12:56 +02:00
|
|
|
|
xor [vmode], 1
|
|
|
|
|
jmp red
|
2011-09-23 06:14:41 +02:00
|
|
|
|
;------------------------------------------------------------------------------
|
2006-08-18 15:32:18 +02:00
|
|
|
|
add_char:
|
2014-06-17 16:12:56 +02:00
|
|
|
|
push esi
|
|
|
|
|
mov esi, [ebp-4]
|
|
|
|
|
imul esi, 80
|
|
|
|
|
add esi, [ebp-8]
|
|
|
|
|
mov [ebp+esi], al
|
|
|
|
|
inc dword[ebp-8]
|
|
|
|
|
cmp dword[ebp-8], 80
|
|
|
|
|
jb .ok
|
|
|
|
|
mov dword[ebp-8], 79
|
2011-09-23 06:14:41 +02:00
|
|
|
|
.ok:
|
2014-06-17 16:12:56 +02:00
|
|
|
|
pop esi
|
|
|
|
|
ret
|
2015-11-22 02:06:00 +01:00
|
|
|
|
|
2011-09-23 06:14:41 +02:00
|
|
|
|
;------------------------------------------------------------------------------
|
2014-06-17 16:12:56 +02:00
|
|
|
|
;************************ WINDOW DEFINITIONS AND DRAW ************************
|
|
|
|
|
;------------------------------------------------------------------------------
|
2006-01-03 10:43:31 +01:00
|
|
|
|
draw_window:
|
2014-06-17 16:12:56 +02:00
|
|
|
|
mcall 12, 1 ; 1, start of draw
|
|
|
|
|
mcall 48, 5 ; GetClientTop
|
|
|
|
|
shr ebx, 16
|
|
|
|
|
mov ecx, ebx
|
|
|
|
|
shl ecx, 16
|
2016-10-14 16:17:06 +02:00
|
|
|
|
add ecx, WINDOW_H ; [y start] *65536 + [y size]
|
2014-06-17 16:12:56 +02:00
|
|
|
|
mov edx, 0xffffff
|
|
|
|
|
or edx, 0x14000000
|
|
|
|
|
xor esi, esi
|
2016-10-14 16:17:06 +02:00
|
|
|
|
mcall 0,[xstart],,,,title
|
2014-06-17 16:12:56 +02:00
|
|
|
|
mov ebx, 296 shl 16+31
|
2016-02-07 17:59:31 +01:00
|
|
|
|
mcall 8,,<4,13>,3,[sc.work_button]
|
2014-06-17 16:12:56 +02:00
|
|
|
|
mov edx, [vmode]
|
|
|
|
|
lea edx, [edx*4+duk]
|
2015-11-22 02:06:00 +01:00
|
|
|
|
mov ecx, 0x80
|
|
|
|
|
shr ecx, 24
|
2016-02-07 17:59:31 +01:00
|
|
|
|
add ecx, [sc.work_button_text]
|
2014-06-17 16:12:56 +02:00
|
|
|
|
mcall 4,<300,7>,,,4
|
|
|
|
|
call draw_text
|
|
|
|
|
mcall 12, 2 ; 2, end of draw
|
|
|
|
|
ret
|
2011-09-23 06:14:41 +02:00
|
|
|
|
;------------------------------------------------------------------------------
|
|
|
|
|
draw_text:
|
2014-06-17 16:12:56 +02:00
|
|
|
|
mov ebx, 15*65536+30 ; draw info text with function 4
|
|
|
|
|
xor ecx, ecx
|
2016-10-14 16:17:06 +02:00
|
|
|
|
or ecx, FONT_TYPE
|
2014-06-17 16:12:56 +02:00
|
|
|
|
mov edi, 0xffffff
|
|
|
|
|
mov edx, text1
|
|
|
|
|
cmp [vmode], 0
|
|
|
|
|
je .kern
|
|
|
|
|
mov edx, text2
|
2015-11-22 02:06:00 +01:00
|
|
|
|
.kern:
|
2014-06-17 16:12:56 +02:00
|
|
|
|
push ebx ecx edx
|
|
|
|
|
mcall 9, procinfo,-1
|
|
|
|
|
mov eax, [ebx+42]
|
|
|
|
|
xor edx, edx
|
|
|
|
|
mov ebx, 6
|
|
|
|
|
div ebx
|
|
|
|
|
pop edx ecx ebx
|
|
|
|
|
mov esi, 80
|
|
|
|
|
cmp eax, esi
|
|
|
|
|
ja @f
|
|
|
|
|
mov esi, eax
|
2011-09-23 06:14:41 +02:00
|
|
|
|
@@:
|
2014-06-17 16:12:56 +02:00
|
|
|
|
cmp esi, 5
|
|
|
|
|
ja @f
|
|
|
|
|
mov esi, 5
|
2011-09-23 06:14:41 +02:00
|
|
|
|
@@:
|
2014-06-17 16:12:56 +02:00
|
|
|
|
sub esi, 4
|
|
|
|
|
mov eax, 4
|
2011-09-23 06:14:41 +02:00
|
|
|
|
newline:
|
2014-06-17 16:12:56 +02:00
|
|
|
|
mcall
|
2016-10-14 16:17:06 +02:00
|
|
|
|
add ebx, LINE_H
|
2014-06-17 16:12:56 +02:00
|
|
|
|
add edx, 80
|
|
|
|
|
cmp [edx], byte 'x'
|
|
|
|
|
jne newline
|
|
|
|
|
ret
|
2010-08-17 23:40:33 +02:00
|
|
|
|
|
2014-06-17 16:12:56 +02:00
|
|
|
|
;------------------------------------------------------------------------------
|
|
|
|
|
;* input: esi = pointer to the file name *
|
|
|
|
|
;------------------------------------------------------------------------------
|
2010-08-17 23:40:33 +02:00
|
|
|
|
CreateFile:
|
2014-06-17 16:12:56 +02:00
|
|
|
|
pusha
|
|
|
|
|
mov dword [InfoStructure+00], 2 ; create file
|
|
|
|
|
mov dword [InfoStructure+04], 0 ; reserved
|
|
|
|
|
mov dword [InfoStructure+08], 0 ; reserved
|
|
|
|
|
mov dword [InfoStructure+12], 0 ; 0 bytes to write (just create)
|
|
|
|
|
mov dword [InfoStructure+16], 0 ; NULL data pointer (no data)
|
|
|
|
|
mov dword [InfoStructure+20], 0 ; reserved
|
|
|
|
|
mov dword [InfoStructure+21], esi ; pointer to the file name
|
|
|
|
|
mcall 70, InfoStructure
|
|
|
|
|
test eax, eax
|
|
|
|
|
jz .out
|
|
|
|
|
stc
|
2015-11-22 02:06:00 +01:00
|
|
|
|
.out:
|
2014-06-17 16:12:56 +02:00
|
|
|
|
popa
|
|
|
|
|
ret
|
|
|
|
|
;------------------------------------------------------------------------------
|
2010-08-17 23:40:33 +02:00
|
|
|
|
;* input: esi = pointer to the file name *
|
|
|
|
|
;* edx = pointer to data buffer *
|
|
|
|
|
;* ecx = data length *
|
2014-06-17 16:12:56 +02:00
|
|
|
|
;------------------------------------------------------------------------------
|
2010-08-17 23:40:33 +02:00
|
|
|
|
WriteToFile:
|
2014-06-17 16:12:56 +02:00
|
|
|
|
push ebx
|
|
|
|
|
mov dword [InfoStructure+00], 3 ; write to file
|
|
|
|
|
mov eax, [filepos]
|
|
|
|
|
mov dword [InfoStructure+04], eax ; lower position addr
|
|
|
|
|
mov dword [InfoStructure+08], 0 ; upper position addr (0 for FAT)
|
|
|
|
|
mov dword [InfoStructure+12], ecx ; number of bytes to write
|
|
|
|
|
mov dword [InfoStructure+16], edx ; pointer to data buffer
|
|
|
|
|
mov dword [InfoStructure+20], 0 ; reserved
|
|
|
|
|
mov dword [InfoStructure+21], esi ; pointer to the file name
|
|
|
|
|
mcall 70, InfoStructure
|
|
|
|
|
clc
|
|
|
|
|
test eax, eax
|
|
|
|
|
jz .out
|
|
|
|
|
stc
|
2015-11-22 02:06:00 +01:00
|
|
|
|
.out:
|
|
|
|
|
pop ebx
|
2014-06-17 16:12:56 +02:00
|
|
|
|
ret
|
2014-03-21 16:11:12 +01:00
|
|
|
|
|
2014-06-17 16:12:56 +02:00
|
|
|
|
;------------------------------------------------------------------------------
|
2014-03-21 16:11:12 +01:00
|
|
|
|
;* input: esi = pointer to string *
|
|
|
|
|
;* edi = pointer to string *
|
|
|
|
|
;* ecx = data length *
|
2014-06-17 16:12:56 +02:00
|
|
|
|
;------------------------------------------------------------------------------
|
2014-03-21 16:11:12 +01:00
|
|
|
|
StrCmp:
|
2014-06-17 16:12:56 +02:00
|
|
|
|
repe cmpsb
|
|
|
|
|
ja .a_greater_b
|
|
|
|
|
jb .a_less_b
|
2015-11-22 02:06:00 +01:00
|
|
|
|
.equal:
|
2014-06-17 16:12:56 +02:00
|
|
|
|
mov eax, 0
|
|
|
|
|
jmp .end
|
2015-11-22 02:06:00 +01:00
|
|
|
|
.a_less_b:
|
2014-06-17 16:12:56 +02:00
|
|
|
|
mov eax, 1
|
|
|
|
|
jmp .end
|
2015-11-22 02:06:00 +01:00
|
|
|
|
.a_greater_b:
|
2014-06-17 16:12:56 +02:00
|
|
|
|
mov eax, -1
|
2015-11-22 02:06:00 +01:00
|
|
|
|
.end:
|
2014-06-17 16:12:56 +02:00
|
|
|
|
ret
|
2014-03-21 16:11:12 +01:00
|
|
|
|
|
2014-06-17 16:12:56 +02:00
|
|
|
|
;------------------------------------------------------------------------------
|
|
|
|
|
;* input: edi = pointer to string *
|
|
|
|
|
;* ecx = data length *
|
|
|
|
|
;------------------------------------------------------------------------------
|
2014-03-21 16:11:12 +01:00
|
|
|
|
; 'a' - 'A' = 32 -> 'A'|32 = 'a'
|
|
|
|
|
ToLower:
|
2014-06-17 16:12:56 +02:00
|
|
|
|
xor eax, eax
|
2014-03-21 16:11:12 +01:00
|
|
|
|
.cycle:
|
2014-06-17 16:12:56 +02:00
|
|
|
|
or byte[edi+eax], 32
|
|
|
|
|
inc eax
|
|
|
|
|
loop .cycle
|
2014-03-21 16:11:12 +01:00
|
|
|
|
.end:
|
2014-06-17 16:12:56 +02:00
|
|
|
|
ret
|
2014-03-21 16:11:12 +01:00
|
|
|
|
|
2014-06-17 16:12:56 +02:00
|
|
|
|
;------------------------------------------------------------------------------
|
|
|
|
|
;* get info on current thread, save pid/tid
|
|
|
|
|
;* look for another process with same name and different pid/tid
|
|
|
|
|
;* if found, close self
|
|
|
|
|
;* else continue normally
|
|
|
|
|
;------------------------------------------------------------------------------
|
2014-03-21 16:11:12 +01:00
|
|
|
|
CheckUnique:
|
2015-11-22 02:06:00 +01:00
|
|
|
|
.get_thread_info:
|
2014-06-17 16:12:56 +02:00
|
|
|
|
mov ebx, procinfo
|
|
|
|
|
mov ecx, -1
|
|
|
|
|
mcall 9
|
|
|
|
|
|
2015-11-22 02:06:00 +01:00
|
|
|
|
.get_pid: ; check_buffer
|
2014-06-17 16:12:56 +02:00
|
|
|
|
mov [process_count], eax
|
|
|
|
|
mov eax, [ebx+process_information.PID]
|
|
|
|
|
mov [pid_tid], eax
|
|
|
|
|
mov ecx, 2
|
|
|
|
|
|
2015-11-22 02:06:00 +01:00
|
|
|
|
.check_threads:
|
2014-06-17 16:12:56 +02:00
|
|
|
|
cmp ecx, [process_count]
|
|
|
|
|
ja .leave_check
|
|
|
|
|
mov eax, 9
|
|
|
|
|
mcall
|
|
|
|
|
|
2015-11-22 02:06:00 +01:00
|
|
|
|
.check_slot_free:
|
2014-06-17 16:12:56 +02:00
|
|
|
|
cmp dword [ebx+process_information.slot_state], 9
|
|
|
|
|
je .next_thread
|
|
|
|
|
|
2015-11-22 02:06:00 +01:00
|
|
|
|
.check_pid:
|
2014-06-17 16:12:56 +02:00
|
|
|
|
mov eax, [pid_tid]
|
|
|
|
|
cmp [ebx+process_information.PID], eax
|
|
|
|
|
je .next_thread
|
|
|
|
|
|
2015-11-22 02:06:00 +01:00
|
|
|
|
.get_proc_name:
|
2014-06-17 16:12:56 +02:00
|
|
|
|
lea edi, [ebx+process_information.process_name]
|
|
|
|
|
push ecx
|
|
|
|
|
mov ecx, my_name_size-1
|
|
|
|
|
|
2015-11-22 02:06:00 +01:00
|
|
|
|
.lower_case:
|
2014-06-17 16:12:56 +02:00
|
|
|
|
call ToLower
|
|
|
|
|
lea esi, [my_name]
|
|
|
|
|
mov ecx, my_name_size
|
|
|
|
|
call StrCmp
|
|
|
|
|
pop ecx
|
|
|
|
|
cmp eax, 0
|
|
|
|
|
je .close_program
|
|
|
|
|
|
2015-11-22 02:06:00 +01:00
|
|
|
|
.next_thread:
|
2014-06-17 16:12:56 +02:00
|
|
|
|
inc ecx
|
|
|
|
|
jmp .check_threads
|
|
|
|
|
|
2015-11-22 02:06:00 +01:00
|
|
|
|
.close_program:
|
2014-06-17 16:12:56 +02:00
|
|
|
|
; restore and active window of previous thread
|
2015-11-22 02:06:00 +01:00
|
|
|
|
mcall 18, 3
|
|
|
|
|
mov eax, -1
|
2014-06-17 16:12:56 +02:00
|
|
|
|
mcall
|
|
|
|
|
|
2015-11-22 02:06:00 +01:00
|
|
|
|
.leave_check:
|
2014-06-17 16:12:56 +02:00
|
|
|
|
ret
|
2014-03-21 16:11:12 +01:00
|
|
|
|
|
2011-09-23 06:14:41 +02:00
|
|
|
|
;------------------------------------------------------------------------------
|
2015-11-22 02:06:00 +01:00
|
|
|
|
; DATA
|
|
|
|
|
|
2006-01-03 10:43:31 +01:00
|
|
|
|
if lang eq ru
|
2011-09-23 06:14:41 +02:00
|
|
|
|
title db '<27><>᪠ <20>⫠<EFBFBD><E2ABA0><EFBFBD> <20> ᮮ<>饭<EFBFBD><E9A5AD>',0
|
2013-06-01 20:52:46 +02:00
|
|
|
|
else if lang eq it
|
|
|
|
|
title db 'Notifiche e informazioni generiche per il debug',0
|
|
|
|
|
else if lang eq ge
|
2011-09-23 06:14:41 +02:00
|
|
|
|
title db 'Allgemeines debug- & nachrichtenboard',0
|
2013-06-01 20:52:46 +02:00
|
|
|
|
else
|
|
|
|
|
title db 'General debug & message board',0
|
2006-01-03 10:43:31 +01:00
|
|
|
|
end if
|
2015-11-22 02:06:00 +01:00
|
|
|
|
|
|
|
|
|
default_filename db '/sys/boardlog.txt',0
|
2014-06-17 16:12:56 +02:00
|
|
|
|
krnl_msg db 'K : '
|
|
|
|
|
duk db 'KernUser'
|
|
|
|
|
my_name db 'board',0
|
2015-11-22 02:06:00 +01:00
|
|
|
|
my_name_size = $-my_name
|
|
|
|
|
|
|
|
|
|
align 4
|
|
|
|
|
vmode dd 1
|
|
|
|
|
targ dd text2
|
|
|
|
|
|
2006-01-03 10:43:31 +01:00
|
|
|
|
I_END:
|
2015-11-22 02:06:00 +01:00
|
|
|
|
|
|
|
|
|
InfoStructure:
|
|
|
|
|
dd ? ; subfunction number
|
|
|
|
|
dd ? ; position in the file in bytes
|
|
|
|
|
dd ? ; upper part of the position address
|
|
|
|
|
dd ? ; number of bytes to read
|
|
|
|
|
dd ? ; pointer to the buffer to write data
|
|
|
|
|
db ?
|
|
|
|
|
dd ? ; pointer to the filename
|
|
|
|
|
|
2018-10-02 16:01:29 +02:00
|
|
|
|
open_log_in_tinypad:
|
|
|
|
|
dd 7
|
|
|
|
|
dd 0
|
|
|
|
|
dd filename
|
|
|
|
|
dd 0
|
|
|
|
|
dd 0
|
|
|
|
|
db '/sys/tinypad',0
|
|
|
|
|
|
2015-11-22 02:06:00 +01:00
|
|
|
|
buffer_length rb 3
|
|
|
|
|
process_count dd ?
|
|
|
|
|
krnl_cnt dd ?
|
|
|
|
|
pid_tid dd ?
|
|
|
|
|
filepos dd ?
|
2014-06-17 16:12:56 +02:00
|
|
|
|
xstart dd ?
|
2016-02-07 17:59:31 +01:00
|
|
|
|
sc system_colors
|
2015-11-22 02:06:00 +01:00
|
|
|
|
|
|
|
|
|
rd 2
|
|
|
|
|
text1 rb 80*(MAXSTRINGS+1)
|
|
|
|
|
tmp1 dd ?
|
|
|
|
|
|
|
|
|
|
rd 2
|
|
|
|
|
text2 rb 80*(MAXSTRINGS+1)
|
|
|
|
|
tmp2 dd ?
|
|
|
|
|
|
2014-06-17 16:12:56 +02:00
|
|
|
|
tmp rb 256
|
|
|
|
|
filename rb 256
|
2015-11-22 02:06:00 +01:00
|
|
|
|
procinfo rb 1024
|
2014-06-17 16:12:56 +02:00
|
|
|
|
stackbuf rb 2000h
|
2015-11-22 02:06:00 +01:00
|
|
|
|
mem:
|