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