blob: 44736e300128d1493e54beda7132fe74d81899c9 (
plain)
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 <stdlib.hch>
#include "pal_master.hch"
#include "debug.hch"
void print_hex_value(unsigned value)
{
unsigned 8 ch;
unsigned 4 i;
unsigned 32 tempvalue;
tempvalue = 0 @ value;
for(i = 0;i < 8;i++)
{
ch = 0 @ (tempvalue\\28);
tempvalue <<= 4;
ch += (ch > 9) ? 0x37 : 0x30;
PalDataPortWrite(PalRS232PortCT(0), ch);
}
}
void print_signed_hex_value(signed value, unsigned 6 size)
{
unsigned 8 ch;
unsigned 4 i;
signed 32 stempvalue;
unsigned 32 utempvalue;
unsigned 6 bit;
unsigned 1 inverse;
if(value & (1<<size))
stempvalue = adjs(value,32);
else
stempvalue = 0@value;
utempvalue = 0;
if(stempvalue<0)
{
for(bit = 0;bit < size; bit++)
{
if (stempvalue & (1<<bit))
{
utempvalue = 1<<bit;
utempvalue += (unsigned)~(stempvalue >> bit);
bit = size;
}
}
PalDataPortWrite(PalRS232PortCT(0), '-');
}
else
{
utempvalue = (unsigned)stempvalue;
}
/* if(stempvalue[size]==1)
{
PalDataPortWrite(PalRS232PortCT(0), '-');
mask = ~(0 @ (1<<size));
utempvalue = ((unsigned)stempvalue) & mask;
}
else
{
utempvalue = (unsigned)stempvalue;
}
*/
for(i = 0;i < 8;i++)
{
ch = 0 @ (utempvalue\\28);
utempvalue <<= 4;
ch += (ch > 9) ? 0x37 : 0x30;
PalDataPortWrite(PalRS232PortCT(0), ch);
}
}
void print_string(unsigned char *s) {
unsigned 10 i;
i = 0;
for(i = 0;'\0' != s[i];i++)
{
PalDataPortWrite(PalRS232PortCT(0), s[i]);
}
}
void print_eol(void)
{
PalDataPortWrite(PalRS232PortCT(0), 0x0A);
// PalDataPortWrite(PalRS232PortCT(0), 0x0D);
}
|