Rev 1739 | Go to most recent revision | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 1739 | Rev 1787 | ||
---|---|---|---|
1 | #include "font-8x16.h" |
1 | #include "font-8x16.h" |
2 | 2 | ||
3 | #define FB_REG "r8" |
3 | #define FB_REG "r8" |
4 | #define SCAN_REG "r9" |
4 | #define SCAN_REG "r9" |
5 | 5 | ||
6 | #define ADDR_REG "r10" |
6 | #define ADDR_REG "r10" |
7 | #define FG_REG "r11" |
7 | #define FG_REG "r11" |
8 | #define BG_REG "r12" |
8 | #define BG_REG "r12" |
9 | 9 | ||
10 | #define FG_COLOR 0xffffffff |
10 | #define FG_COLOR 0xffffffff |
11 | #define BG_COLOR 0x00000000 |
11 | #define BG_COLOR 0x00000000 |
12 | 12 | ||
13 | #define BPP 4 |
13 | #define BPP 4 |
14 | 14 | ||
15 | void print_macro_init(void) { |
15 | void print_macro_init(void) { |
16 | printf(".macro DEBUG_INIT\n"); |
16 | printf(".macro DEBUG_INIT\n"); |
17 | printf("#ifdef CONFIG_DEBUG\n"); |
17 | printf("#ifdef CONFIG_DEBUG\n"); |
18 | printf("\tlis %s, %d\n", FG_REG, FG_COLOR >> 16); |
18 | printf("\tlis %s, %d\n", FG_REG, FG_COLOR >> 16); |
19 | printf("\tori %s, %s, %d\n", FG_REG, FG_REG, FG_COLOR & 0xffff); |
19 | printf("\tori %s, %s, %d\n", FG_REG, FG_REG, FG_COLOR & 0xffff); |
20 | printf("\t\n"); |
20 | printf("\t\n"); |
21 | printf("\tlis %s, %d\n", BG_REG, BG_COLOR >> 16); |
21 | printf("\tlis %s, %d\n", BG_REG, BG_COLOR >> 16); |
22 | printf("\tori %s, %s, %d\n", BG_REG, BG_REG, BG_COLOR & 0xffff); |
22 | printf("\tori %s, %s, %d\n", BG_REG, BG_REG, BG_COLOR & 0xffff); |
23 | printf("\t\n"); |
23 | printf("\t\n"); |
24 | printf("\tmr %s, %s\n", ADDR_REG, FB_REG); |
24 | printf("\tmr %s, %s\n", ADDR_REG, FB_REG); |
25 | printf("#endif\n"); |
25 | printf("#endif\n"); |
26 | printf(".endm\n"); |
26 | printf(".endm\n"); |
27 | } |
27 | } |
28 | 28 | ||
29 | void print_macro(const char *name) { |
29 | void print_macro(const char *name) { |
30 | printf(".macro DEBUG_%s\n", name); |
30 | printf(".macro DEBUG_%s\n", name); |
31 | printf("#ifdef CONFIG_DEBUG\n"); |
31 | printf("#ifdef CONFIG_DEBUG\n"); |
32 | 32 | ||
33 | unsigned int y; |
33 | unsigned int y; |
34 | for (y = 0; y < FONT_SCANLINES; y++) { |
34 | for (y = 0; y < FONT_SCANLINES; y++) { |
35 | printf("\t\n"); |
35 | printf("\t\n"); |
36 | 36 | ||
37 | if (y > 0) |
37 | if (y > 0) |
38 | printf("\tadd %s, %s, %s\n", ADDR_REG, ADDR_REG, SCAN_REG); |
38 | printf("\tadd %s, %s, %s\n", ADDR_REG, ADDR_REG, SCAN_REG); |
39 | 39 | ||
40 | unsigned int i; |
40 | unsigned int i; |
41 | for (i = 0; name[i] != 0; i++) { |
41 | for (i = 0; name[i] != 0; i++) { |
42 | char c = name[i]; |
42 | char c = name[i]; |
43 | 43 | ||
44 | unsigned int x; |
44 | unsigned int x; |
45 | for (x = 0; x < FONT_WIDTH; x++) { |
45 | for (x = 0; x < FONT_WIDTH; x++) { |
46 | if (((fb_font[c * FONT_SCANLINES + y] >> (FONT_WIDTH - x)) & 1) == 1) |
46 | if (((fb_font[c * FONT_SCANLINES + y] >> (FONT_WIDTH - x)) & 1) == 1) |
47 | printf("\tstw %s, %d(%s)\n", FG_REG, (i * FONT_WIDTH + x) * BPP, ADDR_REG); |
47 | printf("\tstw %s, %d(%s)\n", FG_REG, (i * FONT_WIDTH + x) * BPP, ADDR_REG); |
48 | else |
48 | else |
49 | printf("\tstw %s, %d(%s)\n", BG_REG, (i * FONT_WIDTH + x) * BPP, ADDR_REG); |
49 | printf("\tstw %s, %d(%s)\n", BG_REG, (i * FONT_WIDTH + x) * BPP, ADDR_REG); |
50 | } |
50 | } |
51 | } |
51 | } |
52 | } |
52 | } |
53 | 53 | ||
54 | printf("#endif\n"); |
54 | printf("#endif\n"); |
55 | printf(".endm\n"); |
55 | printf(".endm\n"); |
56 | } |
56 | } |
57 | 57 | ||
58 | int main(int argc, char *argv[]) { |
58 | int main(int argc, char *argv[]) { |
59 | print_macro_init(); |
59 | print_macro_init(); |
60 | 60 | ||
61 | int i; |
61 | int i; |
62 | for (i = 1; i < argc; i++) { |
62 | for (i = 1; i < argc; i++) { |
63 | printf("\n"); |
63 | printf("\n"); |
64 | print_macro(argv[i]); |
64 | print_macro(argv[i]); |
65 | } |
65 | } |
66 | 66 | ||
67 | return 0; |
67 | return 0; |
68 | } |
68 | } |
69 | 69 |