Xref: utzoo sci.electronics:20146 rec.video:20545 Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!usc!snorkelwacker.mit.edu!stanford.edu!agate!sprite.berkeley.edu!shirriff From: shirriff@sprite.berkeley.edu (Ken Shirriff) Newsgroups: sci.electronics,rec.video Subject: VCR+: algorithm for first 100 Message-ID: <1991May14.074739.3646@agate.berkeley.edu> Date: 14 May 91 07:47:39 GMT Sender: root@agate.berkeley.edu (Charlie Root) Distribution: usa Organization: University of California, Berkeley Lines: 84 I've determined the algorithm for the first 100 codes. I wrote a C program to decode a code from 1 to 99. To use this, run "code 42 3" to determine what happens with code 42 in March. The first 100 codes correspond to channels 1-4 recording 30 minutes on a fixed set of 8 times for the 1st to the 3rd of the month. The first 1000 codes extend the same times and channels for the rest of the month, but I haven't decoded that yet. Let me know if you find any errors with this program. Also, if there's a VCR+ mailing list, can someone add me to it? /* * Copyright 1991 Ken Shirriff shirriff@sprite.Berkeley.EDU */ char *tn[8] = { "6:30", "4", "7:30", "4:30", "3:30", "5:30", "6", "2:30"}; main(argc,argv) int argc; char **argv; { int num, month; int result, day; int time, chan; if (argc != 3) { printf("usage: code num, month\n"); exit(-1); } num = atoi(argv[1]); month = atoi(argv[2]); code(num, &result, &day); result = (result+day*month)&31; time = ((result&16)>>2) | ((result&4)>>1) | (result&1); chan = (((result&8)>>2) | ((result&2)>>1))+1; printf("Code %d in month %d = %s, ch %d on day %d\n", num, month, tn[time], chan, day); } code(num,result,day) int num, *result, *day; { int row, col, rem, div, d; int res; /* * Break up into 7 rows of 5 columns on 3 days. * The numbers are broken mod 29 and then broken in half again unevenly. */ rem = num%29; div = num/29; if (rem<16-div) { row = 3-div; } else { row = 6-div; rem -= 13; } col = 4-(rem-1)/3; d = ((rem-1)%3)+1; /* * The numbers are then assigned consecutively down the columns. */ res = col*7+row; /* * Swap numbers 1-9 with row 3 */ if (num<=9) { res = num; d = 1; } else if (d==1 && res<=9) { col = 4-(res-1)/3; d = ((res-1)%3)+1; row = 3; res = col*7+row; } *day = d; *result = res; } Ken Shirriff shirriff@sprite.Berkeley.EDU