-
Notifications
You must be signed in to change notification settings - Fork 1
/
printbig.c
executable file
·74 lines (70 loc) · 2.52 KB
/
printbig.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
/*
* A function illustrating how to link C code to code generated from LLVM
*/
#include <stdio.h>
/*
* Font information: one byte per row, 8 rows per character
* In order, space, 0-9, A-Z
*/
static const char font[] = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x1c, 0x3e, 0x61, 0x41, 0x43, 0x3e, 0x1c, 0x00,
0x00, 0x40, 0x42, 0x7f, 0x7f, 0x40, 0x40, 0x00,
0x62, 0x73, 0x79, 0x59, 0x5d, 0x4f, 0x46, 0x00,
0x20, 0x61, 0x49, 0x4d, 0x4f, 0x7b, 0x31, 0x00,
0x18, 0x1c, 0x16, 0x13, 0x7f, 0x7f, 0x10, 0x00,
0x27, 0x67, 0x45, 0x45, 0x45, 0x7d, 0x38, 0x00,
0x3c, 0x7e, 0x4b, 0x49, 0x49, 0x79, 0x30, 0x00,
0x03, 0x03, 0x71, 0x79, 0x0d, 0x07, 0x03, 0x00,
0x36, 0x4f, 0x4d, 0x59, 0x59, 0x76, 0x30, 0x00,
0x06, 0x4f, 0x49, 0x49, 0x69, 0x3f, 0x1e, 0x00,
0x7c, 0x7e, 0x13, 0x11, 0x13, 0x7e, 0x7c, 0x00,
0x7f, 0x7f, 0x49, 0x49, 0x49, 0x7f, 0x36, 0x00,
0x1c, 0x3e, 0x63, 0x41, 0x41, 0x63, 0x22, 0x00,
0x7f, 0x7f, 0x41, 0x41, 0x63, 0x3e, 0x1c, 0x00,
0x00, 0x7f, 0x7f, 0x49, 0x49, 0x49, 0x41, 0x00,
0x7f, 0x7f, 0x09, 0x09, 0x09, 0x09, 0x01, 0x00,
0x1c, 0x3e, 0x63, 0x41, 0x49, 0x79, 0x79, 0x00,
0x7f, 0x7f, 0x08, 0x08, 0x08, 0x7f, 0x7f, 0x00,
0x00, 0x41, 0x41, 0x7f, 0x7f, 0x41, 0x41, 0x00,
0x20, 0x60, 0x40, 0x40, 0x40, 0x7f, 0x3f, 0x00,
0x7f, 0x7f, 0x18, 0x3c, 0x76, 0x63, 0x41, 0x00,
0x00, 0x7f, 0x7f, 0x40, 0x40, 0x40, 0x40, 0x00,
0x7f, 0x7f, 0x0e, 0x1c, 0x0e, 0x7f, 0x7f, 0x00,
0x7f, 0x7f, 0x0e, 0x1c, 0x38, 0x7f, 0x7f, 0x00,
0x3e, 0x7f, 0x41, 0x41, 0x41, 0x7f, 0x3e, 0x00,
0x7f, 0x7f, 0x11, 0x11, 0x11, 0x1f, 0x0e, 0x00,
0x3e, 0x7f, 0x41, 0x51, 0x71, 0x3f, 0x5e, 0x00,
0x7f, 0x7f, 0x11, 0x31, 0x79, 0x6f, 0x4e, 0x00,
0x26, 0x6f, 0x49, 0x49, 0x4b, 0x7a, 0x30, 0x00,
0x00, 0x01, 0x01, 0x7f, 0x7f, 0x01, 0x01, 0x00,
0x3f, 0x7f, 0x40, 0x40, 0x40, 0x7f, 0x3f, 0x00,
0x0f, 0x1f, 0x38, 0x70, 0x38, 0x1f, 0x0f, 0x00,
0x1f, 0x7f, 0x38, 0x1c, 0x38, 0x7f, 0x1f, 0x00,
0x63, 0x77, 0x3e, 0x1c, 0x3e, 0x77, 0x63, 0x00,
0x00, 0x03, 0x0f, 0x78, 0x78, 0x0f, 0x03, 0x00,
0x61, 0x71, 0x79, 0x5d, 0x4f, 0x47, 0x43, 0x00
};
void printbig(int c)
{
int index = 0;
int col, data;
if (c >= '0' && c <= '9') index = 8 + (c - '0') * 8;
else if (c >= 'A' && c <= 'Z') index = 88 + (c - 'A') * 8;
do {
data = font[index++];
for (col = 0 ; col < 8 ; data <<= 1, col++) {
char d = data & 0x80 ? 'X' : ' ';
putchar(d); putchar(d);
}
putchar('\n');
} while (index & 0x7);
}
#ifdef BUILD_TEST
int main()
{
char s[] = "HELLO WORLD09AZ";
char *c;
for ( c = s ; *c ; c++) printbig(*c);
}
#endif