minor refactoring

This commit is contained in:
Egan Ford 2017-04-16 13:16:36 -06:00
parent baedd4edd8
commit 52db29a758
7 changed files with 6 additions and 20 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -2,24 +2,17 @@
int main()
{
int i, j, k, linemap[24];
int i, j, k, mask = 0x7F;
char screen[24][40];
// build table
for (i = 0; i < 8; i++) {
linemap[0 + 3 * i] = i;
linemap[1 + 3 * i] = i + 8;
linemap[2 + 3 * i] = i + 16;
}
// clear screen
for (i = 0; i < 24; i++)
for (j = 0; j < 40; j++)
screen[linemap[i]][j] = ' ';
screen[i][j] = ' ';
for (i = 0; i < 24; i++) {
for (j = 0; j < 40; j++)
screen[linemap[i]][j] = getchar() & 0x7F;
screen[8 * (i % 3) + i / 3][j] = getchar() & mask;
if ((i + 1) % 3 == 0)
for (k = 0; k < 8; k++)
getchar();

View File

@ -14,20 +14,13 @@ unsigned char holes[] = {
int main()
{
char c, highbit = 0x80;
int i, j, k, column = 0, line = 0, linemap[24];
int i, j, k, column = 0, line = 0;
unsigned char screen[24][40];
// build table
for (i = 0; i < 8; i++) {
linemap[0 + i] = 0 + 3 * i;
linemap[8 + i] = 1 + 3 * i;
linemap[16 + i] = 2 + 3 * i;
}
// clear screen
for (i = 0; i < 24; i++)
for (j = 0; j < 40; j++)
screen[linemap[i]][j] = ' ' | highbit;
screen[i][j] = ' ' | highbit;
while ((c = getchar()) != EOF) {
if (c == '\r') // windows trash
@ -42,7 +35,7 @@ int main()
if (line > 23) // ditto
break;
screen[linemap[line]][column++] = c | highbit;
screen[3 * (line % 8) + line / 8][column++] = c | highbit;
}
// dump to stdout