-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathJM_DEBUG.C
84 lines (67 loc) · 1.47 KB
/
JM_DEBUG.C
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
#include "3D_DEF.H"
#include "jm_error.h"
#include "jm_debug.h"
#pragma hdrstop
#ifdef __MPRINTF__
static char x=0;
static char y=0;
static char far *video = MK_FP(0xb000,0x0000);
//-------------------------------------------------------------------------
// mclear()
//-------------------------------------------------------------------------
void mclear(void)
{
short length = 80*25*2;
video = MK_FP(0xb000,0x0000);
while (length--)
*(short *)video++ = 0x0f20;
x=y=0;
video = MK_FP(0xb000,0x0000);
}
//-------------------------------------------------------------------------
// mprintf()
//-------------------------------------------------------------------------
void mprintf(char *msg, ...)
{
char buffer[100],*ptr;
va_list(ap);
va_start(ap,msg);
vsprintf(buffer,msg,ap);
ptr = buffer;
while (*ptr)
{
switch (*ptr)
{
case '\n':
if (y >= 23)
{
video -= (x<<1);
_fmemcpy(MK_FP(0xb000,0x0000),MK_FP(0xb000,0x00a0),3840);
}
else
{
y++;
video += ((80-x)<<1);
}
x=0;
break;
default:
*video = *ptr;
video[1] = 15;
video += 2;
x++;
break;
}
ptr++;
}
va_end(ap);
}
//-------------------------------------------------------------------------
// fmprint()
//-------------------------------------------------------------------------
void fmprint(char far *text)
{
while (*text)
mprintf("%c",*text++);
}
#endif