bullshit commit, sync for travel (to zn00H!) :)
[my-code/arm.git] / betty / font2b.c
index 6c1af61..5ce243a 100644 (file)
@@ -21,6 +21,8 @@
 #include <fcntl.h>
 #include <unistd.h>
 
+typedef unsigned int u32;
+
 // put your font data here!
 #include "/usr/src/linux/drivers/video/console/font_pearl_8x8.c"
 
@@ -40,7 +42,7 @@ int main(int argc,char **argv) {
 
        stat=CHAR;
        if(argc==2) {
-               fd=open(argv[1],O_WRONLY);
+               fd=open(argv[1],O_WRONLY|O_CREAT);
                if(fd<0) {
                        perror("file open");
                        return fd;
@@ -49,34 +51,33 @@ int main(int argc,char **argv) {
        }
 
        if(stat==CHAR)
-               printf("const unsigned char default_font[%d]={\n",256*8*2);
+               printf("const unsigned char default_font[%d]={\n",256*8);
 
        for(font=0;font<=0xff;font++) {
 
                /* print the font number */
-               printf("\t/* %d 0x%02x",font,font);
-               if((font>0x1f)&(font<0x7f))
-                       printf(" %c */\n",font);
-               else
-                       printf(" */\n");
+               if(stat==CHAR) {
+                       printf("\t/* %d 0x%02x",font,font);
+                       if((font>0x1f)&(font<0x7f))
+                               printf(" %c */\n",font);
+                       else
+                               printf(" */\n");
+               }
 
                /* print the array content of the font */
                for(col=0;col<8;col++) {
                        buf=0;
                        for(row=0;row<8;row++)
-                               buf|=(font_data[font*8+row]&(1<<(7-col)));
+                               buf|=(((font_data[font*8+row]>>(7-col))&1)<<row);
                        if(stat==CHAR) {
-                               if(!(col%4))
+                               if(col==0)
                                        printf("\t");
-                               printf("0x%02x,0x%02x",buf,buf);
+                               printf("0x%02x",buf);
                                if((font!=0xff)|(col!=7))
                                        printf(",");
-                               if(col==3)
-                                       printf("\n");
                        }
                        else {
                                write(fd,&buf,1);
-                               write(fd,&buf,1);
                        }
                }
                if(stat==CHAR)