#include #include int blks[608][256]; char uctbl[64]={ ' ', '"', '\'','~', '.', '.', '.', '<', // 000 '>', '^', 0, 0, 0, 0, 0, 0, // 010 ' ', '?', 'S', 'T', 'U', 'V', 'W', 'X', // 020 'Y', 'Z', ' ', '=', 0, 0, '\t', ' ', // 030 '-', 'J', 'K', 'L', 'M', 'N', 'O', 'P', // 040 'Q', 'R', '!', '$', '+', ']', '|', '[', // 050 0, 'A', 'B', 'C', 'D', 'E', 'F', 'G', // 060 'H', 'I', 0, 0xd7, 0, 8, 0, '\n' }; // 070 char lctbl[64]={ ' ', '1', '2', '3', '4', '5', '6', '7', // 000 '8', '9', 0, 0, 0, 0, 0, 0, // 010 '0', '/', 's', 't', 'u', 'v', 'w', 'x', // 020 'y', 'z', ' ', ',', 0, 0, '\t', ' ', // 030 '_', 'j', 'k', 'l', 'm', 'n', 'o', 'p', // 040 'q', 'r', '!', '$', '-', ')', 0, '(', // 050 0, 'a', 'b', 'c', 'd', 'e', 'f', 'g', // 060 'h', 'i', 0, '.', 0, 8, 0, '\n' }; // 070 #define LC 072 #define UC 074 #define BS 075 #define BLACK 034 #define RED 035 int uc=0; void outchr(char c){ char outc; // if(c == 077) return; if(c == UC){ uc = 1; return;} if(c == LC){ uc = 0; return;} if((c == RED)||(c == BLACK)) return; if(uc) outc = (uctbl[c]); else outc = (lctbl[c]); if(outc) putchar(outc); else printf("<<%03o>> ",c); } int main() { int wrd; int i,j; int blk=1; int colcnt; char c; // blocks 1 - 577 interleave 2 // pack 3 8-bit bytes to 18 bits for(blk = 1, colcnt = 1; blk < 578; blk+=2){ if(colcnt++ == 1) printf("\n%04o ", blk); else { printf("%04o ", blk); if(colcnt > 16) colcnt = 1;} for(i=0; i<256; i++){ wrd = (getchar()&0x3f)<<12; wrd |= (getchar()&0x3f)<<6; wrd |= (getchar()&0x3f); blks[blk][i] = wrd; } } // blocks 576 - 0 interleave 2 for(blk = 576, colcnt = 1; blk >= 0; blk-=2){ if(colcnt++ == 1) printf("\n%04o ", blk); else { printf("%04o ", blk); if(colcnt > 16) colcnt = 1;} for(i=0; i<256; i++){ wrd = (getchar()&0x3f)<<12; wrd |= (getchar()&0x3f)<<6; wrd |= (getchar()&0x3f); blks[blk][i] = wrd; } } for(blk=0; blk <= 578; blk++){ for(i=0; i<256; i++){ // if(((i&7)==0)&&(i<255)) printf("\n%04o:%04o ", blk, i); // printf("%06o ", blks[blk][i]); c = (blks[blk][i] & 0770000) >> 12; outchr(c); c = (blks[blk][i] & 0007700) >> 6; outchr(c); c = blks[blk][i] & 0000077; outchr(c); } } }