mirror of
https://github.com/deater/dos33fsprogs.git
synced 2024-08-20 06:29:39 +00:00
347 lines
7.0 KiB
C
347 lines
7.0 KiB
C
/* Use grey2 to make RLE more efficient? */
|
|
|
|
#include <stdio.h>
|
|
#include <string.h>
|
|
|
|
static unsigned char font[256][9]={
|
|
{0,0,0,0,0,0,0,0,0}, // 0
|
|
{0,0,0,0,0,0,0,0,0},
|
|
{0,0,0,0,0,0,0,0,0},
|
|
{0,0,0,0,0,0,0,0,0},
|
|
{0,0,0,0,0,0,0,0,0},
|
|
{0,0,0,0,0,0,0,0,0},
|
|
{0,0,0,0,0,0,0,0,0},
|
|
{0,0,0,0,0,0,0,0,0},
|
|
{0,0,0,0,0,0,0,0,0}, // 8
|
|
{0,0,0,0,0,0,0,0,0},
|
|
{0,0,0,0,0,0,0,0,0},
|
|
{0,0,0,0,0,0,0,0,0},
|
|
{0,0,0,0,0,0,0,0,0},
|
|
{0,0,0,0,0,0,0,0,0},
|
|
{0,0,0,0,0,0,0,0,0},
|
|
{0,0,0,0,0,0,0,0,0},
|
|
{0,0,0,0,0,0,0,0,0}, // 16
|
|
{0,0,0,0,0,0,0,0,0},
|
|
{0,0,0,0,0,0,0,0,0},
|
|
{0,0,0,0,0,0,0,0,0},
|
|
{0,0,0,0,0,0,0,0,0},
|
|
{0,0,0,0,0,0,0,0,0},
|
|
{0,0,0,0,0,0,0,0,0},
|
|
{0,0,0,0,0,0,0,0,0},
|
|
{0,0,0,0,0,0,0,0,0}, // 24
|
|
{0,0,0,0,0,0,0,0,0},
|
|
{0,0,0,0,0,0,0,0,0},
|
|
{0,0,0,0,0,0,0,0,0},
|
|
{0,0,0,0,0,0,0,0,0},
|
|
{0,0,0,0,0,0,0,0,0},
|
|
{0,0,0,0,0,0,0,0,0},
|
|
{0,0,0,0,0,0,0,0,0},
|
|
{5,0,0,0,0,0,0,0,0}, // 32 ' '
|
|
{4,
|
|
0x00,
|
|
0xe0, // ******
|
|
0xe0, // ******
|
|
0x40, // **
|
|
0x40, // **
|
|
0x00, //
|
|
0x40, // **
|
|
0x40, // **
|
|
},
|
|
{0,0,0,0,0,0,0,0,0}, // 34
|
|
{0,0,0,0,0,0,0,0,0},
|
|
{0,0,0,0,0,0,0,0,0},
|
|
{0,0,0,0,0,0,0,0,0},
|
|
{0,0,0,0,0,0,0,0,0},
|
|
{0,0,0,0,0,0,0,0,0},
|
|
{0,0,0,0,0,0,0,0,0}, // 40
|
|
{0,0,0,0,0,0,0,0,0},
|
|
{0,0,0,0,0,0,0,0,0},
|
|
{0,0,0,0,0,0,0,0,0},
|
|
{0,0,0,0,0,0,0,0,0},
|
|
{0,0,0,0,0,0,0,0,0},
|
|
{0,0,0,0,0,0,0,0,0},
|
|
{0,0,0,0,0,0,0,0,0},
|
|
{0,0,0,0,0,0,0,0,0}, // 48
|
|
/*
|
|
** ** ** **** ** ** ****** **** ****** ** ****
|
|
** ** **** ** ** ** ** ** ** ** ** ** ** ** **
|
|
** ** ** ** ** ** ** ** ** ** ** ** ** **
|
|
** ** ** ** ** ****** **** **** ** ** ****
|
|
** ** ** ** ** ** ** ** ** ** ** ** **
|
|
** ** ** ** ** ** ** ** ** ** ** ** **
|
|
** ****** ****** **** ** **** ** ** ** **
|
|
*/
|
|
{0,0,0,0,0,0,0,0,0},
|
|
{0,0,0,0,0,0,0,0,0},
|
|
{0,0,0,0,0,0,0,0,0},
|
|
{0,0,0,0,0,0,0,0,0},
|
|
{0,0,0,0,0,0,0,0,0},
|
|
{0,0,0,0,0,0,0,0,0},
|
|
{0,0,0,0,0,0,0,0,0},
|
|
{0,0,0,0,0,0,0,0,0}, // 56
|
|
{0,0,0,0,0,0,0,0,0},
|
|
{0,0,0,0,0,0,0,0,0},
|
|
{0,0,0,0,0,0,0,0,0},
|
|
{0,0,0,0,0,0,0,0,0},
|
|
{0,0,0,0,0,0,0,0,0},
|
|
{0,0,0,0,0,0,0,0,0},
|
|
{0,0,0,0,0,0,0,0,0},
|
|
{0,0,0,0,0,0,0,0,0}, //64
|
|
{5,
|
|
0x00,
|
|
0x60, // ****
|
|
0x90, // ** **
|
|
0x90, // ** **
|
|
0xf0, // ********
|
|
0x90, // ** **
|
|
0x90, // ** **
|
|
0x90, // ** **
|
|
},
|
|
{5,
|
|
0x00,
|
|
0xe0, // ******
|
|
0x90, // ** **
|
|
0x90, // ** **
|
|
0xe0, // ******
|
|
0x90, // ** **
|
|
0x90, // ** **
|
|
0xe0, // ******
|
|
},
|
|
{5,
|
|
0x00,
|
|
0x70, // ******
|
|
0x80, // **
|
|
0x80, // **
|
|
0x80, // **
|
|
0x80, // **
|
|
0x80, // **
|
|
0x70, // ******
|
|
},
|
|
{5,
|
|
0x00,
|
|
0xc0, // ****
|
|
0xa0, // ** **
|
|
0x90, // ** **
|
|
0x90, // ** **
|
|
0x90, // ** **
|
|
0xa0, // ** **
|
|
0xc0, // ****
|
|
},
|
|
{5,
|
|
0x00,
|
|
0xf0, // ********
|
|
0x80, // **
|
|
0x80, // **
|
|
0xe0, // ******
|
|
0x80, // **
|
|
0x80, // **
|
|
0xf0, // ********
|
|
},
|
|
{0,0,0,0,0,0,0,0,0},
|
|
{0,0,0,0,0,0,0,0,0},
|
|
/*
|
|
********
|
|
**
|
|
**
|
|
******
|
|
**
|
|
**
|
|
**
|
|
|
|
****
|
|
**
|
|
**
|
|
** ****
|
|
** **
|
|
** **
|
|
****
|
|
*/
|
|
{5,
|
|
0x00,
|
|
0x90, // ** **
|
|
0x90, // ** **
|
|
0x90, // ** **
|
|
0xf0, // ********
|
|
0x90, // ** **
|
|
0x90, // ** **
|
|
0x90, // ** **
|
|
},
|
|
|
|
{0,0,0,0,0,0,0,0,0},
|
|
{0,0,0,0,0,0,0,0,0},
|
|
{0,0,0,0,0,0,0,0,0},
|
|
{0,0,0,0,0,0,0,0,0},
|
|
{0,0,0,0,0,0,0,0,0},
|
|
{0,0,0,0,0,0,0,0,0},
|
|
{0,0,0,0,0,0,0,0,0},
|
|
{0,0,0,0,0,0,0,0,0},
|
|
/*
|
|
****** **** ** ** ** ** ** ** ** **** ******
|
|
** ** ** ** ** **** **** **** ** ** ** ** **
|
|
** ** ** ** ** ** ** ** **** ** ** ** ** **
|
|
** ** **** ** ** ** ** **** ** ** ******
|
|
** ** ** ** ** ** ** ** **** ** ** **
|
|
** ** ** ** ** ** ** ** ** ** ** ** **
|
|
****** **** ** ** ******** ** ** ** ** **** **
|
|
*/
|
|
|
|
{0,0,0,0,0,0,0,0,0},
|
|
|
|
/*
|
|
****
|
|
** **
|
|
** **
|
|
** **
|
|
** **
|
|
** ****
|
|
** **
|
|
*/
|
|
|
|
{5,
|
|
0x00,
|
|
0xe0, // ******
|
|
0x90, // ** **
|
|
0x90, // ** **
|
|
0xe0, // ******
|
|
0x90, // ** **
|
|
0x90, // ** **
|
|
0x90, // ** **
|
|
},
|
|
|
|
{5,
|
|
0x00,
|
|
0x70, // ******
|
|
0x80, // **
|
|
0x80, // **
|
|
0x60, // ****
|
|
0x10, // **
|
|
0x10, // **
|
|
0xe0, // ******
|
|
},
|
|
{4,
|
|
0x00,
|
|
0xe0, // ******
|
|
0x40, // **
|
|
0x40, // **
|
|
0x40, // **
|
|
0x40, // **
|
|
0x40, // **
|
|
0x40, // **
|
|
},
|
|
|
|
{5,
|
|
0x00,
|
|
0x90, // ** **
|
|
0x90, // ** **
|
|
0x90, // ** **
|
|
0x90, // ** **
|
|
0x90, // ** **
|
|
0x90, // ** **
|
|
0x90, // ****
|
|
},
|
|
|
|
{5,
|
|
0x90, // ** **
|
|
0x90, // ** **
|
|
0x90, // ** **
|
|
0x90, // ** **
|
|
0x50, // ** **
|
|
0x50, // ** **
|
|
0x20, // **
|
|
},
|
|
|
|
{6,
|
|
0x00,
|
|
0x88, // ** **
|
|
0x88, // ** **
|
|
0x88, // ** **
|
|
0x88, // ** **
|
|
0xa8, // ** ** **
|
|
0xd8, // **** ****
|
|
0x88, // ** **
|
|
},
|
|
|
|
{0,0,0,0,0,0,0,0,0},
|
|
{0,0,0,0,0,0,0,0,0},
|
|
{0,0,0,0,0,0,0,0,0},
|
|
/*
|
|
** ** ** ** **********
|
|
** ** ** ** **
|
|
** ** ** ** **
|
|
** ** **
|
|
** ** ** **
|
|
** ** ** **
|
|
** ** ** **********
|
|
|
|
*/
|
|
|
|
};
|
|
|
|
|
|
static int color_map[4][8]={
|
|
{0x2,0x2,0x6,0xe,0xf,0xe,0x6,0x2}, // Blue
|
|
{0x4,0x4,0xc,0xd,0xf,0xd,0xc,0x4}, // Green
|
|
{0x1,0x1,0x3,0xb,0xf,0xb,0x3,0x1}, // Red
|
|
{0x5,0x5,0x7,0xf,0xf,0xf,0x7,0x5}, // Grey
|
|
};
|
|
|
|
|
|
int main(int argc, char **argv) {
|
|
|
|
//char string[]="ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
|
|
char string[]=" \001DEATER \002WAS \003HERE!!! ";
|
|
int length=0,width=0,x,y,i;
|
|
int color,color1,color2;
|
|
int which_color=0;
|
|
|
|
unsigned char row[4][256];
|
|
|
|
for(i=0;i<strlen(string);i++) {
|
|
if (string[i]<5) { which_color=string[i]-1; continue;}
|
|
|
|
width=font[(int)string[i]][0];
|
|
for(x=0;x<width;x++) {
|
|
color=!!(font[(int)string[i]][1]&(0x80>>x));
|
|
color1=color?color_map[which_color][0]:0;
|
|
color=!!(font[(int)string[i]][2]&(0x80>>x));
|
|
color2=color?(color_map[which_color][1])<<4:0;
|
|
row[0][length]=color1|color2;
|
|
|
|
color=!!(font[(int)string[i]][3]&(0x80>>x));
|
|
color1=color?color_map[which_color][2]:0;
|
|
color=!!(font[(int)string[i]][4]&(0x80>>x));
|
|
color2=color?(color_map[which_color][3])<<4:0;
|
|
row[1][length]=color1|color2;
|
|
|
|
color=!!(font[(int)string[i]][5]&(0x80>>x));
|
|
color1=color?color_map[which_color][4]:0;
|
|
color=!!(font[(int)string[i]][6]&(0x80>>x));
|
|
color2=color?(color_map[which_color][5])<<4:0;
|
|
row[2][length]=color1|color2;
|
|
|
|
color=!!(font[(int)string[i]][7]&(0x80>>x));
|
|
color1=color?color_map[which_color][6]:0;
|
|
color=!!(font[(int)string[i]][8]&(0x80>>x));
|
|
color2=color?(color_map[which_color][7])<<4:0;
|
|
row[3][length]=color1|color2;
|
|
|
|
|
|
length++;
|
|
}
|
|
}
|
|
|
|
|
|
printf("scroll_length: .byte %d\n",length);
|
|
for(y=0;y<4;y++) {
|
|
printf("scroll_row%d:\n",y+1);
|
|
printf("\t.byte ");
|
|
for(x=0;x<length;x++) {
|
|
printf("$%02X",row[y][x]);
|
|
if (x!=length-1) printf(",");
|
|
}
|
|
printf("\n");
|
|
}
|
|
|
|
return 0;
|
|
}
|