kolibrios-gitea/programs/cmm/lib/debug.h
Kirill Lipatov (Leency) 672bbcf6a0 WebVIew 2.4: tabs
git-svn-id: svn://kolibrios.org@7771 a494cfbc-eb01-0410-851d-a64ba20cac60
2020-04-10 16:19:52 +00:00

62 lines
864 B
C

#ifndef INCLUDE_DEBUG_H
#define INCLUDE_DEBUG_H
#ifndef INCLUDE_STRING_H
#include "../lib/strings.h"
#endif
inline fastcall void debugch( ECX)
{
$push eax
$push ebx
$mov eax,63
$mov ebx,1
$int 0x40
$pop ebx
$pop eax
}
inline fastcall void debug( EDX)
{
$push eax
$push ebx
$push ecx
$mov eax, 63
$mov ebx, 1
NEXT_CHAR:
$mov ecx, DSDWORD[edx]
$or cl, cl
$jz DONE
$int 0x40
$inc edx
$jmp NEXT_CHAR
DONE:
$pop ecx
$pop ebx
$pop eax
}
inline fastcall void debugln( EDX)
{
debug( EDX);
debugch(10);
}
:void debugval(dword text,number)
{
char tmpch[12];
debug(text);
debug(": ");
itoa_(#tmpch, number);
debugln(#tmpch);
}
:void debug_n(dword _text, _size)
{
dword res_text = malloc(_size);
strncpy(res_text, _text, _size-1);
debugln(res_text);
free(res_text);
}
#endif