Subversion Repositories Kolibri OS

Rev

Rev 7771 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
6058 leency 1
#ifndef INCLUDE_DEBUG_H
2
#define INCLUDE_DEBUG_H
3
 
4
#ifndef INCLUDE_STRING_H
5
#include "../lib/strings.h"
6
#endif
7
 
8
inline fastcall void debugch( ECX)
9
{
10
	$push eax
11
	$push ebx
12
	$mov eax,63
13
	$mov ebx,1
14
	$int 0x40
15
	$pop ebx
16
	$pop eax
17
}
18
 
19
inline fastcall void debug( EDX)
20
{
21
	$push eax
22
	$push ebx
23
	$push ecx
24
	$mov eax, 63
25
	$mov ebx, 1
26
NEXT_CHAR:
27
	$mov ecx, DSDWORD[edx]
28
	$or	 cl, cl
29
	$jz  DONE
30
	$int 0x40
31
	$inc edx
32
	$jmp NEXT_CHAR
33
DONE:
34
	$pop ecx
35
	$pop ebx
36
	$pop eax
37
}
38
 
39
inline fastcall void debugln( EDX)
40
{
41
	debug( EDX);
6152 leency 42
	debugch(10);
6058 leency 43
}
44
 
7913 leency 45
inline fastcall void debugcls()
46
{
47
	char i;
48
	for (i=0;i<70;i++) debugch(10);
49
}
50
 
7746 leency 51
:void debugval(dword text,number)
6058 leency 52
{
53
	char tmpch[12];
6278 leency 54
	debug(text);
55
	debug(": ");
7746 leency 56
	itoa_(#tmpch, number);
57
	debugln(#tmpch);
6278 leency 58
}
59
 
7771 leency 60
:void debug_n(dword _text, _size)
61
{
62
	dword res_text = malloc(_size);
63
	strncpy(res_text, _text, _size-1);
64
	debugln(res_text);
65
	free(res_text);
66
}
67
 
6058 leency 68
#endif