static void showGoodOSW(OSW computedOSW) { Console.Write("{0:X4} {1} {2:X4} ", computedOSW.ID, computedOSW.group ? "G" : "I", computedOSW.command); newline(); // Console.WriteLine("Good"); }
static void processOSW(bool bit) { int i; int sr, sax, f1, f2, iid, cmd, neb; OSW computedOSW = new OSW(); gob[ct++] = bit; if (ct == 76) { if (blocks == 43) { //Console.WriteLine("{0}%", ((double)good / (double)blocks) * 100.0); blocks = 0; good = 0; } blocks++; sr = 0x036e; sax = 0x0393; neb = 0; for (i = 0; i < 76; i += 2) { osw[i >> 1] = gob[i]; if (gob[i]) { gob[i] ^= true; gob[i + 1] ^= true; gob[i + 3] ^= true; } } for (i = 0; i < 76; i += 2) { if (gob[i + 1] && gob[i + 3]) { osw[i >> 1] ^= true; gob[i + 1] ^= true; gob[i + 3] ^= true; } } for (i = 0; i < 27; i++) { if ((sr & 1) == 1) sr = (sr >> 1) ^ 0x0225; else sr >>= 1; if (osw[i]) sax = sax ^ sr; } for (i = 0; i < 10; i++) { f1 = osw[36 - i] ? 0 : 1; f2 = sax & 1; sax >>= 1; if (f1 != f2) neb++; } if (neb == 0) { good++; bs = 0; for (iid = 0, i = 0; i < 16; i++) { iid = iid << 1; if (!osw[i]) iid++; } computedOSW.ID = (short)(iid ^ 0x33c7); computedOSW.group = (osw[16] ^ true); for (cmd = 0, i = 17; i < 27; i++) { cmd <<= 1; if (!osw[i]) cmd++; } computedOSW.command = (short)(cmd ^ 0x032a); showGoodOSW(computedOSW); } else { Console.Write("Bad "); newline(); //showBadOSW(computedOSW); } } }
static void processOSW(bool bit) { int i; int sr, sax, f1, f2, iid, cmd, neb; OSW computedOSW = new OSW(); gob[ct++] = bit; if (ct == 76) { if (blocks == 43) { //Console.WriteLine("{0}%", ((double)good / (double)blocks) * 100.0); blocks = 0; good = 0; } blocks++; sr = 0x036e; sax = 0x0393; neb = 0; for (i = 0; i < 76; i += 2) { osw[i >> 1] = gob[i]; if (gob[i]) { gob[i] ^= true; gob[i + 1] ^= true; gob[i + 3] ^= true; } } for (i = 0; i < 76; i += 2) { if (gob[i + 1] && gob[i + 3]) { osw[i >> 1] ^= true; gob[i + 1] ^= true; gob[i + 3] ^= true; } } for (i = 0; i < 27; i++) { if ((sr & 1) == 1) { sr = (sr >> 1) ^ 0x0225; } else { sr >>= 1; } if (osw[i]) { sax = sax ^ sr; } } for (i = 0; i < 10; i++) { f1 = osw[36 - i] ? 0 : 1; f2 = sax & 1; sax >>= 1; if (f1 != f2) { neb++; } } if (neb == 0) { good++; bs = 0; for (iid = 0, i = 0; i < 16; i++) { iid = iid << 1; if (!osw[i]) { iid++; } } computedOSW.ID = (short)(iid ^ 0x33c7); computedOSW.group = (osw[16] ^ true); for (cmd = 0, i = 17; i < 27; i++) { cmd <<= 1; if (!osw[i]) { cmd++; } } computedOSW.command = (short)(cmd ^ 0x032a); showGoodOSW(computedOSW); } else { Console.Write("Bad "); newline(); //showBadOSW(computedOSW); } } }