c2d/page2text.c

37 lines
635 B
C
Raw Normal View History

#include <stdio.h>
int main()
{
int i, j, k, linemap[24];
2017-04-16 03:58:58 +00:00
char screen[24][40];
// build table
2017-04-16 16:38:06 +00:00
for (j = 0, i = 0; i < 8; i++, j++) {
linemap[0 + 3 * j] = j;
linemap[1 + 3 * j] = j + 8;
linemap[2 + 3 * j] = j + 16;
}
// clear screen
2017-04-16 16:38:06 +00:00
for (i = 0; i < 24; i++)
for (j = 0; j < 40; j++)
screen[linemap[i]][j] = ' ';
2017-04-16 16:38:06 +00:00
for (i = 0; i < 24; i++) {
for (j = 0; j < 40; j++)
screen[linemap[i]][j] = getchar() & 0x7F;
2017-04-16 16:38:06 +00:00
if ((i + 1) % 3 == 0)
for (k = 0; k < 8; k++)
getchar();
}
// dump to stdout
2017-04-16 16:38:06 +00:00
for (i = 0; i < 24; i++) {
for (j = 0; j < 40; j++)
putchar(screen[i][j]);
printf("\n");
}
return 0;
}