forked from moisutsu-playground/csjikken2-2
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmy_print.c
64 lines (56 loc) · 1.56 KB
/
my_print.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
#define EXTIO_PRINT_STROKE (*(volatile unsigned int *) 0x0300)
#define EXTIO_PRINT_ASCII (*(volatile unsigned int *) 0x0304)
void my_print();
main()
{
unsigned int string[64];
string[0] = 'H';
string[1] = 'E';
string[2] = 'L';
string[3] = 'L';
string[4] = 'O';
string[5] = '!';
string[6] = '!';
string[7] = '\0';
my_print(string);
string[0] = 'B';
string[1] = '\0';
}
void my_print(str)
unsigned int *str;
{
while (*str != '\0') {
EXTIO_PRINT_STROKE = (unsigned int)0x00000000;
if ((*str >= 'A') && (*str <= 'Z')) {
EXTIO_PRINT_ASCII = *str - 'A' + 1;
} else if ((*str >= 'a') && (*str <= 'z')) {
EXTIO_PRINT_ASCII = *str - 'a' + 1;
} else if ((*str >= '0') && (*str <= '9')) {
EXTIO_PRINT_ASCII = *str - '0' + 48;
} else {
if (*str == '@') {
EXTIO_PRINT_ASCII = (unsigned int)0;
} else if (*str == '[') {
EXTIO_PRINT_ASCII = (unsigned int)27;
} else if (*str == ']') {
EXTIO_PRINT_ASCII = (unsigned int)29;
} else if ((*str >= ' ') && (*str <= '/')) {
EXTIO_PRINT_ASCII = *str - ' ' + 32;
} else if (*str == '?') {
EXTIO_PRINT_ASCII = (unsigned int)58;
} else if (*str == '=') {
EXTIO_PRINT_ASCII = (unsigned int)59;
} else if (*str == ';') {
EXTIO_PRINT_ASCII = (unsigned int)60;
} else if (*str == ':') {
EXTIO_PRINT_ASCII = (unsigned int)61;
} else if (*str == '\n') {
EXTIO_PRINT_ASCII = (unsigned int)62;
} else {
EXTIO_PRINT_ASCII = (unsigned int)0x00000000;
}
}
EXTIO_PRINT_STROKE = (unsigned int)0x00000001;
str++;
}
}