Previous 199869 Revisions Next

r34559 Friday 23rd January, 2015 at 11:41:46 UTC by Andreas Naive
315-5881_crypt.c: Key scheduling simplifications [Andreas Naive]
[src/mame/machine]315-5881_crypt.c 315-5881_crypt.h

trunk/src/mame/machine/315-5881_crypt.c
r243070r243071
234234
235235      {
236236         {
237            2,2,2,3,1,1,0,1,0,1,2,2,3,3,0,2,0,3,2,3,3,0,2,1,0,3,1,0,0,2,3,2,
238            3,2,0,3,2,0,1,0,3,3,1,1,2,2,2,0,2,1,3,1,1,1,1,2,2,2,3,0,1,3,0,0,
237            2,2,2,3,1,1,0,1,3,3,1,1,2,2,2,0,0,3,2,3,3,0,2,1,2,2,3,0,1,3,0,0,
238            3,2,0,3,2,0,1,0,0,1,2,2,3,3,0,2,2,1,3,1,1,1,1,2,0,3,1,0,0,2,3,2,
239239         },
240         {1,2,5,6,7,-1},
240         {1,2,5,6,7,6},
241241         {2,7}
242242      },
243243
r243070r243071
341341
342342      {
343343         {
344            0,2,3,2,1,1,0,0,2,1,0,3,3,0,0,0,3,2,0,2,1,1,2,1,0,0,3,1,2,2,3,1,
345            3,1,3,0,0,0,1,3,1,0,0,3,2,2,3,1,1,3,0,0,2,1,3,3,1,3,1,2,3,1,2,1,
344            0,1,3,0,1,1,2,3,2,0,0,3,2,1,3,1,3,3,0,0,1,0,0,3,0,3,3,2,3,2,0,1,
345            3,2,3,2,2,1,3,1,1,1,0,3,3,2,2,1,1,2,0,2,0,1,1,0,1,0,1,1,2,0,3,0,
346346         },
347         {0,3,5,6,-1,-1},
347         {0,3,5,6,5,0},
348348         {1,2}
349349      },
350350
r243070r243071
387387
388388      {
389389         {
390            1,2,3,2,0,3,2,3,0,1,1,0,0,2,2,3,2,0,0,3,0,2,3,3,2,2,1,0,2,1,0,3,
391            1,0,2,0,1,1,0,1,0,0,1,0,3,0,3,3,2,2,0,2,1,1,1,0,3,0,1,3,2,3,2,1,
390            1,0,3,0,0,1,2,1,0,0,1,0,0,0,2,3,2,2,0,2,0,1,3,0,2,0,1,3,2,3,0,1,
391            1,2,2,2,1,3,0,3,0,1,1,0,3,2,3,3,2,0,0,3,1,2,1,3,3,2,1,0,2,1,2,3,
392392         },
393         {2,3,4,6,7,-1},
393         {2,3,4,6,7,2},
394394         {2,3}
395395      },
396396
r243070r243071
406406   {   // 3rd round
407407      {
408408         {
409            0,3,0,1,0,2,3,3,1,0,1,3,2,2,1,1,3,3,3,0,2,0,2,0,0,0,2,3,1,1,0,0,
410            3,3,0,3,3,0,0,2,1,1,1,0,2,2,2,0,3,0,3,1,2,2,0,3,0,0,3,2,0,3,2,1,
409            0,3,0,1,3,0,0,2,1,0,1,3,2,2,2,0,3,3,3,0,2,2,0,3,0,0,2,3,0,3,2,1,
410            3,3,0,3,0,2,3,3,1,1,1,0,2,2,1,1,3,0,3,1,2,0,2,0,0,0,3,2,1,1,0,0,
411411         },
412         {1,4,5,6,7,-1},
412         {1,4,5,6,7,5},
413413         {0,5}
414414      },
415415
r243070r243071
424424
425425      {
426426         {
427            2,2,3,2,0,3,2,3,1,1,2,0,2,3,1,3,0,0,0,3,2,0,1,0,1,3,2,3,3,3,1,0,
427            2,2,0,3,0,3,1,0,1,1,2,3,2,3,1,0,0,0,3,2,2,0,2,3,1,3,2,0,3,3,1,3,           
428428            // unused?
429429            255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,
430430         },
431         {1,2,4,7,-1,-1},
431         {1,2,4,7,2,-1},
432432         {2,4}
433433      },
434434
r243070r243071
481481};
482482
483483const int sega_315_5881_crypt_device::fn1_game_key_scheduling[FN1GK][2] = {
484    {1,29},  {1,71},  {2,4},   {2,54},  {3,8},   {4,56},  {4,73},  {5,11},
485    {6,51},  {7,92},  {8,89},  {9,9},   {9,39},  {9,41},  {9,58},  {9,86},
486    {10,90}, {11,6},  {12,64}, {13,49}, {14,44}, {15,40}, {16,69}, {17,15},
487    {18,23}, {18,43}, {19,82}, {20,81}, {21,32}, {22,5},  {23,66}, {24,13},
488   {24,45}, {25,12}, {25,35}, {26,61}, {27,10}, {27,59}, {28,25}
484   {1,29},  {1,71},  {2,4},   {2,54},  {3,8},   {4,56},  {4,73},  {5,11},
485   {6,51},  {7,92},  {8,89},  {9,9},   {9,39},  {9,58},  {9,86},  {10,90},
486   {11,6},  {12,64}, {13,49}, {14,44}, {15,40}, {16,69}, {17,15}, {18,23},
487   {18,43}, {19,82}, {20,81}, {21,32}, {22,5},  {23,66}, {24,13}, {24,45},
488   {25,12}, {25,35}, {26,61}, {27,10}, {27,59}, {28,25}
489489};
490490
491491const int sega_315_5881_crypt_device::fn2_game_key_scheduling[FN2GK][2] = {
492    {0,0},   {1,3},   {2,11},  {3,20},  {4,22},  {5,23},  {6,29},  {7,38},
493    {8,39},  {9,55},  {9,86},  {9,87},  {9,90},  {10,50}, {10,53}, {11,57},
494    {12,59}, {13,61}, {13,64}, {14,63}, {15,67}, {16,72}, {17,83}, {18,88},
495    {19,94}, {20,35}, {21,17}, {22,6},  {22,11}, {23,85}, {24,16}, {25,25},
496   {26,92}, {27,47}, {28,28}
492   {0,0},   {1,3},   {2,11},  {3,20},  {4,22},  {5,23},  {6,29},  {7,38},
493   {8,39},  {9,55},  {9,86},  {9,87},  {9,90},  {10,50}, {11,57}, {12,59},
494   {13,61}, {14,63}, {15,67}, {16,72}, {17,83}, {18,88}, {19,94}, {20,35},
495   {21,17}, {22,6},  {23,85}, {24,16}, {25,25}, {26,92}, {27,47}, {28,28}
497496};
498497
499498const int sega_315_5881_crypt_device::fn1_sequence_key_scheduling[20][2] = {
r243070r243071
583582      }
584583   }
585584
586   // subkeys bits 10 & 41
587   fn2_subkeys[0] ^= (BIT(sequence_key, 2) << 10);
588   fn2_subkeys[1] ^= (BIT(sequence_key, 4) << 17);
589585   /**************************************************************/
590586
591587   // First Feistel Network
trunk/src/mame/machine/315-5881_crypt.h
r243070r243071
7474   static const sbox fn1_sboxes[4][4];
7575   static const sbox fn2_sboxes[4][4];
7676
77   static const int FN1GK = 39;
78   static const int FN2GK = 35;
77   static const int FN1GK = 38;
78   static const int FN2GK = 32;
7979   static const int fn1_game_key_scheduling[FN1GK][2];
8080   static const int fn2_game_key_scheduling[FN2GK][2];
8181   static const int fn1_sequence_key_scheduling[20][2];


Previous 199869 Revisions Next


© 1997-2024 The MAME Team