forked from gardners/c65gs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
fontfiddle.c
32 lines (30 loc) · 916 Bytes
/
fontfiddle.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
#include <stdio.h>
#include <string.h>
int main(int argc,char **argv)
{
char line[1024];
unsigned int b[8];
line[0]=0; fgets(line,1024,stdin);
while(line[0]) {
if (sscanf(line," x\"%x\", x\"%x\", x\"%x\", x\"%x\", x\"%x\", x\"%x\", x\"%x\", x\"%x\"",
&b[0],&b[1],&b[2],&b[3],&b[4],&b[5],&b[6],&b[7])==8) {
for(int i=0;i<8;i++) {
printf(" -- PIXELS: %c%c%c%c%c%c%c%c\n",
b[i]&0x80?'*':' ',
b[i]&0x40?'*':' ',
b[i]&0x20?'*':' ',
b[i]&0x10?'*':' ',
b[i]&0x08?'*':' ',
b[i]&0x04?'*':' ',
b[i]&0x02?'*':' ',
b[i]&0x01?'*':' ');
}
printf(" x\"%02x\", x\"%02x\", x\"%02x\", x\"%02x\", "
"x\"%02x\", x\"%02x\", x\"%02x\", x\"%02x\",\n",
b[0],b[1],b[2],b[3],b[4],b[5],b[6],b[7]);
} else {
if (strncmp(line," -- PIXELS:",12))
printf("%s",line); }
line[0]=0; fgets(line,1024,stdin);
}
}