-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathdebug.c
92 lines (80 loc) · 1.37 KB
/
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
85
86
87
88
89
90
91
92
#include <exec/types.h>
#include <stdio.h>
extern __stdargs void rawdofmt(char*, char*, void*);
void serout(const char *s)
{
static int init;
if (!init) {
init = 1;
volatile UWORD *serper = (UWORD*)0xdff032;
*serper = 10;
}
volatile UWORD *serdatr = (UWORD*)0xdff018;
volatile UWORD *serdat = (UWORD*)0xdff030;
while (*s) {
for (;;) {
UWORD v = *serdatr;
if (v & 0x1000)
break;
}
*serdat = (*s) | 0x100;
s++;
}
}
void DebugPutStr(char *buff)
{
serout(buff);
}
void DebugPutDec(char *what, ULONG val)
{
APTR format[2] = { (APTR)val, what };
char buf[80];
rawdofmt(buf, "%08ld %s ", format);
serout(buf);
}
void DebugPutHex(char *what, ULONG val)
{
APTR format[2] = { (APTR)val, what };
char buf[80];
rawdofmt(buf, "%08lx %s ", format);
serout(buf);
}
void DebugPutHexVal(ULONG val)
{
}
void ENTER(char *s)
{
serout(">");
serout(s);
serout("\n");
}
void EXIT(char *s)
{
serout("<");
serout(s);
serout("\n");
}
void Trace(int id, char *title, char *format, ...)
{
va_list parms;
char buf[256];
serout("-");
serout(title);
serout(":");
va_start(parms, format);
rawdofmt(buf, format, parms);
serout(buf);
va_end(parms);
}
void ErrorTrace(int id, char *title, char *format, ...)
{
va_list parms;
char buf[256];
serout("-");
serout(title);
serout(":");
va_start(parms, format);
rawdofmt(buf, format, parms);
serout(buf);
va_end(parms);
}