basic implementation done ...
[my-code/atmel.git] / led_plex / convert_font.c
1 /*
2  * convert_font.c - convert linux console 8x8 font data
3  *
4  * author: hackbard@hackdaworld.org
5  *
6  * usage:
7  *
8  * first you have to adjust this file two times (see comments!)
9  *
10  * build: gcc -Wall -o convert_font convert_font.c -I/usr/src/linux/include
11  * 
12  * ./convert_font > fonts.asm
13  *
14  * ONLY 8x8 FONTS SUPPORTED!
15  *
16  */
17
18 #define _GNU_SOURCE
19 #include <stdio.h>
20 #include <sys/types.h>
21 #include <sys/stat.h>
22 #include <fcntl.h>
23 #include <unistd.h>
24
25 typedef unsigned int u32;
26
27 // put your font data here!
28 #include "/usr/src/linux/drivers/video/console/font_pearl_8x8.c"
29
30 int main(int argc,char **argv) {
31
32         unsigned char *font_data;
33         int font,col,row;
34
35         // adjust the font data pointer here!
36         font_data=(unsigned char *)fontdata_pearl8x8;
37
38         for(font=0;font<=0x7f;font++) {
39
40                 /* print the font number */
41                 printf("; %d 0x%02x",font,font);
42                 if((font>0x1f)&(font<0x7f))
43                         printf(" %c\n",font);
44                 else
45                         printf("\n");
46                 printf(".db ");
47
48                 /* print the array content of the font */
49                 for(col=0;col<8;col++) {
50                         printf("0b");
51                         for(row=0;row<8;row++)
52         printf("%c",((font_data[font*8+row]>>(7-col))&1)?'1':'0');
53                         if(col!=7) printf(", ");
54                         else printf("\n");
55
56                 }
57         }
58
59         return 0;
60 }