/* * This program examines triplets of consecutive DECtape mark track codes * to determine what spurious (unsynchronized) codes might be detected * when using an 8-bit detector. * * Copyright 2001 Eric Smith * * $Id: dectape3.c,v 1.2 2001/01/26 00:10:41 eric Exp eric $ */ #include #include int used_code [256]; /* * init_used_codes() sets up used_code[] with ones for the codes that the * eight bit mark track detector recognizes */ void init_used_codes (void) { used_code [0125] = 1; /* SYNC */ used_code [0325] = 1; /* SYNC, listed in TC11 manual but not sure how this one can occur */ used_code [0126] = 1; /* MK_BLK_MK */ used_code [0232] = 1; /* MK_DATA_SYNC */ used_code [0210] = 1; /* MK_BLK_START */ used_code [0010] = 1; /* MK_BLK_START */ used_code [0070] = 1; /* MK_DATA */ used_code [0073] = 1; /* MK_BLK_END */ used_code [0373] = 1; /* MK_BLK_END */ used_code [0351] = 1; /* MK_BLK_SYNC */ used_code [0222] = 1; /* MK_END */ } /* * codes() is passed a triplet of consecutive mark track codes (a total * of 18 mark track bits), and examines each of the possible * unsynchronized eight-bit subsequences to determine whether any * might falsely trip the mark track decoder. * * If a spurious code is found, it will be identified in the output * by an asterisk. */ void codes (int c1, int c2, int c3) { int i, c, sc; printf ("code triplet %02o %02o %02o:", c1, c2, c3); c = (c1 << 12) + (c2 << 6) + c3; for (i = 10; i > 0; i--) if (i != 6) { sc = (c >> i) & 0377; printf (" %03o%c", sc, used_code [sc] ? '*' : ' '); } printf ("\n"); } /* * main() tests all of the legal triples of mark track codes. * The list was determined by enumerating the codes, and which codes * they can be succeeded by. However, some triplets are not possible * as noted in the comments. We check them anyhow. */ int main (int argc, char *argv[]) { codes (010,010,010); codes (010,010,070); codes (010,010,073); codes (010,070,070); codes (010,070,073); /* should never happen, since there must be an even number of 18-bit data words in a block */ codes (010,073,051); /* can't happen, always four 073s in a row */ codes (010,073,073); codes (022,022,022); codes (025,022,022); codes (025,025,022); codes (025,025,025); codes (025,025,026); codes (025,026,032); codes (026,032,010); codes (032,010,010); codes (032,010,070); /* can't haappen, always four 010s in a row */ codes (045,025,022); /* can't happen, there are always 199 forward extensions (025) before the forward end zone (022) */ codes (045,025,025); codes (045,025,026); /* shouldn't happen, there should be two extensions (025) between the reverse block (045) and the forward block (026) */ codes (051,045,025); codes (055,025,022); /* can't happen, reverse end zone (055) will be further from forward end zone (022) */ codes (055,025,025); codes (055,025,026); /* can't happen, there are always 199 reverse extensions (025) after the reverse end zone (055) */ codes (055,055,025); codes (055,055,055); codes (070,070,070); codes (070,070,073); codes (070,073,051); /* can't happen, always four 073s in a row */ codes (070,073,073); codes (073,051,045); codes (073,073,051); codes (073,073,073); exit (0); }