On Mon 14 May 2012 at 07:42:08 +0000, William Levak wrote: > I wrote a basic routine to calculate the expexted numbers and > compare them to the ones actually produced by the 6702. I ran this > for several thousand write and read cycles. They matched. Then I > modified the routine to write every even number for each 420 number > cycle, 53760 cycles. They all matched. That is good to hear! Being away from the machine, I tried something similar from the other end. I put a C version of same into the C version of the dongle checking function. Unfortunately I must have been doing something wrong, because the produced numbers didn't pass the check (they were also different from the table of static numbers). This is what I made. Perhaps you can see the silly mistake. unsigned char LOOKUP_TABLE[ 15 ] = { // Indexed as 0 to 14. 214, 214, 214, 214, 198, 198, 212, 212, 84, 84, 6, 6, 39, 39, 51, }; unsigned char LOOKUP_INDEX; // Index to the above table. // ******************************************************************* // *** *** // *** Function to return a code from the simulated 6702 device. *** // *** *** // ******************************************************************* static int a[8] = { 0 }; static int val = 0xd6; static int canchange; unsigned char Read6702( void ) { assert( LOOKUP_INDEX <= 14 ); printf("Read: %02x (calc: %02x)\n", LOOKUP_TABLE[ LOOKUP_INDEX], val); LOOKUP_INDEX++; return val; } // End of function Read6702 void Write6702( unsigned char input ) { //printf("Write: %02x", input); if (input & 1) { if (canchange) { int i; int advance = input ^ (128 + 64 + 16 + 4 + 2); printf("Write: %02x", input); printf(" (advance = %02x", advance); for (i = 7; i >= 0; i--) { if (advance & (1<<i)) a[i]++; printf(" %d", a[i]); } printf(")"); int v = (((a[7]/2) & 1)*128+ ((a[6]/5) & 1)*64+ ((a[5]/3) & 1)*32+ ((a[4]/1) & 1)*16+ ((a[3]/8) & 1)*8+ ((a[2]/7) & 1)*4+ ((a[1]/3) & 1)*2+ ((a[0]/6) & 1)*1) ^ 0xd6; val = v; printf(" (next value: %02x)\n", val); canchange = 0; } else { //printf(" (odd value ignored)", val); } } else { if (!canchange) { canchange = 1; //printf(" (even value)", val); } else { //printf(" (even value ignored)", val); } } //printf("\n", val); } I did remember to put the Write6702() calls back into the check function. (In order to be able to compare with the static table, I didn't add any Read6702() calls, so I replaced the ones like Write6702( Read6702() << 1 ); with just Write6702(0); > The value of the even number doesn't appear to matter, at least when > the odd number is one. I tried a few other cases (all with odd number 214+1) and there it was true as well. > The fact that both bits one and five toggle every three cycles > indicates that they used existing 8 bit technology. If they were > designing a chip from scratch, they could easily have made one of > the bits change every 9 cycles. If they used actual 3-bit counters, yes I suppose. If they used "twisted ring counters", they could easily have made one a bit longer. In this sort of implementation the counters for the different output bits would have been of different sizes anyway. But maybe they didn't want to use 9 but a "more prime" numer and didn't want to bother to go for 11. > wlevak@sdf.lonestar.org -Olaf. -- ___ Olaf 'Rhialto' Seibert -- There's no point being grown-up if you \X/ rhialto/at/xs4all.nl -- can't be childish sometimes. -The 4th Doctor Message was sent through the cbm-hackers mailing listReceived on 2012-05-14 17:00:05
Archive generated by hypermail 2.2.0.